當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。