create-bucket-metadata-configuration
The create-bucket-metadata-configuration command creates the metadata management (Metadata) configuration for a bucket, including the journal table and an optional live inventory table.
Usage notes
Metadata management (Metadata) is in invitational preview. It is not yet available to all users and is available only in regions where Table Bucket is supported. To use this feature, contact technical support to apply. In addition, you can enable, modify, or disable metadata management in the OSS console.
By default, an Alibaba Cloud account has the permissions to create the metadata configuration for a bucket. To create the metadata configuration for a bucket by using a RAM user or Security Token Service (STS), you must have the oss:CreateBucketMetadataTableConfiguration permission. For more information, see Attach a custom policy to a RAM user.
Syntax
ossutil api create-bucket-metadata-configuration --bucket examplebucket --metadata-configuration file://metadata-configuration.xml
|
Parameter |
Type |
Description |
|
--bucket |
string |
The name of the target bucket. |
|
--metadata-configuration |
string |
The container that stores the metadata table configuration, in XML or JSON format. If the option value contains the |
--metadata-configuration
The --metadata-configuration option supports XML and JSON syntax. If the option value contains the file:// prefix, the configuration is read from the specified file. The following example shows the content of the metadata-configuration.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<MetadataConfiguration>
<JournalTableConfiguration>
<RecordExpiration>
<Expiration>ENABLED</Expiration>
<Days>7</Days>
</RecordExpiration>
</JournalTableConfiguration>
<InventoryTableConfiguration>
<ConfigurationState>ENABLED</ConfigurationState>
<EncryptionConfiguration>
<SseAlgorithm>AES256</SseAlgorithm>
</EncryptionConfiguration>
</InventoryTableConfiguration>
</MetadataConfiguration>
The equivalent JSON syntax is as follows:
{
"JournalTableConfiguration": {
"RecordExpiration": {
"Expiration": "ENABLED",
"Days": 7
}
},
"InventoryTableConfiguration": {
"ConfigurationState": "ENABLED",
"EncryptionConfiguration": {
"SseAlgorithm": "AES256"
}
}
}
|
Parameter |
Type |
Required |
Description |
|
JournalTableConfiguration |
Container |
Yes |
The configuration of the journal table. |
|
JournalTableConfiguration.RecordExpiration |
Container |
Yes |
The expiration configuration for journal table records. |
|
JournalTableConfiguration.RecordExpiration.Expiration |
String |
Yes |
Specifies whether to enable record expiration. Valid values: ENABLED and DISABLED. |
|
JournalTableConfiguration.RecordExpiration.Days |
Integer |
Conditionally required |
The number of days after which records expire. Required when Expiration is set to ENABLED. The value must be a positive integer. |
|
JournalTableConfiguration.EncryptionConfiguration |
Container |
No |
The encryption configuration of the journal table. |
|
JournalTableConfiguration.EncryptionConfiguration.SseAlgorithm |
String |
Conditionally required |
The encryption algorithm. Required when EncryptionConfiguration is specified. |
|
JournalTableConfiguration.EncryptionConfiguration.KmsKeyArn |
String |
Conditionally required |
The ARN of the KMS key. Required when SseAlgorithm is set to SSE-KMS. |
|
InventoryTableConfiguration |
Container |
No |
The configuration of the inventory table. You can enable it when you create the metadata configuration. |
|
InventoryTableConfiguration.ConfigurationState |
String |
Conditionally required |
Required when InventoryTableConfiguration is specified. Valid values: ENABLED and DISABLED. |
|
InventoryTableConfiguration.EncryptionConfiguration |
Container |
No |
The encryption configuration of the inventory table. |
|
InventoryTableConfiguration.EncryptionConfiguration.SseAlgorithm |
String |
Conditionally required |
The encryption algorithm. Required when EncryptionConfiguration is specified. |
This command requires ossutil 2.4.1 or later. For earlier versions, call the corresponding operation by using the invoke-operation generic command.
For more information about supported global command-line options, see Global command-line options.
Examples
Create the metadata configuration for a bucket named examplebucket: enable the journal table and set the record expiration period to 7 days, and enable the inventory table with AES256 encryption. Add the following content to a configuration file named metadata-configuration.xml:
<?xml version="1.0" encoding="UTF-8"?>
<MetadataConfiguration>
<JournalTableConfiguration>
<RecordExpiration>
<Expiration>ENABLED</Expiration>
<Days>7</Days>
</RecordExpiration>
</JournalTableConfiguration>
<InventoryTableConfiguration>
<ConfigurationState>ENABLED</ConfigurationState>
<EncryptionConfiguration>
<SseAlgorithm>AES256</SseAlgorithm>
</EncryptionConfiguration>
</InventoryTableConfiguration>
</MetadataConfiguration>
Alternatively, you can use a JSON configuration file named metadata-configuration.json with the following content:
{
"JournalTableConfiguration": {
"RecordExpiration": {
"Expiration": "ENABLED",
"Days": 7
}
},
"InventoryTableConfiguration": {
"ConfigurationState": "ENABLED",
"EncryptionConfiguration": {
"SseAlgorithm": "AES256"
}
}
}
Sample command:
ossutil api create-bucket-metadata-configuration --bucket examplebucket --metadata-configuration file://metadata-configuration.xmlossutil api create-bucket-metadata-configuration --bucket examplebucket --metadata-configuration file://metadata-configuration.json