Example usage for com.amazonaws.services.s3 AmazonS3Client getObjectAcl

List of usage examples for com.amazonaws.services.s3 AmazonS3Client getObjectAcl

Introduction

In this page you can find the example usage for com.amazonaws.services.s3 AmazonS3Client getObjectAcl.

Prototype

@Override
    public AccessControlList getObjectAcl(String bucketName, String key, String versionId)
            throws SdkClientException, AmazonServiceException 

Source Link

Usage

From source file:com.eucalyptus.objectstorage.providers.s3.S3ProviderClient.java

License:Open Source License

@Override
public GetObjectAccessControlPolicyResponseType getObjectAccessControlPolicy(
        GetObjectAccessControlPolicyType request) throws S3Exception {
    GetObjectAccessControlPolicyResponseType reply = request.getReply();
    User requestUser = getRequestUser(request);
    OsgInternalS3Client internalS3Client = null;
    try {/*from   w  w w. j  a  v  a  2 s .  c  o m*/
        internalS3Client = getS3Client(requestUser);
        AmazonS3Client s3Client = internalS3Client.getS3Client();
        com.amazonaws.services.s3.model.AccessControlList acl = s3Client.getObjectAcl(request.getBucket(),
                request.getKey(), request.getVersionId());
        reply.setAccessControlPolicy(sdkAclToEucaAcl(acl));
    } catch (AmazonServiceException e) {
        LOG.debug("Error from backend", e);
        throw S3ExceptionMapper.fromAWSJavaSDK(e);
    }
    return reply;
}