Skip to content

Commit b545b94

Browse files
authoredNov 21, 2024
Merge pull request #3690 from aws/release-v1.94.0
Release 1.94.0 (to main)
2 parents 564d7ad + bd88284 commit b545b94

11 files changed

+514
-1
lines changed
 

‎.cfnlintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ ignore_templates:
137137
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
138138
- tests/translator/output/**/function_with_snapstart.json # Snapstart intentionally not attached to a lambda version which causes lint issues
139139
- tests/translator/output/**/managed_policies_everything.json # intentionally contains wrong arns
140+
- tests/translator/output/**/function_with_provisioned_poller_config.json
140141
- tests/translator/output/**/function_with_metrics_config.json
142+
141143
ignore_checks:
142144
- E2531 # Deprecated runtime; not relevant for transform tests
143145
- E2533 # Another deprecated runtime; not relevant for transform tests

‎samtranslator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.93.0"
1+
__version__ = "1.94.0"

‎samtranslator/internal/schema_source/aws_serverless_function.py

+2
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ class MSKEventProperties(BaseModel):
420420
Topics: PassThroughProp = mskeventproperties("Topics")
421421
SourceAccessConfigurations: Optional[PassThroughProp] = mskeventproperties("SourceAccessConfigurations")
422422
DestinationConfig: Optional[PassThroughProp] # TODO: add documentation
423+
ProvisionedPollerConfig: Optional[PassThroughProp]
423424

424425

425426
class MSKEvent(BaseModel):
@@ -458,6 +459,7 @@ class SelfManagedKafkaEventProperties(BaseModel):
458459
StartingPosition: Optional[PassThroughProp] # TODO: add documentation
459460
StartingPositionTimestamp: Optional[PassThroughProp] # TODO: add documentation
460461
Topics: PassThroughProp = selfmanagedkafkaeventproperties("Topics")
462+
ProvisionedPollerConfig: Optional[PassThroughProp]
461463

462464

463465
class SelfManagedKafkaEvent(BaseModel):

‎samtranslator/model/eventsources/pull.py

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class PullEventSource(ResourceMacro, metaclass=ABCMeta):
5555
"KmsKeyArn": PassThroughProperty(False),
5656
"ConsumerGroupId": PropertyType(False, IS_STR),
5757
"ScalingConfig": PropertyType(False, IS_DICT),
58+
"ProvisionedPollerConfig": PropertyType(False, IS_DICT),
5859
"MetricsConfig": PropertyType(False, IS_DICT),
5960
}
6061

@@ -79,6 +80,7 @@ class PullEventSource(ResourceMacro, metaclass=ABCMeta):
7980
KmsKeyArn: Optional[Intrinsicable[str]]
8081
ConsumerGroupId: Optional[Intrinsicable[str]]
8182
ScalingConfig: Optional[Dict[str, Any]]
83+
ProvisionedPollerConfig: Optional[Dict[str, Any]]
8284
MetricsConfig: Optional[Dict[str, Any]]
8385

8486
@abstractmethod
@@ -147,6 +149,7 @@ def to_cloudformation(self, **kwargs): # type: ignore[no-untyped-def] # noqa: P
147149
lambda_eventsourcemapping.FilterCriteria = self.FilterCriteria
148150
lambda_eventsourcemapping.KmsKeyArn = self.KmsKeyArn
149151
lambda_eventsourcemapping.ScalingConfig = self.ScalingConfig
152+
lambda_eventsourcemapping.ProvisionedPollerConfig = self.ProvisionedPollerConfig
150153
lambda_eventsourcemapping.MetricsConfig = self.MetricsConfig
151154
self._validate_filter_criteria()
152155

‎samtranslator/model/lambda_.py

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class LambdaEventSourceMapping(Resource):
122122
"AmazonManagedKafkaEventSourceConfig": GeneratedProperty(),
123123
"SelfManagedKafkaEventSourceConfig": GeneratedProperty(),
124124
"ScalingConfig": GeneratedProperty(),
125+
"ProvisionedPollerConfig": GeneratedProperty(),
125126
"MetricsConfig": GeneratedProperty(),
126127
}
127128

