update-bucket-metadata-journal-table-configuration

Updated at:

The update-bucket-metadata-journal-table-configuration command updates the journal table configuration of a bucket. For example, you can configure the expiration policy for journal records.

Usage notes

Important

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 update the journal table configuration of a bucket. To update the journal table configuration of a bucket by using a RAM user or Security Token Service (STS), you must have the oss:UpdateBucketMetadataJournalTableConfiguration permission. For more information, see Attach a custom policy to a RAM user.

Syntax

ossutil api update-bucket-metadata-journal-table-configuration --bucket examplebucket --journal-table-configuration file://journal-table-configuration.xml

Parameter

Type

Description

--bucket

string

The name of the target bucket.

--journal-table-configuration

string

The container that stores the metadata table configuration, in XML or JSON format. If the option value contains the file:// prefix, the configuration is read from the specified file.

--journal-table-configuration

The --journal-table-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 journal-table-configuration.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<JournalTableConfiguration>
  <RecordExpiration>
    <Expiration>ENABLED</Expiration>
    <Days>7</Days>
  </RecordExpiration>
</JournalTableConfiguration>

The equivalent JSON syntax is as follows:

{
  "RecordExpiration": {
    "Expiration": "ENABLED",
    "Days": 7
  }
}

Parameter

Type

Required

Description

RecordExpiration

Container

Yes

The expiration configuration for journal table records.

RecordExpiration.Expiration

String

Yes

Specifies whether to enable record expiration. Valid values: ENABLED and DISABLED.

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.

Note

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

Update the journal table configuration of a bucket named examplebucket: enable record expiration and set the expiration period to 7 days. Add the following content to a configuration file named journal-table-configuration.xml:

<?xml version="1.0" encoding="UTF-8"?>
<JournalTableConfiguration>
  <RecordExpiration>
    <Expiration>ENABLED</Expiration>
    <Days>7</Days>
  </RecordExpiration>
</JournalTableConfiguration>

Alternatively, you can use a JSON configuration file named journal-table-configuration.json with the following content:

{
  "RecordExpiration": {
    "Expiration": "ENABLED",
    "Days": 7
  }
}

Sample command:

ossutil api update-bucket-metadata-journal-table-configuration --bucket examplebucket --journal-table-configuration file://journal-table-configuration.xml
ossutil api update-bucket-metadata-journal-table-configuration --bucket examplebucket --journal-table-configuration file://journal-table-configuration.json