add support for watching for replication/ilm events (#3525)

This commit is contained in:
Harshavardhana
2020-12-07 12:23:11 -08:00
committed by GitHub
parent 4dc0a44ebf
commit b6969bc501
2 changed files with 19 additions and 7 deletions
+9
View File
@@ -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)
}
+10 -7
View File
@@ -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
`,
}