getBucketVersioning method
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 bucket is owned by a
different account, the request will fail with an HTTP 403 (Access
Denied)
error.
Implementation
Future<GetBucketVersioningOutput> getBucketVersioning({
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)}?versioning',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return GetBucketVersioningOutput.fromXml($result.body);
}