-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bucket Notifications #201
Bucket Notifications #201
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export * from './bucket'; | ||
export * from './bucket-policy'; | ||
export * from './rule'; | ||
export * from './notification-dest'; | ||
|
||
// AWS::S3 CloudFormation Resources: | ||
export * from './s3.generated'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import cdk = require('@aws-cdk/cdk'); | ||
import { Bucket } from './bucket'; | ||
|
||
/** | ||
* Implemented by constructs that can be used as bucket notification targets. | ||
*/ | ||
export interface INotificationDestination { | ||
/** | ||
* Registers this resource to receive notifications for the specified bucket. | ||
* @param bucket The bucket. Use the `path` of the bucket as a unique ID. | ||
*/ | ||
bucketNotificationDestination(bucket: Bucket): NotificationDestinationProps; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we said the standard name for this function was going to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We did, but because of namespacing the interface name lost some of the context. However as a method of an L2 construct “notificationDestination” is not sufficient. We must have some delinataion as for where is this coming from. Otherwise it will look very odd. Maybe ‘s3NotificationDestination’? Otherwise, I can rename the interface to ‘BucketNotificationDestination’. What do you think? I am also wondering - ideally users shouldn’t care about these “inverted control” methods whatsoever (we now have a few of them). I wonder if we should find some convention that makes it intuitively clear that you don’t need to call this yourself. We could prefix with something like an underscore... or something like “asBucketNotificationDestination”. I kinda like the “as” prefix. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, changed to |
||
} | ||
|
||
/** | ||
* Represents the properties of a notification target. | ||
*/ | ||
export interface NotificationDestinationProps { | ||
/** | ||
* The notification type. | ||
*/ | ||
readonly type: NotificationDestinationType; | ||
|
||
/** | ||
* The ARN of the target. | ||
*/ | ||
readonly arn: cdk.Arn; | ||
} | ||
|
||
/** | ||
* Supported types of notificaiton targets. | ||
*/ | ||
export enum NotificationDestinationType { | ||
Lambda, | ||
Queue, | ||
Topic | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './notifications-resource'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change filter to be strongly typed. Prefix can only be specified once apparently for example