getBucketReplication method
Returns the replication configuration of a bucket. For information about replication configuration, see Replication in the Amazon Simple Storage Service Developer Guide.
This operation requires permissions for the
s3:GetReplicationConfiguration
action. For more information
about permissions, see Using
Bucket Policies and User Policies.
If you include the Filter
element in a replication
configuration, you must also include the
DeleteMarkerReplication
and Priority
elements.
The response also returns those elements.
For information about GetBucketReplication
errors, see List
of replication-related error codes
The following operations are related to GetBucketReplication
:
Parameter bucket
:
The bucket name for which to get the replication information.
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<GetBucketReplicationOutput> getBucketReplication({
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.sendRaw(
method: 'GET',
requestUri: '/${Uri.encodeComponent(bucket)}?replication',
headers: headers,
exceptionFnMap: _exceptionFns,
);
final $elem = await _s.xmlFromResponse($result);
return GetBucketReplicationOutput(
replicationConfiguration: ReplicationConfiguration.fromXml($elem),
);
}