PUT Bucket versioning
API Description
You can use this API to set the versioning status for a bucket.
Method Definition
1. ObsClient->setBucketVersioning(array $parameter) 2. ObsClient->getBucketVersioningAsync(array $parameter, callable $callback)
Request Parameter
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| Bucket | string | Mandatory | Bucket name |
| Status | string | Mandatory | Versioning status of the bucket. Possible values are:
|
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 -> setBucketVersioning([
'Bucket' => 'bucketname',
'Status' => 'Enabled'
]);
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: DELETE Bucket website
Next Article: GET Bucket versioning
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.