Metadata management (Java SDK V2)
This topic describes how to create, view, update, and delete the metadata table configurations of a bucket by using Java 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 synchronous sample code, see CreateBucketMetadataConfiguration.java, GetBucketMetadataConfiguration.java, DeleteBucketMetadataConfiguration.java, UpdateBucketMetadataInventoryTableConfiguration.java, and UpdateBucketMetadataJournalTableConfiguration.java.
For asynchronous sample code, see CreateBucketMetadataConfigurationAsync.java, GetBucketMetadataConfigurationAsync.java, DeleteBucketMetadataConfigurationAsync.java, UpdateBucketMetadataInventoryTableConfigurationAsync.java, and UpdateBucketMetadataJournalTableConfigurationAsync.java.