Set Bucket storagePolicy
API Description
You can use this API to set storage classes for buckets. The storage class of an object defaults to be that of its residing bucket.
Method Definition
1. ObsClient->setBucketStoragePolicy(array $parameter) 2. ObsClient->setBucketStoragePolicyAsync(array $parameter, callable $callback)
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
Bucket |
string |
Mandatory |
Bucket name |
|
StorageClass |
string |
Mandatory |
Storage class of the bucket |
Returned Result
|
Field |
Type |
Description |
|---|---|---|
|
HttpStatusCode |
integer |
HTTP status code |
|
Reason |
string |
Reason description |
|
RequestId |
string |
Request ID returned by the OBS server |
Sample Code
try{
$resp = $obsClient -> setBucketStoragePolicy([
'Bucket' => 'bucketname',
'StorageClass' => ObsClient::StorageClassWarm
]);
printf("RequestId:%s\n", $resp['RequestId']);
}catch (Obs\Common\ObsException $obsException){
printf("ExceptionCode:%s\n", $obsException->getExceptionCode());
printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
Last Article: GET Bucket quota
Next Article: GET Bucket storagePolicy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.