Skip to content

S3  >  Operations  >  get_bucket_versioning

get_bucket_versioning

Operation

get_bucket_versioning async

get_bucket_versioning(input: GetBucketVersioningInput, plugins: list[Plugin] | None = None) -> GetBucketVersioningOutput
Note

This operation is not supported for directory buckets.

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:

Warning

You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Parameters:

Name Type Description Default
input GetBucketVersioningInput

An instance of GetBucketVersioningInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetBucketVersioningOutput

An instance of GetBucketVersioningOutput.

Input

GetBucketVersioningInput dataclass

Bases: _SerdeShape

Dataclass for GetBucketVersioningInput structure.

Attributes

bucket class-attribute instance-attribute
bucket: str | None = ...

The name of the bucket for which to get the versioning information.

expected_bucket_owner class-attribute instance-attribute
expected_bucket_owner: str | None = ...

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).

Output

GetBucketVersioningOutput dataclass

Bases: _SerdeShape

Dataclass for GetBucketVersioningOutput structure.

Attributes

mfa_delete class-attribute instance-attribute
mfa_delete: str | None = ...

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.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

status class-attribute instance-attribute
status: str | None = ...

The versioning state of the bucket.