doc-exports/docs/obs/api-ref/obs_04_0028.html
Jawei, Li f1cb839979 OBS api-ref 2.0.38.SP5
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-03 11:54:51 +00:00

114 lines
5.4 KiB
HTML

<a name="obs_04_0028"></a><a name="obs_04_0028"></a>
<h1 class="topictitle1">Obtaining Bucket Policy Information</h1>
<div id="body10808528"><div class="section" id="obs_04_0028__section5584184924715"><h4 class="sectiontitle">Functions</h4><p class="msonormal" id="obs_04_0028__p53525998">This operation uses the sub-resources of policy to return the policy information of a specified bucket.</p>
<p class="msonormal" id="obs_04_0028__p11971939">To perform this operation, the user must be the bucket owner or the bucket owner's IAM user that has permissions required for obtaining bucket policies.</p>
<p id="obs_04_0028__p1678084014810">This operation cannot be performed in the following scenarios, and the 404 error code "NoSuchBucketPolicy" is returned:</p>
<ul id="obs_04_0028__ul3224164520812"><li id="obs_04_0028__li1929617220914">The specified bucket policy does not exist.</li><li id="obs_04_0028__li22242454814">The standard bucket policy is set to <strong id="obs_04_0028__b18324181615488">Private</strong> and no custom bucket policy is configured.</li></ul>
</div>
<div class="section" id="obs_04_0028__section30202992"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0028__screen3075560"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>GET /?policy HTTP/1.1
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0028__section3391474"><h4 class="sectiontitle">Request Parameters</h4><p class="msonormal" id="obs_04_0028__p12514316">This request contains no parameter.</p>
</div>
<div class="section" id="obs_04_0028__section30523269"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="obs_04_0028__p7026703">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_0028__section6273971"><h4 class="sectiontitle">Request Elements</h4><p class="msonormal" id="obs_04_0028__p22192995">This request involves no elements.</p>
</div>
<div class="section" id="obs_04_0028__section56465739"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0028__screen52802153"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 status_code
Content-Type: application/xml
Date: date
Policy Content
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0028__section38429608"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0028__p1512332591013">The response to the request 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_0028__section10322153"><h4 class="sectiontitle">Response Elements</h4><p class="msonormal" id="obs_04_0028__p38602580">The response body is a JSON string containing bucket policy information.</p>
</div>
<div class="section" id="obs_04_0028__section25790521"><h4 class="sectiontitle">Error Responses</h4><p class="msonormal" id="obs_04_0028__p39801275">No special error responses are returned. For details, see <a href="obs_04_0115.html#obs_04_0115__d0e843">Table 2</a>.</p>
</div>
<div class="section" id="obs_04_0028__section14819157124617"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0028__screen42901510155312"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>GET /?policy HTTP/1.1
Host: examplebucket.obs.region.example.com
Date: WED, 01 Jul 2015 02:35:46 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:jZiAT8Vx4azWEvPRMWi0X5BpJMA=
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0028__section13755536443"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0028__screen18548202314552"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 200 OK
x-obs-request-id: A603000001604A7DFE4A4AF31E301891
x-obs-id-2: BKOvGmTlt6sda5X4G89PuMO4fabObGYmnpRGkaMba1LqPt0fCACEuCMllAObRK1n
Date: WED, 01 Jul 2015 02:35:46 GMT
Content-Length: 509
Server: OBS
{
&quot;Statement&quot;:[
{
&quot;Sid&quot;:&quot;Stmt1375240018061&quot;,
&quot;Effect&quot;:&quot;Allow&quot;,
&quot;Principal&quot;:{
&quot;ID&quot;:[
&quot;domain/domainiddomainiddomainiddo006666:user/useriduseriduseriduseridus004001&quot;,
&quot;domain/domainiddomainiddomainiddo006667:user/*&quot;
]
},
&quot;Action&quot;:[
&quot;*&quot;
],
&quot;Resource&quot;:[
&quot;examplebucket&quot;
]
}
]
}
</pre></div>
</td></tr></table></div>
</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>