From b6969bc501dc6658ce135e6d7297c1eb67b6a208 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 7 Dec 2020 12:23:11 -0800 Subject: [PATCH] add support for watching for replication/ilm events (#3525) --- cmd/client-s3.go | 9 +++++++++ cmd/event-add.go | 17 ++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cmd/client-s3.go b/cmd/client-s3.go index 03b9ea1b..28dfcf43 100644 --- a/cmd/client-s3.go +++ b/cmd/client-s3.go @@ -265,6 +265,11 @@ func (c *S3Client) AddNotificationConfig(ctx context.Context, arn string, events nc.AddEvents(notification.ObjectRemovedAll) case "get": nc.AddEvents(notification.ObjectAccessedAll) + case "replica": + nc.AddEvents(notification.EventType("s3:Replication:*")) + case "ilm": + nc.AddEvents(notification.EventType("s3:ObjectRestore:*")) + nc.AddEvents(notification.EventType("s3:ObjectTransition:*")) default: return errInvalidArgument().Trace(events...) } @@ -727,6 +732,10 @@ func (c *S3Client) Watch(ctx context.Context, options WatchOptions) (*WatchObjec events = append(events, string(notification.ObjectRemovedAll)) case "get": events = append(events, string(notification.ObjectAccessedAll)) + case "replica": + events = append(events, "s3:Replication:*") // TODO: add it to minio-go as constant + case "ilm": + events = append(events, "s3:ObjectRestore:*", "s3:ObjectTransition:*") // TODO: add it to minio-go as constant default: return nil, errInvalidArgument().Trace(event) } diff --git a/cmd/event-add.go b/cmd/event-add.go index 80d04a90..34f4c5c2 100644 --- a/cmd/event-add.go +++ b/cmd/event-add.go @@ -66,14 +66,17 @@ FLAGS: {{range .VisibleFlags}}{{.}} {{end}} EXAMPLES: - 1. Enable bucket notification with a specific arn - {{.Prompt}} {{.HelpName}} myminio/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue + 1. Enable bucket notification with a specific ARN + {{.Prompt}} {{.HelpName}} myminio/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue - 2. Enable bucket notification with filters parameters - {{.Prompt}} {{.HelpName}} s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue --event put,delete,get --prefix photos/ --suffix .jpg - - 3. Ignore duplicate bucket notification with -p flag - {{.Prompt}} {{.HelpName}} s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue -p --event put,delete,get --prefix photos/ --suffix .jpg + 2. Enable bucket notification with filters parameters + {{.Prompt}} {{.HelpName}} s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue --event put,delete,get --prefix photos/ --suffix .jpg + + 3. Ignore duplicate bucket notification with -p flag + {{.Prompt}} {{.HelpName}} s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue -p --event put,delete,get --prefix photos/ --suffix .jpg + + 4. Enable bucket notification for Replication and ILM transition events to a specific ARN + {{.Prompt}} {{.HelpName}} myminio/mysourcebucket arn:aws:sqs:us-west-2:444455556666:your-queue --event replica,ilm `, }