获取桶ACL
功能说明
获取桶的访问权限。
方法定义
ObsClient.getBucketAcl
请求参数
字段名 | 类型 | 约束 | 说明 |
|---|---|---|---|
Bucket | String | 必选 | 桶名。 |
RequestDate | String 或 Date | 可选 | 指定请求时间。 说明: 当为String类型时,必须符合ISO8601或RFC822规范。 |
返回结果(InterfaceResult)
字段名 | 类型 | 说明 | ||
|---|---|---|---|---|
RequestId | String | OBS服务端返回的请求ID。 | ||
Owner | Object | 桶的所有者。 | ||
- | ID | String | 桶所有者的DomainId。 | |
Name | String | 桶所有者的名字。 | ||
Grants | Array | 被授权用户权限信息列表。 | ||
- | Grantee | Object | 被授权用户。 | |
- | Name | String | 被授权用户的名字,当用户类型是Group时为空。 | |
ID | String | 被授权用户的DomainId,当用户类型是Group时为空。 | ||
URI | String | 被授权的用户组,当用户类型是CanonicalUser时为空。 | ||
Permission | String | 被授予的权限。 | ||
Delivered | String | 桶内对象ACL是否继承桶的ACL。 | ||
代码样例
obsClient.getBucketAcl ({
Bucket : 'bucketname'
},function (err, result) {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
console.log('Owner[ID]-->' + result.InterfaceResult.Owner.ID);
console.log('Grants:');
for(var i=0;i<result.InterfaceResult.Grants.length;i++){
console.log('Grant[' + i + ']:');
console.log('Grantee[ID]-->' + result.InterfaceResult.Grants[i]['Grantee']['ID']);
console.log('Grantee[URI]-->' + result.InterfaceResult.Grants[i]['Grantee']['URI']);
console.log('Permission-->' + result.InterfaceResult.Grants[i]['Permission']);
}
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
}); 
