openstack-manuals/doc/user-guide/source/sdk_schedule_objects_for_deletion.rst
Andreas Jaeger 28d95bfc66 End User Guide: Remove user_only and orphan
With the split of the User Guides, there's no need anymore to have
orphan and user_only flags, remove them from the user-guide
directory.

Only files that keep :orphan: are
doc/user-guide/source/hot-guide/hot_advanced_topics.rst and
hot_existing_templates.rst since these files are not currently included.

Change-Id: I1ac0356d69d8668785f8b1947e8b061731aca747
2015-05-13 18:09:16 +00:00

2.0 KiB

Schedule objects for deletion

To determine whether your Object Storage system supports this feature, see managing-openstack-object-storage-with-swift-cli. Alternatively, check with your service provider.

Scheduling an object for deletion is helpful for managing objects that you do not want to permanently store, such as log files, recurring full backups of a dataset, or documents or images that become outdated at a specified time.

To schedule an object for deletion, include one of these headers with the PUT or POST request on the object:

X-Delete-At

A UNIX epoch timestamp, in integer form. For example, 1348691905 represents Wed, 26 Sept 2012 20:38:25 GMT. It specifies the time you want the object to expire, no longer be served, and be deleted completely from the object store.

X-Delete-After

An integer value which specifies the number of seconds from the time of the request to when you want to delete the object. This header is converted to a X-Delete-At header that is set to the sum of the X-Delete-After value plus the current time, in seconds.

Note

Use http://www.epochconverter.com/ to convert dates to and from epoch timestamps and for batch conversions.

Use the POST method to assign expiration headers to existing objects that you want to expire.

In this example, the X-Delete-At header is assigned a UNIX epoch timestamp in integer form for Mon, 11 Jun 2012 15:38:25 GMT.

$ curl -i publicURL/marktwain/goodbye -X PUT -H "X-Auth-Token: token" \
-H "X-Delete-At: 1390581073" -H "Content-Length: 14" -H \
"Content-Type: application/octet-stream"

In this example, the X-Delete-After header is set to 864000 seconds. The object expires after this time.

PUT /<api version>/<account>/<container>/<object> HTTP/1.1
Host: storage.example.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
Content-Type: image/jpeg
X-Delete-After: 864000