Setting a Storage Class for a Bucket
API Description
You can use this API to set a storage class for a bucket. The storage class of an object defaults to be that of its residing bucket.
Method Definition
ObsClient.setBucketStoragePolicy(bucketName, storageClass)
Request Parameters
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
str |
Mandatory |
Bucket name |
|
storageClass |
str |
Mandatory |
Storage Classes of the bucket |
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
Sample Code
try:
resp = obsClient.setBucketStoragePolicy('bucketname', StorageClass.STANDARD)
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: Obtaining the Storage Capacity Quota of a Bucket
Next Article: Obtaining the Storage Class of a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.