Skip to content

Commit 46e0be2

Browse files
committed
feat: Stream Analytics
1 parent c074ee8 commit 46e0be2

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

samtranslator/model/eventsources/pull.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class PullEventSource(ResourceMacro):
3434
"Broker": PropertyType(False, is_str()),
3535
"Queues": PropertyType(False, is_type(list)),
3636
"SourceAccessConfigurations": PropertyType(False, is_type(list)),
37+
"TumblingWindowInSeconds": PropertyType(False, is_type(int)),
3738
}
3839

3940
def get_policy_arn(self):
@@ -85,6 +86,7 @@ def to_cloudformation(self, **kwargs):
8586
lambda_eventsourcemapping.Topics = self.Topics
8687
lambda_eventsourcemapping.Queues = self.Queues
8788
lambda_eventsourcemapping.SourceAccessConfigurations = self.SourceAccessConfigurations
89+
lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds
8890

8991
destination_config_policy = None
9092
if self.DestinationConfig:

samtranslator/model/lambda_.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class LambdaEventSourceMapping(Resource):
7575
"Topics": PropertyType(False, is_type(list)),
7676
"Queues": PropertyType(False, is_type(list)),
7777
"SourceAccessConfigurations": PropertyType(False, is_type(list)),
78+
"TumblingWindowInSeconds": PropertyType(False, is_type(int)),
7879
}
7980

8081
runtime_attrs = {"name": lambda self: ref(self.logical_id)}

tests/translator/input/function_with_event_source_mapping.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Resources:
5252
BisectBatchOnFunctionError: true
5353
MaximumRecordAgeInSeconds: 86400
5454
StartingPosition: TRIM_HORIZON
55+
TumblingWindowInSeconds: 60
5556
DestinationConfig:
5657
OnFailure:
5758
Type: SQS

tests/translator/output/aws-cn/function_with_event_source_mapping.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
"StartingPosition": "TRIM_HORIZON",
182182
"ParallelizationFactor": 8,
183183
"MaximumRetryAttempts": 100,
184-
"BisectBatchOnFunctionError": true
184+
"BisectBatchOnFunctionError": true,
185+
"TumblingWindowInSeconds": 60
185186
}
186187
},
187188
"MyFunctionForBatchingExample": {

tests/translator/output/aws-us-gov/function_with_event_source_mapping.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
"StartingPosition": "TRIM_HORIZON",
182182
"ParallelizationFactor": 8,
183183
"MaximumRetryAttempts": 100,
184-
"BisectBatchOnFunctionError": true
184+
"BisectBatchOnFunctionError": true,
185+
"TumblingWindowInSeconds": 60
185186
}
186187
},
187188
"MyFunctionForBatchingExample": {

tests/translator/output/function_with_event_source_mapping.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
"StartingPosition": "TRIM_HORIZON",
182182
"ParallelizationFactor": 8,
183183
"MaximumRetryAttempts": 100,
184-
"BisectBatchOnFunctionError": true
184+
"BisectBatchOnFunctionError": true,
185+
"TumblingWindowInSeconds": 60
185186
}
186187
},
187188
"MyFunctionForBatchingExample": {

versions/2016-10-31.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ BisectBatchOnFunctionError | `boolean` | A boolean flag which determines whether
512512
MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be invoked by Lambda. If an `OnFailure` destination is set, metadata describing the records will be sent to the destination. If no destination is set, the records will be bypassed
513513
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.
514514
ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing.
515+
TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations.
515516

516517
**NOTE:** `SQSSendMessagePolicy` or `SNSPublishMessagePolicy` needs to be added in `Policies` for publishing messages to the `SQS` or `SNS` resource mentioned in `OnFailure` property
517518

@@ -534,6 +535,7 @@ Properties:
534535
OnFailure:
535536
Type: SQS
536537
Destination: !GetAtt MySqsQueue.Arn
538+
TumblingWindowInSeconds: 0
537539
```
538540

539541

@@ -579,6 +581,7 @@ BisectBatchOnFunctionError | `boolean` | A boolean flag which determines whether
579581
MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be invoked by Lambda. If an `OnFailure` destination is set, metadata describing the records will be sent to the destination. If no destination is set, the records will be bypassed
580582
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.
581583
ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing.
584+
TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations.
582585

583586
##### Example: DynamoDB event source object
584587

@@ -598,6 +601,7 @@ Properties:
598601
OnFailure:
599602
Type: SQS
600603
Destination: !GetAtt MySqsQueue.Arn
604+
TumblingWindowInSeconds: 0
601605
```
602606

603607
#### SQS

0 commit comments

Comments
 (0)