更新时间:2022-02-10 GMT+08:00
获取桶列表
功能说明
查询桶列表,返回结果按照桶名字典序排列。
方法定义
func (obsClient ObsClient) ListBuckets(input *ListBucketsInput) (output *ListBucketsOutput, err error)
使用带授权信息URL的方法定义
func (obsClient ObsClient) ListBucketsWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *ListBucketsOutput, err error)
请求参数
参数名 |
类型 |
约束 |
---|---|---|
input |
可选 |
返回结果
参数名 |
类型 |
---|---|
output |
|
err |
error |
代码样例
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) } } }
父主题: 桶相关接口