关闭事件通知

更新时间: 2019-03-14 10:05

关闭桶事件通知实际上就是调用ObsClient.SetBucketNotification将事件通知配置清空,以下代码展示了如何清除桶的事件通知:

  1. // 引入依赖包
  2. import (
  3. "fmt"
  4. "obs"
  5. )
  6.  
  7. var ak = "*** Provide your Access Key ***"
  8. var sk = "*** Provide your Secret Key ***"
  9. var endpoint = "https://your-endpoint"
  10.  
  11. // 创建ObsClient结构体
  12. var obsClient, _ = obs.New(ak, sk, endpoint)
  13.  
  14. func main() {
  15. input := &obs.SetBucketNotificationInput{}
  16. input.Bucket = "bucketname"
  17. output, err := obsClient.SetBucketNotification(input)
  18. if err == nil {
  19. fmt.Printf("RequestId:%s\n", output.RequestId)
  20. } else if obsError, ok := err.(obs.ObsError); ok {
  21. fmt.Printf("Code:%s\n", obsError.Code)
  22. fmt.Printf("Message:%s\n", obsError.Message)
  23. }
  24. }

父主题:事件通知