forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
166 lines
14 KiB
HTML
166 lines
14 KiB
HTML
<a name="obs_04_0166"></a><a name="obs_04_0166"></a>
|
|
|
|
<h1 class="topictitle1">Configuring WORM Retention for an Object</h1>
|
|
<div id="body0000001416525314"><div class="section" id="obs_04_0166__section1418853462"><h4 class="sectiontitle">Functions</h4><p id="obs_04_0166__p536618144613">This operation configures or updates the retention period for objects uploaded to a bucket with WORM enabled.</p>
|
|
<ul id="obs_04_0166__ul107135163910"><li id="obs_04_0166__li471317161997">When you upload an object, if you do not configure a protection period or apply the default bucket-level protection rule to the object, you can perform this operation to configure a protection period for the object.</li><li id="obs_04_0166__li1420203751011">When you upload an object, if you configure a protection period or apply the default bucket-level protection rule to the object, you can perform this operation to prolong the protection period for the object.</li><li id="obs_04_0166__li12276195321014">The protection period of an object can only be modified, but not deleted.<div class="note" id="obs_04_0166__note1495184981616"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_04_0166__p119513497166">To configure or update the protection period of an object, you must have the PutObjectRetention permission.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section166231716962"><h4 class="sectiontitle">Versioning</h4><p id="obs_04_0166__p05588201614">OBS automatically enables versioning when you enable WORM for a bucket. In such case, the object you uploaded to the bucket will be assigned a version ID. An object-level WORM policy is applied to the current object version by default, but you can specify a version ID to make the policy applied to a specific object version. The WORM configuration does not apply to a delete marker with a unique version ID.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section212181410230"><h4 class="sectiontitle">Multipart Upload</h4><p id="obs_04_0166__p1122262711235">Before a multipart upload is complete, the default bucket-level WORM policy is not automatically applied to the object parts uploaded. Besides, you cannot configure an object-level WORM policy using a header when you upload a part or assemble the object parts, or for a part that is already uploaded to the bucket. You can call this API to configure a WORM retention policy for the new object after the object parts are assembled.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section1688810391961"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="obs_04_0166__screen12589134813160">PUT /ObjectName?retention HTTP/1.1
|
|
Host: <em id="obs_04_0166__i123441746202313">bucketname</em>.obs.<em id="obs_04_0166__i034434682311">region</em>.example.com
|
|
Date: <em id="obs_04_0166__i56987672">date</em>
|
|
Authorization: <em id="obs_04_0166__i52598685">authorization</em>
|
|
|
|
<Retention>
|
|
<Mode>String</Mode>
|
|
<RetainUntilDate>Timestamp</RetainUntilDate>
|
|
</Retention></pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section1056812491663"><h4 class="sectiontitle">Request Parameters</h4><p id="obs_04_0166__p20701582"><a href="#obs_04_0166__table44298471191845">Table 1</a> describes the parameters.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0166__table44298471191845"></a><a name="table44298471191845"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0166__table44298471191845" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request parameters</caption><thead align="left"><tr id="obs_04_0166__row25509231"><th align="left" class="cellrowborder" valign="top" width="22.220000000000002%" id="mcps1.3.5.3.2.4.1.1"><p id="obs_04_0166__p52981853">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="62.629999999999995%" id="mcps1.3.5.3.2.4.1.2"><p id="obs_04_0166__p36174163">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.15%" id="mcps1.3.5.3.2.4.1.3"><p id="obs_04_0166__p64290664">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0166__row25907270"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0166__p18114101">versionId</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.629999999999995%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0166__p57956065">ID of the object version on which this operation will be performed. If this header is not carried, this operation applies to the current object version.</p>
|
|
<p id="obs_04_0166__p51842537">Type: string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.15%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0166__p38495930">No</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section326625618613"><h4 class="sectiontitle">Request Headers</h4><p id="obs_04_0166__p188514013720">This request uses common headers. For details, see <a href="obs_04_0007.html#obs_04_0007__table25197309">Table 3</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section2747181671"><h4 class="sectiontitle">Request Elements</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0166__table1679652183911" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_04_0166__row7797121113916"><th align="left" class="cellrowborder" valign="top" width="33.283328332833285%" id="mcps1.3.7.2.1.4.1.1"><p id="obs_04_0166__p579722153917">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.38333833383338%" id="mcps1.3.7.2.1.4.1.2"><p id="obs_04_0166__p2079752193913">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.7.2.1.4.1.3"><p id="obs_04_0166__p679752123917">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0166__row1779710211397"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.7.2.1.4.1.1 "><p id="obs_04_0166__p107971212393">Retention</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.7.2.1.4.1.2 "><p id="obs_04_0166__p1579712133912">Container for configuring an object-level WORM retention policy.</p>
|
|
<p id="obs_04_0166__p12922627164915">Type: container</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.7.2.1.4.1.3 "><p id="obs_04_0166__p167971721183911">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0166__row679772110399"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.7.2.1.4.1.1 "><p id="obs_04_0166__p67971121113918">Mode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.7.2.1.4.1.2 "><p id="obs_04_0166__p1387519162919">Protection mode for the object. It can only be set to <strong id="obs_04_0166__b495765803610">COMPLIANCE</strong> now.</p>
|
|
<p id="obs_04_0166__p221134815417">Type: string</p>
|
|
<p id="obs_04_0166__p158992261598">Example: <strong id="obs_04_0166__b11280303555317">COMPLIANCE</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.7.2.1.4.1.3 "><p id="obs_04_0166__p37976212394">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0166__row3797102133919"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.7.2.1.4.1.1 "><p id="obs_04_0166__p19797152110399">RetainUntilDate</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.7.2.1.4.1.2 "><p id="obs_04_0166__p8797122114397">Protection period for the object. Its value is a timestamp accurate to milliseconds, for example, <strong id="obs_04_0166__b2851115043815">1435728035000</strong> (corresponding to 13:20:35 on July 1, 2015).</p>
|
|
<div class="note" id="obs_04_0166__note84999367225"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_04_0166__p105009367227">The value of this field must be later than the current time and can be extended but not shortened.</p>
|
|
</div></div>
|
|
<p id="obs_04_0166__p558629165319">Type: long</p>
|
|
<p id="obs_04_0166__p14372133763111">Example: <strong id="obs_04_0166__b1775863411406">1435728035000</strong></p>
|
|
<p id="obs_04_0166__p380071274616"><span style="color:#212121;">Remarks: Its value is a timestamp accurate to milliseconds in Unix time.</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.7.2.1.4.1.3 "><p id="obs_04_0166__p1979716217396">Yes</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section4341481779"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="obs_04_0166__screen243442010198">HTTP/1.1 status_code
|
|
Date: date
|
|
Content-Length: length</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section19822152117719"><h4 class="sectiontitle">Response Headers</h4><p id="obs_04_0166__p26611929474">This response uses common headers. For details, see <a href="obs_04_0013.html#obs_04_0013__d0e686">Table 1</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section1461933014718"><h4 class="sectiontitle">Response Elements</h4><p id="obs_04_0166__p13644940974">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section4672343878"><h4 class="sectiontitle">Error Responses</h4><p id="obs_04_0166__p521115102117"><a href="#obs_04_0166__table13791928162213">Table 2</a> describes possible special errors in this request.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0166__table13791928162213"></a><a name="table13791928162213"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0166__table13791928162213" frame="border" border="1" rules="all"><caption><b>Table 2 </b></caption><thead align="left"><tr id="obs_04_0166__row2380132892215"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.11.3.2.4.1.1"><p id="obs_04_0166__p183804282221">Error Code</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.11.3.2.4.1.2"><p id="obs_04_0166__p1138042892218">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.11.3.2.4.1.3"><p id="obs_04_0166__p2380172817229">HTTP Status Code</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0166__row838012280229"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.1 "><p id="obs_04_0166__p9380192810222"><span style="color:#494949;">InvalidRequest</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.2 "><p id="obs_04_0166__p1238082852213">The object retention period cannot be configured, because object lock is not enabled for the bucket.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.3 "><p id="obs_04_0166__p038019285225">400</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0166__row1241096102813"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.1 "><p id="obs_04_0166__p19410968284"><span style="color:#494949;">InvalidRequest</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.2 "><p id="obs_04_0166__p1410166122817">The retention period date must be later than the current or the configured date.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.3 "><p id="obs_04_0166__p1841019617282">400</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0166__row038042892219"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.1 "><p id="obs_04_0166__p2041118376519"><span style="color:#212121;">MalformedObjectLockError</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.2 "><p id="obs_04_0166__p193801528102212">Invalid format of the Object Lock configuration.</p>
|
|
<p id="obs_04_0166__p415813185220"><span style="color:#212121;">The XML you provided was not well-formed or did not validate against our published schema</span>.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.3 "><p id="obs_04_0166__p73801928132214">400</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0166__row7548813564"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.1 "><p id="obs_04_0166__p195518135617"><span style="color:#212121;">NoSuchVersion</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.2 "><p id="obs_04_0166__p85610819560"><span style="color:#212121;">The specified version does not exist.</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.11.3.2.4.1.3 "><p id="obs_04_0166__p205610819569">400</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="obs_04_0166__p27652932518">For other errors, see <a href="obs_04_0115.html#obs_04_0115__d0e843">Table 2</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section20891205319711"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="obs_04_0166__screen814811213323">PUT /objectname?retention HTTP/1.1
|
|
Host: bucketname.obs.<em id="obs_04_0166__i1895211304561">region</em>.example.com
|
|
Date: WED, 01 Jul 2015 02:25:05 GMT
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
|
|
Content-Type: application/xml
|
|
Content-Length: 157
|
|
<Retention>
|
|
<Mode>COMPLIANCE</Mode>
|
|
<RetainUntilDate><span>1435728035</span>000</RetainUntilDate>
|
|
</Retention></pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0166__section10684516817"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="obs_04_0166__screen16761132633211">HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-obs-request-id: BF260000016435CE298386946AE4C482
|
|
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz
|
|
Date: WED, 01 Jul 2015 02:25:06 GMT
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0079.html">Operations on Objects</a></div>
|
|
</div>
|
|
</div>
|
|
|