Query the retention policy configured for a bucket

Updated at:

Queries the retention policy that is configured for a bucket.

Usage notes

  • To query the retention policy configured for a bucket, you must have the oss:GetBucketWorm permission. For more information, see Grant a custom policy.

  • OSS supports the Write Once Read Many (WORM) strategy, which prevents objects from being deleted or overwritten for a specified period of time. You can configure a time-based retention policy for a bucket with a retention period ranging from one day to 70 years.

  • After a bucket's retention policy is locked, you can read objects from or upload objects to the bucket. However, the objects and the retention policy cannot be deleted within the retention period. You can delete objects only after the retention period expires.

Command syntax

ossutil api get-bucket-worm --bucket value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket.

Note

For more information, see Command-line options.

Examples

  • Query the retention policy configured for the examplebucket bucket.

    ossutil api get-bucket-worm --bucket examplebucket
  • Query the retention policy configured for the examplebucket bucket and format the output in JSON.

    ossutil api get-bucket-worm --bucket examplebucket --output-format json
  • Query the retention policy configured for the examplebucket bucket and format the output in YAML.

    ossutil api get-bucket-worm --bucket examplebucket --output-format yaml