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>
192 lines
16 KiB
HTML
192 lines
16 KiB
HTML
<a name="obs_04_0167"></a><a name="obs_04_0167"></a>
|
|
|
|
<h1 class="topictitle1">Configuring a Default WORM Policy for a Bucket</h1>
|
|
<div id="body0000001415415300"><div class="section" id="obs_04_0167__section825319515138"><h4 class="sectiontitle">Functions</h4><p id="obs_04_0167__p1852294611316">This operation allows you to configure the default WORM policy and a retention period for a bucket.</p>
|
|
<p id="obs_04_0167__p82501515414">With the bucket's default WORM policy, if you do not specify a WORM policy or a retention period when you upload an object to the bucket, the default policy will be automatically applied to the newly uploaded object. An object-level WORM policy requires configuring a specific date, which indicates an object will be protected until that date. For a default bucket-level WORM policy, a retention period is required, and the protection for an object starts when the object is uploaded to the bucket.</p>
|
|
<p id="obs_04_0167__p4544455153115">To perform this operation, you must have the PutBucketObjectLockConfiguration permission. The bucket owner can perform this operation by default and can grant this permission to others by using a bucket policy or a user policy.</p>
|
|
<div class="note" id="obs_04_0167__note582512142216"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_04_0167__ul42901721185820"><li id="obs_04_0167__li6290221125810">You can modify or even delete the default WORM policy of a bucket. The change applies only to the objects uploaded after the change, but not to those uploaded before.</li><li id="obs_04_0167__li16290122112583">During a multipart upload, the object parts uploaded are not protected before they are assembled. After object parts are assembled, the new object is protected by the default bucket-level WORM policy. You can also configure an object-level WORM policy for the new object.</li><li id="obs_04_0167__li4543117152617">You can also configure an object-level WORM policy when initializing a multipart upload or for an already assembled multipart object.</li></ul>
|
|
</div></div>
|
|
<p id="obs_04_0167__p969114357138">Other restrictions on the WORM retention configuration:</p>
|
|
<ul id="obs_04_0167__ul148739386168"><li id="obs_04_0167__li187383881612">The WORM mode can only be <strong id="obs_04_0167__b152291850183119">COMPLIANCE</strong>.</li><li id="obs_04_0167__li18497181361720">The retention period can be set to <strong id="obs_04_0167__b6239101219258">1</strong> to <strong id="obs_04_0167__b06171214182515">36500</strong> days or <strong id="obs_04_0167__b88668563364">1</strong> to <strong id="obs_04_0167__b67261610371">100</strong> years.</li></ul>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section1035113371133"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="obs_04_0167__screen246515802615">PUT /?object-lock HTTP/1.1
|
|
Host: bucketname.obs.region.example.com
|
|
Date: date
|
|
Authorization: authorization
|
|
Content-Type: application/xml
|
|
Content-Length: length
|
|
<ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/">
|
|
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
|
|
<Rule>
|
|
<DefaultRetention>
|
|
<Days>integer</Days>
|
|
<Mode>COMPLIANCE</Mode>
|
|
<Years>integer</Years>
|
|
</DefaultRetention>
|
|
</Rule>
|
|
</ObjectLockConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section4305204519136"><h4 class="sectiontitle">Request Parameters</h4><p id="obs_04_0167__p129584362329">This request contains no message parameters.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section1555665711135"><h4 class="sectiontitle">Request Headers</h4><p id="obs_04_0167__p397211521328">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_0167__section1994410681414"><h4 class="sectiontitle">Request Elements</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0167__table1679652183911" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request elements</caption><thead align="left"><tr id="obs_04_0167__row7797121113916"><th align="left" class="cellrowborder" valign="top" width="33.283328332833285%" id="mcps1.3.5.2.2.4.1.1"><p id="obs_04_0167__p579722153917">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.38333833383338%" id="mcps1.3.5.2.2.4.1.2"><p id="obs_04_0167__p2079752193913">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.2.2.4.1.3"><p id="obs_04_0167__p679752123917">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0167__row1779710211397"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p107971212393">ObjectLockConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p1579712133912">Container for configuring WORM for a bucket.</p>
|
|
<p id="obs_04_0167__p12922627164915">Type: container</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p167971721183911">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row679772110399"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p67971121113918">ObjectLockEnabled</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p18797821133916">Indicates whether the bucket has WORM enabled. The value can only be <strong id="obs_04_0167__b176352310582">Enabled</strong>.</p>
|
|
<p id="obs_04_0167__p12643141501">Type: string</p>
|
|
<p id="obs_04_0167__p1423214208507">Example: <strong id="obs_04_0167__b9235164119587">Enabled</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p37976212394">No</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row3797102133919"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p19797152110399">Rule</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p8797122114397">Rule container for the default bucket-level WORM policy.</p>
|
|
<p id="obs_04_0167__p558629165319">Type: container</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p1979716217396">This header is mandatory for configuring the default WORM policy for a bucket. If it is not contained, the existing default WORM policy will be deleted.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row10797221153913"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p1879710213396">DefaultRetention</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p279711219397">Container for the default WORM retention policy for the bucket.</p>
|
|
<p id="obs_04_0167__p181019142814">Type: container</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p779782120397">Mandatory if the Rule container is included.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row20797121163912"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p3797122113914">Mode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p1387519162919">Default protection mode. It can only be set to <strong id="obs_04_0167__b1092818291261">COMPLIANCE</strong> now.</p>
|
|
<p id="obs_04_0167__p221134815417">Type: string</p>
|
|
<p id="obs_04_0167__p158992261598">Example: <strong id="obs_04_0167__b1011049135">COMPLIANCE</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p177972217391">Mandatory if the DefaultRetention container is included.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row16238258198"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p22395581917">Days</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p19239115814918">Default protection period, in days. The value is from <strong id="obs_04_0167__b14987132154217">1</strong> to <strong id="obs_04_0167__b1462132619426">36500</strong>.</p>
|
|
<p id="obs_04_0167__p134321416151020">Type: integer</p>
|
|
<p id="obs_04_0167__p0280113110103">Example: <strong id="obs_04_0167__b1251018571779">1</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p223975810915">If the DefaultRetention container is included, you must specify either <strong id="obs_04_0167__b560211241114">Days</strong> or <strong id="obs_04_0167__b1864927992">Years</strong>, but you cannot specify both at the same time.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row2079859191218"><td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.3.5.2.2.4.1.1 "><p id="obs_04_0167__p879839161214">Years</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.38333833383338%" headers="mcps1.3.5.2.2.4.1.2 "><p id="obs_04_0167__p1979839171211">Default protection period, in years. The value is from <strong id="obs_04_0167__b11985122123412">1</strong> to <strong id="obs_04_0167__b671116414345">100</strong>. In a leap year, only 365 days are calculated.</p>
|
|
<p id="obs_04_0167__p193941719181214">Type: integer</p>
|
|
<p id="obs_04_0167__p968762751212">Example: <strong id="obs_04_0167__b18928194517817">1</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.2.2.4.1.3 "><p id="obs_04_0167__p97987918122">If the DefaultRetention container is included, you must specify either <strong id="obs_04_0167__b152162053986">Years</strong> or <strong id="obs_04_0167__b62151253287">Days</strong>, but you cannot specify both at the same time.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section5720132219153"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="obs_04_0167__screen243442010198">HTTP/1.1 status_code
|
|
Date: date
|
|
Content-Length: length</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section11201162351411"><h4 class="sectiontitle">Response Headers</h4><p id="obs_04_0167__p12628544172010">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_0167__section7772229111415"><h4 class="sectiontitle">Response Elements</h4><p id="obs_04_0167__p1156955162016">This response contains no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section15262153611419"><h4 class="sectiontitle">Error Responses</h4><p id="obs_04_0167__p521115102117"><a href="#obs_04_0167__table13791928162213">Table 2</a> describes possible special errors in this request.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0167__table13791928162213"></a><a name="table13791928162213"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0167__table13791928162213" frame="border" border="1" rules="all"><caption><b>Table 2 </b></caption><thead align="left"><tr id="obs_04_0167__row2380132892215"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.1"><p id="obs_04_0167__p183804282221">Error Code</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.2"><p id="obs_04_0167__p1138042892218">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.3"><p id="obs_04_0167__p2380172817229">HTTP Status Code</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0167__row838012280229"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="obs_04_0167__p9380192810222">InvalidRequest</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="obs_04_0167__p1238082852213">The object lock is disabled for the bucket.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="obs_04_0167__p038019285225">400</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0167__row038042892219"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="obs_04_0167__p1884102148">MalformedXML</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="obs_04_0167__p193801528102212">Invalid format of the Object Lock configuration.</p>
|
|
<p id="obs_04_0167__p1544582641410">The XML you provided was not well-formed or did not validate against our published schema.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="obs_04_0167__p73801928132214">400</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="obs_04_0167__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_0167__section1451984311413"><h4 class="sectiontitle">Sample Request 1</h4><p id="obs_04_0167__p1044117151834">Configure the default bucket-level WORM policy with a retention period of 2 years.</p>
|
|
<pre class="screen" id="obs_04_0167__screen153991356203016">PUT /?object-lock HTTP/1.1
|
|
Host: bucketname.obs.<em id="obs_04_0167__i19498146269">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
|
|
<ObjectLockConfiguration xmlns="http://obs.<em id="obs_04_0167__i720218417566">region</em>.example.com/doc/2015-06-30/">
|
|
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
|
|
<Rule>
|
|
<DefaultRetention>
|
|
<Mode>COMPLIANCE</Mode>
|
|
<Years>2</Years>
|
|
</DefaultRetention>
|
|
</Rule>
|
|
</ObjectLockConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section179921048191417"><h4 class="sectiontitle">Sample Response 1</h4><pre class="screen" id="obs_04_0167__screen12980191120172">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 class="section" id="obs_04_0167__section28394401810"><h4 class="sectiontitle">Sample Request 2</h4><p id="obs_04_0167__p583371915818">Delete the configuration of the default bucket-level WORM policy.</p>
|
|
<pre class="screen" id="obs_04_0167__screen366073114175">PUT /?object-lock HTTP/1.1
|
|
Host: bucketname.obs.region.example.com
|
|
Date: WED, 01 Jul 2015 02:25:05 GMT
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
|
|
Content-Type: application/xml
|
|
Content-Length: 157
|
|
<ObjectLockConfiguration xmlns="http://obs.<em id="obs_04_0167__i177111593566">region</em>.example.com/doc/2015-06-30/">
|
|
</ObjectLockConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0167__section13520621188"><h4 class="sectiontitle">Sample Response 2</h4><pre class="screen" id="obs_04_0167__screen10151726162117">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_0026.html">Advanced Bucket Settings</a></div>
|
|
</div>
|
|
</div>
|
|
|