PUT Bucket
API Description
You can use this API to create a bucket and name it as you specify. The created bucket name must be unique in OBS. If a user repeatedly creates buckets with the same name in one region, status code 200 is returned. In other cases, status code 409 is returned. Each user can create a maximum of 100 buckets.
Method Definition
func (obsClient ObsClient) CreateBucket(input *CreateBucketInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) CreateBucketWithSignedUrl(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.CreateBucketInput{} input.Bucket = "bucketname" input.ACL = obs.AclPrivate input.StorageClass = obs.StorageClassWarm output, err := obsClient.CreateBucket(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) } } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot