Skip to content

Commit

Permalink
Merge branch 'release-v1.57.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot committed Jan 12, 2023
2 parents 89e6214 + 544d8a9 commit f7ec351
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 1 deletion.
2 changes: 1 addition & 1 deletion samtranslator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.56.0"
__version__ = "1.57.0"
3 changes: 3 additions & 0 deletions samtranslator/model/eventsources/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PullEventSource(ResourceMacro):
"KafkaBootstrapServers": PropertyType(False, is_type(list)),
"FilterCriteria": PropertyType(False, is_type(dict)),
"ConsumerGroupId": PropertyType(False, is_str()),
"ScalingConfig": PropertyType(False, is_type(dict)),
}

Stream: Optional[Intrinsicable[str]]
Expand All @@ -78,6 +79,7 @@ class PullEventSource(ResourceMacro):
KafkaBootstrapServers: Optional[List[Any]]
FilterCriteria: Optional[Dict[str, Any]]
ConsumerGroupId: Optional[Intrinsicable[str]]
ScalingConfig: Optional[Dict[str, Any]]

def get_policy_arn(self): # type: ignore[no-untyped-def]
raise NotImplementedError("Subclass must implement this method")
Expand Down Expand Up @@ -137,6 +139,7 @@ def to_cloudformation(self, **kwargs): # type: ignore[no-untyped-def]
lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds
lambda_eventsourcemapping.FunctionResponseTypes = self.FunctionResponseTypes
lambda_eventsourcemapping.FilterCriteria = self.FilterCriteria
lambda_eventsourcemapping.ScalingConfig = self.ScalingConfig
self._validate_filter_criteria() # type: ignore[no-untyped-call]

if self.KafkaBootstrapServers:
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/lambda_.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class LambdaEventSourceMapping(Resource):
"FilterCriteria": PropertyType(False, is_type(dict)),
"AmazonManagedKafkaEventSourceConfig": PropertyType(False, is_type(dict)),
"SelfManagedKafkaEventSourceConfig": PropertyType(False, is_type(dict)),
"ScalingConfig": PropertyType(False, is_type(dict)),
}

runtime_attrs = {"name": lambda self: ref(self.logical_id)}
Expand Down
1 change: 1 addition & 0 deletions samtranslator/schema/aws_serverless_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class SQSEventProperties(BaseModel):
FilterCriteria: Optional[PassThrough] = sqseventproperties("FilterCriteria")
MaximumBatchingWindowInSeconds: Optional[PassThrough] = sqseventproperties("MaximumBatchingWindowInSeconds")
Queue: PassThrough = sqseventproperties("Queue")
ScalingConfig: Optional[PassThrough] # Update docs when live


class SQSEvent(BaseModel):
Expand Down
3 changes: 3 additions & 0 deletions samtranslator/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2291,6 +2291,9 @@
"title": "Queue",
"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\\.",
"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\\."
},
"ScalingConfig": {
"title": "Scalingconfig"
}
},
"additionalProperties": false
Expand Down
16 changes: 16 additions & 0 deletions tests/translator/input/sqs_with_scaling_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Resources:
SQSFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/queues.zip
Handler: queue.sqs_handler
Runtime: python2.7
Events:
MySqsQueue:
Type: SQS
Properties:
Queue: arn:aws:sqs:us-west-2:012345678901:my-queue
BatchSize: 10
Enabled: false
ScalingConfig:
MaximumConcurrency: 500
72 changes: 72 additions & 0 deletions tests/translator/output/aws-cn/sqs_with_scaling_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Resources": {
"SQSFunction": {
"Properties": {
"Code": {
"S3Bucket": "sam-demo-bucket",
"S3Key": "queues.zip"
},
"Handler": "queue.sqs_handler",
"Role": {
"Fn::GetAtt": [
"SQSFunctionRole",
"Arn"
]
},
"Runtime": "python2.7",
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::Lambda::Function"
},
"SQSFunctionMySqsQueue": {
"Properties": {
"BatchSize": 10,
"Enabled": false,
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
"FunctionName": {
"Ref": "SQSFunction"
},
"ScalingConfig": {
"MaximumConcurrency": 500
}
},
"Type": "AWS::Lambda::EventSourceMapping"
},
"SQSFunctionRole": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}
72 changes: 72 additions & 0 deletions tests/translator/output/aws-us-gov/sqs_with_scaling_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Resources": {
"SQSFunction": {
"Properties": {
"Code": {
"S3Bucket": "sam-demo-bucket",
"S3Key": "queues.zip"
},
"Handler": "queue.sqs_handler",
"Role": {
"Fn::GetAtt": [
"SQSFunctionRole",
"Arn"
]
},
"Runtime": "python2.7",
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::Lambda::Function"
},
"SQSFunctionMySqsQueue": {
"Properties": {
"BatchSize": 10,
"Enabled": false,
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
"FunctionName": {
"Ref": "SQSFunction"
},
"ScalingConfig": {
"MaximumConcurrency": 500
}
},
"Type": "AWS::Lambda::EventSourceMapping"
},
"SQSFunctionRole": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
"arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
"arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}
72 changes: 72 additions & 0 deletions tests/translator/output/sqs_with_scaling_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Resources": {
"SQSFunction": {
"Properties": {
"Code": {
"S3Bucket": "sam-demo-bucket",
"S3Key": "queues.zip"
},
"Handler": "queue.sqs_handler",
"Role": {
"Fn::GetAtt": [
"SQSFunctionRole",
"Arn"
]
},
"Runtime": "python2.7",
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::Lambda::Function"
},
"SQSFunctionMySqsQueue": {
"Properties": {
"BatchSize": 10,
"Enabled": false,
"EventSourceArn": "arn:aws:sqs:us-west-2:012345678901:my-queue",
"FunctionName": {
"Ref": "SQSFunction"
},
"ScalingConfig": {
"MaximumConcurrency": 500
}
},
"Type": "AWS::Lambda::EventSourceMapping"
},
"SQSFunctionRole": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
"arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}

0 comments on commit f7ec351

Please sign in to comment.