-
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
feat(sns): addSubscription returns the created Subscription #16785
Conversation
Allow creating dependencies on the subscription by return it from addSubscription(). Before this change the subscription resource was hidden. Creating a dependency required manually creating the subscription 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.
Makes sense, thanks!
Sorry @njlynch seems like we were stepping on each other's toes here. I already started to work on a basic test to make CodeBuild happy. I'll ping you when it's ready. Right now I'm fighting with GitPod. I keep getting weird unrelated errors about CloudWatch when trying to run the test. |
GitPod wouldn't even start up for me anymore 🤷 @njlynch it's ready. The test is a bit simplistic, but it does convey why I created the PR in the first place. I can remove it if you think it doesn't add much value and we can stick with the exempt-tests label. |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…ption (#16785)" (#17166) This reverts commit 62f389e. Changing the return type from void to Subscription is a breaking change for F# customers, where the return type changes from "unit" to "Subscription", potentially breaking `do` statements. Example: https://github.com/aws/aws-cdk/blob/62f389ea0522cbaefca5ca17080228031d401ce6/packages/aws-cdk/lib/init-templates/v1/sample-app/fsharp/src/%25name.PascalCased%25/%25name.PascalCased%25Stack.template.fs#L14 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@njlynch I just see this get released with v2.0.0-rc.28. Does that mean it will be in v2.x but not in v1.x? |
Allow creating dependencies on the subscription by returning it from `addSubscription()`. Before this change the subscription resource was inaccessible. Creating a dependency required manually creating the subscription resource. Our current workaround is: ``` topic = sns.Topic(self, "topic") subscription_req = subs.SqsSubscription(queue) subscription_data = subscription_req.bind(topic) subscription = sns.Subscription( self, "Subscription", topic=topic, endpoint=subscription_data.endpoint, protocol=subscription_data.protocol, region=subscription_data.region, raw_message_delivery=subscription_data.raw_message_delivery, filter_policy=subscription_data.filter_policy, dead_letter_queue=subscription_data.dead_letter_queue, ) something.add_dependency(subscription) ``` And it would be much simpler as: ``` topic = sns.Topic(self, "topic") subscription = topic.add_subscription(subs.SqsSubscription(queue)) something.add_dependency(subscription) ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…ption (aws#16785)" (aws#17166) This reverts commit 62f389e. Changing the return type from void to Subscription is a breaking change for F# customers, where the return type changes from "unit" to "Subscription", potentially breaking `do` statements. Example: https://github.com/aws/aws-cdk/blob/62f389ea0522cbaefca5ca17080228031d401ce6/packages/aws-cdk/lib/init-templates/v1/sample-app/fsharp/src/%25name.PascalCased%25/%25name.PascalCased%25Stack.template.fs#L14 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Allow creating dependencies on the subscription by returning it from
addSubscription()
. Before this change the subscription resource was inaccessible. Creating a dependency required manually creating the subscription resource.Our current workaround is:
And it would be much simpler as:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license