createBucketMetadataConfiguration method
Creates an S3 Metadata V2 metadata configuration for a general purpose bucket. For more information, see Accelerating data discovery with S3 Metadata in the Amazon S3 User Guide.
- Permissions
-
To use this operation, you must have the following permissions. For more
information, see Setting
up permissions for configuring metadata tables in the Amazon S3
User Guide.
If you want to encrypt your metadata tables with server-side encryption with Key Management Service (KMS) keys (SSE-KMS), you need additional permissions in your KMS key policy. For more information, see Setting up permissions for configuring metadata tables in the Amazon S3 User Guide.
If you also want to integrate your table bucket with Amazon Web Services analytics services so that you can query your metadata table, you need additional permissions. For more information, see Integrating Amazon S3 Tables with Amazon Web Services analytics services in the Amazon S3 User Guide.
To query your metadata tables, you need additional permissions. For more information, see Permissions for querying metadata tables in the Amazon S3 User Guide.
-
s3:CreateBucketMetadataTableConfiguration -
s3tables:CreateTableBucket -
s3tables:CreateNamespace -
s3tables:GetTable -
s3tables:CreateTable -
s3tables:PutTablePolicy -
s3tables:PutTableEncryption -
kms:DescribeKey
-
CreateBucketMetadataConfiguration:
- DeleteBucketMetadataConfiguration
- GetBucketMetadataConfiguration
- UpdateBucketMetadataInventoryTableConfiguration
- UpdateBucketMetadataJournalTableConfiguration
Parameter bucket :
The general purpose bucket that you want to create the metadata
configuration for.
Parameter metadataConfiguration :
The contents of your metadata configuration.
Parameter checksumAlgorithm :
The checksum algorithm to use with your metadata configuration.
Parameter contentMD5 :
The Content-MD5 header for the metadata configuration.
Parameter expectedBucketOwner :
The expected owner of the general purpose bucket that corresponds to your
metadata configuration.
Implementation
Future<void> createBucketMetadataConfiguration({
required String bucket,
required MetadataConfiguration metadataConfiguration,
ChecksumAlgorithm? checksumAlgorithm,
String? contentMD5,
String? expectedBucketOwner,
}) async {
final headers = <String, String>{
if (checksumAlgorithm != null)
'x-amz-sdk-checksum-algorithm': checksumAlgorithm.value,
if (contentMD5 != null) 'Content-MD5': contentMD5.toString(),
if (expectedBucketOwner != null)
'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
};
await _protocol.send(
method: 'POST',
requestUri: '/${Uri.encodeComponent(bucket)}?metadataConfiguration',
headers: headers,
payload: metadataConfiguration.toXml('MetadataConfiguration'),
exceptionFnMap: _exceptionFns,
);
}