-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support DLQ, RetryPolicy properties for EventBridgeRule,Schedule event sources (#1842) * Add DeadLetterConfig,RetryPolicy properties for EventBridgeRule,Schedule event sources * Minor fix,rename function argument * Update test class name * Combine dlq extraction/generation into the utility class * Remove unused import * fix: propagate condition to sqs queue policy for sqssubscription (#1798) * fix: propagate condition to sqs queue policy for sqssubscription * Update unit test for function_event_conditions * Update black commands in Makefile to check only .py files * Update test with one more SNS event source with sqsSubscription set * Revert "Update black commands in Makefile to check only .py files" This reverts commit 115ff09. * chore: Remove biased language from pylintrc (#1847) * fix: Support new CodeDeploy ManagedPolicy (#1858) * fix: Support new CodeDeploy MangedPolicy in regions without AWSCodeDeployRoleForLambda CodeDeploy is migrating from AWSCodeDeployRoleForLambda to AWSCodeDeployRoleForLambdaLimited. Some partitions do not support AWSCodeDeployRoleForLambda and therefore we need to use the newer one in those partitions. We cannot widely update to AWSCodeDeployRoleForLambdaLimited since this can cause customer's stacks to fail unexpectedly. * Forgot to commit unit tests * Handle PR feedback Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> * fix: Update Slack invite link (#1877) Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> * feature: Support for custom checkpointing (#1883) Co-authored-by: Vinayak <vinayaks@amazon.com> * Fix: Description in AWS::Serverless::HttpApi (#1884) * Fix: Description in AWS::Serverless::HttpApi * Update _set to _add * Update AWS::S3::Bucket properties (#1885) * Update AWS::S3::Bucket properties * Fix type checking validators for AWS::S3::Bucket * Update to use any_type() in favor of supporing ref * Fix: Replaced invalid AMQ managed policy by providing policy statements (#1891) * Fix for invalid MQ event source managed policy * Fix for invalid managed policy for MQ, included support for new MQ event source property, updated test cases * Black reformatting * Test case changes * Changed policy name * Modified test cases with new policy name * chore: bump version 1.34.0 (#1892) * Fix: SAM crashes method_definition for path is invalid (#1802) * Fix: SAM crashes method_definition for path is invalid * Fix: SAM crashes whenmappings is null * Removed print statement in test_translator * Fix: Swagger security not a dict Co-authored-by: Mufaddal Makati <mmmakati@amazon.com> Co-authored-by: ejafarli <54083696+ejafarli@users.noreply.github.com> Co-authored-by: _sam <3804518+aahung@users.noreply.github.com> Co-authored-by: Jacob Fuss <32497805+jfuss@users.noreply.github.com> Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com> Co-authored-by: vinayaksood <vinayaksood.282@gmail.com> Co-authored-by: Vinayak <vinayaks@amazon.com> Co-authored-by: Qingchuan Ma <69653965+qingchm@users.noreply.github.com> Co-authored-by: Mufaddal Makati <mufaddal@rawbytes.com> Co-authored-by: Mufaddal Makati <mmmakati@amazon.com>
- Loading branch information
1 parent
d2f18e7
commit cf126c6
Showing
109 changed files
with
5,107 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.33.0" | ||
__version__ = "1.34.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from samtranslator.model.sqs import SQSQueue, SQSQueuePolicy, SQSQueuePolicies | ||
from samtranslator.model.exceptions import InvalidEventException | ||
|
||
|
||
class EventBridgeRuleUtils: | ||
@staticmethod | ||
def create_dead_letter_queue_with_policy(rule_logical_id, rule_arn, queue_logical_id=None): | ||
resources = [] | ||
|
||
queue = SQSQueue(queue_logical_id or rule_logical_id + "Queue") | ||
dlq_queue_arn = queue.get_runtime_attr("arn") | ||
dlq_queue_url = queue.get_runtime_attr("queue_url") | ||
|
||
# grant necessary permission to Eventbridge Rule resource for sending messages to dead-letter queue | ||
policy = SQSQueuePolicy(rule_logical_id + "QueuePolicy") | ||
policy.PolicyDocument = SQSQueuePolicies.eventbridge_dlq_send_message_resource_based_policy( | ||
rule_arn, dlq_queue_arn | ||
) | ||
policy.Queues = [dlq_queue_url] | ||
|
||
resources.append(queue) | ||
resources.append(policy) | ||
|
||
return resources | ||
|
||
@staticmethod | ||
def validate_dlq_config(source_logical_id, dead_letter_config): | ||
supported_types = ["SQS"] | ||
is_arn_defined = "Arn" in dead_letter_config | ||
is_type_defined = "Type" in dead_letter_config | ||
if is_arn_defined and is_type_defined: | ||
raise InvalidEventException( | ||
source_logical_id, "You can either define 'Arn' or 'Type' property of DeadLetterConfig" | ||
) | ||
if is_type_defined and dead_letter_config.get("Type") not in supported_types: | ||
raise InvalidEventException( | ||
source_logical_id, | ||
"The only valid value for 'Type' property of DeadLetterConfig is 'SQS'", | ||
) | ||
if not is_arn_defined and not is_type_defined: | ||
raise InvalidEventException(source_logical_id, "No 'Arn' or 'Type' property provided for DeadLetterConfig") | ||
|
||
@staticmethod | ||
def get_dlq_queue_arn_and_resources(cw_event_source, source_arn): | ||
"""returns dlq queue arn and dlq_resources, assuming cw_event_source.DeadLetterConfig has been validated""" | ||
dlq_queue_arn = cw_event_source.DeadLetterConfig.get("Arn") | ||
if dlq_queue_arn is not None: | ||
return dlq_queue_arn, [] | ||
queue_logical_id = cw_event_source.DeadLetterConfig.get("QueueLogicalId") | ||
dlq_resources = EventBridgeRuleUtils.create_dead_letter_queue_with_policy( | ||
cw_event_source.logical_id, source_arn, queue_logical_id | ||
) | ||
dlq_queue_arn = dlq_resources[0].get_runtime_attr("arn") | ||
return dlq_queue_arn, dlq_resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.