doc-exports/docs/obs/api-ref/obs_04_0168.html
zhangyue 7d2a7ec198 OBS API DOC
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2024-11-05 16:37:11 +00:00

177 lines
12 KiB
HTML

<a name="obs_04_0168"></a><a name="obs_04_0168"></a>
<h1 class="topictitle1">Obtaining the Default WORM Policy of a Bucket</h1>
<div id="body0000001465651797"><div class="section" id="obs_04_0168__section6114129132213"><h4 class="sectiontitle">Functions</h4><p id="obs_04_0168__p202364164229">This operation returns the default WORM policy of a bucket.</p>
<p id="obs_04_0168__p196987444249">To perform this operation, you must have the GetBucketObjectLockConfiguration 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_0168__note17631402619"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_04_0168__p187635452612">If you have never configured the default bucket-level retention policy after you enable WORM for a bucket, you can still use this API to check whether WORM is enabled.</p>
</div></div>
</div>
<div class="section" id="obs_04_0168__section8242218182219"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="obs_04_0168__screen2235195720268">GET /?object-lock HTTP/1.1
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization
Content-Type: application/xml
Content-Length: length</pre>
</div>
<div class="section" id="obs_04_0168__section1523630102210"><h4 class="sectiontitle">Request Parameters</h4><p id="obs_04_0168__p513823515227">This request contains no message parameters.</p>
</div>
<div class="section" id="obs_04_0168__section124123711224"><h4 class="sectiontitle">Request Headers</h4><p id="obs_04_0168__p162518406229">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_0168__section12877144252210"><h4 class="sectiontitle">Request Elements</h4><p id="obs_04_0168__p82981147142711">This request involves no elements.</p>
</div>
<div class="section" id="obs_04_0168__section839134922216"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="obs_04_0168__screen866918337285">HTTP/1.1 status_code
Date: date
Content-Type: application/xml
Content-Length: length
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ObjectLockConfiguration xmlns="http://obs.<em id="obs_04_0168__i04758162563">region</em>.example.com/doc/2015-06-30/"&gt;
&lt;ObjectLockEnabled&gt;Enabled&lt;/ObjectLockEnabled&gt;
&lt;Rule&gt;
&lt;DefaultRetention&gt;
&lt;Days&gt;integer&lt;/Days&gt;
&lt;Mode&gt;COMPLIANCE&lt;/Mode&gt;
&lt;Years&gt;integer&lt;/Years&gt;
&lt;/DefaultRetention&gt;
&lt;/Rule&gt;
&lt;/ObjectLockConfiguration&gt;</pre>
</div>
<div class="section" id="obs_04_0168__section22975413237"><h4 class="sectiontitle">Response Headers</h4><p id="obs_04_0168__p588217819239">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_0168__section72110115233"><h4 class="sectiontitle">Response Elements</h4><p id="obs_04_0168__p1337117584336"><a href="#obs_04_0168__table17259161213419">Table 1</a> describes the elements of the default bucket-level WORM policy in the response.</p>
<div class="tablenoborder"><a name="obs_04_0168__table17259161213419"></a><a name="table17259161213419"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0168__table17259161213419" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Elements of the default bucket-level WORM policy</caption><thead align="left"><tr id="obs_04_0168__row92591812143411"><th align="left" class="cellrowborder" valign="top" width="29.310000000000002%" id="mcps1.3.8.3.2.3.1.1"><p id="obs_04_0168__p18260312183415">Element</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70.69%" id="mcps1.3.8.3.2.3.1.2"><p id="obs_04_0168__p1226017129341">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0168__row826011273418"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p107971212393">ObjectLockConfiguration</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p1579712133912">Container for configuring for a bucket.</p>
<p id="obs_04_0168__p12922627164915">Type: container</p>
</td>
</tr>
<tr id="obs_04_0168__row6260312143413"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p67971121113918">ObjectLockEnabled</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p18797821133916">Indicates whether WORM is enabled for the bucket. The value can only be <strong id="obs_04_0168__b332934004116">Enabled</strong>.</p>
<p id="obs_04_0168__p12643141501">Type: string</p>
<p id="obs_04_0168__p1423214208507">Example: <strong id="obs_04_0168__b86252294216">Enabled</strong></p>
</td>
</tr>
<tr id="obs_04_0168__row1526021217341"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p19797152110399">Rule</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p8797122114397">Container for the default bucket-level WORM policy. If you have never configured the default policy, this header will not be included in the response.</p>
<p id="obs_04_0168__p558629165319">Type: container</p>
</td>
</tr>
<tr id="obs_04_0168__row726041243418"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p1879710213396">DefaultRetention</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p279711219397">Container for the default bucket-level WORM policy.</p>
<p id="obs_04_0168__p181019142814">Type: container</p>
</td>
</tr>
<tr id="obs_04_0168__row2260181215340"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p3797122113914">Mode</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p1387519162919">Default protection mode. It can only be set to <strong id="obs_04_0168__b533974320251">COMPLIANCE</strong> now.</p>
<p id="obs_04_0168__p221134815417">Type: string</p>
<p id="obs_04_0168__p158992261598">Example: <strong id="obs_04_0168__b5564205614412">COMPLIANCE</strong></p>
</td>
</tr>
<tr id="obs_04_0168__row19260612203417"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p22395581917">Days</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p19239115814918">Default protection period, in days. The value is from <strong id="obs_04_0168__b1788901818471">1</strong> to <strong id="obs_04_0168__b12185320124713">36500</strong>.</p>
<p id="obs_04_0168__p134321416151020">Type: integer</p>
<p id="obs_04_0168__p0280113110103">Example: <strong id="obs_04_0168__b1779415364510">1</strong></p>
</td>
</tr>
<tr id="obs_04_0168__row093143783515"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0168__p3931193720355">Years</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0168__p1979839171211">Default protection period, in years. The value is from 1 to 100. In a leap year, only 365 days are calculated.</p>
<p id="obs_04_0168__p193941719181214">Type: integer</p>
<p id="obs_04_0168__p123858462357">Example: <strong id="obs_04_0168__b2445011104514">1</strong></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_04_0168__section32451518182310"><h4 class="sectiontitle">Error Responses</h4><p id="obs_04_0168__p521115102117"><a href="#obs_04_0168__table13791928162213">Table 2</a> describes possible special errors in this request.</p>
<div class="tablenoborder"><a name="obs_04_0168__table13791928162213"></a><a name="table13791928162213"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0168__table13791928162213" frame="border" border="1" rules="all"><caption><b>Table 2 </b></caption><thead align="left"><tr id="obs_04_0168__row2380132892215"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.1"><p id="obs_04_0168__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_0168__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_0168__p2380172817229">HTTP Status Code</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0168__row838012280229"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="obs_04_0168__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_0168__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_0168__p038019285225">400</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_04_0168__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_0168__section4223182814232"><h4 class="sectiontitle">Sample Request 1</h4><p id="obs_04_0168__p11568111783715">Get the configuration where the bucket has WORM enabled, but has no default retention policy configured.</p>
<pre class="screen" id="obs_04_0168__screen8223154143610">GET /?object-lock HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 02:25:05 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
Content-Length: 0</pre>
</div>
<div class="section" id="obs_04_0168__section1533013378230"><h4 class="sectiontitle">Sample Response 1</h4><pre class="screen" id="obs_04_0168__screen1781513577366">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: 157
&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"&gt;
&lt;ObjectLockEnabled&gt;Enabled&lt;/ObjectLockEnabled&gt;
&lt;/ObjectLockConfiguration&gt;</pre>
</div>
<div class="section" id="obs_04_0168__section1981774824014"><h4 class="sectiontitle">Sample Request 2</h4><p id="obs_04_0168__p182869532404">Get the configuration where the bucket has WORM enabled and has the default retention policy configured.</p>
<pre class="screen" id="obs_04_0168__screen11250175884317">GET /?object-lock HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 02:25:05 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
Content-Length: 0</pre>
</div>
<div class="section" id="obs_04_0168__section18751190114410"><h4 class="sectiontitle">Sample Response 2</h4><pre class="screen" id="obs_04_0168__screen14319124443">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: 157
&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"&gt;
&lt;ObjectLockEnabled&gt;Enabled&lt;/ObjectLockEnabled&gt;
&lt;Rule&gt;
&lt;DefaultRetention&gt;
&lt;Mode&gt;COMPLIANCE&lt;/Mode&gt;
&lt;Days&gt;10&lt;/Days&gt;
&lt;Years&gt;0&lt;/Years&gt;
&lt;/DefaultRetention&gt;
&lt;/Rule&gt;
&lt;/ObjectLockConfiguration&gt;</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>