Obtaining Bucket Tags
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 Results
| 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: Setting Bucket Tags
Next Article: Deleting Bucket Tags
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.