Updated on 2022-02-10 GMT+08:00
GET Buckets
API Description
You can use this API to obtain the bucket list. In the list, bucket names are displayed in lexicographical order.
Method Definition
func (obsClient ObsClient) ListBuckets(input *ListBucketsInput) (output *ListBucketsOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) ListBucketsWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *ListBucketsOutput, err error)
Request Parameter
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Optional |
Returned Result
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { output, err := obsClient.ListBuckets(nil) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) fmt.Printf("Owner.ID:%s\n", output.Owner.ID) for index, val := range output.Buckets { fmt.Printf("Bucket[%d]-Name:%s,CreationDate:%s\n", index, val.Name, val.CreationDate) } } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Parent topic: Bucket-Related APIs
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.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot