Skip to content

delete_bucket_ownership_controls async

delete_bucket_ownership_controls(
    bucket: BucketName,
    *,
    config_overrides: Optional[AsyncS3ClientConfig] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> None

This operation is not supported for directory buckets.

Removes OwnershipControls for an Amazon S3 bucket. To use this operation, you must have the s3:PutBucketOwnershipControls permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy.

For information about Amazon S3 Object Ownership, see Using Object Ownership.

The following operations are related to DeleteBucketOwnershipControls:

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:

  • bucket (BucketName) –

    The Amazon S3 bucket whose OwnershipControls you want to delete.

  • expected_bucket_owner (Optional[AccountId], default: 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).

Raises:

Source code in docs_src/capo_s3/_services/async_s3.py
async def delete_bucket_ownership_controls(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    *,
    config_overrides: Optional[AsyncS3ClientConfig] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> None:
    """<note> <p>This operation is not supported for directory buckets.</p> </note> <p>Removes <code>OwnershipControls</code> for an Amazon S3 bucket. To use this operation, you must have the <code>s3:PutBucketOwnershipControls</code> permission. For more information about Amazon S3 permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html">Specifying Permissions in a Policy</a>.</p> <p>For information about Amazon S3 Object Ownership, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html">Using Object Ownership</a>. </p> <p>The following operations are related to <code>DeleteBucketOwnershipControls</code>:</p> <ul> <li> <p> <a>GetBucketOwnershipControls</a> </p> </li> <li> <p> <a>PutBucketOwnershipControls</a> </p> </li> </ul> <important> <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p> </important>

    Args:
        bucket: <p>The Amazon S3 bucket whose <code>OwnershipControls</code> you want to delete. </p>
        expected_bucket_owner: <p>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 <code>403 Forbidden</code> (access denied).</p>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_s3.types.delete_bucket_ownership_controls_request.DeleteBucketOwnershipControlsRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_s3._operations.amazon_s3.delete_bucket_ownership_controls

        (
            output,
            http_response,
        ) = await capo_s3._operations.amazon_s3.delete_bucket_ownership_controls.async_delete_bucket_ownership_controls(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteBucketOwnershipControls")
    )
    input_: capo_s3.types.delete_bucket_ownership_controls_request.DeleteBucketOwnershipControlsRequest = {
        "bucket": bucket
    }
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner

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