From 5d3ea533167b51f9792cd742454f559c8f92746f Mon Sep 17 00:00:00 2001 From: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:34:38 -0800 Subject: [PATCH] feat: event source filtering (#2241) * feat: add support for event filtering (DDB, Kinesis, SQS) (#90) * Add support for Event Filtering (DDB, Kinesis, SQS) * PR feedback Rename test file. Move to a variable the list of event types that have event filtering. * chore: change a test case that CFN doesn't support (#98) Co-authored-by: Renato Valenzuela <37676028+valerena@users.noreply.github.com> --- samtranslator/model/eventsources/pull.py | 20 +++ samtranslator/model/lambda_.py | 1 + .../input/error_event_filtering.yaml | 56 +++++++ .../input/function_with_event_filtering.yaml | 49 ++++++ .../translator/input/intrinsic_functions.yaml | 6 + .../aws-cn/function_with_event_filtering.json | 140 ++++++++++++++++++ .../output/aws-cn/intrinsic_functions.json | 13 ++ .../function_with_event_filtering.json | 140 ++++++++++++++++++ .../aws-us-gov/intrinsic_functions.json | 13 ++ .../output/error_event_filtering.json | 3 + .../output/function_with_event_filtering.json | 140 ++++++++++++++++++ .../output/intrinsic_functions.json | 13 ++ tests/translator/test_translator.py | 1 + versions/2016-10-31.md | 3 + 14 files changed, 598 insertions(+) create mode 100644 tests/translator/input/error_event_filtering.yaml create mode 100644 tests/translator/input/function_with_event_filtering.yaml create mode 100644 tests/translator/output/aws-cn/function_with_event_filtering.json create mode 100644 tests/translator/output/aws-us-gov/function_with_event_filtering.json create mode 100644 tests/translator/output/error_event_filtering.json create mode 100644 tests/translator/output/function_with_event_filtering.json diff --git a/samtranslator/model/eventsources/pull.py b/samtranslator/model/eventsources/pull.py index 537d9cd30..13d6addc7 100644 --- a/samtranslator/model/eventsources/pull.py +++ b/samtranslator/model/eventsources/pull.py @@ -21,6 +21,9 @@ class PullEventSource(ResourceMacro): :cvar str policy_arn: The ARN of the AWS managed role policy corresponding to this pull event source """ + # Event types that support `FilterCriteria`, stored as a list to keep the alphabetical order + RESOURCE_TYPES_WITH_EVENT_FILTERING = ["DynamoDB", "Kinesis", "SQS"] + resource_type = None requires_stream_queue_broker = True property_types = { @@ -43,6 +46,7 @@ class PullEventSource(ResourceMacro): "TumblingWindowInSeconds": PropertyType(False, is_type(int)), "FunctionResponseTypes": PropertyType(False, is_type(list)), "KafkaBootstrapServers": PropertyType(False, is_type(list)), + "FilterCriteria": PropertyType(False, is_type(dict)), } def get_policy_arn(self): @@ -102,6 +106,8 @@ def to_cloudformation(self, **kwargs): lambda_eventsourcemapping.SourceAccessConfigurations = self.SourceAccessConfigurations lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds lambda_eventsourcemapping.FunctionResponseTypes = self.FunctionResponseTypes + lambda_eventsourcemapping.FilterCriteria = self.FilterCriteria + self._validate_filter_criteria() if self.KafkaBootstrapServers: lambda_eventsourcemapping.SelfManagedEventSource = { @@ -169,6 +175,20 @@ def _link_policy(self, role, destination_config_policy=None): if not destination_config_policy.get("PolicyDocument") in [d["PolicyDocument"] for d in role.Policies]: role.Policies.append(destination_config_policy) + def _validate_filter_criteria(self): + if not self.FilterCriteria or is_intrinsic(self.FilterCriteria): + return + if self.resource_type not in self.RESOURCE_TYPES_WITH_EVENT_FILTERING: + raise InvalidEventException( + self.relative_id, + "FilterCriteria is only available for {} events.".format( + ", ".join(self.RESOURCE_TYPES_WITH_EVENT_FILTERING) + ), + ) + # FilterCriteria is either empty or only has "Filters" + if list(self.FilterCriteria.keys()) not in [[], ["Filters"]]: + raise InvalidEventException(self.relative_id, "FilterCriteria field has a wrong format") + class Kinesis(PullEventSource): """Kinesis event source.""" diff --git a/samtranslator/model/lambda_.py b/samtranslator/model/lambda_.py index 75089bc04..0c822d640 100644 --- a/samtranslator/model/lambda_.py +++ b/samtranslator/model/lambda_.py @@ -79,6 +79,7 @@ class LambdaEventSourceMapping(Resource): "TumblingWindowInSeconds": PropertyType(False, is_type(int)), "FunctionResponseTypes": PropertyType(False, is_type(list)), "SelfManagedEventSource": PropertyType(False, is_type(dict)), + "FilterCriteria": PropertyType(False, is_type(dict)), } runtime_attrs = {"name": lambda self: ref(self.logical_id)} diff --git a/tests/translator/input/error_event_filtering.yaml b/tests/translator/input/error_event_filtering.yaml new file mode 100644 index 000000000..ef575217f --- /dev/null +++ b/tests/translator/input/error_event_filtering.yaml @@ -0,0 +1,56 @@ +Resources: + WrongFilterName: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://sam-demo-bucket/filtered_events.zip + Handler: index.handler + Runtime: nodejs16.x + Events: + DynamoDBStreamEvent: + Type: DynamoDB + Properties: + Stream: !GetAtt DynamoDBTable.StreamArn + StartingPosition: TRIM_HORIZON + FilterCriteria: + FiltersToUse: + - Pattern: '{"name": "value"}' + + NotSupportedPullEvent: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://sam-demo-bucket/filtered_events.zip + Handler: index.handler + Runtime: nodejs16.x + Events: + KafkaEvent: + Type: MSK + Properties: + StartingPosition: LATEST + Stream: arn:aws:kafka:us-east-1:012345678012:cluster/clusterName/abcdefab-1234-abcd-5678-cdef0123ab01-2 + Topics: + - MyTopic + FilterCriteria: + Filters: + - Pattern: '{"name": "value"}' + + + NotSupportedPushEvent: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://sam-demo-bucket/filtered_events.zip + Handler: index.handler + Runtime: nodejs16.x + Events: + SNSEvent: + Type: SNS + Properties: + Topic: !GetAtt MySnsTopic.Arn + FilterCriteria: + Filters: + - Pattern: '{"name": "value"}' + + DynamoDBTable: + Type: AWS::DynamoDB::Table + + MySnsTopic: + Type: AWS::SNS::Topic diff --git a/tests/translator/input/function_with_event_filtering.yaml b/tests/translator/input/function_with_event_filtering.yaml new file mode 100644 index 000000000..5aabd1614 --- /dev/null +++ b/tests/translator/input/function_with_event_filtering.yaml @@ -0,0 +1,49 @@ +Resources: + FilteredEventsFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3://sam-demo-bucket/filtered_events.zip + Handler: index.handler + Runtime: nodejs16.x + Events: + KinesisStream: + Type: Kinesis + Properties: + Stream: !GetAtt KinesisStream.Arn + StartingPosition: LATEST + FilterCriteria: + Filters: + - Pattern: '{"name": "value"}' + - Pattern: '{"name2": "value2"}' + DynamoDBStreamEvent: + Type: DynamoDB + Properties: + Stream: !GetAtt DynamoDBTable.StreamArn + StartingPosition: TRIM_HORIZON + FilterCriteria: + Filters: + - Pattern: '{ + "dynamodb": { + "NewImage": { + "value": { "S": ["test"] } + } + } + }' + MySqsQueue: + Type: SQS + Properties: + Queue: !GetAtt MySqsQueue.Arn + FilterCriteria: + Filters: + - Pattern: '{"name": "value"}' + + KinesisStream: + Type: AWS::Kinesis::Stream + Properties: + ShardCount: 1 + + DynamoDBTable: + Type: AWS::DynamoDB::Table + + MySqsQueue: + Type: AWS::SQS::Queue \ No newline at end of file diff --git a/tests/translator/input/intrinsic_functions.yaml b/tests/translator/input/intrinsic_functions.yaml index 76d9b24b2..7ce6df062 100644 --- a/tests/translator/input/intrinsic_functions.yaml +++ b/tests/translator/input/intrinsic_functions.yaml @@ -108,6 +108,12 @@ Resources: Fn::GetAtt: [MyTable, "StreamArn"] BatchSize: 200 StartingPosition: LATEST + FilterCriteria: + Fn::Select: + - "1" + - + - {} + - { "Filters": { "Pattern": "{\"value\": \"b\"}" }} MyTable: Type: AWS::DynamoDB::Table diff --git a/tests/translator/output/aws-cn/function_with_event_filtering.json b/tests/translator/output/aws-cn/function_with_event_filtering.json new file mode 100644 index 000000000..60f4c7082 --- /dev/null +++ b/tests/translator/output/aws-cn/function_with_event_filtering.json @@ -0,0 +1,140 @@ +{ + "Resources": { + "KinesisStream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "ShardCount": 1 + } + }, + "DynamoDBTable": { + "Type": "AWS::DynamoDB::Table" + }, + "MySqsQueue": { + "Type": "AWS::SQS::Queue" + }, + "FilteredEventsFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": "sam-demo-bucket", + "S3Key": "filtered_events.zip" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "FilteredEventsFunctionRole", + "Arn" + ] + }, + "Runtime": "nodejs16.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole", + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole", + "arn:aws-cn:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionDynamoDBStreamEvent": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "DynamoDBTable", + "StreamArn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "TRIM_HORIZON", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{ \"dynamodb\": { \"NewImage\": { \"value\": { \"S\": [\"test\"] } } } }" + } + ] + } + } + }, + "FilteredEventsFunctionKinesisStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "KinesisStream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "LATEST", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + }, + { + "Pattern": "{\"name2\": \"value2\"}" + } + ] + } + } + }, + "FilteredEventsFunctionMySqsQueue": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "MySqsQueue", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/tests/translator/output/aws-cn/intrinsic_functions.json b/tests/translator/output/aws-cn/intrinsic_functions.json index 370d77440..88052c283 100644 --- a/tests/translator/output/aws-cn/intrinsic_functions.json +++ b/tests/translator/output/aws-cn/intrinsic_functions.json @@ -605,6 +605,19 @@ "MyTable", "StreamArn" ] + }, + "FilterCriteria": { + "Fn::Select": [ + "1", + [ + {}, + { + "Filters": { + "Pattern": "{\"value\": \"b\"}" + } + } + ] + ] } } }, diff --git a/tests/translator/output/aws-us-gov/function_with_event_filtering.json b/tests/translator/output/aws-us-gov/function_with_event_filtering.json new file mode 100644 index 000000000..ca2fc7d17 --- /dev/null +++ b/tests/translator/output/aws-us-gov/function_with_event_filtering.json @@ -0,0 +1,140 @@ +{ + "Resources": { + "KinesisStream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "ShardCount": 1 + } + }, + "DynamoDBTable": { + "Type": "AWS::DynamoDB::Table" + }, + "MySqsQueue": { + "Type": "AWS::SQS::Queue" + }, + "FilteredEventsFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": "sam-demo-bucket", + "S3Key": "filtered_events.zip" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "FilteredEventsFunctionRole", + "Arn" + ] + }, + "Runtime": "nodejs16.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole", + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole", + "arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionDynamoDBStreamEvent": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "DynamoDBTable", + "StreamArn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "TRIM_HORIZON", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{ \"dynamodb\": { \"NewImage\": { \"value\": { \"S\": [\"test\"] } } } }" + } + ] + } + } + }, + "FilteredEventsFunctionKinesisStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "KinesisStream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "LATEST", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + }, + { + "Pattern": "{\"name2\": \"value2\"}" + } + ] + } + } + }, + "FilteredEventsFunctionMySqsQueue": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "MySqsQueue", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/tests/translator/output/aws-us-gov/intrinsic_functions.json b/tests/translator/output/aws-us-gov/intrinsic_functions.json index d62ecebe9..3a87a501d 100644 --- a/tests/translator/output/aws-us-gov/intrinsic_functions.json +++ b/tests/translator/output/aws-us-gov/intrinsic_functions.json @@ -605,6 +605,19 @@ "MyTable", "StreamArn" ] + }, + "FilterCriteria": { + "Fn::Select": [ + "1", + [ + {}, + { + "Filters": { + "Pattern": "{\"value\": \"b\"}" + } + } + ] + ] } } }, diff --git a/tests/translator/output/error_event_filtering.json b/tests/translator/output/error_event_filtering.json new file mode 100644 index 000000000..86e8ecf15 --- /dev/null +++ b/tests/translator/output/error_event_filtering.json @@ -0,0 +1,3 @@ +{ + "errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 3. Resource with id [NotSupportedPullEvent] is invalid. Event with id [KafkaEvent] is invalid. FilterCriteria is only available for DynamoDB, Kinesis, SQS events. Resource with id [NotSupportedPushEventSNSEvent] is invalid. property FilterCriteria not defined for resource of type SNS Resource with id [WrongFilterName] is invalid. Event with id [DynamoDBStreamEvent] is invalid. FilterCriteria field has a wrong format" +} \ No newline at end of file diff --git a/tests/translator/output/function_with_event_filtering.json b/tests/translator/output/function_with_event_filtering.json new file mode 100644 index 000000000..60edd1607 --- /dev/null +++ b/tests/translator/output/function_with_event_filtering.json @@ -0,0 +1,140 @@ +{ + "Resources": { + "KinesisStream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "ShardCount": 1 + } + }, + "DynamoDBTable": { + "Type": "AWS::DynamoDB::Table" + }, + "MySqsQueue": { + "Type": "AWS::SQS::Queue" + }, + "FilteredEventsFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": "sam-demo-bucket", + "S3Key": "filtered_events.zip" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "FilteredEventsFunctionRole", + "Arn" + ] + }, + "Runtime": "nodejs16.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "FilteredEventsFunctionDynamoDBStreamEvent": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "DynamoDBTable", + "StreamArn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "TRIM_HORIZON", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{ \"dynamodb\": { \"NewImage\": { \"value\": { \"S\": [\"test\"] } } } }" + } + ] + } + } + }, + "FilteredEventsFunctionKinesisStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "KinesisStream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "StartingPosition": "LATEST", + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + }, + { + "Pattern": "{\"name2\": \"value2\"}" + } + ] + } + } + }, + "FilteredEventsFunctionMySqsQueue": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "MySqsQueue", + "Arn" + ] + }, + "FunctionName": { + "Ref": "FilteredEventsFunction" + }, + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\"name\": \"value\"}" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/tests/translator/output/intrinsic_functions.json b/tests/translator/output/intrinsic_functions.json index f8793600a..3b8fa89cc 100644 --- a/tests/translator/output/intrinsic_functions.json +++ b/tests/translator/output/intrinsic_functions.json @@ -581,6 +581,19 @@ "MyTable", "StreamArn" ] + }, + "FilterCriteria": { + "Fn::Select": [ + "1", + [ + {}, + { + "Filters": { + "Pattern": "{\"value\": \"b\"}" + } + } + ] + ] } } }, diff --git a/tests/translator/test_translator.py b/tests/translator/test_translator.py index 1cf5673ba..59d8d7c67 100644 --- a/tests/translator/test_translator.py +++ b/tests/translator/test_translator.py @@ -455,6 +455,7 @@ class TestTranslatorEndToEnd(AbstractTestTranslator): "function_with_self_managed_kafka", "function_with_auth_mechanism_for_self_managed_kafka", "function_with_vpc_permission_for_self_managed_kafka", + "function_with_event_filtering", ], [ ("aws", "ap-southeast-1"), diff --git a/versions/2016-10-31.md b/versions/2016-10-31.md index 3794356fe..4be371949 100644 --- a/versions/2016-10-31.md +++ b/versions/2016-10-31.md @@ -517,6 +517,7 @@ DestinationConfig | [Destination Config Object](#destination-config-object) | Ex 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. +FilterCriteria | [AWS Lambda Filter Criteria](#filter-criteria-object) | Configuration to filter messages from the stream before processing **NOTE:** `SQSSendMessagePolicy` or `SNSPublishMessagePolicy` needs to be added in `Policies` for publishing messages to the `SQS` or `SNS` resource mentioned in `OnFailure` property @@ -589,6 +590,7 @@ DestinationConfig | [DestinationConfig Object](#destination-config-object) | Exp 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. +FilterCriteria | [AWS Lambda Filter Criteria](#filter-criteria-object) | Configuration to filter messages from the stream before processing ##### Example: DynamoDB event source object @@ -624,6 +626,7 @@ Property Name | Type | Description Queue | `string` | **Required.** ARN of the SQS queue. BatchSize | `integer` | Maximum number of messages to process per function invocation. Enabled | `boolean` | Indicates whether Lambda begins polling the event source. +FilterCriteria | [AWS Lambda Filter Criteria](#filter-criteria-object) | Configuration to filter messages from the queue before processing ##### Example: SQS event source object