Skip to content

get_bucket_request_payment async

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

This operation is not supported for directory buckets.

Returns the request payment configuration of a bucket. To use this version of the operation, you must be the bucket owner. For more information, see Requester Pays Buckets.

The following operations are related to GetBucketRequestPayment:

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 name of the bucket for which to get the payment request configuration

  • 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:

Examples:

To get bucket versioning configuration The following example retrieves bucket versioning configuration.

>>> await client.get_bucket_request_payment(bucket='examplebucket')
Source code in docs_src/capo_s3/_services/async_s3.py
async def get_bucket_request_payment(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    *,
    config_overrides: Optional[AsyncS3ClientConfig] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> (
    "capo_s3.types.get_bucket_request_payment_output.GetBucketRequestPaymentOutput"
):
    """<note> <p>This operation is not supported for directory buckets.</p> </note> <p>Returns the request payment configuration of a bucket. To use this version of the operation, you must be the bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html">Requester Pays Buckets</a>.</p> <p>The following operations are related to <code>GetBucketRequestPayment</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html">ListObjects</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 name of the bucket for which to get the payment request configuration</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.

    Examples:
        To get bucket versioning configuration
        The following example retrieves bucket versioning configuration.

        >>> await client.get_bucket_request_payment(bucket='examplebucket')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3.types.get_bucket_request_payment_request.GetBucketRequestPaymentRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3.types.get_bucket_request_payment_output.GetBucketRequestPaymentOutput"
    ]:
        import capo_s3._operations.amazon_s3.get_bucket_request_payment

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetBucketRequestPayment")
    )
    input_: capo_s3.types.get_bucket_request_payment_request.GetBucketRequestPaymentRequest = {
        "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