getBucketAcl method
This implementation of the GET
operation uses the
acl
subresource to return the access control list (ACL) of a
bucket. To use GET
to return the ACL of the bucket, you must
have READ_ACP
access to the bucket. If READ_ACP
permission is granted to the anonymous user, you can return the ACL of the
bucket without using an authorization header.
Related Resources
Parameter bucket
:
Specifies the S3 bucket whose ACL is being requested.
Parameter expectedBucketOwner
:
The account id of the expected bucket owner. If the bucket is owned by a
different account, the request will fail with an HTTP 403 (Access
Denied)
error.
Implementation
Future<GetBucketAclOutput> getBucketAcl({
required String bucket,
String? expectedBucketOwner,
}) async {
ArgumentError.checkNotNull(bucket, 'bucket');
final headers = <String, String>{
if (expectedBucketOwner != null)
'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
};
final $result = await _protocol.send(
method: 'GET',
requestUri: '/${Uri.encodeComponent(bucket)}?acl',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return GetBucketAclOutput.fromXml($result.body);
}