fix(iot): unable to add the same lambda function to two TopicRule Actions#17521
fix(iot): unable to add the same lambda function to two TopicRule Actions#17521mergify[bot] merged 7 commits intoaws:masterfrom
Conversation
skinny85
left a comment
There was a problem hiding this comment.
Looks good @yamatatsu, a few tiny suggestions!
packages/@aws-cdk/aws-iot-actions/test/lambda/lambda-function-action.test.ts
Outdated
Show resolved
Hide resolved
|
|
||
| bind(topicRule: iot.ITopicRule): iot.ActionConfig { | ||
| this.func.addPermission('invokedByAwsIotRule', { | ||
| this.func.addPermission(`${Names.nodeUniqueId(topicRule.node)}:Permission`, { |
There was a problem hiding this comment.
I would make the "Permission" part more module-specific. Something like:
| this.func.addPermission(`${Names.nodeUniqueId(topicRule.node)}:Permission`, { | |
| this.func.addPermission(`${Names.nodeUniqueId(topicRule.node)}:IotLambdaFunctionAction`, { |
| sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"), | ||
| actions: [action], | ||
| })).not.toThrow(); | ||
| }); |
There was a problem hiding this comment.
How about we actually assert that two different permissions are created, instead of just asserting the lack of an exception being thrown?
…action.test.ts Co-authored-by: Adam Ruka <adamruka85@gmail.com>
Pull request has been modified.
skinny85
left a comment
There was a problem hiding this comment.
Awesome, thanks for the fix @yamatatsu!
|
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). |
fix: #17508
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license