Skip to content

get_bucket_versioning async

get_bucket_versioning(
    account_id: AccountId,
    bucket: BucketName,
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
) -> GetBucketVersioningResult

This operation returns the versioning state for S3 on Outposts buckets only. To return the versioning state for an S3 bucket, see GetBucketVersioning in the Amazon S3 API Reference.

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.

Parameters:

  • account_id (AccountId) –

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

  • bucket (BucketName) –

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

Raises:

Source code in docs_src/capo_s3_control/_services/async_s3_control.py
async def get_bucket_versioning(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    bucket: "capo_s3_control.types.bucket_name.BucketName",
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
) -> "capo_s3_control.types.get_bucket_versioning_result.GetBucketVersioningResult":
    """<note> <p>This operation returns the versioning state for S3 on Outposts buckets only. To return the versioning state for an S3 bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html">GetBucketVersioning</a> in the <i>Amazon S3 API Reference</i>. </p> </note> <p>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.</p> <p>If you've never set versioning on your bucket, it has no versioning state. In that case, the <code>GetBucketVersioning</code> request does not return a versioning state value.</p> <p>For more information about versioning, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html">Versioning</a> in the <i>Amazon S3 User Guide</i>.</p> <p>All Amazon S3 on Outposts REST API requests for this action require an additional parameter of <code>x-amz-outpost-id</code> to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of <code>s3-control</code>. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the <code>x-amz-outpost-id</code> derived by using the access point ARN, see the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketVersioning.html#API_control_GetBucketVersioning_Examples">Examples</a> section.</p> <p>The following operations are related to <code>GetBucketVersioning</code> for S3 on Outposts.</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketVersioning.html">PutBucketVersioning</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html">PutBucketLifecycleConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html">GetBucketLifecycleConfiguration</a> </p> </li> </ul>

    Args:
        account_id: <p>The Amazon Web Services account ID of the S3 on Outposts bucket.</p>
        bucket: <p>The S3 on Outposts bucket to return the versioning state for.</p>

    Raises:
        capo_s3_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3_control.types.get_bucket_versioning_request.GetBucketVersioningRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3_control.types.get_bucket_versioning_result.GetBucketVersioningResult"
    ]:
        import capo_s3_control._operations.awss3_control_service_v20180820.get_bucket_versioning

        (
            output,
            http_response,
        ) = await capo_s3_control._operations.awss3_control_service_v20180820.get_bucket_versioning.async_get_bucket_versioning(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetBucketVersioning")
    )
    input_: capo_s3_control.types.get_bucket_versioning_request.GetBucketVersioningRequest = {
        "account_id": account_id,
        "bucket": bucket,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output