GET Bucket location
API Description
You can use this API to obtain the bucket location.
Method Definition
func (obsClient ObsClient) GetBucketLocation(bucketName string) (output *GetBucketLocationOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetBucketLocationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketLocationOutput, err error)
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
string |
Mandatory |
Bucket name |
Returned Result
|
Field |
Type |
|---|---|
|
output |
|
|
err |
error |
Sample Code
func main() {
output, err := obsClient.GetBucketLocation("bucketname")
if err == nil {
fmt.Printf("RequestId:%s\n", output.RequestId)
fmt.Printf("Location:%s\n", output.Location)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}
Last Article: Obtain Bucket Metadata
Next Article: GET Bucket storageinfo
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.