getBucketVersioning method

Future<GetBucketVersioningResult> getBucketVersioning({
  1. required String accountId,
  2. required String bucket,
})
Returns the versioning state for an S3 on Outposts bucket. With S3 Versioning, you can save multiple distinct copies of your objects and recover from unintended user actions and application failures.

If you've never set versioning on your bucket, it has no versioning state. In that case, the GetBucketVersioning request does not return a versioning state value.

For more information about versioning, see Versioning in the Amazon S3 User Guide.

All Amazon S3 on Outposts REST API requests for this action require an additional parameter of x-amz-outpost-id to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of s3-control. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id derived by using the access point ARN, see the Examples section.

The following operations are related to GetBucketVersioning for S3 on Outposts.

Parameter accountId : The Amazon Web Services account ID of the S3 on Outposts bucket.

Parameter bucket : The S3 on Outposts bucket to return the versioning state for.

Implementation

Future<GetBucketVersioningResult> getBucketVersioning({
  required String accountId,
  required String bucket,
}) async {
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $result = await _protocol.send(
    method: 'GET',
    requestUri: '/v20180820/bucket/${Uri.encodeComponent(bucket)}/versioning',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetBucketVersioningResult.fromXml($result.body);
}