Skip to content

Commit 996ba0d

Browse files
authored
Merge pull request #2802 from aws/release-v1.58.0
Release 1.58.0 (to develop)
2 parents ccd6cb7 + c1eb8e4 commit 996ba0d

17 files changed

+1108
-3
lines changed

.cfnlintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ ignore_templates:
115115
- tests/translator/output/**/state_machine_with_event_schedule_state.json
116116
- tests/translator/output/**/state_machine_with_schedule.json
117117
- tests/translator/output/**/state_machine_with_schedule_dlq_retry_policy.json
118+
- tests/translator/output/**/globals_for_function.json # RuntimeManagementConfig
119+
- tests/translator/output/**/function_with_runtime_config.json # RuntimeManagementConfig
118120
ignore_checks:
119121
- E2531 # Deprecated runtime; not relevant for transform tests
120122
- W2531 # EOL runtime; not relevant for transform tests

docs/globals.rst

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Currently, the following resources and properties are being supported:
7373
EventInvokeConfig:
7474
Architectures:
7575
EphemeralStorage:
76+
RuntimeManagementConfig:
7677
7778
Api:
7879
# Properties of AWS::Serverless::Api

samtranslator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.57.0"
1+
__version__ = "1.58.0"

samtranslator/model/lambda_.py

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class LambdaFunction(Resource):
3131
"Architectures": PropertyType(False, list_of(one_of(IS_STR, IS_DICT))),
3232
"SnapStart": PropertyType(False, IS_DICT),
3333
"EphemeralStorage": PropertyType(False, IS_DICT),
34+
"RuntimeManagementConfig": PropertyType(False, IS_DICT),
3435
}
3536

3637
Code: Dict[str, Any]
@@ -56,6 +57,7 @@ class LambdaFunction(Resource):
5657
Architectures: Optional[List[Any]]
5758
SnapStart: Optional[Dict[str, Any]]
5859
EphemeralStorage: Optional[Dict[str, Any]]
60+
RuntimeManagementConfig: Optional[Dict[str, Any]]
5961

6062
runtime_attrs = {"name": lambda self: ref(self.logical_id), "arn": lambda self: fnGetAtt(self.logical_id, "Arn")}
6163

@@ -66,6 +68,7 @@ class LambdaVersion(Resource):
6668
"CodeSha256": PropertyType(False, IS_STR),
6769
"Description": PropertyType(False, IS_STR),
6870
"FunctionName": PropertyType(True, one_of(IS_STR, IS_DICT)),
71+
"RuntimeManagementConfig": PropertyType(False, IS_DICT),
6972
}
7073

7174
runtime_attrs = {

samtranslator/model/sam_resources.py

+4
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class SamFunction(SamResourceMacro):
127127
"Architectures": PropertyType(False, list_of(one_of(IS_STR, IS_DICT))),
128128
"SnapStart": PropertyType(False, IS_DICT),
129129
"FunctionUrlConfig": PropertyType(False, IS_DICT),
130+
"RuntimeManagementConfig": PropertyType(False, IS_DICT),
130131
}
131132

132133
FunctionName: Optional[Intrinsicable[str]]
@@ -530,6 +531,7 @@ def _construct_lambda_function(self) -> LambdaFunction:
530531

531532
lambda_function.CodeSigningConfigArn = self.CodeSigningConfigArn
532533

534+
lambda_function.RuntimeManagementConfig = self.RuntimeManagementConfig # type: ignore[attr-defined]
533535
self._validate_package_type(lambda_function)
534536
self._validate_architectures(lambda_function)
535537
return lambda_function
@@ -893,6 +895,8 @@ def _construct_version(
893895
lambda_version = LambdaVersion(logical_id=logical_id, attributes=attributes)
894896
lambda_version.FunctionName = function.get_runtime_attr("name")
895897
lambda_version.Description = self.VersionDescription
898+
# Copy the same runtime policy for the version and the function
899+
lambda_version.RuntimeManagementConfig = function.RuntimeManagementConfig
896900

897901
return lambda_version
898902

samtranslator/plugins/globals/globals.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List
1+
from typing import Any, Dict, List
22

33
from samtranslator.model.exceptions import ExceptionWithMessage
44
from samtranslator.public.sdk.resource import SamResourceType
@@ -49,6 +49,7 @@ class Globals:
4949
"SnapStart",
5050
"EphemeralStorage",
5151
"FunctionUrlConfig",
52+
"RuntimeManagementConfig",
5253
],
5354
# Everything except
5455
# DefinitionBody: because its hard to reason about merge of Swagger dictionaries
@@ -88,7 +89,7 @@ class Globals:
8889
}
8990
# unreleased_properties *must be* part of supported_properties too
9091
unreleased_properties: Dict[str, List[str]] = {
91-
SamResourceType.Function.value: [],
92+
SamResourceType.Function.value: ["RuntimeManagementConfig"],
9293
}
9394

