diff --git a/samtranslator/model/eventsources/pull.py b/samtranslator/model/eventsources/pull.py index 2739d2196..95afc5f3a 100644 --- a/samtranslator/model/eventsources/pull.py +++ b/samtranslator/model/eventsources/pull.py @@ -35,6 +35,7 @@ class PullEventSource(ResourceMacro): "Queues": PropertyType(False, is_type(list)), "SourceAccessConfigurations": PropertyType(False, is_type(list)), "TumblingWindowInSeconds": PropertyType(False, is_type(int)), + "FunctionResponseTypes": PropertyType(False, is_type(list)), } def get_policy_arn(self): @@ -87,6 +88,7 @@ def to_cloudformation(self, **kwargs): lambda_eventsourcemapping.Queues = self.Queues lambda_eventsourcemapping.SourceAccessConfigurations = self.SourceAccessConfigurations lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds + lambda_eventsourcemapping.FunctionResponseTypes = self.FunctionResponseTypes destination_config_policy = None if self.DestinationConfig: diff --git a/samtranslator/model/lambda_.py b/samtranslator/model/lambda_.py index cd829a818..c473bbd6f 100644 --- a/samtranslator/model/lambda_.py +++ b/samtranslator/model/lambda_.py @@ -76,6 +76,7 @@ class LambdaEventSourceMapping(Resource): "Queues": PropertyType(False, is_type(list)), "SourceAccessConfigurations": PropertyType(False, is_type(list)), "TumblingWindowInSeconds": PropertyType(False, is_type(int)), + "FunctionResponseTypes": PropertyType(False, is_type(list)), } runtime_attrs = {"name": lambda self: ref(self.logical_id)} diff --git a/tests/translator/input/function_with_event_source_mapping.yaml b/tests/translator/input/function_with_event_source_mapping.yaml index 769cd289d..edea3e214 100644 --- a/tests/translator/input/function_with_event_source_mapping.yaml +++ b/tests/translator/input/function_with_event_source_mapping.yaml @@ -53,6 +53,8 @@ Resources: MaximumRecordAgeInSeconds: 86400 StartingPosition: TRIM_HORIZON TumblingWindowInSeconds: 60 + FunctionResponseTypes: + - ReportBatchItemFailures DestinationConfig: OnFailure: Type: SQS diff --git a/tests/translator/output/aws-cn/function_with_event_source_mapping.json b/tests/translator/output/aws-cn/function_with_event_source_mapping.json index 9b4f44478..c566b9490 100644 --- a/tests/translator/output/aws-cn/function_with_event_source_mapping.json +++ b/tests/translator/output/aws-cn/function_with_event_source_mapping.json @@ -182,7 +182,8 @@ "ParallelizationFactor": 8, "MaximumRetryAttempts": 100, "BisectBatchOnFunctionError": true, - "TumblingWindowInSeconds": 60 + "TumblingWindowInSeconds": 60, + "FunctionResponseTypes": ["ReportBatchItemFailures"] } }, "MyFunctionForBatchingExample": { @@ -239,4 +240,4 @@ } } } -} \ No newline at end of file +} diff --git a/tests/translator/output/aws-us-gov/function_with_event_source_mapping.json b/tests/translator/output/aws-us-gov/function_with_event_source_mapping.json index 3e028f48e..a910aefed 100644 --- a/tests/translator/output/aws-us-gov/function_with_event_source_mapping.json +++ b/tests/translator/output/aws-us-gov/function_with_event_source_mapping.json @@ -182,7 +182,8 @@ "ParallelizationFactor": 8, "MaximumRetryAttempts": 100, "BisectBatchOnFunctionError": true, - "TumblingWindowInSeconds": 60 + "TumblingWindowInSeconds": 60, + "FunctionResponseTypes": ["ReportBatchItemFailures"] } }, "MyFunctionForBatchingExample": { @@ -239,4 +240,4 @@ } } } -} \ No newline at end of file +} diff --git a/tests/translator/output/function_with_event_source_mapping.json b/tests/translator/output/function_with_event_source_mapping.json index c039a3396..2a2f668ef 100644 --- a/tests/translator/output/function_with_event_source_mapping.json +++ b/tests/translator/output/function_with_event_source_mapping.json @@ -182,7 +182,8 @@ "ParallelizationFactor": 8, "MaximumRetryAttempts": 100, "BisectBatchOnFunctionError": true, - "TumblingWindowInSeconds": 60 + "TumblingWindowInSeconds": 60, + "FunctionResponseTypes": ["ReportBatchItemFailures"] } }, "MyFunctionForBatchingExample": { @@ -239,4 +240,4 @@ } } } -} \ No newline at end of file +} diff --git a/versions/2016-10-31.md b/versions/2016-10-31.md index 9a009551b..3b5f18593 100644 --- a/versions/2016-10-31.md +++ b/versions/2016-10-31.md @@ -513,6 +513,7 @@ MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be DestinationConfig | [Destination Config Object](#destination-config-object) | Expired record metadata/retries and exhausted metadata is sent to this destination after they have passed the defined limits. ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing. TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations. +FunctionResponseTypes | `list` | Response types enabled for your function. **NOTE:** `SQSSendMessagePolicy` or `SNSPublishMessagePolicy` needs to be added in `Policies` for publishing messages to the `SQS` or `SNS` resource mentioned in `OnFailure` property @@ -536,6 +537,8 @@ Properties: Type: SQS Destination: !GetAtt MySqsQueue.Arn TumblingWindowInSeconds: 0 + FunctionResponseTypes: + - ReportBatchItemFailures ``` @@ -582,6 +585,7 @@ MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be DestinationConfig | [DestinationConfig Object](#destination-config-object) | Expired record metadata/retries and exhausted metadata is sent to this destination after they have passed the defined limits. ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing. TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations. +FunctionResponseTypes | `list` | Response types enabled for your function. ##### Example: DynamoDB event source object @@ -602,6 +606,8 @@ Properties: Type: SQS Destination: !GetAtt MySqsQueue.Arn TumblingWindowInSeconds: 0 + FunctionResponseTypes + - ReportBatchItemFailures ``` #### SQS