Select your cookie preferences

We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features.

get_bucket_versioning

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 bucket is owned by a different account, 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': {
        '...': '...',
    },
}