Retrieves the Write Once Read Many (WORM) retention policy configured for a bucket, including the policy status and retention period.
Prerequisites
Before you begin, make sure that you have:
The
oss:GetBucketWormpermission. For more information, see Attach a custom policy to a RAM user.ossutil installed and configured with valid credentials.
Syntax
ossutil api get-bucket-worm --bucket <bucket-name> [flags]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
--bucket | string | Yes | The name of the bucket |
For a full list of global flags, see Command-line options.
Examples
Query the retention policy for a bucket
ossutil api get-bucket-worm --bucket examplebucketQuery the retention policy and format the output as JSON
ossutil api get-bucket-worm --bucket examplebucket --output-format jsonQuery the retention policy and format the output as YAML
ossutil api get-bucket-worm --bucket examplebucket --output-format yamlUsage notes
OSS supports a time-based retention policy based on the WORM model. Once configured, objects in the bucket cannot be deleted or overwritten until the retention period expires. A retention policy has a retention period that ranges from one day to 70 years.
After a policy is locked, you can read objects from and upload objects to the bucket. However, the policy itself and any objects within the retention period cannot be deleted.
What's next
Configure a retention policy — create a time-based retention policy for a bucket.
Lock a retention policy — lock an in-progress policy to enforce it.
Delete a retention policy — delete an unlocked policy.
Extend a retention policy — extend the retention period of a locked policy.