Updated on 2022-02-10 GMT+08:00

GET Bucket acl

API Description

You can use this API to obtain a bucket ACL.

Method Definition

func (obsClient ObsClient) GetBucketAcl(bucketName string) (output *GetBucketAclOutput, err error)

Method Definition If a Signed URL Is Used

func (obsClient ObsClient) GetBucketAclWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketAclOutput, err error)

Request Parameter

Field

Type

Optional or Mandatory

Description

bucketName

string

Mandatory

Bucket name

Returned Result

Field

Type

output

*GetBucketAclOutput

err

error

Sample Code

func main() {
       output, err := obsClient.GetBucketAcl("bucketname")
       if err == nil {
              fmt.Printf("RequestId:%s\n", output.RequestId)
              fmt.Printf("Owner.ID:%s\n", output.Owner.ID)
              for index, grant := range output.Grants {
                     fmt.Printf("Grant[%d]-Type:%s, ID:%s, URI:%s, Permission:%s\n", index, grant.Grantee.Type, grant.Grantee.ID, grant.Grantee.URI, grant.Permission)
              }
       } else {
              if obsError, ok := err.(obs.ObsError); ok {
                     fmt.Println(obsError.Code)
                     fmt.Println(obsError.Message)
              } else {
                     fmt.Println(err)
              }
       }
}