当前位置: 首页>>代码示例>>Java>>正文


Java EmailAddressGrantee类代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.EmailAddressGrantee的典型用法代码示例。如果您正苦于以下问题:Java EmailAddressGrantee类的具体用法?Java EmailAddressGrantee怎么用?Java EmailAddressGrantee使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmailAddressGrantee类属于com.amazonaws.services.s3.model包,在下文中一共展示了EmailAddressGrantee类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setBucketAcl

import com.amazonaws.services.s3.model.EmailAddressGrantee; //导入依赖的package包/类
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.defaultClient();
    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);
    }
}
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:20,代码来源:SetAcl.java

示例2: setObjectAcl

import com.amazonaws.services.s3.model.EmailAddressGrantee; //导入依赖的package包/类
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.defaultClient();
    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);
    }
}
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:21,代码来源:SetAcl.java

示例3: convertToXml

import com.amazonaws.services.s3.model.EmailAddressGrantee; //导入依赖的package包/类
/**
 * Returns an XML fragment representing the specified Grantee.
 *
 * @param grantee
 *            The grantee to convert to an XML representation that can be
 *            sent to Amazon S3 as part of a request.
 * @param xml
 *            The XmlWriter to which to concatenate this node to.
 *
 * @return The given XmlWriter containing the specified grantee.
 *
 * @throws SdkClientException
 *             If the specified grantee type isn't recognized.
 */
protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws SdkClientException {
    if (grantee instanceof CanonicalGrantee) {
        return convertToXml((CanonicalGrantee)grantee, xml);
    } else if (grantee instanceof EmailAddressGrantee) {
        return convertToXml((EmailAddressGrantee)grantee, xml);
    } else if (grantee instanceof GroupGrantee) {
        return convertToXml((GroupGrantee)grantee, xml);
    } else {
        throw new SdkClientException("Unknown Grantee type: " + grantee.getClass().getName());
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:26,代码来源:AclXmlFactory.java


注:本文中的com.amazonaws.services.s3.model.EmailAddressGrantee类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。