Updated on 2022-02-10 GMT+08:00

GET Bucket storageinfo

API Description

You can use this API to obtain storage information about a bucket, including the bucket size and number of objects in the bucket.

Method Definition

1. ObsClient->getBucketStorageInfo(array $parameter)
2. ObsClient->getBucketStorageInfo(array $parameter, callback $callback)

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

string

Mandatory

Bucket name

Returned Result (InterfaceResult)

Field

Type

Description

HttpStatusCode

integer

HTTP status code

Reason

string

Reason description

RequestId

string

Request ID returned by the OBS server

Size

double

Bucket size

ObjectNumber

integer

Number of objects in the bucket

Sample Code

try{
       $resp = $obsClient -> getBucketStorageInfo([
              'Bucket' => 'bucketname'
       ]);
       printf("RequestId:%s\n", $resp['RequestId']);
       printf("Size:%s\n", $resp['Size']);
       printf("ObjectNumber:%s\n", $resp['ObjectNumber']);
}catch (Obs\Common\ObsException $obsException){
       printf("ExceptionCode:%s\n", $obsException->getExceptionCode());              
       printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}