Package com.amazonaws.services.ec2.model

Examples of com.amazonaws.services.ec2.model.VolumeAttachment


  }

  private Image newImageWithStatus(final String state, final String code,
      final String message) {

    final StateReason reason = new StateReason();
    reason.setCode(code);
    reason.setMessage(message);

    final Image image = new Image();
    image.setState(state);
    image.setStateReason(reason);
View Full Code Here


  public void stopInstance() throws ClientProtocolException, IOException
  {
    String instanceId = getInstanceId();
    List<String> instancesId = new ArrayList<String>();
    instancesId.add(instanceId);
    StopInstancesRequest stopInstancesRequest = new StopInstancesRequest(instancesId);
    amazonEC2Client.stopInstances(stopInstancesRequest);
  }
View Full Code Here

    private void addTag(AmazonEC2Client ec2, NetworkInterface o, String key, String value) {
        addTag(ec2, o.getNetworkInterfaceId(), key, value);
    }

    private void addTag(AmazonEC2Client ec2, String id, String key, String value) {
        Tag tag = new Tag(key, value);
        List<Tag> tags = Lists.newArrayList();
        tags.add(tag);

        CreateTagsRequest request = new CreateTagsRequest();
        request.setResources(Collections.singletonList(id));
View Full Code Here

    final Collection<String> resourceList = new ArrayList<String>(1);
    resourceList.add(resourceId);

    final Collection<Tag> tagList = new ArrayList<Tag>(1);
    tagList.add(new Tag(key, value));

    request.setResources(resourceList);
    request.setTags(tagList);

    logger.info("tag create request=" + request);
View Full Code Here

    final Collection<String> resourceList = new ArrayList<String>(1);
    resourceList.add(resourceId);

    final Collection<Tag> tagList = new ArrayList<Tag>(1);
    tagList.add(new Tag(key, value));

    request.setResources(resourceList);
    request.setTags(tagList);

    logger.info("tag delete request=" + request);
View Full Code Here

   *
   * @param instanceIds
   */
  public static void terminateInstances(List<String> instanceIds) {
    // terminate
    TerminateInstancesRequest request = new TerminateInstancesRequest(instanceIds);
    getEC2Client().terminateInstances(request);
  }
View Full Code Here

   *
   * @param instanceIds
   */
  public static void terminateInstances(String... instanceIds) {
    // terminate
    TerminateInstancesRequest request = new TerminateInstancesRequest();
    getEC2Client().terminateInstances(request.withInstanceIds(instanceIds));
  }
View Full Code Here

                continue;
            }

            Map<String, String> janitorMetadata = parseJanitorTag(tags);
            // finding the instance attached most recently.
            VolumeAttachment latest = null;
            for (VolumeAttachment attachment : attachments) {
                if (latest == null || latest.getAttachTime().before(attachment.getAttachTime())) {
                    latest = attachment;
                }
            }
            if (latest != null) {
                instanceId = latest.getInstanceId();
                owner = getOwnerEmail(instanceId, janitorMetadata, tags, awsClient);
            }

            if (latest == null || "detached".equals(latest.getState())) {
                if (janitorMetadata.get(JanitorMonkey.DETACH_TIME_TAG_KEY) == null) {
                    // There is no attached instance and the last detached time is not set.
                    // Use the current time as the last detached time.
                    LOGGER.info(String.format("Setting the last detached time to %s for volume %s",
                            now, volume.getVolumeId()));
View Full Code Here

     * Returns the marshaled request configured with additional parameters to
     * enable operation dry-run.
     */
    @Override
    public Request<RunInstancesRequest> getDryRunRequest() {
        Request<RunInstancesRequest> request = new RunInstancesRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
View Full Code Here

     * Returns the marshaled request configured with additional parameters to
     * enable operation dry-run.
     */
    @Override
    public Request<RunInstancesRequest> getDryRunRequest() {
        Request<RunInstancesRequest> request = new RunInstancesRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.ec2.model.VolumeAttachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.