List of usage examples for com.amazonaws.services.s3.model BucketTaggingConfiguration getTagSet
public TagSet getTagSet()
Gets the first TagSet object contained in this object.
From source file:com.eucalyptus.portal.provider.impl.S3TagProvider.java
License:Open Source License
@Nonnull @Override/*from w ww .j a v a 2 s .co m*/ public Set<String> getTagKeys(@Nonnull final User user) { final Set<String> tagKeys = Sets.newHashSet(); try (final EucaS3Client client = EucaS3ClientFactory.getEucaS3Client(user)) { for (final Bucket bucket : client.listBuckets()) try { final BucketTaggingConfiguration taggingConfiguration = client .getBucketTaggingConfiguration(bucket.getName()); if (taggingConfiguration != null) { tagKeys.addAll(taggingConfiguration.getTagSet().getAllTags().keySet()); } } catch (final AmazonServiceException e) { if (!"NoSuchTagSetError".equals(e.getErrorCode())) { throw e; } } } catch (final Exception e) { logger.error("Error describing keys for s3", e); } return tagKeys; }