com.amazonaws.services.s3.model.CanonicalGrantee#com.amazonaws.services.s3.model.EmailAddressGrantee源码实例Demo

下面列出了com.amazonaws.services.s3.model.CanonicalGrantee#com.amazonaws.services.s3.model.EmailAddressGrantee 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: aws-doc-sdk-examples   文件: SetAcl.java
public static void setBucketAcl(String bucket_name, String email, String access) {
    System.out.format("Setting %s access for %s\n", access, email);
    System.out.println("on bucket: " + bucket_name);

    final AmazonS3 s3 = AmazonS3ClientBuilder.standard().withRegion(Regions.DEFAULT_REGION).build();
    try {
        // get the current ACL
        AccessControlList acl = s3.getBucketAcl(bucket_name);
        // set access for the grantee
        EmailAddressGrantee grantee = new EmailAddressGrantee(email);
        Permission permission = Permission.valueOf(access);
        acl.grantPermission(grantee, permission);
        s3.setBucketAcl(bucket_name, acl);
    } catch (AmazonServiceException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
}
 
源代码2 项目: aws-doc-sdk-examples   文件: SetAcl.java
public static void setObjectAcl(String bucket_name, String object_key, String email, String access) {
    System.out.format("Setting %s access for %s\n", access, email);
    System.out.println("for object: " + object_key);
    System.out.println(" in bucket: " + bucket_name);

    final AmazonS3 s3 = AmazonS3ClientBuilder.standard().withRegion(Regions.DEFAULT_REGION).build();
    try {
        // get the current ACL
        AccessControlList acl = s3.getObjectAcl(bucket_name, object_key);
        // set access for the grantee
        EmailAddressGrantee grantee = new EmailAddressGrantee(email);
        Permission permission = Permission.valueOf(access);
        acl.grantPermission(grantee, permission);
        s3.setObjectAcl(bucket_name, object_key, acl);
    } catch (AmazonServiceException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
}
 
源代码3 项目: localization_nifi   文件: AbstractS3Processor.java
protected Grantee createGrantee(final String value) {
    if (StringUtils.isEmpty(value)) {
        return null;
    }

    if (value.contains("@")) {
        return new EmailAddressGrantee(value);
    } else {
        return new CanonicalGrantee(value);
    }
}
 
源代码4 项目: nifi   文件: AbstractS3Processor.java
protected Grantee createGrantee(final String value) {
    if (StringUtils.isEmpty(value)) {
        return null;
    }

    if (value.contains("@")) {
        return new EmailAddressGrantee(value);
    } else {
        return new CanonicalGrantee(value);
    }
}