9495
def __init__(self, template): # type: ignore[no-untyped-def]

samtranslator/schema/aws_serverless_function.py

+3
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ class ScheduleV2Event(BaseModel):
448448
Architectures = Optional[PassThroughProp]
449449
EphemeralStorage = Optional[PassThroughProp]
450450
SnapStart = Optional[PassThroughProp] # TODO: check the type
451+
RuntimeManagementConfig = Optional[PassThroughProp] # TODO: check the type
451452

452453

453454
class Properties(BaseModel):
@@ -507,6 +508,7 @@ class Properties(BaseModel):
507508
Role: Optional[SamIntrinsicable[str]] = prop("Role")
508509
Runtime: Optional[Runtime] = prop("Runtime")
509510
SnapStart: Optional[SnapStart] = prop("SnapStart")
511+
RuntimeManagementConfig: Optional[RuntimeManagementConfig] # TODO: add prop and types
510512
Tags: Optional[Tags] = prop("Tags")
511513
Timeout: Optional[Timeout] = prop("Timeout")
512514
Tracing: Optional[Tracing] = prop("Tracing")
@@ -539,6 +541,7 @@ class Globals(BaseModel):
539541
Architectures: Optional[Architectures] = prop("Architectures")
540542
EphemeralStorage: Optional[EphemeralStorage] = prop("EphemeralStorage")
541543
SnapStart: Optional[SnapStart] = prop("SnapStart")
544+
RuntimeManagementConfig: Optional[RuntimeManagementConfig] # TODO: add prop
542545

543546

544547
class Resource(BaseModel):

samtranslator/schema/sam.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -4478,6 +4478,9 @@
44784478
"markdownDescription": "The identifier of the function's [runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)\\. This property is only required if the `PackageType` property is set to `Zip`\\. \nIf you specify the `provided` identifier for this property, you can use the `Metadata` resource attribute to instruct AWS SAM to build the custom runtime that this function requires\\. For more information about building custom runtimes, see [Building custom runtimes](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/building-custom-runtimes.html)\\.\n*Type*: String \n*Required*: Conditional \n*AWS CloudFormation compatibility*: This property is passed directly to the [`Runtime`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime) property of an `AWS::Lambda::Function` resource\\.",
44794479
"title": "Runtime"
44804480
},
4481+
"RuntimeManagementConfig": {
4482+
"$ref": "#/definitions/PassThroughProp"
4483+
},
44814484
"SnapStart": {
44824485
"allOf": [
44834486
{
@@ -4932,6 +4935,9 @@
49324935
"markdownDescription": "The identifier of the function's [runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)\\. This property is only required if the `PackageType` property is set to `Zip`\\. \nIf you specify the `provided` identifier for this property, you can use the `Metadata` resource attribute to instruct AWS SAM to build the custom runtime that this function requires\\. For more information about building custom runtimes, see [Building custom runtimes](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/building-custom-runtimes.html)\\.\n*Type*: String \n*Required*: Conditional \n*AWS CloudFormation compatibility*: This property is passed directly to the [`Runtime`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime) property of an `AWS::Lambda::Function` resource\\.",
49334936
"title": "Runtime"
49344937
},
4938+
"RuntimeManagementConfig": {
4939+
"$ref": "#/definitions/PassThroughProp"
4940+
},
49354941
"SnapStart": {
49364942
"allOf": [
49374943
{

samtranslator/schema/schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -158011,6 +158011,9 @@
158011158011
"markdownDescription": "The identifier of the function's [runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)\\. This property is only required if the `PackageType` property is set to `Zip`\\. \nIf you specify the `provided` identifier for this property, you can use the `Metadata` resource attribute to instruct AWS SAM to build the custom runtime that this function requires\\. For more information about building custom runtimes, see [Building custom runtimes](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/building-custom-runtimes.html)\\.\n*Type*: String \n*Required*: Conditional \n*AWS CloudFormation compatibility*: This property is passed directly to the [`Runtime`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime) property of an `AWS::Lambda::Function` resource\\.",
158012158012
"title": "Runtime"
158013158013
},
158014+
"RuntimeManagementConfig": {
158015+
"$ref": "#/definitions/PassThroughProp"
158016+
},
158014158017
"SnapStart": {
158015158018
"allOf": [
158016158019
{
@@ -158465,6 +158468,9 @@
158465158468
"markdownDescription": "The identifier of the function's [runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)\\. This property is only required if the `PackageType` property is set to `Zip`\\. \nIf you specify the `provided` identifier for this property, you can use the `Metadata` resource attribute to instruct AWS SAM to build the custom runtime that this function requires\\. For more information about building custom runtimes, see [Building custom runtimes](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/building-custom-runtimes.html)\\.\n*Type*: String \n*Required*: Conditional \n*AWS CloudFormation compatibility*: This property is passed directly to the [`Runtime`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime) property of an `AWS::Lambda::Function` resource\\.",
158466158469
"title": "Runtime"
158467158470
},
158471+
"RuntimeManagementConfig": {
158472+
"$ref": "#/definitions/PassThroughProp"
158473+
},
158468158474
"SnapStart": {
158469158475
"allOf": [
158470158476
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
%YAML 1.1
2+
---
3+
Parameters:
4+
RuntimeVersionParam:
5+
Type: String
6+
RuntimeUpdateParam:
7+
Type: String
8+
9+
Resources:
10+
FunctionWithRuntimeManagementConfig:
11+
Type: AWS::Serverless::Function
12+
Properties:
13+
CodeUri: s3://sam-demo-bucket/hello.zip
14+
Handler: hello.handler
15+
Runtime: python3.8
16+
RuntimeManagementConfig:
17+
UpdateRuntimeOn: Auto
18+
MinimalFunctionWithManualRuntimeManagementConfig:
19+
Type: AWS::Serverless::Function
20+
Properties:
21+
CodeUri: s3://sam-demo-bucket/hello.zip
22+
Handler: hello.handler
23+
Runtime: python3.8
24+
RuntimeManagementConfig:
25+
UpdateRuntimeOn: Manual
26+
RuntimeVersionArn: !Sub arn:aws:lambda:${AWS::Region}::runtime:python3.8::0af1966588ced06e3143ae720245c9b7aeaae213c6921c12c742a166679cc505
27+
FunctionWithRuntimeManagementConfigAndAlias:
28+
Type: AWS::Serverless::Function
29+
Properties:
30+
CodeUri: s3://sam-demo-bucket/hello.zip
31+
Handler: hello.handler
32+
Runtime: python3.8
33+
AutoPublishAlias: live
34+
RuntimeManagementConfig:
35+
UpdateRuntimeOn: Auto
36+
FunctionWithIntrinsicUpdateRuntimeOn:
37+
Type: AWS::Serverless::Function
38+
Properties:
39+
CodeUri: s3://sam-demo-bucket/hello.zip
40+
Handler: hello.handler
41+
Runtime: python3.8
42+
RuntimeManagementConfig:
43+
UpdateRuntimeOn: !Ref RuntimeUpdateParam
44+
FunctionWithIntrinsicRuntimeVersion:
45+
Type: AWS::Serverless::Function
46+
Properties:
47+
CodeUri: s3://sam-demo-bucket/hello.zip
48+
Handler: hello.handler
49+
Runtime: python3.8
50+
RuntimeManagementConfig:
51+
UpdateRuntimeOn: !Ref RuntimeUpdateParam
52+
RuntimeVersionArn: !Ref RuntimeVersionParam

tests/translator/input/globals_for_function.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Globals:
2828
ApplyOn: PublishedVersions
2929
EphemeralStorage:
3030
Size: 1024
31+
RuntimeManagementConfig:
32+
UpdateRuntimeOn: Auto
3133

3234
Resources:
3335
MinimalFunction:
@@ -57,3 +59,5 @@ Resources:
5759
SnapStart:
5860
ApplyOn: None
5961
ReservedConcurrentExecutions: 100
62+
RuntimeManagementConfig:
63+
UpdateRuntimeOn: FunctionChange

0 commit comments

Comments
 (0)