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

GET Object acl

API Description

You can use this API to obtain the ACL of an object in a specified bucket.

Method Definition

func (obsClient ObsClient) GetObjectAcl(input *GetObjectAclInput) (output *GetObjectAclOutput, err error)

Method Definition If a Signed URL Is Used

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

Request Parameter

Field

Type

Optional or Mandatory

input

*GetObjectAclInput

Mandatory

Returned Result

Field

Type

output

*GetObjectAclOutput

err

error

Sample Code

func main() {
       input := &obs.GetObjectAclInput{}
       input.Bucket = "bucketname"
       input.Key = "objectkey"
       output, err := obsClient.GetObjectAcl(input)
       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)
              }
       }
}