@Override public DescribeTagsResult describeTags() { return describeTags(new DescribeTagsRequest()); }
/** * <p> * Describes one or more of the tags for your EC2 resources. * </p> * <p> * For more information about tags, see * <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html"> Tagging Your Resources </a> * in the <i>Amazon Elastic Compute Cloud User Guide</i> . * </p> * * @return The response from the DescribeTags service method, as returned * by AmazonEC2. * * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonEC2 indicating * either a problem with the data in the request, or a server side issue. */ public DescribeTagsResult describeTags() throws AmazonServiceException, AmazonClientException { return describeTags(new DescribeTagsRequest()); }
@Override public DescribeTagsResult describeTags() { return describeTags(new DescribeTagsRequest()); }
@Override @Cacheable(cacheNames = "ami-expiration-time", cacheManager = "oneMinuteTTLCacheManager") public ZonedDateTime getExpirationTime(String regionName, String imageOwner, String imageId) { // tags are only visible in the owning account of the image final AmazonEC2Client ec2 = clientProvider.getClient(AmazonEC2Client.class, imageOwner, Region.getRegion(Regions.fromName(regionName))); final DescribeTagsRequest tagsRequest = new DescribeTagsRequest().withFilters( new Filter("resource-id").withValues(imageId), new Filter("resource-type").withValues("image"), new Filter("key").withValues(TAG_KEY)); return ec2.describeTags(tagsRequest).getTags().stream() .findFirst() .map(TagDescription::getValue) .map(value -> ZonedDateTime.parse(value, ISO_DATE_TIME)) .orElse(null); } }
request.setFilters(Arrays.asList(new Filter("resource-type").withValues("instance"), new Filter("resource-id").withValues(instanceId))); DescribeTagsResult result = ec2Client.describeTags(request); List<TagDescription> tags = result.getTags(); for (TagDescription tag : tags) {
request.setFilters(Arrays.asList(new Filter("resource-type").withValues("instance"), new Filter("resource-id").withValues(instanceId))); DescribeTagsResult result = ec2Client.describeTags(request); List<TagDescription> tags = result.getTags(); for (TagDescription tag : tags) {