PutBucketPolicy介面用於為指定的儲存空間(Bucket)設定授權策略(Policy)。
請求文法
PUT /?policy
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
Policy written in JSON
要求標頭
此介面僅涉及公用要求標頭。更多資訊,請參見公用要求標頭(Common Request Headers)。
回應標頭
此介面僅涉及公用回應標頭。更多資訊,請參見公用回應標頭(Common Response Headers)。
樣本
請求樣本
PUT /?policy Content-Length: 230 Host: oss-example.oss-cn-hangzhou.aliyuncs.com Date: Thu, 21 Feb 2019 12:51:09 GMT Authorization: OSS qn6q**************:77Dv**************** { "Version":"1", "Statement":[ { "Action":[ "oss:PutObject", "oss:GetObject" ], "Effect":"Deny", "Principal":["1234567890"], "Resource":["acs:oss:*:1234567890:*/*"] } ] }
返回樣本
HTTP/1.1 200 OK content-length: 0 server: AliyunOSS x-oss-server-time: 87 connection: keep-alive x-oss-request-id: 5C6E9EBD5CC26B28EE41**** date: Thu, 21 Feb 2019 12:51:09 GMT