Obtaining an 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 | Mandatory |
Returned Result
| Field | Type |
|---|---|
| output | |
| 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) } } }
Last Article: Setting an Object ACL
Next Article: Setting Object Properties
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.