feat: add sqs and sns policies based on destination config#1299
feat: add sqs and sns policies based on destination config#1299ShreyaGangishetty merged 8 commits intoaws:developfrom
Conversation
samtranslator/model/iam.py
Outdated
| @classmethod | ||
| def sqs_send_message_role_policy(cls, queue_arn, logical_id): | ||
| document = { | ||
| 'PolicyName': 'SQSPublishPolicy' + logical_id, |
There was a problem hiding this comment.
Should I change the naming convention to logical_id + SQSPublishPolicy?
There was a problem hiding this comment.
What is the existing convention?
There was a problem hiding this comment.
existing convention is FunctioRole logical_id+ 'Policy'+'integer number'. But I cannot follow this convention as it might conflict with the explicit Policies section.
logical_id is Functioname+EventName
There was a problem hiding this comment.
updated the policy name to <eventlogicalid> + <sqspolicy/snspolicy>
| "Policies": [ | ||
| { | ||
| "PolicyName": "MyFunctionForBatchingExampleRolePolicy0", | ||
| "PolicyName": "SQSPublishPolicyMyFunctionForBatchingExampleDynamoDBStreamEvent", |
There was a problem hiding this comment.
SQSPublishPolicyMyFunctionForBatchingExampleDynamoDBStreamEvent will be changed as MyFunctionForBatchingExampleDynamoDBStreamEventSQSPublishRolePolicy
Codecov Report
@@ Coverage Diff @@
## develop #1299 +/- ##
===========================================
- Coverage 94.61% 94.39% -0.23%
===========================================
Files 78 78
Lines 4252 4280 +28
Branches 844 854 +10
===========================================
+ Hits 4023 4040 +17
- Misses 110 114 +4
- Partials 119 126 +7
Continue to review full report at Codecov.
|
Issue #, if available:
SAM expects the users to define
sqs:SendMessageandsns:publishpolicies whenDestinationConfigproperty is set for Kinesis and DynamoDb event types (documentation).Description of changes:
This PR removes the need to specify these policies explicitly if a property
Typeis specified by the user inOnFailureproperty ofDestinationConfig.If
Typeis not given users have to specify the policiles explicitly. Hence, this change is backwards compatible.Description of how you validated changes:
Deployed the template and verified if the right policies are added and also verified if the DestinationConfig is displayed without
Typeparameter in the consoleChecklist:
make prpassesexamples/2016-10-31By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.