Setting a Storage Class for a Bucket
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
func (obsClient ObsClient) SetBucketStoragePolicy(input *SetBucketStoragePolicyInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) SetBucketStoragePolicyWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
Request Parameter
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Result
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.SetBucketStoragePolicyInput{} input.Bucket = "bucketname" input.StorageClass = obs.StorageClassWarm output, err := obsClient.SetBucketStoragePolicy(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Obtaining a Bucket Quota
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.