Create Event Notification Rule
client.R2.Buckets.EventNotifications.Update(ctx, bucketName, queueID, params) (*BucketEventNotificationUpdateResponse, error)
PUT/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}
Create event notification rule.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Accepted Permissions (at least one required)
Parameters
Create Event Notification Rule
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/r2"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
eventNotification, err := client.R2.Buckets.EventNotifications.Update(
context.TODO(),
"example-bucket",
"queue_id",
r2.BucketEventNotificationUpdateParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Rules: cloudflare.F([]r2.BucketEventNotificationUpdateParamsRule{r2.BucketEventNotificationUpdateParamsRule{
Actions: cloudflare.F([]r2.BucketEventNotificationUpdateParamsRulesAction{r2.BucketEventNotificationUpdateParamsRulesActionPutObject, r2.BucketEventNotificationUpdateParamsRulesActionCopyObject}),
}}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", eventNotification)
}
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {},
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {},
"success": true
}