Updated on 2022-02-10 GMT+08:00
PUT Bucket notification
API Description
You can use this API to configure event notification for a bucket. You will be notified of all specified operations performed on the bucket.
Method Definition
func (obsClient ObsClient) SetBucketNotification(input *SetBucketNotificationInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) SetBucketNotificationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
Request Parameter
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Mandatory |
Returned Result
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { input := &obs.SetBucketNotificationInput{} input.Bucket = "bucketname" var topicConfigurations [1]obs.TopicConfiguration topicConfigurations[0] = obs.TopicConfiguration{} topicConfigurations[0].ID = "001" topicConfigurations[0].Topic = "topic" topicConfigurations[0].Events = []obs.EventType{obs.ObjectCreatedAll} var filterRules [2]obs.FilterRule filterRules[0] = obs.FilterRule{Name: "prefix", Value: "smn"} filterRules[1] = obs.FilterRule{Name: "suffix", Value: ".jpg"} topicConfigurations[0].FilterRules = filterRules[:] input.TopicConfigurations = topicConfigurations[:] output, err := obsClient.SetBucketNotification(input) 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) } } }
Parent topic: Bucket-Related APIs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot