Skip to content

get_bucket_metadata_configuration

get_bucket_metadata_configuration(
    bucket: BucketName,
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> GetBucketMetadataConfigurationOutput

Retrieves the S3 Metadata configuration for a general purpose bucket. For more information, see Accelerating data discovery with S3 Metadata in the Amazon S3 User Guide.

You can use the V2 GetBucketMetadataConfiguration API operation with V1 or V2 metadata configurations. However, if you try to use the V1 GetBucketMetadataTableConfiguration API operation with V2 configurations, you will receive an HTTP 405 Method Not Allowed error.

Permissions

To use this operation, you must have the s3:GetBucketMetadataTableConfiguration permission. For more information, see Setting up permissions for configuring metadata tables in the Amazon S3 User Guide.

The IAM policy action name is the same for the V1 and V2 API operations.

The following operations are related to GetBucketMetadataConfiguration:

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 general purpose bucket that corresponds to the metadata configuration that you want to retrieve.

  • expected_bucket_owner (Optional[AccountId], default: None ) –

    The expected owner of the general purpose bucket that you want to retrieve the metadata table configuration for.

Raises:

Source code in docs_src/capo_s3/_services/s3.py
def get_bucket_metadata_configuration(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> "capo_s3.types.get_bucket_metadata_configuration_output.GetBucketMetadataConfigurationOutput":
    """<p>Retrieves the S3 Metadata configuration for a general purpose bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-overview.html">Accelerating data discovery with S3 Metadata</a> in the <i>Amazon S3 User Guide</i>. </p> <note> <p>You can use the V2 <code>GetBucketMetadataConfiguration</code> API operation with V1 or V2 metadata configurations. However, if you try to use the V1 <code>GetBucketMetadataTableConfiguration</code> API operation with V2 configurations, you will receive an HTTP <code>405 Method Not Allowed</code> error.</p> </note> <dl> <dt>Permissions</dt> <dd> <p>To use this operation, you must have the <code>s3:GetBucketMetadataTableConfiguration</code> permission. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-permissions.html">Setting up permissions for configuring metadata tables</a> in the <i>Amazon S3 User Guide</i>. </p> <note> <p>The IAM policy action name is the same for the V1 and V2 API operations.</p> </note> </dd> </dl> <p>The following operations are related to <code>GetBucketMetadataConfiguration</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucketMetadataConfiguration.html">CreateBucketMetadataConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetadataConfiguration.html">DeleteBucketMetadataConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataInventoryTableConfiguration.html">UpdateBucketMetadataInventoryTableConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataJournalTableConfiguration.html">UpdateBucketMetadataJournalTableConfiguration</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 general purpose bucket that corresponds to the metadata configuration that you want to retrieve. </p>
        expected_bucket_owner: <p> The expected owner of the general purpose bucket that you want to retrieve the metadata table configuration for. </p>

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

    def _handler(
        req: "OperationRequest[capo_s3.types.get_bucket_metadata_configuration_request.GetBucketMetadataConfigurationRequest]",
    ) -> OperationResponse[
        "capo_s3.types.get_bucket_metadata_configuration_output.GetBucketMetadataConfigurationOutput"
    ]:
        import capo_s3._operations.amazon_s3.get_bucket_metadata_configuration

        output, http_response = (
            capo_s3._operations.amazon_s3.get_bucket_metadata_configuration.get_bucket_metadata_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output