Available in Classic and VPC
Register a new lifecycle rule on an Ncloud Storage bucket or overwrite an existing lifecycle rule.
To ensure stable operation, object deletion tasks (delete current version, delete previous version, delete expired deletion marker) have been temporarily disabled. The expiration task of existing rules will not be performed. We will inform you again when the feature is resumed.
Request
This section describes the request format. The method and URI are as follows:
| Method | URL |
|---|---|
| PUT | - |
Request headers
For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage request headers.
Request body
You can include the following data in the body of your request:
| Field | Type | Required | Description |
|---|---|---|---|
| Rule | List | Required | Rule list
|
| Rule.ID | String | Optional | Rule name
|
| Rule.Filter | List | Optional | Filter to distinguish which objects to apply the rule to |
| Rule.Filter.Prefix | String | Optional | Prefix of the object to apply the rule to, currently only filterable by prefix |
| Rule.Expiration | List | Optional | Expiration rule |
| Rule.Expiration.Days | Integer | Optional | Number of days the object is deleted after being created, which must be a positive integer greater than 0 |
| Rule.Transition | List | Optional | Storage class migration rule |
| Rule.Transition.Days | Integer | Optional | Number of days after the object is created that it is switched to the specified storage class, which must be a positive integer |
| Rule.Transition.StorageClass | String | Optional | Storage class to be switched to
|
| Rule.NoncurrentVersionExpiration | List | Optional | Expiration rule for non-current object versions |
| Rule.NoncurrentVersionExpiration.NewerNoncurrentVersions | Integer | Optional | Number of non-current versions to archive
|
| Rule.NoncurrentVersionExpiration.NoncurrentDays | Integer | Optional | Number of days the object remains noncurrent
|
| Rule.NoncurrentVersionTransition | List | Optional | Storage class migration rule for non-current object versions |
| Rule.NoncurrentVersionTransition.NewerNoncurrentVersions | Integer | Optional | Number of non-current versions to keep in the same storage class before switching the object
|
| Rule.NoncurrentVersionTransition.NoncurrentDays | Integer | Optional | Number of days the object remains noncurrent
|
| Rule.NoncurrentVersionTransition.StorageClass | String | Optional | Storage class to be switched to
|
The Date field is not supported.
Request example
The request example is as follows:
When bucket versioning is not enabled
The following is a sample request to transition objects with the "logs/" prefix to the DEEP_ARCHIVE storage class after 180 days, according to the Transition rule.
PUT /?lifecycle HTTP/1.1
Host: bucket.kr.ncloudstorage.com
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>id1</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>180</Days>
<StorageClass>DEEP_ARCHIVE</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>
When bucket versioning is enabled
The following is a sample request that automatically transitions all object versions, except for the five most recent previous versions with the "logs/" prefix, to the DEEP_ARCHIVE storage class 180 days after they become inactive, according to the NoncurrentVersionTransition rule.
PUT /?lifecycle HTTP/1.1
Host: bucket.kr.ncloudstorage.com
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>id2</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionTransition>
<NewerNoncurrentVersions>5</NewerNoncurrentVersions>
<NoncurrentDays>180</NoncurrentDays>
<StorageClass>DEEP_ARCHIVE</StorageClass>
</NoncurrentVersionTransition>
</Rule>
</LifecycleConfiguration>
Response
This section describes the response format.
Response headers
For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage response headers.
Response status codes
For information about the HTTP status codes common to all Ncloud Storage APIs, see Common Ncloud Storage response status codes.
Response example
The response example is as follows:
HTTP/1.1 200 OK