List of usage examples for com.amazonaws.services.ec2.model Snapshot getTags
public java.util.List<Tag> getTags()
Any tags assigned to the snapshot.
From source file:com.netflix.simianarmy.aws.janitor.crawler.EBSSnapshotJanitorCrawler.java
License:Apache License
private List<Resource> getSnapshotResources(String... snapshotIds) { refreshSnapshotToAMIs();//from w ww. j av a 2 s . co m List<Resource> resources = new LinkedList<Resource>(); AWSClient awsClient = getAWSClient(); for (Snapshot snapshot : awsClient.describeSnapshots(snapshotIds)) { Resource snapshotResource = new AWSResource().withId(snapshot.getSnapshotId()) .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.EBS_SNAPSHOT) .withLaunchTime(snapshot.getStartTime()).withDescription(snapshot.getDescription()); for (Tag tag : snapshot.getTags()) { LOGGER.debug(String.format("Adding tag %s = %s to resource %s", tag.getKey(), tag.getValue(), snapshotResource.getId())); snapshotResource.setTag(tag.getKey(), tag.getValue()); } snapshotResource.setOwnerEmail(getOwnerEmailForResource(snapshotResource)); ((AWSResource) snapshotResource).setAWSResourceState(snapshot.getState()); Collection<String> amis = snapshotToAMIs.get(snapshotResource.getId()); if (amis != null) { snapshotResource.setAdditionalField(SNAPSHOT_FIELD_AMIS, StringUtils.join(amis, ",")); } resources.add(snapshotResource); } return resources; }
From source file:com.pearson.eidetic.driver.threads.EideticSubThreadMethods.java
@Override public Collection<Tag> getResourceTags(Snapshot snapshot) { List<Tag> tagsList = snapshot.getTags(); Collection<Tag> tags = tagsList; return tags;/*from w w w .j a v a2 s.com*/ }