创建存储桶

功能说明

在指定账号下创建一个新的 Bucket,当 Bucket 已存在时会返回错误。

方法原型

  1. func (s *BucketService) Put(ctx context.Context, opt *BucketPutOptions) (*Response, error)

请求示例

  1. opt := &cos.BucketPutOptions{
  2. XCosACL: "public-read",
  3. }
  4. resp, err := client.Bucket.Put(context.Background(), opt)

参数说明

  1. type BucketPutOptions struct {
  2. XCosACL string
  3. XCosGrantRead string
  4. XCosGrantWrite string
  5. XCosGrantFullControl string
  6. }
参数名称参数描述类型必填
XCosACL设置 Bucket 的 ACL,如 private,public-read,public-read-writestring
XCosGrantFullControl赋予指定账户对 Bucket 的读写权限。格式为id=" ",id=" "当需要给子账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{SubUin}"当需要给根账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{OwnerUin}"例如id="qcs::cam::uin/123:uin/456",id="qcs::cam::uin/123:uin/123"string
XCosGrantRead赋予指定账户对 Bucket 的读权限。格式为id=" ",id=" "当需要给子账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{SubUin}"当需要给根账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{OwnerUin}"例如id="qcs::cam::uin/123:uin/456",id="qcs::cam::uin/123:uin/123"string
XCosGrantWrite赋予指定账户对 Bucket 的写权限。格式为id=" ",id=" "当需要给子账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{SubUin}"当需要给根账户授权时,格式为id="qcs::cam::uin/{OwnerUin}:uin/{OwnerUin}"例如id="qcs::cam::uin/123:uin/456",id="qcs::cam::uin/123:uin/123"string