object-api/openstack-object-storage-dev/section_object-api-expire-o...

62 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section [
<!-- Useful for describing APIs -->
<!ENTITY PUT '<command xmlns="http://docbook.org/ns/docbook">PUT</command>'>
<!ENTITY POST '<command xmlns="http://docbook.org/ns/docbook">POST</command>'>
]>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="expire-objects">
<title>Schedule objects for deletion</title>
<para>To discover whether your Object Storage system supports this
feature, see <xref linkend="discoverability"/>. Alternatively,
check with your service provider.</para>
<para>Scheduling an object for deletion is helpful for 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 future time.</para>
<para>To schedule an object for deletion, include one of these
headers with the &PUT; or &POST; request on the object:</para>
<itemizedlist>
<listitem>
<para><literal>X-Delete-After</literal></para>
<para>An integer value. Specifies the number of seconds in
the future when you want to delete the object.</para>
<para>This header is converted to an
<literal>X-Delete-At</literal> header that is set
to the sum of the <literal>X-Delete-After</literal>
value plus the current time, in seconds.</para>
</listitem>
<listitem>
<para><literal>X-Delete-At</literal></para>
<para>A UNIX Epoch timestamp, in integer form. For
example, <literal>1348691905</literal> represents
<literal>Wed, 26 Sep 2012 20:38:25 GMT</literal>.
Specifies the time when you want the object to expire,
not be served, and be deleted completely from the
object store.</para>
</listitem>
</itemizedlist>
<para>Use the &POST; method to assign expiration headers to
existing objects that you want expire.</para>
<simplesect>
<title>Delete object at specified time request: HTTP</title>
<para>In the example, the <code>X-Delete-At</code> header is
assigned a UNIX Epoch timestamp in integer form for Mon,
11 Jun 2012 15:38:25 GMT. Use <link
xlink:href="http://www.epochconverter.com/"
>http://www.epochconverter.com/</link> for example
timestamps and a batch converter.</para>
<screen><prompt>#</prompt> <userinput>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"</userinput></screen>
</simplesect>
<simplesect>
<title>Delete object after specified interval request:
HTTP</title>
<para>This example sets the <code>X-Delete-After</code> header
to a value in seconds that is equivalent to 10 days. After
this time, the object expires.</para>
<literallayout class="monospaced"><xi:include href="samples/object-delete-after-req.txt" parse="text"/></literallayout>
</simplesect>
</section>