更新时间:2022-02-10 GMT+08:00
设置桶ACL
功能说明
设置桶的访问权限。
方法定义
func (obsClient ObsClient) SetBucketAcl(input *SetBucketAclInput) (output *BaseModel, err error)
使用带授权信息URL的方法定义
func (obsClient ObsClient) SetBucketAclWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
请求参数
参数名 |
类型 |
约束 |
---|---|---|
input |
必选 |
返回结果
参数名 |
类型 |
---|---|
output |
|
err |
error |
代码样例
func main() { input := &obs.SetBucketAclInput{} input.Bucket = "bucketname" input.Owner.ID = "ownerid" var grants [3]obs.Grant grants[0].Grantee.Type = obs.GranteeGroup grants[0].Grantee.URI = obs.GroupAuthenticatedUsers grants[0].Permission = obs.PermissionRead grants[1].Grantee.Type = obs.GranteeUser grants[1].Grantee.ID = "userid" grants[1].Permission = obs.PermissionWrite grants[2].Grantee.Type = obs.GranteeUser grants[2].Grantee.ID = "userid" grants[2].Permission = obs.PermissionRead input.Grants = grants[0:3] output, err := obsClient.SetBucketAcl(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
父主题: 桶相关接口