S3 / Client / get_bucket_versioning
get_bucket_versioning#
- S3.Client.get_bucket_versioning(**kwargs)#
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
:See also: AWS API Documentation
Request Syntax
response = client.get_bucket_versioning( Bucket='string', ExpectedBucketOwner='string' )
- Parameters:
Bucket (string) –
[REQUIRED]
The name of the bucket for which to get the versioning information.
ExpectedBucketOwner (string) – 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).
- Return type:
dict
- Returns:
Response Syntax
{ 'Status': 'Enabled'|'Suspended', 'MFADelete': 'Enabled'|'Disabled' }
Response Structure
(dict) –
Status (string) –
The versioning state of the bucket.
MFADelete (string) –
Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned.
Examples
The following example retrieves bucket versioning configuration.
response = client.get_bucket_versioning( Bucket='examplebucket', ) print(response)
Expected Output:
{ 'MFADelete': 'Disabled', 'Status': 'Enabled', 'ResponseMetadata': { '...': '...', }, }