Java Code Examples for com.amazonaws.services.s3.model.CannedAccessControlList#values()

The following examples show how to use com.amazonaws.services.s3.model.CannedAccessControlList#values() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CannedAclUtils.java    From circus-train with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link CannedAccessControlList} from its {@code x-amz-acl} value.
 *
 * @param cannedAcl S3 x-amz-acl value
 * @return The corresponding CannedAccessControlList value
 */
public static CannedAccessControlList toCannedAccessControlList(String cannedAcl) {
  if (cannedAcl == null) {
    return null;
  }

  cannedAcl = cannedAcl.toLowerCase(Locale.ROOT);

  for (CannedAccessControlList acl : CannedAccessControlList.values()) {
    if (acl.toString().equals(cannedAcl)) {
      return acl;
    }
  }

  throw new IllegalArgumentException("CannedAccessControlList does not contain " + cannedAcl);
}
 
Example 2
Source File: S3OutputConfig.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
public CannedAccessControlList calculateAcls(String aclStr) {
  for (CannedAccessControlList val : CannedAccessControlList.values()) {
    if (val.toString().equals(aclStr)) {
      return val;
    }
  }
  throw new IllegalArgumentException(String.format("'%s' is not a valid ACL setting", aclStr));
}
 
Example 3
Source File: S3BlobStore.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs canned acl from string
 */
public static CannedAccessControlList initCannedACL(String cannedACL) {
    if ((cannedACL == null) || cannedACL.equals("")) {
        return CannedAccessControlList.Private;
    }

    for (final CannedAccessControlList cur : CannedAccessControlList.values()) {
        if (cur.toString().equalsIgnoreCase(cannedACL)) {
            return cur;
        }
    }

    throw new BlobStoreException("cannedACL is not valid: [" + cannedACL + "]");
}