Setting the Versioning Status for a Bucket
API Description
You can use this API to set the versioning status for a bucket.
Method Definition
ObsClient.setBucketVersioning(bucketName, status)
Request Parameters
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
str |
Mandatory |
Bucket name |
|
status |
str |
Mandatory |
Versioning status of the bucket. Possible values are:
|
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
Sample Code
try:
resp = obsClient.setBucketVersioning('bucketname', 'Enabled')
if resp.status < 300:
print('requestId:', resp.requestId)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc())
Last Article: Deleting Website Hosting Settings of a Bucket
Next Article: Obtaining the Versioning Status of a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.