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>
147 lines
8.2 KiB
HTML
147 lines
8.2 KiB
HTML
<a name="EN-US_TOPIC_0125560316"></a><a name="EN-US_TOPIC_0125560316"></a>
|
|
|
|
<h1 class="topictitle1">PUT Bucket policy</h1>
|
|
<div id="body49716479"><p class="msonormal" id="EN-US_TOPIC_0125560316__p45268471">You can use this operation to create or modify a policy on a bucket. If the bucket already has a policy, the policy will be overwritten by the one specified in this request.</p>
|
|
<p class="msonormal" id="EN-US_TOPIC_0125560316__p4763056">Only the bucket owner or users granted the <strong id="EN-US_TOPIC_0125560316__b040512301213">s3:PutBucketPolicy</strong> permission can create or modify the bucket policy.</p>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section17192404"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560316__screen6016785011353">PUT /?policy HTTP/1.1
|
|
User-Agent: agent
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: date
|
|
Authorization: signatureValue
|
|
Content-Length: length
|
|
|
|
Policy written in JSON</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section20513908"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560316__p19319065">This request involves no parameters.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section50407447"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560316__p21340395">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_0125560316__section51013847"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560316__p25245814">The request body is a JSON string containing bucket policies. For details about JSON elements, see <a href="en-us_topic_0125560422.html">Bucket Policy</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section15687104"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560316__screen39159494115933">HTTP/1.1 status_code
|
|
Server: Server Name
|
|
x-amz-request-id: request id
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
x-amz-id-2: id
|
|
Date: date </pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section6966214"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560316__p53548493">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_0125560316__section62695926"><h4 class="sectiontitle">Response elements</h4><p id="EN-US_TOPIC_0125560316__p16761596">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section27392427"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560316__p15512006">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_0125560316__section48331085"><h4 class="sectiontitle">Sample Request: Grant OBS account permission</h4><p id="EN-US_TOPIC_0125560316__p56828332145929">Account's domain ID is <strong id="EN-US_TOPIC_0125560316__b1819214744517">783fc6652cf246c096ea836694f71855</strong>.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0125560316__screen47474259145943">PUT /?policy HTTP/1.1
|
|
User-Agent: curl/7.19.0
|
|
Host: bucketname.obs.example.com
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT
|
|
Accept: */*
|
|
Authorization: AWS UDSIAMSTUBTEST000002:1YPpMv6hAokMd/r6Ft5/6SZANDw=
|
|
Content-Length: 223
|
|
|
|
{
|
|
"Id": "Policy1375342051334",
|
|
"Statement": [
|
|
{
|
|
"Sid": "Stmt1375240018061",
|
|
"Action": [
|
|
"s3:GetBucketLogging"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "arn:aws:s3:::logging.bucket3",
|
|
"Principal": {
|
|
"AWS": [
|
|
"arn:aws:iam::783fc6652cf246c096ea836694f71855:root"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section32326581"><h4 class="sectiontitle">Sample Response: Grant OBS account permission</h4><pre class="screen" id="EN-US_TOPIC_0125560316__screen23553199115959">HTTP/1.1 204 No Content
|
|
Server: OBS
|
|
x-amz-request-id: 7B6DFC9BC71DD58B061285551605709
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
x-amz-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT </pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section26981558165327"><h4 class="sectiontitle">Sample Request: Grant OBS user permission</h4><p id="EN-US_TOPIC_0125560316__p5786632915126">User ID is <strong id="EN-US_TOPIC_0125560316__b163587574457">71f3901173514e6988115ea2c26d1999</strong> and Account's domain ID is <strong id="EN-US_TOPIC_0125560316__b36474594458">219d520ceac84c5a98b237431a2cf4c2</strong>.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0125560316__screen977609315138">PUT /?policy HTTP/1.1
|
|
User-Agent: curl/7.19.0
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT
|
|
Authorization: AWS UDSIAMSTUBTEST000002:1YPpMv6hAokMd/r6Ft5/6SZANDw=
|
|
Content-Length: 256
|
|
|
|
{
|
|
"Id": "Policy1375342051335",
|
|
"Statement": [
|
|
{
|
|
"Sid": "Stmt1375240018062",
|
|
"Action": [
|
|
"s3:PutBucketLogging"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "arn:aws:s3:::logging.bucket3",
|
|
"Principal": {
|
|
"AWS": [
|
|
"arn:aws:iam::219d520ceac84c5a98b237431a2cf4c2:user/71f3901173514e6988115ea2c26d1999"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section8966703165327"><h4 class="sectiontitle">Sample Response: Grant OBS user permission</h4><pre class="screen" id="EN-US_TOPIC_0125560316__screen34154268165327">HTTP/1.1 204 No Content
|
|
x-amz-request-id: 7B6DFC9BC71DD58B061285551605709
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
x-amz-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section18012296430"><h4 class="sectiontitle">Sample Request: Deny Operations of an OBS User</h4><p id="EN-US_TOPIC_0125560316__p7510155920435">The user ID is <strong id="EN-US_TOPIC_0125560316__b2904538103714">useriduseriduseriduseridus004001</strong> and the account's domain ID is <strong id="EN-US_TOPIC_0125560316__b89051138123715">domainiddomainiddomainiddo006666</strong>.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0125560316__screen92591418114414">PUT /?policy HTTP/1.1
|
|
User-Agent: curl/7.19.0
|
|
Host: testbucketpolicy.obs.example.com
|
|
Accept: */*
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT
|
|
Authorization: AWS UDSIAMSTUBTEST000002:1YPpMv6hAokMd/r6Ft5/6SZANDw=
|
|
Content-Length: 311
|
|
|
|
{
|
|
"Statement": [
|
|
{
|
|
"Effect": "Deny",
|
|
"Action": [
|
|
"s3:*"
|
|
],
|
|
"Resource": [
|
|
"arn:aws:s3:::testbucketpolicy/*",
|
|
"arn:aws:s3:::testbucketpolicy"
|
|
],
|
|
"Principal": {
|
|
"AWS": [
|
|
"arn:aws:iam::domainiddomainiddomainiddo006666:user/useriduseriduseriduseridus004001",
|
|
"arn:aws:iam::domainiddomainiddomainiddo006666:root"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560316__section582262994311"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560316__screen20823429184315">HTTP/1.1 204 No Content
|
|
x-amz-request-id: A603000001604A7DFE4A4AF31E301891
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
x-amz-id-2: BKOvGmTlt6sda5X4G89PuMO4fabObGYmnpRGkaMba1LqPt0fCACEuCMllAObRK1n
|
|
Date: Mon, 27 Sep 2010 01:40:03 GMT </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>
|
|
|