Skip to content

Commit 9820834

Browse files
authored
Merge pull request #2471 from aws/release-v1.50.0
Release 1.50.0 (to develop)
2 parents 27b089e + 8ef69cb commit 9820834

25 files changed

+704
-16
lines changed

docs/cloudformation_compatibility.rst

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,28 @@ SourceAccessConfigurations All
120120

121121
MSK
122122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123-
======================== ================================== ========================
124-
Property Name Intrinsic(s) Supported Reasons
125-
======================== ================================== ========================
126-
Stream All
127-
Topics All
128-
StartingPosition All
129-
======================== ================================== ========================
123+
================================ ================================== ========================
124+
Property Name Intrinsic(s) Supported Reasons
125+
================================ ================================== ========================
126+
MaximumBatchingWindowInSeconds All
127+
Stream All
128+
Topics All
129+
StartingPosition All
130+
ConsumerGroupId All
131+
================================ ================================== ========================
132+
133+
SelfManagedKafka
134+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135+
================================ ================================== ========================
136+
Property Name Intrinsic(s) Supported Reasons
137+
================================ ================================== ========================
138+
BatchSize All
139+
Topics All
140+
KafkaBootstrapServers All
141+
SourceAccessConfigurations All
142+
Enabled All
143+
ConsumerGroupId All
144+
================================ ================================= ========================
130145

131146
DynamoDB
132147
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

integration/combination/test_api_with_authorizer_apikey.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ def test_authorizer_apikey(self):
1919
apigw_client = self.client_provider.api_client
2020

2121
authorizers = apigw_client.get_authorizers(restApiId=rest_api_id)["items"]
22-
lambda_authorizer_uri = (
23-
"arn:aws:apigateway:"
24-
+ self.my_region
25-
+ ":lambda:path/2015-03-31/functions/"
26-
+ stack_outputs["AuthorizerFunctionArn"]
27-
+ "/invocations"
22+
23+
lambda_authorizer_uri = "arn:{}:apigateway:{}:lambda:path/2015-03-31/functions/{}/invocations".format(
24+
self.partition, self.my_region, stack_outputs["AuthorizerFunctionArn"]
2825
)
2926

3027
lambda_token_authorizer = get_authorizer_by_name(authorizers, "MyLambdaTokenAuth")

integration/combination/test_function_with_self_managed_kafka.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from unittest.case import skipIf
12
import pytest
23

34
from integration.helpers.base_test import BaseTest

integration/helpers/base_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def setUpClass(cls):
7272
cls.code_dir = Path(cls.resources_dir, "code")
7373
cls.session = boto3.session.Session()
7474
cls.my_region = cls.session.region_name
75+
cls.partition = cls.session.get_partition_for_region(cls.my_region)
7576
cls.client_provider = ClientProvider()
7677
cls.file_to_s3_uri_map = read_test_config_file("file_to_s3_map_modified.json")
7778
cls.code_key_to_file = read_test_config_file("code_key_to_file_map.json")

samtranslator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.49.0"
1+
__version__ = "1.50.0"

samtranslator/model/eventsources/pull.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class PullEventSource(ResourceMacro):
4646
"FunctionResponseTypes": PropertyType(False, is_type(list)),
4747
"KafkaBootstrapServers": PropertyType(False, is_type(list)),
4848
"FilterCriteria": PropertyType(False, is_type(dict)),
49+
"ConsumerGroupId": PropertyType(False, is_str()),
4950
}
5051

5152
def get_policy_arn(self):
@@ -112,6 +113,17 @@ def to_cloudformation(self, **kwargs):
112113
lambda_eventsourcemapping.SelfManagedEventSource = {
113114
"Endpoints": {"KafkaBootstrapServers": self.KafkaBootstrapServers}
114115
}
116+
if self.ConsumerGroupId:
117+
consumer_group_id_structure = {"ConsumerGroupId": self.ConsumerGroupId}
118+
if self.resource_type == "MSK":
119+
lambda_eventsourcemapping.AmazonManagedKafkaConfig = consumer_group_id_structure
120+
elif self.resource_type == "SelfManagedKafka":
121+
lambda_eventsourcemapping.SelfManagedKafkaConfig = consumer_group_id_structure
122+
else:
123+
raise InvalidEventException(
124+
self.logical_id,
125+
"Property ConsumerGroupId not defined for resource of type {}.".format(self.resource_type),
126+
)
115127

116128
destination_config_policy = None
117129
if self.DestinationConfig:

samtranslator/model/lambda_.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class LambdaEventSourceMapping(Resource):
8181
"FunctionResponseTypes": PropertyType(False, is_type(list)),
8282
"SelfManagedEventSource": PropertyType(False, is_type(dict)),
8383
"FilterCriteria": PropertyType(False, is_type(dict)),
84+
"AmazonManagedKafkaConfig": PropertyType(False, is_type(dict)),
85+
"SelfManagedKafkaConfig": PropertyType(False, is_type(dict)),
8486
}
8587

8688
runtime_attrs = {"name": lambda self: ref(self.logical_id)}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Resources:
2+
NotSupportedPullTrigger:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/filtered_events.zip
6+
Handler: index.handler
7+
Runtime: nodejs16.x
8+
Events:
9+
DDBEvent:
10+
Type: DynamoDB
11+
Properties:
12+
Stream: arn:aws:dynamodb:us-east-1:012345678901:table/TestTable/stream/2015-05-11T21:21:33.291
13+
StartingPosition: TRIM_HORIZON
14+
ConsumerGroupId: consumergroup1
15+
16+
NotSupportedPushTrigger:
17+
Type: AWS::Serverless::Function
18+
Properties:
19+
CodeUri: s3://sam-demo-bucket/filtered_events.zip
20+
Handler: index.handler
21+
Runtime: nodejs16.x
22+
Events:
23+
SNSEvent:
24+
Type: SNS
25+
Properties:
26+
Topic: arn:aws:sns:us-east-1:123456789012:my_topic
27+
ConsumerGroupId: consumergroup1
28+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Parameters: {}
3+
4+
Resources:
5+
MyMskStreamProcessor:
6+
Type: AWS::Serverless::Function
7+
Properties:
8+
Runtime: nodejs12.x
9+
Handler: index.handler
10+
CodeUri: s3://sam-demo-bucket/kafka.zip
11+
Events:
12+
MyMskEvent:
13+
Type: MSK
14+
Properties:
15+
StartingPosition: LATEST
16+
Stream: !Sub arn:aws:kafka:${AWS::Region}:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2
17+
Topics:
18+
- "MyDummyTestTopic"
19+
ConsumerGroupId: consumergroup1
20+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Parameters:
3+
StartingPositionValue:
4+
Type: String
5+
Default: LATEST
6+
7+
StreamValue:
8+
Type: String
9+
Default: arn:aws:kafka:us-east-1:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2
10+
11+
TopicsValue:
12+
Type: CommaDelimitedList
13+
Default: Topic
14+
15+
ConsumerGroupValue:
16+
Type: String
17+
Default: consumergroup1
18+
19+
20+
Resources:
21+
MyMskStreamProcessor:
22+
Type: AWS::Serverless::Function
23+
Properties:
24+
Runtime: nodejs12.x
25+
Handler: index.handler
26+
CodeUri: s3://sam-demo-bucket/kafka.zip
27+
Events:
28+
MyMskEvent:
29+
Type: MSK
30+
Properties:
31+
StartingPosition: !Ref StartingPositionValue
32+
Stream: !Ref StreamValue
33+
Topics: !Ref TopicsValue
34+
ConsumerGroupId: !Ref ConsumerGroupValue
35+

0 commit comments

Comments
 (0)