Example usage for com.amazonaws.services.s3.model BucketTaggingConfiguration getAllTagSets

List of usage examples for com.amazonaws.services.s3.model BucketTaggingConfiguration getAllTagSets

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model BucketTaggingConfiguration getAllTagSets.

Prototype

public List<TagSet> getAllTagSets() 

Source Link

Document

Gets the list of TagSet objects contained in this object.

Usage

From source file:org.duracloud.s3storage.S3StorageProvider.java

License:Apache License

/**
 * {@inheritDoc}/*from   w  w w .ja v a2  s  .  c  o  m*/
 */
protected Map<String, String> getAllSpaceProperties(String spaceId) {
    log.debug("getAllSpaceProperties(" + spaceId + ")");

    // Will throw if bucket does not exist
    String bucketName = getBucketName(spaceId);

    // Retrieve space properties from bucket tags
    Map<String, String> spaceProperties = new HashMap<>();
    BucketTaggingConfiguration tagConfig = s3Client.getBucketTaggingConfiguration(bucketName);
    if (null != tagConfig) {
        for (TagSet tagSet : tagConfig.getAllTagSets()) {
            spaceProperties.putAll(tagSet.getAllTags());
        }
    }

    // Handle @ symbol (change from +), to allow for email usernames in ACLs
    spaceProperties = replaceInMapValues(spaceProperties, "+", "@");

    // Add space count
    spaceProperties.put(PROPERTIES_SPACE_COUNT, getSpaceCount(spaceId, MAX_ITEM_COUNT));

    return spaceProperties;
}