PutBucketLifecycle

최신 업데이트:2022-03-01 18:22:25

PutBucketLifecycle

Used to create a life cycle for the space or replace the original life cycle rules. IAM wos:PutBucketLifecycle permission is required

Request syntax

PUT /?lifecycle HTTP/1.1
Host: Bucket.Endpoint
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="https://www.wangsu.com/document ">
   <Rule>
      <Expiration>
         <Days>integer</Days>
      </Expiration>
      <Filter>
         <Prefix>string</Prefix>
      </Filter>
      <ID>string</ID>
      <Transition>
         <Date>timestamp</Date>
         <StorageClass>string</StorageClass>
      </Transition>
   </Rule>
   ...
</LifecycleConfiguration>

URI request parameters

no

Request header

Only use public request headers .

Request body

The request body is the following xml information

Element name

Element description

LifecyckeConfiguration

Define the life cycle configuration list.

Type: XML

Child node: Rule

Parent node: empty

Rule

Define the detailed configuration of a certain life cycle.

Type: XML

Parent node: LifecycleConfiguration

Child node: Filter

ID

Define a unique identifier for each rule.

Type: String

Parent node: Rule

Filter

Define a subset of objects that meet the life cycle rules. This filtering currently only supports prefixes based on object names. If it is not defined (<Filter></Filter>), this life cycle rule is applied to all objects in the space.

Type: XML

Child node: Prefix

Parent node: Rule

Prefix

Define the filter conditions for the life cycle configuration. Only for objects that meet this prefix in the space, the life cycle configuration will take effect.

Type: String

Parent node: Filter

Expiration

Define the expiration rules for objects that meet the Filter in the space.

Type: XML

Child node: Days|Date

Parent node: Rule

Days

Define the relative expiration days of the object . For example, when the value is 3 , it means that the object that is 3 days after the last modification time is deleted

Type: positive integer

Parent node: Expiration

Transition

Conversion rules

Type: XML

Child node: Days|StorageClass

Parent node: Rule

Days

Days converted

Type: positive integer

Parent node: Transition

StorageClass

Conversion type, IA- low frequency, Archive- archive

Type: String

Parent node: Transition

Response syntax

HTTP/1.1 200 OK
x-wos-request-id: request id
Content-Type: type
Date: date
Content-Length: length
Server: WS-web-server

Response header

Only use public response headers .

Response element

no

Example

Create a rule of 30 days to low frequency, 60 days to archive, and 365 days to delete rules

PUT /?lifecycle HTTP/1.1
Host: bucket.s3-cn-east-1.wcsapi.com
x-amz-date: Sun, 14 May 2017 02:11:21 GMT
Content-MD5: q6yJDlIkcBaGGfb3QLY69A==
Authorization: authorization string
Content-Length: 105
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Filter>
    <Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
    <Days>365</Days>
</Expiration>
<Transition>
    <Days>30</Days>
    <StorageClass>IA</StorageClass>
</Transition>
<Transition>
    <Days>60</Days>
    <StorageClass>Archive</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>

HTTP/1.1 200 OK
x-wos-request-id: 9E26D08072A8EF9E
Date: Sun, 14 May 2017 02:11:22 GMT
Content-Length: 0
Server: WCS-Web-Server

이 문서의 내용이 도움이 되었습니까?
아니오
정상적으로 제출되었습니다.피드백을 주셔서 감사합니다.앞으로도 개선을 위해 노력하겠습니다.