getBucketVersioning method

Future<GetBucketVersioningOutput> getBucketVersioning({
  1. required String bucket,
  2. String? expectedBucketOwner,
})
Returns the versioning state of a bucket.

To retrieve the versioning state of a bucket, you must be the bucket owner.

This implementation also returns the MFA Delete status of the versioning state. If the MFA Delete status is enabled, the bucket owner must use an authentication device to change the versioning state of the bucket.

The following operations are related to GetBucketVersioning:

Parameter bucket : The name of the bucket for which to get the versioning 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<GetBucketVersioningOutput> getBucketVersioning({
  required String bucket,
  String? expectedBucketOwner,
}) async {
  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)}?versioning',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetBucketVersioningOutput.fromXml($result.body);
}