Available in Classic and VPC
This section explains how to manage object lifecycle to automatically delete objects at a specified time. You can set the lifecycle using the X-Delete-At or X-Delete-After header when making a PUT (upload) request or a POST request after the upload. Even if you make the request using the X-Delete-After header, it is converted to and saved as X-Delete-At. To remove the lifecycle setting, use the X-Remove-Delete-At or X-Remove-Delete-After header.
| Name | Applicable fields | Type | Description |
|---|---|---|---|
| X-Delete-At | header | integer | Enter the deletion time for the object (Unix Epoch timestamp). |
| X-Delete-After | header | integer | Delete the object after the entered number of seconds. |
The lifecycle can be applied to individual objects. If the object to which the lifecycle is being applied was uploaded as a DLO or SLO, you must set the lifecycle separately for both the segment object and the manifest object.
Objects deleted through lifecycle settings cannot be recovered.
Set object lifecycle (PUT)
An example of setting the lifecycle by including the X-Delete-At or X-Delete-After header in an object upload (PUT) request is as follows:
Syntax
PUT /v1/AUTH_{project_id}/{container}/{object}
Request example
curl -i -X PUT -H "X-Delete-At: 1540520319" -H "X-Auth-Token: $token" -T "/FILE_PATH/OBJECT" https://kr.archive.ncloudstorage.com/v1/AUTH_{project_id}/{container}/{object}
or
curl -i -X PUT -H "X-Delete-After: 3600" -H "X-Auth-Token: $token" -T "/FILE_PATH/OBJECT" https://kr.archive.ncloudstorage.com/v1/AUTH_{project_id}/{container}/{object}
Set object lifecycle (POST)
An example of setting the lifecycle by including the X-Delete-At or X-Delete-After header in an object POST request is as follows:
Syntax
POST /v1/AUTH_{project_id}/{container}/{object}
Request example
curl -i -X POST -H "X-Delete-At: 1540520319" -H "X-Auth-Token: $token" https://kr.archive.ncloudstorage.com/v1/AUTH_{project_id}/{container}/{object}
or
curl -i -X POST -H "X-Delete-After: 3600" -H "X-Auth-Token: $token" https://kr.archive.ncloudstorage.com/v1/AUTH_{project_id}/{container}/{object}
View object lifecycle
An example of viewing the lifecycle set for an object is as follows:
Syntax
HEAD /v1/AUTH_{project_id}/{container}/{object}
Request example
curl -i -X HEAD -H "X-Auth-Token: $token" https://kr.archive.ncloudstorage.com/v1/AUTH_{project_id}/{container}/{object}
Response example
HTTP/1.1 200 OK
Content-Length: 4
X-Delete-At: 1540520319
Accept-Ranges: bytes
Last-Modified: Fri, 26 Oct 2018 02:25:30 GMT
Etag: 098f6bcd4621d373cade4e832627b4f6
X-Timestamp: 1540520729.75505
Content-Type: text/html
X-Trans-Id: txeaa0f1050fcf4cad9ccce-005bd27b8d
X-Openstack-Request-Id: txeaa0f1050fcf4cad9ccce-005bd27b8d
Date: Fri, 26 Oct 2018 02:27:25 GMT
Remove object lifecycle
Archive Storage does not support directly removing the lifecycle header (X-Delete-At) using the X-Remove-Delete-At header.
If a lifecycle header has already been set, the object cannot be deleted until the specified deletion time. If you need to delete the object before that time, upload the object again with the same key (overwrite) to remove the lifecycle setting, and delete the object.