doc-exports/docs/obs/s3api/en-us_topic_0000001759314566.html
zhangyue 6fcdbfd13e OBS S3 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-02-26 11:17:13 +00:00

175 lines
14 KiB
HTML

<a name="EN-US_TOPIC_0000001759314566"></a><a name="EN-US_TOPIC_0000001759314566"></a>
<h1 class="topictitle1">Obtaining the Default WORM Policy of a Bucket</h1>
<div id="body0000001759314566"><div class="section" id="EN-US_TOPIC_0000001759314566__section6114129132213"><h4 class="sectiontitle">Functions</h4><p id="EN-US_TOPIC_0000001759314566__p202364164229">This operation returns the default WORM policy of a bucket.</p>
<p id="EN-US_TOPIC_0000001759314566__p196987444249">To perform this operation, you must have the s3: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="EN-US_TOPIC_0000001759314566__note17631402619"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__section8242218182219"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__section1523630102210"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0000001759314566__p513823515227">This request contains no message parameters.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section124123711224"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="EN-US_TOPIC_0000001759314566__p30785969">This request uses common headers. For details about common request headers, see the section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section12877144252210"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0000001759314566__p82981147142711">This request involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section839134922216"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__section22975413237"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0000001759314566__p4098511311838">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section72110115233"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0000001759314566__p1337117584336"><a href="#EN-US_TOPIC_0000001759314566__table17259161213419">Table 1</a> describes the elements of the default bucket-level WORM policy in the response.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001759314566__table17259161213419"></a><a name="table17259161213419"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__row92591812143411"><th align="left" class="cellrowborder" valign="top" width="29.310000000000002%" id="mcps1.3.8.3.2.3.1.1"><p id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__p1226017129341">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001759314566__row826011273418"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p107971212393">ObjectLockConfiguration</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__p1579712133912">Container for configuring for a bucket.</p>
<p id="EN-US_TOPIC_0000001759314566__p12922627164915">Type: container</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row6260312143413"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p67971121113918">ObjectLockEnabled</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__p18797821133916">Indicates whether WORM is enabled for the bucket. The value can only be <strong id="EN-US_TOPIC_0000001759314566__b332934004116">Enabled</strong>.</p>
<p id="EN-US_TOPIC_0000001759314566__p12643141501">Type: string</p>
<p id="EN-US_TOPIC_0000001759314566__p1423214208507">Example: <strong id="EN-US_TOPIC_0000001759314566__b86252294216">Enabled</strong></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row1526021217341"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p19797152110399">Rule</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__p558629165319">Type: container</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row726041243418"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p1879710213396">DefaultRetention</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__p279711219397">Container for the default bucket-level WORM policy.</p>
<p id="EN-US_TOPIC_0000001759314566__p181019142814">Type: container</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row2260181215340"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p3797122113914">Mode</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__p1387519162919">Default protection mode. It can only be set to <strong id="EN-US_TOPIC_0000001759314566__b533974320251">COMPLIANCE</strong> now.</p>
<p id="EN-US_TOPIC_0000001759314566__p221134815417">Type: string</p>
<p id="EN-US_TOPIC_0000001759314566__p158992261598">Example: <strong id="EN-US_TOPIC_0000001759314566__b5564205614412">COMPLIANCE</strong></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row19260612203417"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p22395581917">Days</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__p19239115814918">Default protection period, in days. The value is from <strong id="EN-US_TOPIC_0000001759314566__b1788901818471">1</strong> to <strong id="EN-US_TOPIC_0000001759314566__b12185320124713">36500</strong>.</p>
<p id="EN-US_TOPIC_0000001759314566__p134321416151020">Type: integer</p>
<p id="EN-US_TOPIC_0000001759314566__p0280113110103">Example: <strong id="EN-US_TOPIC_0000001759314566__b1779415364510">1</strong></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001759314566__row093143783515"><td class="cellrowborder" valign="top" width="29.310000000000002%" headers="mcps1.3.8.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001759314566__p3931193720355">Years</p>
</td>
<td class="cellrowborder" valign="top" width="70.69%" headers="mcps1.3.8.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__p193941719181214">Type: integer</p>
<p id="EN-US_TOPIC_0000001759314566__p123858462357">Example: <strong id="EN-US_TOPIC_0000001759314566__b2445011104514">1</strong></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section32451518182310"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0000001759314566__p521115102117"><a href="#EN-US_TOPIC_0000001759314566__table13791928162213">Table2 Special errors</a> describes possible special errors in this request.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001759314566__table13791928162213"></a><a name="table13791928162213"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001759314566__table13791928162213" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Special errors</caption><thead align="left"><tr id="EN-US_TOPIC_0000001759314566__row2380132892215"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.1"><p id="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__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="EN-US_TOPIC_0000001759314566__p2380172817229">HTTP Status Code</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001759314566__row838012280229"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001759314566__p9380192810222"><span style="color:#494949;">InvalidRequest</span></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001759314566__p1238082852213">The default object lock rule cannot be get, because object lock is not enabled for this bucket.</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001759314566__p038019285225">400</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001759314566__p3530175">For details about other errors, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section4223182814232"><h4 class="sectiontitle">Sample Request for Get the Configuration where the Bucket has WORM Enabled, but has no Default Retention Policy Configured</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__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: authorization
Content-Length: 0</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section1533013378230"><h4 class="sectiontitle">Sample Response for Get the Configuration where the Bucket has WORM Enabled, but has no Default Retention Policy Configured</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__screen1781513577366">HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: BF260000016435CE298386946AE4C482
x-amz-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="EN-US_TOPIC_0000001759314566__section1981774824014"><h4 class="sectiontitle">Sample Request for Get the Configuration where the Bucket has WORM Enabled and has the Default Retention Policy Configured</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__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: authorization
Content-Length: 0</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000001759314566__section18751190114410"><h4 class="sectiontitle">Sample Response for Get the Configuration where the Bucket has WORM Enabled and has the Default Retention Policy Configured</h4><pre class="screen" id="EN-US_TOPIC_0000001759314566__screen14319124443">HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: BF260000016435CE298386946AE4C482
x-amz-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="en-us_topic_0125560493.html">Operations on Buckets</a></div>
</div>
</div>