All Products
Search
Document Center

Object Storage Service:get-bucket-lifecycle

Last Updated:Jul 31, 2024

Queries lifecycle rules of a bucket.

Usage notes

  • By default, only the owner of a bucket has the permissions to query the lifecycle rules of the bucket.

  • To query lifecycle rules of a bucket, you must have the oss:GetBucketLifecycle permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

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

Parameter

Type

Description

--bucket

string

The name of the bucket.

Note

For more information, see Command-line options.

Examples

  • Query lifecycle rules of the examplebucket bucket.

    ossutil api get-bucket-lifecycle --bucket examplebucket
  • Query lifecycle rules of the examplebucket bucket and format the output in JSON.

    ossutil api get-bucket-lifecycle --bucket examplebucket --output-format json
  • Query lifecycle rules of the examplebucket bucket and format the output in YAML.

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