Skip to content

Commit 264d14a

Browse files
authored
Merge branch 'main' into release-v1.58.0
2 parents d22d12b + f7ec351 commit 264d14a

File tree

8 files changed

+240
-0
lines changed

8 files changed

+240
-0
lines changed

samtranslator/model/eventsources/pull.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class PullEventSource(ResourceMacro, metaclass=ABCMeta):
5454
"KafkaBootstrapServers": PropertyType(False, is_type(list)),
5555
"FilterCriteria": PropertyType(False, IS_DICT),
5656
"ConsumerGroupId": PropertyType(False, IS_STR),
57+
"ScalingConfig": PropertyType(False, IS_DICT),
5758
}
5859

5960
BatchSize: Optional[Intrinsicable[int]]
@@ -75,6 +76,7 @@ class PullEventSource(ResourceMacro, metaclass=ABCMeta):
7576
KafkaBootstrapServers: Optional[List[Any]]
7677
FilterCriteria: Optional[Dict[str, Any]]
7778
ConsumerGroupId: Optional[Intrinsicable[str]]
79+
ScalingConfig: Optional[Dict[str, Any]]
7880

7981
@abstractmethod
8082
def get_policy_arn(self) -> Optional[str]:
@@ -132,6 +134,7 @@ def to_cloudformation(self, **kwargs): # type: ignore[no-untyped-def]
132134
lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds
133135
lambda_eventsourcemapping.FunctionResponseTypes = self.FunctionResponseTypes
134136
lambda_eventsourcemapping.FilterCriteria = self.FilterCriteria
137+
lambda_eventsourcemapping.ScalingConfig = self.ScalingConfig
135138
self._validate_filter_criteria() # type: ignore[no-untyped-call]
136139

137140
if self.KafkaBootstrapServers:

samtranslator/model/lambda_.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class LambdaEventSourceMapping(Resource):
114114
"FilterCriteria": PropertyType(False, IS_DICT),
115115
"AmazonManagedKafkaEventSourceConfig": PropertyType(False, IS_DICT),
116116
"SelfManagedKafkaEventSourceConfig": PropertyType(False, IS_DICT),
117+
"ScalingConfig": PropertyType(False, IS_DICT),
117118
}
118119

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

samtranslator/schema/aws_serverless_function.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class SQSEventProperties(BaseModel):
195195
FilterCriteria: Optional[PassThrough] = sqseventproperties("FilterCriteria")
196196
MaximumBatchingWindowInSeconds: Optional[PassThrough] = sqseventproperties("MaximumBatchingWindowInSeconds")
197197
Queue: PassThrough = sqseventproperties("Queue")
198+
ScalingConfig: Optional[PassThrough] # Update docs when live
198199

199200

200201
class SQSEvent(BaseModel):

