• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (PHP SDK)
  4. Bucket-Related APIs
  5. GET Bucket acl

GET Bucket acl

API Description

You can use this API to obtain a bucket ACL.

Method Definition

1. ObsClient->getBucketAcl(array $parameter)
2. ObsClient->getBucketAclAsync(array $parameter, callable $callback)

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

string

Mandatory

Bucket name

Returned Result

Field

Type

Description

HttpStatusCode

integer

HTTP status code

Reason

string

Reason description

RequestId

string

Request ID returned by the OBS server

Owner

associative array

Bucket owner

  

ID

string

ID of the domain to which the bucket owner belongs

DisplayName

string

Name of the bucket owner

Grants

indexed array

List of grantees' permission information

  

Grantee

associative array

Grantee

  

DisplayName

string

Grantee name. This field is null when Type of Grantee is Group.

ID

string

ID of the domain to which the grantee belongs. This field is null when Type of Grantee is Group.

URI

string

Grantee group. This field is null when Type of Grantee is CanonicalUser.

Permission

string

Granted permission

Sample Code

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());
}