更新时间:2022-02-10 GMT+08:00
获取对象ACL
功能说明
获取指定桶中对象的访问权限。
方法定义
func (obsClient ObsClient) GetObjectAcl(input *GetObjectAclInput) (output *GetObjectAclOutput, err error)
使用带授权信息URL的方法定义
func (obsClient ObsClient) GetObjectAclWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetObjectAclOutput, err error)
请求参数
|
参数名 |
类型 |
约束 |
|---|---|---|
|
input |
必选 |
返回结果
|
参数名 |
类型 |
|---|---|
|
output |
|
|
err |
error |
代码样例
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)
}
}
}
父主题: 对象相关接口