GET Bucket tagging
API Description
You can use this API to obtain the tags of a specified bucket.
Method Definition
func (obsClient ObsClient) GetBucketTagging(bucketName string) (output *GetBucketTaggingOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetBucketTaggingWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketTaggingOutput, 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.GetBucketTagging("bucketname")
if err == nil {
fmt.Printf("RequestId:%s\n", output.RequestId)
for index, tag := range output.Tags {
fmt.Printf("Tag[%d]-Key:%s, Value:%s\n", index, tag.Key, tag.Value)
}
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
} Last Article: PUT Bucket tagging
Next Article: DELETE Bucket tagging
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.