All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Get Bucket Lifecycle

Last updated:2021-09-14 16:18:08

Description

You can call this operation to query the lifecycle configuration set on a bucket and obtain the result in XML format. To call this operation, you must have the ks3:GetBucketLifecycle permission. By default, the bucket owner has this permission.

Request

Request syntax

GET /?lifecycle HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}

References:

Request parameters

This operation does not involve request parameters.

Request headers

This operation involves only common request headers. For more information, please click Public request headers.

Request body

This operation does not involve request body. Kingsoft Cloud Standard Storage Service (KS3) specifics a set of permissions in a policy. Each permission is mapped to a specific KS3 operation.

Response

Response headers

This operation involves only common response headers. For more information, please click Public response headers.

Response body

This operation returns a response in XML format, which may contain the following parameters.

Parameter Description Required
LifecycleConfiguration The container that contains multiple rules. A bucket can have up to 1,000 rules.
Type: Container
Child node: Rule
Parent node: None
Yes
Rule The rule.
Type: Container
Parent node: LifecycleConfiguration
Yes
ID The ID of the rule, which must be unique in a bucket. The ID can be up to 255 UTF-8 characters, not bytes, in length.
Type: String
Parent node: Rule
Yes
Filter The filter that specifies a prefix. A rule can have only one filter. The prefixes of rules must not conflict with each other.
Type: Container
Child node: Prefix
Parent node: Rule
No
And A subset of filters. This node is required only when you specify multiple filters.
If you want to filter objects by prefix and tag at the same time, or specify multiple tags to filter objects, you can use this node.
Type: Container
Parent node: LifecycleConfiguration.Rule.Filter
No
Prefix The prefix that specifies the objects. The object with a specified prefix will be deleted. A rule can have only one filter and one prefix.
Type: String
Parent node: Filter
No
Tag The collection of tags, which supports up to 10 tags.
Type: Container
No
Key The key of the tag. A valid key can be up to 128 bytes in length, and can contain letters, digits, spaces, plus signs (+), minus signs (-), underscores (_), equal signs (=), periods (.), colons (:), forward slashes (/) and backslashes (\).
Type: String
No
Value The value of the tag. A valid value can be up to 256 bytes in length, and can contain letters, digits, spaces, plus signs (+), minus signs (-), underscores (_), equal signs (=), periods (.), colons (:), forward slashes (/) and backslashes (\).
Type: String
No
Status The status of the rule. If the rule is in the Enabled state, the rule takes effect as scheduled. If the rule is in the Disabled state, the rule cannot take effect. In this case, the rule is not deleted and can be enabled at any time.
Type: String
Parent node: Rule
Valid value: Enabled and Disabled
Yes
Expiration The date at which the object expires or the lifetime, in days, of the object.
Type: Container
Child nodes: Days and Date
Parent node: Rule
No
Days The number of days (counted from the last modification date) after which the corresponding object will be deleted. The value must be greater than zero.
Type: Integer
Parent nodes: Expiration and Transition
Yes (if Date is unavailable)
Date The date for deleting objects. Objects whose last modification date is earlier than this value will be deleted. The date must be in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss+08:00 format. You must set hh:mm:ss to 00:00:00.
Type: String
Parent nodes: Expiration and Transition
Yes (if Days is unavailable)
Transition The time to convert the storage class of the specified object between IA and Archive during the lifecycle of this object.
Type: Container
Child node: Days, Date, and StorageClass
No
StorageClass The storage class for storing the specified object.
Parent node: Transition
Valid values: STANDARD_IA and ARCHIVE (not supported if the AWS SDK is used in the console)
No (Yes if Transition is available)

Examples

Sample request

GET /?lifecycle HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyuncs.com
Date: Wed, 01 Mar 2016 12:00:00 GMT
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 312
Date: Wed, 16 Aug 2017 12:23:54 GMT
Server: tencent-cos
x-kss-request-id: NTk5NDM5NWFfMjQ4OGY3Xzc3NGRf****

<LifecycleConfiguration>
  <Rule>
    <ID>id1</ID>
    <Filter>
       <Prefix>documents/</Prefix>
    </Filter>
    <Status>Enabled</Status>
    <Transition>
      <Days>100</Days>
      <StorageClass>STANDARD_IA</StorageClass>
    </Transition>
  </Rule>
  <Rule>
    <ID>id2</ID>
    <Filter>
       <Prefix>logs/</Prefix>
    </Filter>
    <Status>Enabled</Status>
    <Expiration>
      <Days>10</Days>
    </Expiration>
  </Rule>
</LifecycleConfiguration>
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback