Skip to content

Commit

Permalink
Merge pull request #3690 from aws/release-v1.94.0
Browse files Browse the repository at this point in the history
Release 1.94.0 (to main)
  • Loading branch information
godwingrs22 authored Nov 21, 2024
2 parents 564d7ad + bd88284 commit b545b94
Show file tree
Hide file tree
Showing 11 changed files with 514 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .cfnlintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ ignore_templates:
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
- tests/translator/output/**/function_with_snapstart.json # Snapstart intentionally not attached to a lambda version which causes lint issues
- tests/translator/output/**/managed_policies_everything.json # intentionally contains wrong arns
- tests/translator/output/**/function_with_provisioned_poller_config.json
- tests/translator/output/**/function_with_metrics_config.json

ignore_checks:
- E2531 # Deprecated runtime; not relevant for transform tests
- E2533 # Another deprecated runtime; not relevant for transform tests
Expand Down
2 changes: 1 addition & 1 deletion samtranslator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.93.0"
__version__ = "1.94.0"
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ class MSKEventProperties(BaseModel):
Topics: PassThroughProp = mskeventproperties("Topics")
SourceAccessConfigurations: Optional[PassThroughProp] = mskeventproperties("SourceAccessConfigurations")
DestinationConfig: Optional[PassThroughProp] # TODO: add documentation
ProvisionedPollerConfig: Optional[PassThroughProp]


class MSKEvent(BaseModel):
Expand Down Expand Up @@ -458,6 +459,7 @@ class SelfManagedKafkaEventProperties(BaseModel):
StartingPosition: Optional[PassThroughProp] # TODO: add documentation
StartingPositionTimestamp: Optional[PassThroughProp] # TODO: add documentation
Topics: PassThroughProp = selfmanagedkafkaeventproperties("Topics")
ProvisionedPollerConfig: Optional[PassThroughProp]


class SelfManagedKafkaEvent(BaseModel):
Expand Down
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, metaclass=ABCMeta):
"KmsKeyArn": PassThroughProperty(False),
"ConsumerGroupId": PropertyType(False, IS_STR),
"ScalingConfig": PropertyType(False, IS_DICT),
"ProvisionedPollerConfig": PropertyType(False, IS_DICT),
"MetricsConfig": PropertyType(False, IS_DICT),
}

Expand All @@ -79,6 +80,7 @@ class PullEventSource(ResourceMacro, metaclass=ABCMeta):
KmsKeyArn: Optional[Intrinsicable[str]]
ConsumerGroupId: Optional[Intrinsicable[str]]
ScalingConfig: Optional[Dict[str, Any]]
ProvisionedPollerConfig: Optional[Dict[str, Any]]
MetricsConfig: Optional[Dict[str, Any]]

@abstractmethod
Expand Down Expand Up @@ -147,6 +149,7 @@ def to_cloudformation(self, **kwargs): # type: ignore[no-untyped-def] # noqa: P
lambda_eventsourcemapping.FilterCriteria = self.FilterCriteria
lambda_eventsourcemapping.KmsKeyArn = self.KmsKeyArn
lambda_eventsourcemapping.ScalingConfig = self.ScalingConfig
lambda_eventsourcemapping.ProvisionedPollerConfig = self.ProvisionedPollerConfig
lambda_eventsourcemapping.MetricsConfig = self.MetricsConfig
self._validate_filter_criteria()

Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/lambda_.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class LambdaEventSourceMapping(Resource):
"AmazonManagedKafkaEventSourceConfig": GeneratedProperty(),
"SelfManagedKafkaEventSourceConfig": GeneratedProperty(),
"ScalingConfig": GeneratedProperty(),
"ProvisionedPollerConfig": GeneratedProperty(),
"MetricsConfig": GeneratedProperty(),
}

Expand Down
6 changes: 6 additions & 0 deletions samtranslator/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -276154,6 +276154,9 @@
"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\\.",
"title": "MaximumBatchingWindowInSeconds"
},
"ProvisionedPollerConfig": {
"$ref": "#/definitions/PassThroughProp"
},
"SourceAccessConfigurations": {
"allOf": [
{
Expand Down Expand Up @@ -276996,6 +276999,9 @@
"KmsKeyArn": {
"$ref": "#/definitions/PassThroughProp"
},
"ProvisionedPollerConfig": {
"$ref": "#/definitions/PassThroughProp"
},
"SourceAccessConfigurations": {
"allOf": [
{
Expand Down
6 changes: 6 additions & 0 deletions schema_source/sam.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,9 @@
"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\\.",
"title": "MaximumBatchingWindowInSeconds"
},
"ProvisionedPollerConfig": {
"$ref": "#/definitions/PassThroughProp"
},
"SourceAccessConfigurations": {
"allOf": [
{
Expand Down Expand Up @@ -3194,6 +3197,9 @@
"KmsKeyArn": {
"$ref": "#/definitions/PassThroughProp"
},
"ProvisionedPollerConfig": {
"$ref": "#/definitions/PassThroughProp"
},
"SourceAccessConfigurations": {
"allOf": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Resources:
KafkaEventsFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/metricsConfig.zip
Handler: index.handler
Runtime: nodejs16.x
Events:
MyMskEvent:
Type: MSK
Properties:
StartingPosition: LATEST
Stream: !Sub arn:aws:kafka:${AWS::Region}:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2
Topics:
- MyDummyTestTopic
ConsumerGroupId: consumergroup1
ProvisionedPollerConfig:
MinimumPollers: 5
MaximumPollers: 10
MyKafkaCluster:
Type: SelfManagedKafka
Properties:
KafkaBootstrapServers:
- abc.xyz.com:9092
- 123.45.67.89:9096
Topics:
- Topic1
SourceAccessConfigurations:
- Type: SASL_SCRAM_512_AUTH
URI: arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c
- Type: VPC_SUBNET
URI: subnet:subnet-12345
- Type: VPC_SECURITY_GROUP
URI: security_group:sg-67890
ConsumerGroupId: consumergroup1
StartingPosition: AT_TIMESTAMP
StartingPositionTimestamp: 1672560000
ProvisionedPollerConfig:
MinimumPollers: 2
MaximumPollers: 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"Resources": {
"KafkaEventsFunction": {
"Properties": {
"Code": {
"S3Bucket": "sam-demo-bucket",
"S3Key": "metricsConfig.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"KafkaEventsFunctionRole",
"Arn"
]
},
"Runtime": "nodejs16.x",
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::Lambda::Function"
},
"KafkaEventsFunctionMyKafkaCluster": {
"Properties": {
"FunctionName": {
"Ref": "KafkaEventsFunction"
},
"ProvisionedPollerConfig": {
"MaximumPollers": 100,
"MinimumPollers": 2
},
"SelfManagedEventSource": {
"Endpoints": {
"KafkaBootstrapServers": [
"abc.xyz.com:9092",
"123.45.67.89:9096"
]
}
},
"SelfManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "consumergroup1"
},
"SourceAccessConfigurations": [
{
"Type": "SASL_SCRAM_512_AUTH",
"URI": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c"
},
{
"Type": "VPC_SUBNET",
"URI": "subnet:subnet-12345"
},
{
"Type": "VPC_SECURITY_GROUP",
"URI": "security_group:sg-67890"
}
],
"StartingPosition": "AT_TIMESTAMP",
"StartingPositionTimestamp": 1672560000,
"Topics": [
"Topic1"
]
},
"Type": "AWS::Lambda::EventSourceMapping"
},
"KafkaEventsFunctionMyMskEvent": {
"Properties": {
"AmazonManagedKafkaEventSourceConfig": {
"ConsumerGroupId": "consumergroup1"
},
"EventSourceArn": {
"Fn::Sub": "arn:aws:kafka:${AWS::Region}:012345678901:cluster/mycluster/6cc0432b-8618-4f44-bccc-e1fbd8fb7c4d-2"
},
"FunctionName": {
"Ref": "KafkaEventsFunction"
},
"ProvisionedPollerConfig": {
"MaximumPollers": 10,
"MinimumPollers": 5
},
"StartingPosition": "LATEST",
"Topics": [
"MyDummyTestTopic"
]
},
"Type": "AWS::Lambda::EventSourceMapping"
},
"KafkaEventsFunctionRole": {
"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/AWSLambdaMSKExecutionRole"
],
"Policies": [
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"secretsmanager:GetSecretValue"
],
"Effect": "Allow",
"Resource": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-path/my-secret-name-1a2b3c"
},
{
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface",
"ec2:DescribeVpcs",
"ec2:DescribeSubnets",
"ec2:DescribeSecurityGroups"
],
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "SelfManagedKafkaExecutionRolePolicy"
}
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}
Loading

0 comments on commit b545b94

Please sign in to comment.