samtranslator/schema/schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,9 @@
23002300
"title": "Queue",
23012301
"description": "The ARN of the queue\\. \n*Type*: String \n*Required*: Yes \n*AWS CloudFormation compatibility*: This property is passed directly to the [`EventSourceArn`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn) property of an `AWS::Lambda::EventSourceMapping` resource\\.",
23022302
"markdownDescription": "The ARN of the queue\\. \n*Type*: String \n*Required*: Yes \n*AWS CloudFormation compatibility*: This property is passed directly to the [`EventSourceArn`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn) property of an `AWS::Lambda::EventSourceMapping` resource\\."
2303+
},
2304+
"ScalingConfig": {
2305+
"title": "Scalingconfig"
23032306
}
23042307
},
23052308
"additionalProperties": false
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Resources:
2+
SQSFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/queues.zip
6+
Handler: queue.sqs_handler
7+
Runtime: python2.7
8+
Events:
9+
MySqsQueue:
10+
Type: SQS
11+
Properties:
12+
Queue: arn:aws:sqs:us-west-2:012345678901:my-queue
13+
BatchSize: 10
14+
Enabled: false
15+
ScalingConfig:
16+
MaximumConcurrency: 500
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"Resources": {
3+
"SQSFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "queues.zip"
8+
},
9+
"Handler": "queue.sqs_handler",
10+
"Role": {
11+
"Fn::GetAtt": [
12+
"SQSFunctionRole",
13+
"Arn"
14+
]
15+
},
16+
"Runtime": "python2.7",
17+
"Tags": [
18+
{
19+
"Key": "lambda:createdBy",
20+
"Value": "SAM"
21+
}
22+
]
23+
},
24+
"Type": "AWS::Lambda::Function"
25+
},
26+
"SQSFunctionMySqsQueue": {
27+
"Properties": {
28+
"BatchSize": 10,
29+
"Enabled": false,
30+
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
31+
"FunctionName": {
32+
"Ref": "SQSFunction"
33+
},
34+
"ScalingConfig": {
35+
"MaximumConcurrency": 500
36+
}
37+
},
38+
"Type": "AWS::Lambda::EventSourceMapping"
39+
},
40+
"SQSFunctionRole": {
41+
"Properties": {
42+
"AssumeRolePolicyDocument": {
43+
"Statement": [
44+
{
45+
"Action": [
46+
"sts:AssumeRole"
47+
],
48+
"Effect": "Allow",
49+
"Principal": {
50+
"Service": [
51+
"lambda.amazonaws.com"
52+
]
53+
}
54+
}
55+
],
56+
"Version": "2012-10-17"
57+
},
58+
"ManagedPolicyArns": [
59+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
60+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
61+
],
62+
"Tags": [
63+
{
64+
"Key": "lambda:createdBy",
65+
"Value": "SAM"
66+
}
67+
]
68+
},
69+
"Type": "AWS::IAM::Role"
70+
}
71+
}
72+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"Resources": {
3+
"SQSFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "queues.zip"
8+
},
9+
"Handler": "queue.sqs_handler",
10+
"Role": {
11+
"Fn::GetAtt": [
12+
"SQSFunctionRole",
13+
"Arn"
14+
]
15+
},
16+
"Runtime": "python2.7",
17+
"Tags": [
18+
{
19+
"Key": "lambda:createdBy",
20+
"Value": "SAM"
21+
}
22+
]
23+
},
24+
"Type": "AWS::Lambda::Function"
25+
},
26+
"SQSFunctionMySqsQueue": {
27+
"Properties": {
28+
"BatchSize": 10,
29+
"Enabled": false,
30+
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
31+
"FunctionName": {
32+
"Ref": "SQSFunction"
33+
},
34+
"ScalingConfig": {
35+
"MaximumConcurrency": 500
36+
}
37+
},
38+
"Type": "AWS::Lambda::EventSourceMapping"
39+
},
40+
"SQSFunctionRole": {
41+
"Properties": {
42+
"AssumeRolePolicyDocument": {
43+
"Statement": [
44+
{
45+
"Action": [
46+
"sts:AssumeRole"
47+
],
48+
"Effect": "Allow",
49+
"Principal": {
50+
"Service": [
51+
"lambda.amazonaws.com"
52+
]
53+
}
54+
}
55+
],
56+
"Version": "2012-10-17"
57+
},
58+
"ManagedPolicyArns": [
59+
"arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
60+
"arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
61+
],
62+
"Tags": [
63+
{
64+
"Key": "lambda:createdBy",
65+
"Value": "SAM"
66+
}
67+
]
68+
},
69+
"Type": "AWS::IAM::Role"
70+
}
71+
}
72+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"Resources": {
3+
"SQSFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "queues.zip"
8+
},
9+
"Handler": "queue.sqs_handler",
10+
"Role": {
11+
"Fn::GetAtt": [
12+
"SQSFunctionRole",
13+
"Arn"
14+
]
15+
},
16+
"Runtime": "python2.7",
17+
"Tags": [
18+
{
19+
"Key": "lambda:createdBy",
20+
"Value": "SAM"
21+
}
22+
]
23+
},
24+
"Type": "AWS::Lambda::Function"
25+
},
26+
"SQSFunctionMySqsQueue": {
27+
"Properties": {
28+
"BatchSize": 10,
29+
"Enabled": false,
30+
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
31+
"FunctionName": {
32+
"Ref": "SQSFunction"
33+
},
34+
"ScalingConfig": {
35+
"MaximumConcurrency": 500
36+
}
37+
},
38+
"Type": "AWS::Lambda::EventSourceMapping"
39+
},
40+
"SQSFunctionRole": {
41+
"Properties": {
42+
"AssumeRolePolicyDocument": {
43+
"Statement": [
44+
{
45+
"Action": [
46+
"sts:AssumeRole"
47+
],
48+
"Effect": "Allow",
49+
"Principal": {
50+
"Service": [
51+
"lambda.amazonaws.com"
52+
]
53+
}
54+
}
55+
],
56+
"Version": "2012-10-17"
57+
},
58+
"ManagedPolicyArns": [
59+
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
60+
"arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
61+
],
62+
"Tags": [
63+
{
64+
"Key": "lambda:createdBy",
65+
"Value": "SAM"
66+
}
67+
]
68+
},
69+
"Type": "AWS::IAM::Role"
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)