use of com.amazonaws.services.ec2.AmazonEC2 in project checker-framework by typetools.
the class Cve2 method correct3.
public static void correct3(AmazonEC2 client) {
DescribeImagesRequest request = new DescribeImagesRequest();
request.setExecutableUsers(Collections.singletonList("myUser1"));
DescribeImagesResult result = client.describeImages(request);
}
use of com.amazonaws.services.ec2.AmazonEC2 in project checker-framework by typetools.
the class MorePreciseFilters method withOwnerId.
void withOwnerId(AmazonEC2 ec2) {
DescribeImagesRequest request = new DescribeImagesRequest().withFilters(new Filter("name", Arrays.asList("my_image_name")), new Filter("owner-id", Arrays.asList("12345")));
DescribeImagesResult result = ec2.describeImages(request);
}
use of com.amazonaws.services.ec2.AmazonEC2 in project checker-framework by typetools.
the class MorePreciseFilters method withFilterNameInList.
/* TODO: handle lists
void ownerAliasList(AmazonEC2 ec2Client) {
DescribeImagesRequest imagesRequest = new DescribeImagesRequest();
List<Filter> imageFilters = new ArrayList<Filter>();
imageFilters.add(new Filter().withName("owner-alias").withValues("microsoft"));
ec2Client.describeImages(imagesRequest.withFilters(imageFilters)).getImages();
}
*/
void withFilterNameInList(AmazonEC2 ec2Client) {
DescribeImagesRequest request = new DescribeImagesRequest();
request.setFilters(Collections.singletonList(new Filter().withName("image-id").withValues("12345")));
DescribeImagesResult result = ec2Client.describeImages(request);
}
use of com.amazonaws.services.ec2.AmazonEC2 in project checker-framework by typetools.
the class MorePreciseFilters method withName4.
void withName4(AmazonEC2 ec2Client) {
DescribeImagesRequest request = new DescribeImagesRequest();
request.withFilters(new Filter().withName("owner-id").withName("foo").withValues("12345"), new Filter("owner-id", Arrays.asList("12345")));
DescribeImagesResult result = ec2Client.describeImages(request);
}
use of com.amazonaws.services.ec2.AmazonEC2 in project SimianArmy by Netflix.
the class AWSClient method describeSnapshots.
/**
* Describe a set of specific EBS snapshots.
*
* @param snapshotIds the snapshot ids
* @return the snapshots
*/
public List<Snapshot> describeSnapshots(String... snapshotIds) {
if (snapshotIds == null || snapshotIds.length == 0) {
LOGGER.info(String.format("Getting all EBS snapshots in region %s.", region));
} else {
LOGGER.info(String.format("Getting EBS snapshotIds for %d ids in region %s.", snapshotIds.length, region));
}
AmazonEC2 ec2Client = ec2Client();
DescribeSnapshotsRequest request = new DescribeSnapshotsRequest();
// Set the owner id to self to avoid getting snapshots from other accounts.
request.withOwnerIds(Arrays.<String>asList("self"));
if (snapshotIds != null) {
request.setSnapshotIds(Arrays.asList(snapshotIds));
}
DescribeSnapshotsResult result = ec2Client.describeSnapshots(request);
List<Snapshot> snapshots = result.getSnapshots();
LOGGER.info(String.format("Got %d EBS snapshots in region %s.", snapshots.size(), region));
return snapshots;
}
Aggregations