Package com.amazonaws.services.ec2.model

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


        }

        /* Generate key pair in Amazon if necessary */
        try {
            /* Get current key pair in Amazon */
            DescribeKeyPairsRequest describeKeyPairsRequest = new DescribeKeyPairsRequest();
            ec2.describeKeyPairs(describeKeyPairsRequest.withKeyNames(keyPairName));

            /* If key exists and new key is created, delete old key and replace
             * with new one. Else, do nothing */
            if (newKey) {
                DeleteKeyPairRequest deleteKeyPairRequest = new DeleteKeyPairRequest(keyPairName);
View Full Code Here


   *
   * @return list of keypairs
   */
  public static List<String> loadKeypairs(){
    List<String> resultList = new ArrayList<String>();
    DescribeKeyPairsResult results = getEC2Client().describeKeyPairs();
    for (KeyPairInfo key : results.getKeyPairs()) {
      resultList.add(key.getKeyName());
    }
    return resultList;
  }
View Full Code Here

     * For backwards compatibility, we preserve the existing List<String> of
     * security group names by explicitly populating it from the full list
     * of security group info.
     */
      if (response instanceof DescribeSpotInstanceRequestsResult) {
        DescribeSpotInstanceRequestsResult result = (DescribeSpotInstanceRequestsResult)response;
        for (SpotInstanceRequest spotInstanceRequest : result.getSpotInstanceRequests()) {
          LaunchSpecification launchSpecification = spotInstanceRequest.getLaunchSpecification();
          populateLaunchSpecificationSecurityGroupNames(launchSpecification);
        }
      } else if (response instanceof RequestSpotInstancesResult) {
        RequestSpotInstancesResult result = (RequestSpotInstancesResult)response;
        for (SpotInstanceRequest spotInstanceRequest : result.getSpotInstanceRequests()) {
          LaunchSpecification launchSpecification = spotInstanceRequest.getLaunchSpecification();
          populateLaunchSpecificationSecurityGroupNames(launchSpecification);
        }
      } else if (response instanceof DescribeInstancesResult) {
        DescribeInstancesResult result = (DescribeInstancesResult)response;
        for (Reservation reservation : result.getReservations()) {
          populateReservationSecurityGroupNames(reservation);
        }
      } else if (response instanceof RunInstancesResult) {
        RunInstancesResult result = (RunInstancesResult)response;
        populateReservationSecurityGroupNames(result.getReservation());
      }
  }
View Full Code Here

                do
                {
                    log.info("Sleeping for " + sleep.get() + " ms");
                    Thread.sleep(sleep.get());
                    DescribeVolumesResult describeVolumesResult = ec2Client.describeVolumes(describeVolumesRequest);
                    if (describeVolumesResult.getVolumes().isEmpty())
                    {
                        return;
                    }

                    Volume bootstrapVolume = describeVolumesResult.getVolumes().get(0);
                    List<VolumeAttachment> attachments = bootstrapVolume.getAttachments();
                    for (VolumeAttachment attachment : attachments)
                    {
                        if (!instanceId.equals(attachment.getInstanceId()))
                        {
View Full Code Here

        {
            while (true)
            {
                log.info("Sleeping for " + sleep.get().toString() + " ms");
                Thread.sleep(sleep.get());
                DescribeVolumesResult describeVolumesResult = getEc2Client().describeVolumes(describeVolumesRequest);

                Volume volume = describeVolumesResult.getVolumes().get(0);
                String state = volume.getState();

                log.info("volume state = " +  state);

                if ("creating".equals(state))
View Full Code Here

        {
            while (true)
            {
                log.info("Sleeping for " + sleep.get().toString() + " ms");
                Thread.sleep(sleep.get());
                DescribeVolumesResult describeVolumesResult = getEc2Client().describeVolumes(describeVolumesRequest);

                Volume volume = describeVolumesResult.getVolumes().get(0);
                String state = volume.getState();

                log.info("volume state = " +  state);

                if ("creating".equals(state))
View Full Code Here

        if (null == volumeId.get())
        {
            return Optional.absent();
        }

        DescribeVolumesResult result = getEc2Client().describeVolumes(new DescribeVolumesRequest().
                withFilters(new Filter().withName("volume-id").withValues(volumeId.get())));

        if (result.getVolumes().isEmpty())
        {
            return Optional.absent();
        }

        return Optional.fromNullable(result.getVolumes().get(0));
    }
View Full Code Here

            assertThat(bdm.get(i).getEbs().getDeleteOnTermination()).isTrue();

            volumeIds.add(bdm.get(i).getEbs().getVolumeId());
        }

        DescribeVolumesResult volumesResult = client.describeVolumes(
            new DescribeVolumesRequest().withVolumeIds(volumeIds));
        for (Volume volume : volumesResult.getVolumes()) {
            assertThat(volume.getState()).isIn(Lists.newArrayList("creating", "available", "in-use"));
        }
        assertThat(volumesResult.getVolumes().get(0).getSize())
            .isNotEqualTo(volumesResult.getVolumes().get(1).getSize());
    }
View Full Code Here

        AmazonEC2 ec2Client = ec2Client();
        DescribeVolumesRequest request = new DescribeVolumesRequest();
        if (volumeIds != null) {
            request.setVolumeIds(Arrays.asList(volumeIds));
        }
        DescribeVolumesResult result = ec2Client.describeVolumes(request);
        List<Volume> volumes = result.getVolumes();

        LOGGER.info(String.format("Got %d EBS volumes in region %s.", volumes.size(), region));
        return volumes;
    }
View Full Code Here

            assertThat(bdm.get(i).getDeviceName()).isEqualTo("/dev/sda" + ((i+1) * (i+1)));
            assertThat(bdm.get(i).getEbs().getDeleteOnTermination()).isTrue();
            volumeIds.add(bdm.get(i).getEbs().getVolumeId());
        }

        DescribeVolumesResult volumesResult = client.describeVolumes(
                new DescribeVolumesRequest().withVolumeIds(volumeIds));
        for (Volume volume : volumesResult.getVolumes()) {
            assertThat(volume.getState()).isIn(Lists.newArrayList("creating", "available", "in-use"));
        }
        assertThat(volumesResult.getVolumes().get(0).getSize()).isNotEqualTo(volumesResult.getVolumes().get(1).getSize());
    }
View Full Code Here

TOP

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

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.