PutBucketPolicy接口用于为指定的存储空间(Bucket)设置授权策略(Policy)。

请求语法

PUT /?policy
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
Policy written in JSON

当您在OSS ON云盒中调用该接口时,您需要将Host替换为云盒Endpoint。更多信息,请参见云盒Endpoint

请求头

此接口仅涉及公共请求头。更多信息,请参见公共请求头(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 xxxxxxx:xxxxxxxxxxxx
    {
       "Version":"1",
       "Statement":[
       {
         "Action":[
           "oss:PutObject",
           "oss:GetObject"
        ],
        "Effect":"Deny",
        "Principal":["1234567890"],
        "Resource":["acs:oss:*:1234567890:*/*"]
       }
      ]
     }
  • 返回示例
    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