‎samtranslator/schema/schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -276154,6 +276154,9 @@
276154276154
"markdownDescription": "The maximum amount of time to gather records before invoking the function, in seconds\\. \n*Type*: Integer \n*Required*: No \n*AWS CloudFormation compatibility*: This property is passed directly to the [`MaximumBatchingWindowInSeconds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumbatchingwindowinseconds) property of an `AWS::Lambda::EventSourceMapping` resource\\.",
276155276155
"title": "MaximumBatchingWindowInSeconds"
276156276156
},
276157+
"ProvisionedPollerConfig": {
276158+
"$ref": "#/definitions/PassThroughProp"
276159+
},
276157276160
"SourceAccessConfigurations": {
276158276161
"allOf": [
276159276162
{
@@ -276996,6 +276999,9 @@
276996276999
"KmsKeyArn": {
276997277000
"$ref": "#/definitions/PassThroughProp"
276998277001
},
277002+
"ProvisionedPollerConfig": {
277003+
"$ref": "#/definitions/PassThroughProp"
277004+
},
276999277005
"SourceAccessConfigurations": {
277000277006
"allOf": [
277001277007
{

‎schema_source/sam.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -2421,6 +2421,9 @@
24212421
"markdownDescription": "The maximum amount of time to gather records before invoking the function, in seconds\\. \n*Type*: Integer \n*Required*: No \n*AWS CloudFormation compatibility*: This property is passed directly to the [`MaximumBatchingWindowInSeconds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumbatchingwindowinseconds) property of an `AWS::Lambda::EventSourceMapping` resource\\.",
24222422
"title": "MaximumBatchingWindowInSeconds"
24232423
},
2424+
"ProvisionedPollerConfig": {
2425+
"$ref": "#/definitions/PassThroughProp"
2426+
},
24242427
"SourceAccessConfigurations": {
24252428
"allOf": [
24262429
{
@@ -3194,6 +3197,9 @@
31943197
"KmsKeyArn": {
31953198
"$ref": "#/definitions/PassThroughProp"
31963199
},
3200+
"ProvisionedPollerConfig": {
3201+
"$ref": "#/definitions/PassThroughProp"
3202+
},
31973203
"SourceAccessConfigurations": {
31983204
"allOf": [
31993205
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Resources:
2+
KafkaEventsFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/metricsConfig.zip
6+
Handler: index.handler
7+
Runtime: nodejs16.x
8+
Events:
9+
MyMskEvent:
10+
Type: MSK
11+
Properties:
12+
StartingPosition: LATEST
13+
Stream: !Sub arn:aws:kafka:${AWS::Region}:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2
14+
Topics:
15+
- MyDummyTestTopic
16+
ConsumerGroupId: consumergroup1
17+
ProvisionedPollerConfig:
18+
MinimumPollers: 5
19+
MaximumPollers: 10
20+
MyKafkaCluster:
21+
Type: SelfManagedKafka
22+
Properties:
23+
KafkaBootstrapServers:
24+
- abc.xyz.com:9092
25+
- 123.45.67.89:9096
26+
Topics:
27+
- Topic1
28+
SourceAccessConfigurations:
29+
- Type: SASL_SCRAM_512_AUTH
30+
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c
31+
- Type: VPC_SUBNET
32+
URI: subnet:subnet-12345
33+
- Type: VPC_SECURITY_GROUP
34+
URI: security_group:sg-67890
35+
ConsumerGroupId: consumergroup1
36+
StartingPosition: AT_TIMESTAMP
37+
StartingPositionTimestamp: 1672560000
38+
ProvisionedPollerConfig:
39+
MinimumPollers: 2
40+
MaximumPollers: 100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"Resources": {
3+
"KafkaEventsFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "metricsConfig.zip"
8+
},
9+
"Handler": "index.handler",
10+
"Role": {
11+
"Fn::GetAtt": [
12+
"KafkaEventsFunctionRole",
13+
"Arn"
14+
]
15+
},
16+
"Runtime": "nodejs16.x",
17+
"Tags": [
18+
{
19+
"Key": "lambda:createdBy",
20+
"Value": "SAM"
21+
}
22+
]
23+
},
24+
"Type": "AWS::Lambda::Function"
25+
},
26+
"KafkaEventsFunctionMyKafkaCluster": {
27+
"Properties": {
28+
"FunctionName": {
29+
"Ref": "KafkaEventsFunction"
30+
},
31+
"ProvisionedPollerConfig": {
32+
"MaximumPollers": 100,
33+
"MinimumPollers": 2
34+
},
35+
"SelfManagedEventSource": {
36+
"Endpoints": {
37+
"KafkaBootstrapServers": [
38+
"abc.xyz.com:9092",
39+
"123.45.67.89:9096"
40+
]
41+
}
42+
},
43+
"SelfManagedKafkaEventSourceConfig": {
44+
"ConsumerGroupId": "consumergroup1"
45+
},
46+
"SourceAccessConfigurations": [
47+
{
48+
"Type": "SASL_SCRAM_512_AUTH",
49+
"URI": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c"
50+
},
51+
{
52+
"Type": "VPC_SUBNET",
53+
"URI": "subnet:subnet-12345"
54+
},
55+
{
56+
"Type": "VPC_SECURITY_GROUP",
57+
"URI": "security_group:sg-67890"
58+
}
59+
],
60+
"StartingPosition": "AT_TIMESTAMP",
61+
"StartingPositionTimestamp": 1672560000,
62+
"Topics": [
63+
"Topic1"
64+
]
65+
},
66+
"Type": "AWS::Lambda::EventSourceMapping"
67+
},
68+
"KafkaEventsFunctionMyMskEvent": {
69+
"Properties": {
70+
"AmazonManagedKafkaEventSourceConfig": {
71+
"ConsumerGroupId": "consumergroup1"
72+
},
73+
"EventSourceArn": {
74+
"Fn::Sub": "arn:aws:kafka:${AWS::Region}:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2"
75+
},
76+
"FunctionName": {
77+
"Ref": "KafkaEventsFunction"
78+
},
79+
"ProvisionedPollerConfig": {
80+
"MaximumPollers": 10,
81+
"MinimumPollers": 5
82+
},
83+
"StartingPosition": "LATEST",
84+
"Topics": [
85+
"MyDummyTestTopic"
86+
]
87+
},
88+
"Type": "AWS::Lambda::EventSourceMapping"
89+
},
90+
"KafkaEventsFunctionRole": {
91+
"Properties": {
92+
"AssumeRolePolicyDocument": {
93+
"Statement": [
94+
{
95+
"Action": [
96+
"sts:AssumeRole"
97+
],
98+
"Effect": "Allow",
99+
"Principal": {
100+
"Service": [
101+
"lambda.amazonaws.com"
102+
]
103+
}
104+
}
105+
],
106+
"Version": "2012-10-17"
107+
},
108+
"ManagedPolicyArns": [
109+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
110+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaMSKExecutionRole"
111+
],
112+
"Policies": [
113+
{
114+
"PolicyDocument": {
115+
"Statement": [
116+
{
117+
"Action": [
118+
"secretsmanager:GetSecretValue"
119+
],
120+
"Effect": "Allow",
121+
"Resource": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c"
122+
},
123+
{
124+
"Action": [
125+
"ec2:CreateNetworkInterface",
126+
"ec2:DescribeNetworkInterfaces",
127+
"ec2:DeleteNetworkInterface",
128+
"ec2:DescribeVpcs",
129+
"ec2:DescribeSubnets",
130+
"ec2:DescribeSecurityGroups"
131+
],
132+
"Effect": "Allow",
133+
"Resource": "*"
134+
}
135+
],
136+
"Version": "2012-10-17"
137+
},
138+
"PolicyName": "SelfManagedKafkaExecutionRolePolicy"
139+
}
140+
],
141+
"Tags": [
142+
{
143+
"Key": "lambda:createdBy",
144+
"Value": "SAM"
145+
}
146+
]
147+
},
148+
"Type": "AWS::IAM::Role"
149+
}
150+
}
151+
}

0 commit comments

Comments
 (0)
Failed to load comments.