Metadata management (Go SDK V2)
This topic describes how to create, view, update, and delete the metadata table configurations of a bucket by using Go SDK V2, including the journal table configuration and the inventory table configuration.
Overview
Metadata management provides metadata table configuration capabilities for a bucket, including the following two types of configurations:
-
Journal table configuration (JournalTableConfiguration): Use
RecordExpirationto control whether journal records are enabled (Expirationis set toENABLEDorDISABLED) and the record retention period (Days). -
Inventory table configuration (InventoryTableConfiguration): Use
ConfigurationStateto control whether the inventory table is enabled (set toENABLEDorDISABLED), and optionally useEncryptionConfigurationto specify the encryption algorithm (SseAlgorithm).
Notes
-
The sample code in this topic uses the region ID
cn-hangzhouof the China (Hangzhou) region. Replace it with the actual region as needed. -
In this topic, access credentials are obtained from environment variables. Make sure that you have configured access credentials (AccessKey) before use.
-
Make sure that you have the permissions to perform metadata table configuration operations on the target bucket. By default, the bucket owner has these permissions. If you do not have the required permissions, contact the bucket owner to grant you the permissions.
-
You can also enable, modify, or disable metadata management in the OSS console.
Sample code
References
-
For sample code that creates a metadata table configuration, see create_bucket_metadata_table_configuration.go.
-
For sample code that queries the metadata table configuration, see get_bucket_metadata_table_configuration.go.
-
For sample code that updates the inventory table configuration, see update_bucket_metadata_inventory_table_configuration.go.
-
For sample code that updates the journal table configuration, see update_bucket_metadata_journal_table_configuration.go.
-
For sample code that deletes the metadata table configuration, see delete_bucket_metadata_table_configuration.go.