getBucketReplication method

Future<GetBucketReplicationOutput> getBucketReplication({
  1. required String bucket,
  2. String? expectedBucketOwner,
})
Returns the replication configuration of a bucket. For information about replication configuration, see Replication in the Amazon S3 User Guide.

This action 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 account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Implementation

Future<GetBucketReplicationOutput> getBucketReplication({
  required String bucket,
  String? expectedBucketOwner,
}) async {
  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),
  );
}