-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
refactor(sns): move subscribers to aws-sns-subscribers
#2804
Conversation
In accordance with new guidelines, we're centralizing cross-service integrations into their own package. In this case, centralizing SNS Subscribers into @aws-cdk/aws-sns-subscribers. BREAKING CHANGE: using a queue, lambda, email, URL as SNS Subscriber now requires an integration object from the `@aws-cdk/aws-sns-subscribers` package.
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.
I think this should be “subscriptions” or “targets”, otherwise looks good!
@@ -62,7 +63,7 @@ export class ManualApprovalAction extends codepipeline.Action { | |||
if (this._notificationTopic) { | |||
this._notificationTopic.grantPublish(info.role); | |||
for (const notifyEmail of this.props.notifyEmails || []) { | |||
this._notificationTopic.subscribeEmail(`Subscription-${notifyEmail}`, notifyEmail); | |||
this._notificationTopic.subscribe(new subs.EmailSubscriber(notifyEmail)); |
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.
Rename to addSubscriber
"@aws-cdk/cdk": "^0.33.0" | ||
}, | ||
"engines": { | ||
"node": ">= 8.10.0" | ||
}, | ||
"awslint": { | ||
"exclude": [ | ||
"construct-base-is-private:@aws-cdk/aws-sns.TopicBase" | ||
"construct-base-is-private:@aws-cdk/aws-sns.TopicBase", | ||
"integ-return-type:@aws-cdk/aws-sns.ITopicSubscription.bind" |
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.
I think we should update the awslint rule to allow void as a return type for bind
@@ -530,7 +530,7 @@ export class Construct implements IConstruct { | |||
* Return whether the given object is a Construct | |||
*/ | |||
public static isConstruct(x: any): x is Construct { | |||
return CONSTRUCT_SYMBOL in x; | |||
return typeof x === 'object' && x !== null && CONSTRUCT_SYMBOL in x; |
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.
ouch!
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.
We should make sure all of our isXxx
methods are implemented like this.
@@ -20,7 +21,7 @@ public HelloStack(Construct parent, string id, IStackProps props) : base(parent, | |||
DisplayName = "My First Topic Yeah" | |||
}); | |||
|
|||
topic.SubscribeQueue(queue, null); | |||
topic.AddSubscription(new SqsSubscription(queue, null)); |
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.
what's this null
?
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.
I believe .NET does not support optional arguments
In accordance with new guidelines, we're centralizing cross-service
integrations into their own package. In this case, centralizing
SNS Subscribers into @aws-cdk/aws-sns-subscribers.
BREAKING CHANGE: using a queue, lambda, email, URL as SNS Subscriber now
requires an integration object from the
@aws-cdk/aws-sns-subscribers
package.
Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.