Get Bucket Lifecycle

最近更新时间:2020-07-13 22:50:17

GET Bucket lifecycle


Description

This GET operation returns the bucket's lifecyle configuration, which is an XML describing each rule. Only the owner of bucket has permission to use this interface.

Request

Grammar

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

Note:

Request parameters

This interface does not use request parameters.

Request header

This interface only uses common request headers. For more information, please click Public request headers.

Request content

This interface does not use the requested content.

Response

Response header

This interface only uses common response headers. For more information, please click Public response headers.

Response content

Returns an XML, which may have the following nodes:

Name Description Necessity
LifecycleConfiguration A container that contains a bunch of rules. A bucket can contain up to 100 rules.
Type: Container
Child node: Rule
Parent node: None
YES
Rule Include a rule.
Type: Container
Parent node: LifecycleConfiguration
YES
ID Unique ID of rule. ID in a bucket cannot be duplicate. ID length is less than or equal to 255 characters. Note that it is utf8 encoding character, not byte.
Type: String
Parent node: Rule
YES
Filter The prefix is specified. A rule can only have one filter. The prefixes of different rules cannot conflict.
Type: Container
Child nodes: Prefix
Parent node: Rule
NO
Prefix Objects matching this prefix will be deleted. A rule can only have one filter and one prefix.
Type: String
Parent node: Filter
NO
Status In Enabled state, the rule is executed on a regular basis; In Disabled state, the rule is ignored, but the rule can be enabled instead of deleted at any time.
Type: String
Parent node: Rule
Value: Enabled, Disabled
YES
Expiration Specifies when the corresponding object is deleted.
Type: Container

Child node: Days,Date
Parent node: Rule
YES
Date Objects with last modify day less than this number are deleted. Must be Beijing time in ISO 8601 format. Time, minute and second must be filled with 0, that is, it must be 0 point.
Type: String
Parent node: Expiration
Yes (if no days)
Days Specify a positive number, corresponding to how many days after last modify the object is deleted.
Type: integer
Parent node: Expiration
Yes (if there is no date)

Special errors

Error Code Description HTTP Status Code
NoSuchLifecycleConfiguration This bucket has no lifecycle configuration. 404 Not Found

Example

Request example

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

Response example

HTTP/1.1 200 OK
Date: Wed, 01 Mar 2016 12:02:00 GMT
Content-Length: 124
Server: Tengine
x-kss-request-id: 54a47bda18ac4e6e91de369add54218e
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Expiration>
<Date>2016-12-31T00:00:00+08:00</Date>
</Expiration>
<Status>Enabled</Status>
</Rule>
<Rule>
<ID>id2</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>

金山云,开启您的云计算之旅

免费注册