doc-exports/docs/obs/s3api/en-us_topic_0125560369.html
zhangyue 5eee175e13 OBS S3 API
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2023-03-14 12:40:31 +00:00

77 lines
4.6 KiB
HTML

<a name="EN-US_TOPIC_0125560369"></a><a name="EN-US_TOPIC_0125560369"></a>
<h1 class="topictitle1">GET Bucket policy</h1>
<div id="body39094511"><p class="msonormal" id="EN-US_TOPIC_0125560369__p61313404">You can use this operation to return the policy of a specified bucket.</p>
<p class="msonormal" id="EN-US_TOPIC_0125560369__p14949724">Only the bucket owner or users granted the <strong id="EN-US_TOPIC_0125560369__b12538797">s3:GetBucketPolicy</strong> permission can get the bucket policy.</p>
<p class="msonormal" id="EN-US_TOPIC_0125560369__p329795">If the bucket specified in this operation does not have a policy, OBS returns <strong id="EN-US_TOPIC_0125560369__b16300154221">404 error NoSuchBucketPolicy</strong>.</p>
<div class="section" id="EN-US_TOPIC_0125560369__section8537732"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560369__screen2782933412013">GET /?policy HTTP/1.1
Host: bucketname.obs.example.com
Accept: */*
Date: date
Authorization: authorization</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section9730728"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560369__p57169753">This request involves no parameters.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section20467690"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560369__p238391">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section49991483"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560369__p20580004">This request involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section61673188"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560369__screen2793035612030">HTTP/1.1 status_code
Server: OBS
x-amz-request-id: 90E2BA26427C00000140F21821AA017A
x-amz-id-2: kwE/ohXjGAEm+DJ6Q0bu/ovJsX99na/V16xuDPFFp6C4OXrF+8V1Uu8nK6tvppvE
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: application/xml
Date: date
Content-Length: length
Policy Content</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section18187781"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560369__p27886049">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_0125560369__section29472302"><h4 class="sectiontitle">Response elements</h4><p id="EN-US_TOPIC_0125560369__p21607723">The response body is a JSON string containing bucket policies.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section63924128"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560369__p5395127">No special error responses are returned. For details about error responses, 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_0125560369__section43934385"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560369__screen3387304612045">GET /?policy HTTP/1.1
Host: bucketname.obs.example.com
Accept: */*
Date: Fri, 06 Sep 2013 07:06:42 GMT
Authorization: signature</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560369__section59865151"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560369__screen4305037612127">HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: 90E2BA26427C00000140F21821AA017A
x-amz-id-2: kwE/ohXjGAEm+DJ6Q0bu/ovJsX99na/V16xuDPFFp6C4OXrF+8V1Uu8nK6tvppvE
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: application/xml
Date: Fri, 06 Sep 2013 07:06:42 GMT
Content-Length: 184
{
"Id": "Policy1375342051334",
"Statement": [
{
"Sid": "Stmt1375240018061",
"Action": [
"s3:GetBucketLogging"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::logging.bucket3",
"Principal": {
"AWS": [
"norman"
]
}
}
]
}</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>