Example usage for com.amazonaws.services.s3.model TagSet getAllTags

List of usage examples for com.amazonaws.services.s3.model TagSet getAllTags

Introduction

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

Prototype

public Map<String, String> getAllTags() 

Source Link

Document

Get all the tags for this TagSet

Usage

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

License:Apache License

/**
 * {@inheritDoc}/*from   w w  w  . j  av  a  2  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;
}