Updated on 2022-02-10 GMT+08:00

PUT Bucket quota

API Description

You can use this API to set the bucket quota. A bucket quota must be expressed in bytes and the maximum value is 263-1. Value 0 indicates that no upper limit is set for the bucket quota.

Method Definition

func (obsClient ObsClient) SetBucketQuota(input *SetBucketQuotaInput) (output *BaseModel, err error)

Method Definition If a Signed URL Is Used

func (obsClient ObsClient) SetBucketQuotaWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)

Request Parameter

Field

Type

Optional or Mandatory

input

*SetBucketQuotaInput

Mandatory

Returned Result

Field

Type

output

*BaseModel

err

error

Sample Code

func main() {
       input := &obs.SetBucketQuotaInput{}
       input.Bucket = "bucketname"
       input.Quota = 1024 * 1024 * 1024
       output, err := obsClient.SetBucketQuota(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)
              }
       }
}