Obtaining the Event Notification Settings of a Bucket
API Description
You can use this API to obtain the event notification configuration of a bucket.
Method Definition
func (obsClient ObsClient) GetBucketNotification(bucketName string) (output *GetBucketNotificationOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetBucketNotificationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketNotificationOutput, 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.GetBucketNotification("bucketname") for index, topicConfiguration := range output.TopicConfigurations { fmt.Printf("TopicConfiguration[%d]\n", index) fmt.Printf("ID:%s, Topic:%s, Events:%v\n", topicConfiguration.ID, topicConfiguration.Topic, topicConfiguration.Events) } if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Configuring the Event Notifications for a Bucket
Next Article: Setting Bucket Tags
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.