PUT Bucket acl
API Description
You can use this API to set the ACL for a bucket.
Method Definition
func (obsClient ObsClient) SetBucketAcl(input *SetBucketAclInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) SetBucketAclWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
Request Parameter
|
Field |
Type |
Optional or Mandatory |
|---|---|---|
|
input |
Mandatory |
Returned Result
|
Field |
Type |
|---|---|
|
output |
|
|
err |
error |
Sample Code
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)
}
}
}
Last Article: GET Bucket Storage Class
Next Article: GET Bucket acl
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.