获取桶ACL
功能说明
获取桶的访问权限。
方法定义
1. ObsClient->getBucketAcl(array $parameter) 2. ObsClient->getBucketAclAsync(array $parameter, callable $callback)
请求参数
字段名 | 类型 | 约束 | 说明 |
|---|---|---|---|
Bucket | string | 必选 | 桶名。 |
返回结果
字段名 | 类型 | 说明 | ||
|---|---|---|---|---|
HttpStatusCode | integer | HTTP状态码。 | ||
Reason | string | HTTP文本描述。 | ||
RequestId | string | OBS服务端返回的请求ID。 | ||
Owner | associative array | 桶的所有者。 | ||
- | ID | string | 桶所有者的DomainId。 | |
Grants | indexed array | 被授权用户权限信息列表。 | ||
- | Grantee | associative array | 被授权用户。 | |
- | ID | string | 被授权用户的DomainId,当用户类型是Group时为空。 | |
URI | string | 被授权的用户组,当用户类型是CanonicalUser时为空。 | ||
Permission | string | 被授予的权限。 | ||
Delivered | boolean | 桶内对象ACL是否继承桶的ACL。 | ||
代码样例
try{
$resp = $obsClient -> getBucketAcl([
'Bucket' => 'bucketname'
]);
printf("RequestId:%s\n", $resp['RequestId']);
printf("Owner[ID]:%s\n", $resp['Owner']['ID']);
printf("Owner[DisplayName]:%s\n", $resp['Owner']['DisplayName']);
printf("Grants\n");
foreach ($resp['Grants'] as $index => $grant){
printf("Grants[%d]", $index + 1);
printf("Grantee[ID]:%s\n", $grant['Grantee']['ID']);
printf("Grantee[DisplayName]:%s\n", $grant['Grantee']['DisplayName']);
printf("Grantee[URI]:%s\n", $grant['Grantee']['URI']);
printf("Permission:%s\n", $grant['Permission']);
}
}catch (Obs\Common\ObsException $obsException){
printf("ExceptionCode:%s\n", $obsException->getExceptionCode());
printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
} 
