List of usage examples for com.amazonaws.services.s3.model BucketTaggingConfiguration BucketTaggingConfiguration
public BucketTaggingConfiguration()
Creates a new bucket tagging configuration.
From source file:com.eucalyptus.cloudformation.resources.standard.actions.AWSS3BucketResourceAction.java
License:Open Source License
private BucketTaggingConfiguration convertTags(List<CloudFormationResourceTag> tags) { BucketTaggingConfiguration bucketTaggingConfiguration = new BucketTaggingConfiguration(); // In theory BucketTaggingConfiguration Collection<TagSet> tagSets = Lists.newArrayList(); TagSet tagSet = new TagSet(); for (CloudFormationResourceTag cloudformationResourceTag : tags) { tagSet.setTag(cloudformationResourceTag.getKey(), cloudformationResourceTag.getValue()); }//w w w . ja va2s . c om tagSets.add(tagSet); bucketTaggingConfiguration.setTagSets(tagSets); return bucketTaggingConfiguration; }
From source file:org.duracloud.s3storage.S3StorageProvider.java
License:Apache License
/** * {@inheritDoc}/* w w w .ja v a 2 s. c o m*/ */ protected void doSetSpaceProperties(String spaceId, Map<String, String> spaceProperties) { log.debug("setSpaceProperties(" + spaceId + ")"); // Will throw if bucket does not exist String bucketName = getBucketName(spaceId); Map<String, String> originalProperties; try { originalProperties = getAllSpaceProperties(spaceId); } catch (NotFoundException e) { // Likely adding a new space, so no existing properties yet. originalProperties = new HashMap<>(); } // Set creation date String creationDate = originalProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = spaceProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = getBucketCreationDate(bucketName); } } spaceProperties.put(PROPERTIES_SPACE_CREATED, creationDate); // Handle @ symbol (change to +), to allow for email usernames in ACLs spaceProperties = replaceInMapValues(spaceProperties, "@", "+"); // Store properties BucketTaggingConfiguration tagConfig = new BucketTaggingConfiguration() .withTagSets(new TagSet(spaceProperties)); s3Client.setBucketTaggingConfiguration(bucketName, tagConfig); }