更新时间:2022-02-10 GMT+08:00
获取桶的事件通知配置
功能说明
获取指定桶的事件通知配置信息。
方法定义
func (obsClient ObsClient) GetBucketNotification(bucketName string) (output *GetBucketNotificationOutput, err error)
使用带授权信息URL的方法定义
func (obsClient ObsClient) GetBucketNotificationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketNotificationOutput, err error)
请求参数
|
参数名 |
类型 |
约束 |
说明 |
|---|---|---|---|
|
bucketName |
string |
必选 |
桶名。 |
返回结果
|
参数名 |
类型 |
|---|---|
|
output |
|
|
err |
error |
代码样例
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)
}
}
}
父主题: 桶相关接口