PUT Bucket Policy

描述

设置桶的policy

语法

PUT /?policy HTTP/1.1
Host: ${BucketName}.${endpoint}
Authorization: ${signature}
policy written in json

示例

Request

{
     "Version": "2018-06-25",
     "Id": "Test",
     "Statement": {
         "Sid" : "TestStatement",
         "Effect" : "Allow",
         "Action" : ["nos:PutObject"],
         "Principal" : {"nws":["nrn:nws:iam::productid:root"]},
         "Resource" : ["nrn:nws:nos:::example_bucket/object"],
         "Condition" : {
             "IpAddress" : {
                 "nws:SourceIp":"192.168.0.1/24"
             }
         }
     }
 }

Response

HTTP/1.1 200 OK
x-nos-request-id: 17b21e42ac11000001390ab891440240
Date: Wed, 01 Mar 2012 21:34:55 GMT
Connection: close
Server: NOS

细节描述

如果Bucket不存在,返回404 no content错误。错误码:NoSuchBucket。 如果之前存在其他的策略,那么该接口会覆盖之前的设置 对策略的所有操作,只有桶的属主可以,其他用户就算授权了也不行 策略相关的文档,请参考 RBC