Skip to content

Commit 5252262

Browse files
authored
Merge pull request #3118 from aws/release-v1.65.0
Release 1.65.0 (to main)
2 parents c916e66 + cc5addd commit 5252262

39 files changed

+58374
-6957
lines changed

bin/run_cfn_lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VENV=.venv_cfn_lint
77
# See https://github.com/aws/serverless-application-model/issues/1042
88
if [ ! -d "${VENV}" ]; then
99
python3 -m venv "${VENV}"
10-
"${VENV}/bin/python" -m pip install cfn-lint --quiet
1110
fi
1211

12+
"${VENV}/bin/python" -m pip install cfn-lint==0.75.0 --upgrade --quiet
1313
"${VENV}/bin/cfn-lint" --format parseable

bin/sam-translate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def transform_template(input_file_path, output_file_path): # type: ignore[no-un
116116
except InvalidDocumentException as e:
117117
error_message = reduce(lambda message, error: message + " " + error.message, e.causes, e.message)
118118
LOG.error(error_message)
119-
errors = map(lambda cause: cause.message, e.causes)
119+
errors = (cause.message for cause in e.causes)
120120
LOG.error(errors)
121121

122122

integration/combination/test_connectors.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def tearDown(self):
5050
("combination/connector_event_rule_to_eb_custom_write",),
5151
("combination/connector_event_rule_to_lambda_write",),
5252
("combination/connector_event_rule_to_lambda_write_multiple",),
53-
("combination/connector_function_to_location_place_index",),
5453
("combination/connector_mix_destination",),
5554
("combination/connector_sqs_to_function",),
5655
("combination/connector_sns_to_function_write",),
@@ -75,6 +74,30 @@ def test_connector_by_invoking_a_function(self, template_file_path):
7574
self.assertEqual(response.get("StatusCode"), 200)
7675
self.assertEqual(response.get("FunctionError"), None)
7776

77+
@parameterized.expand(
78+
[
79+
("combination/connector_function_to_location_place_index",),
80+
]
81+
)
82+
@retry_once
83+
def test_connector_by_invoking_a_function_with_parameters(self, template_file_path):
84+
parameters = []
85+
parameters.append(self.generate_parameter("IndexName", f"PlaceIndex-{generate_suffix()}"))
86+
self.skip_using_service_detector(template_file_path)
87+
self.create_and_verify_stack(template_file_path, parameters)
88+
89+
lambda_function_name = self.get_physical_id_by_logical_id("TriggerFunction")
90+
lambda_client = self.client_provider.lambda_client
91+
92+
request_params = {
93+
"FunctionName": lambda_function_name,
94+
"InvocationType": "RequestResponse",
95+
"Payload": "{}",
96+
}
97+
response = lambda_client.invoke(**request_params)
98+
self.assertEqual(response.get("StatusCode"), 200)
99+
self.assertEqual(response.get("FunctionError"), None)
100+
78101
@parameterized.expand(
79102
[
80103
("combination/connector_sfn_to_function_without_policy",),

integration/resources/templates/combination/connector_function_to_location_place_index.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Transform: AWS::Serverless-2016-10-31-test
22

3+
Parameters:
4+
IndexName:
5+
Type: String
6+
Default: PlaceIndex
7+
38
Resources:
49
TriggerFunction:
510
Type: AWS::Serverless::Function
@@ -35,14 +40,14 @@ Resources:
3540
)
3641
Environment:
3742
Variables:
38-
LOCATION_INDEX: !Sub ${AWS::StackName}-PI
43+
LOCATION_INDEX: !Ref IndexName
3944

4045

4146
MyPlace:
4247
Type: AWS::Location::PlaceIndex
4348
Properties:
4449
DataSource: Here
45-
IndexName: !Sub ${AWS::StackName}-PI
50+
IndexName: !Ref IndexName
4651

4752
MyConnector:
4853
Type: AWS::Serverless::Connector

requirements/dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pytest-xdist>=2.5,<4
44
pytest-env>=0.6,<1
55
pytest-rerunfailures>=9.1,<12
66
pyyaml~=6.0
7-
ruff==0.0.254 # loose the requirement once it is more stable
7+
ruff==0.0.259 # loose the requirement once it is more stable
88

99
# Test requirements
1010
pytest>=6.2,<8

ruff.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ select = [
2020
"RUF", # Ruff-specific rules
2121
"YTT", # flake8-2020
2222
"UP", # pyupgrade
23+
"C4", # flake8-comprehensions
2324
]
2425

2526
# Mininal python version we support is 3.7

samtranslator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.64.0"
1+
__version__ = "1.65.0"

samtranslator/internal/schema_source/aws_serverless_api.py

+182-39
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@
1212
ResourceAttributes,
1313
SamIntrinsicable,
1414
get_prop,
15+
passthrough_prop,
1516
)
1617

18+
PROPERTIES_STEM = "sam-resource-api"
19+
DOMAIN_STEM = "sam-property-api-domainconfiguration"
20+
ROUTE53_STEM = "sam-property-api-route53configuration"
21+
ENDPOINT_CONFIGURATION_STEM = "sam-property-api-endpointconfiguration"
22+
DEFINITION_URI_STEM = "sam-property-api-apidefinition"
23+
1724
resourcepolicy = get_prop("sam-property-api-resourcepolicystatement")
1825
cognitoauthorizeridentity = get_prop("sam-property-api-cognitoauthorizationidentity")
1926
cognitoauthorizer = get_prop("sam-property-api-cognitoauthorizer")
@@ -24,11 +31,11 @@
2431
usageplan = get_prop("sam-property-api-apiusageplan")
2532
auth = get_prop("sam-property-api-apiauth")
2633
cors = get_prop("sam-property-api-corsconfiguration")
27-
route53 = get_prop("sam-property-api-route53configuration")
28-
domain = get_prop("sam-property-api-domainconfiguration")
29-
definitionuri = get_prop("sam-property-api-apidefinition")
30-
endpointconfiguration = get_prop("sam-property-api-endpointconfiguration")
31-
properties = get_prop("sam-resource-api")
34+
route53 = get_prop(ROUTE53_STEM)
35+
domain = get_prop(DOMAIN_STEM)
36+
definitionuri = get_prop(DEFINITION_URI_STEM)
37+
endpointconfiguration = get_prop(ENDPOINT_CONFIGURATION_STEM)
38+
properties = get_prop(PROPERTIES_STEM)
3239

3340

3441
class ResourcePolicy(BaseModel):
@@ -127,10 +134,26 @@ class Cors(BaseModel):
127134

128135

129136
class Route53(BaseModel):
130-
DistributionDomainName: Optional[PassThroughProp] = route53("DistributionDomainName")
131-
EvaluateTargetHealth: Optional[PassThroughProp] = route53("EvaluateTargetHealth")
132-
HostedZoneId: Optional[PassThroughProp] = route53("HostedZoneId")
133-
HostedZoneName: Optional[PassThroughProp] = route53("HostedZoneName")
137+
DistributionDomainName: Optional[PassThroughProp] = passthrough_prop(
138+
ROUTE53_STEM,
139+
"DistributionDomainName",
140+
["AWS::Route53::RecordSetGroup.AliasTarget", "DNSName"],
141+
)
142+
EvaluateTargetHealth: Optional[PassThroughProp] = passthrough_prop(
143+
ROUTE53_STEM,
144+
"EvaluateTargetHealth",
145+
["AWS::Route53::RecordSetGroup.AliasTarget", "EvaluateTargetHealth"],
146+
)
147+
HostedZoneId: Optional[PassThroughProp] = passthrough_prop(
148+
ROUTE53_STEM,
149+
"HostedZoneId",
150+
["AWS::Route53::RecordSetGroup.RecordSet", "HostedZoneId"],
151+
)
152+
HostedZoneName: Optional[PassThroughProp] = passthrough_prop(
153+
ROUTE53_STEM,
154+
"HostedZoneName",
155+
["AWS::Route53::RecordSetGroup.RecordSet", "HostedZoneName"],
156+
)
134157
IpV6: Optional[bool] = route53("IpV6")
135158
SetIdentifier: Optional[PassThroughProp] # TODO: add docs
136159
Region: Optional[PassThroughProp] # TODO: add docs
@@ -141,23 +164,59 @@ class Domain(BaseModel):
141164
BasePath: Optional[PassThroughProp] = domain("BasePath")
142165
NormalizeBasePath: Optional[bool] = domain("NormalizeBasePath")
143166
CertificateArn: PassThroughProp = domain("CertificateArn")
144-
DomainName: PassThroughProp = domain("DomainName")
167+
DomainName: PassThroughProp = passthrough_prop(
168+
DOMAIN_STEM,
169+
"DomainName",
170+
["AWS::ApiGateway::DomainName", "Properties", "DomainName"],
171+
)
145172
EndpointConfiguration: Optional[SamIntrinsicable[Literal["REGIONAL", "EDGE"]]] = domain("EndpointConfiguration")
146-
MutualTlsAuthentication: Optional[PassThroughProp] = domain("MutualTlsAuthentication")
147-
OwnershipVerificationCertificateArn: Optional[PassThroughProp] = domain("OwnershipVerificationCertificateArn")
173+
MutualTlsAuthentication: Optional[PassThroughProp] = passthrough_prop(
174+
DOMAIN_STEM,
175+
"MutualTlsAuthentication",
176+
["AWS::ApiGateway::DomainName", "Properties", "MutualTlsAuthentication"],
177+
)
178+
OwnershipVerificationCertificateArn: Optional[PassThroughProp] = passthrough_prop(
179+
DOMAIN_STEM,
180+
"OwnershipVerificationCertificateArn",
181+
["AWS::ApiGateway::DomainName", "Properties", "OwnershipVerificationCertificateArn"],
182+
)
148183
Route53: Optional[Route53] = domain("Route53")
149-
SecurityPolicy: Optional[PassThroughProp] = domain("SecurityPolicy")
184+
SecurityPolicy: Optional[PassThroughProp] = passthrough_prop(
185+
DOMAIN_STEM,
186+
"SecurityPolicy",
187+
["AWS::ApiGateway::DomainName", "Properties", "SecurityPolicy"],
188+
)
150189

151190

152191
class DefinitionUri(BaseModel):
153-
Bucket: PassThroughProp = definitionuri("Bucket")
154-
Key: PassThroughProp = definitionuri("Key")
155-
Version: Optional[PassThroughProp] = definitionuri("Version")
192+
Bucket: PassThroughProp = passthrough_prop(
193+
DEFINITION_URI_STEM,
194+
"Bucket",
195+
["AWS::ApiGateway::RestApi.S3Location", "Bucket"],
196+
)
197+
Key: PassThroughProp = passthrough_prop(
198+
DEFINITION_URI_STEM,
199+
"Key",
200+
["AWS::ApiGateway::RestApi.S3Location", "Key"],
201+
)
202+
Version: Optional[PassThroughProp] = passthrough_prop(
203+
DEFINITION_URI_STEM,
204+
"Version",
205+
["AWS::ApiGateway::RestApi.S3Location", "Version"],
206+
)
156207

157208

158209
class EndpointConfiguration(BaseModel):
159-
Type: Optional[PassThroughProp] = endpointconfiguration("Type")
160-
VPCEndpointIds: Optional[PassThroughProp] = endpointconfiguration("VPCEndpointIds")
210+
Type: Optional[PassThroughProp] = passthrough_prop(
211+
ENDPOINT_CONFIGURATION_STEM,
212+
"Type",
213+
["AWS::ApiGateway::RestApi.EndpointConfiguration", "Types"],
214+
)
215+
VPCEndpointIds: Optional[PassThroughProp] = passthrough_prop(
216+
ENDPOINT_CONFIGURATION_STEM,
217+
"VPCEndpointIds",
218+
["AWS::ApiGateway::RestApi.EndpointConfiguration", "VpcEndpointIds"],
219+
)
161220

162221

163222
Name = Optional[PassThroughProp]
@@ -180,53 +239,137 @@ class EndpointConfiguration(BaseModel):
180239

181240

182241
class Properties(BaseModel):
183-
AccessLogSetting: Optional[AccessLogSetting] = properties("AccessLogSetting")
184-
ApiKeySourceType: Optional[PassThroughProp] = properties("ApiKeySourceType")
242+
AccessLogSetting: Optional[AccessLogSetting] = passthrough_prop(
243+
PROPERTIES_STEM,
244+
"AccessLogSetting",
245+
["AWS::ApiGateway::Stage", "Properties", "AccessLogSetting"],
246+
)
247+
ApiKeySourceType: Optional[PassThroughProp] = passthrough_prop(
248+
PROPERTIES_STEM,
249+
"ApiKeySourceType",
250+
["AWS::ApiGateway::RestApi", "Properties", "ApiKeySourceType"],
251+
)
185252
Auth: Optional[Auth] = properties("Auth")
186253
BinaryMediaTypes: Optional[BinaryMediaTypes] = properties("BinaryMediaTypes")
187-
CacheClusterEnabled: Optional[CacheClusterEnabled] = properties("CacheClusterEnabled")
188-
CacheClusterSize: Optional[CacheClusterSize] = properties("CacheClusterSize")
189-
CanarySetting: Optional[CanarySetting] = properties("CanarySetting")
254+
CacheClusterEnabled: Optional[CacheClusterEnabled] = passthrough_prop(
255+
PROPERTIES_STEM,
256+
"CacheClusterEnabled",
257+
["AWS::ApiGateway::Stage", "Properties", "CacheClusterEnabled"],
258+
)
259+
CacheClusterSize: Optional[CacheClusterSize] = passthrough_prop(
260+
PROPERTIES_STEM,
261+
"CacheClusterSize",
262+
["AWS::ApiGateway::Stage", "Properties", "CacheClusterSize"],
263+
)
264+
CanarySetting: Optional[CanarySetting] = passthrough_prop(
265+
PROPERTIES_STEM,
266+
"CanarySetting",
267+
["AWS::ApiGateway::Stage", "Properties", "CanarySetting"],
268+
)
190269
Cors: Optional[CorsType] = properties("Cors")
191270
DefinitionBody: Optional[DictStrAny] = properties("DefinitionBody")
192271
DefinitionUri: Optional[DefinitionUriType] = properties("DefinitionUri")
193272
MergeDefinitions: Optional[MergeDefinitions] = properties("MergeDefinitions")
194-
Description: Optional[PassThroughProp] = properties("Description")
273+
Description: Optional[PassThroughProp] = passthrough_prop(
274+
PROPERTIES_STEM,
275+
"Description",
276+
["AWS::ApiGateway::Stage", "Properties", "Description"],
277+
)
195278
DisableExecuteApiEndpoint: Optional[PassThroughProp] = properties("DisableExecuteApiEndpoint")
196279
Domain: Optional[Domain] = properties("Domain")
197280
EndpointConfiguration: Optional[EndpointConfigurationType] = properties("EndpointConfiguration")
198-
FailOnWarnings: Optional[PassThroughProp] = properties("FailOnWarnings")
281+
FailOnWarnings: Optional[PassThroughProp] = passthrough_prop(
282+
PROPERTIES_STEM,
283+
"FailOnWarnings",
284+
["AWS::ApiGateway::RestApi", "Properties", "FailOnWarnings"],
285+
)
199286
GatewayResponses: Optional[GatewayResponses] = properties("GatewayResponses")
200-
MethodSettings: Optional[MethodSettings] = properties("MethodSettings")
201-
MinimumCompressionSize: Optional[MinimumCompressionSize] = properties("MinimumCompressionSize")
202-
Mode: Optional[PassThroughProp] = properties("Mode")
287+
MethodSettings: Optional[MethodSettings] = passthrough_prop(
288+
PROPERTIES_STEM,
289+
"MethodSettings",
290+
["AWS::ApiGateway::Stage", "Properties", "MethodSettings"],
291+
)
292+
MinimumCompressionSize: Optional[MinimumCompressionSize] = passthrough_prop(
293+
PROPERTIES_STEM,
294+
"MinimumCompressionSize",
295+
["AWS::ApiGateway::RestApi", "Properties", "MinimumCompressionSize"],
296+
)
297+
Mode: Optional[PassThroughProp] = passthrough_prop(
298+
PROPERTIES_STEM,
299+
"Mode",
300+
["AWS::ApiGateway::RestApi", "Properties", "Mode"],
301+
)
203302
Models: Optional[DictStrAny] = properties("Models")
204-
Name: Optional[Name] = properties("Name")
303+
Name: Optional[Name] = passthrough_prop(
304+
PROPERTIES_STEM,
305+
"Name",
306+
["AWS::ApiGateway::RestApi", "Properties", "Name"],
307+
)
205308
OpenApiVersion: Optional[OpenApiVersion] = properties("OpenApiVersion")
206309
StageName: SamIntrinsicable[str] = properties("StageName")
207310
Tags: Optional[DictStrAny] = properties("Tags")
208-
TracingEnabled: Optional[TracingEnabled] = properties("TracingEnabled")
209-
Variables: Optional[Variables] = properties("Variables")
311+
TracingEnabled: Optional[TracingEnabled] = passthrough_prop(
312+
PROPERTIES_STEM,
313+
"TracingEnabled",
314+
["AWS::ApiGateway::Stage", "Properties", "TracingEnabled"],
315+
)
316+
Variables: Optional[Variables] = passthrough_prop(
317+
PROPERTIES_STEM,
318+
"Variables",
319+
["AWS::ApiGateway::Stage", "Properties", "Variables"],
320+
)
210321
AlwaysDeploy: Optional[AlwaysDeploy] = properties("AlwaysDeploy")
211322

212323

213324
class Globals(BaseModel):
214325
Auth: Optional[Auth] = properties("Auth")
215-
Name: Optional[Name] = properties("Name")
326+
Name: Optional[Name] = passthrough_prop(
327+
PROPERTIES_STEM,
328+
"Name",
329+
["AWS::ApiGateway::RestApi", "Properties", "Name"],
330+
)
216331
DefinitionUri: Optional[PassThroughProp] = properties("DefinitionUri")
217-
CacheClusterEnabled: Optional[CacheClusterEnabled] = properties("CacheClusterEnabled")
218-
CacheClusterSize: Optional[CacheClusterSize] = properties("CacheClusterSize")
332+
CacheClusterEnabled: Optional[CacheClusterEnabled] = passthrough_prop(
333+
PROPERTIES_STEM,
334+
"CacheClusterEnabled",
335+
["AWS::ApiGateway::Stage", "Properties", "CacheClusterEnabled"],
336+
)
337+
CacheClusterSize: Optional[CacheClusterSize] = passthrough_prop(
338+
PROPERTIES_STEM,
339+
"CacheClusterSize",
340+
["AWS::ApiGateway::Stage", "Properties", "CacheClusterSize"],
341+
)
219342
MergeDefinitions: Optional[MergeDefinitions] = properties("MergeDefinitions")
220-
Variables: Optional[Variables] = properties("Variables")
343+
Variables: Optional[Variables] = passthrough_prop(
344+
PROPERTIES_STEM,
345+
"Variables",
346+
["AWS::ApiGateway::Stage", "Properties", "Variables"],
347+
)
221348
EndpointConfiguration: Optional[PassThroughProp] = properties("EndpointConfiguration")
222349
MethodSettings: Optional[MethodSettings] = properties("MethodSettings")
223350
BinaryMediaTypes: Optional[BinaryMediaTypes] = properties("BinaryMediaTypes")
224-
MinimumCompressionSize: Optional[MinimumCompressionSize] = properties("MinimumCompressionSize")
351+
MinimumCompressionSize: Optional[MinimumCompressionSize] = passthrough_prop(
352+
PROPERTIES_STEM,
353+
"MinimumCompressionSize",
354+
["AWS::ApiGateway::RestApi", "Properties", "MinimumCompressionSize"],
355+
)
225356
Cors: Optional[CorsType] = properties("Cors")
226357
GatewayResponses: Optional[GatewayResponses] = properties("GatewayResponses")
227-
AccessLogSetting: Optional[AccessLogSetting] = properties("AccessLogSetting")
228-
CanarySetting: Optional[CanarySetting] = properties("CanarySetting")
229-
TracingEnabled: Optional[TracingEnabled] = properties("TracingEnabled")
358+
AccessLogSetting: Optional[AccessLogSetting] = passthrough_prop(
359+
PROPERTIES_STEM,
360+
"AccessLogSetting",
361+
["AWS::ApiGateway::Stage", "Properties", "AccessLogSetting"],
362+
)
363+
CanarySetting: Optional[CanarySetting] = passthrough_prop(
364+
PROPERTIES_STEM,
365+
"CanarySetting",
366+
["AWS::ApiGateway::Stage", "Properties", "CanarySetting"],
367+
)
368+
TracingEnabled: Optional[TracingEnabled] = passthrough_prop(
369+
PROPERTIES_STEM,
370+
"TracingEnabled",
371+
["AWS::ApiGateway::Stage", "Properties", "TracingEnabled"],
372+
)
230373
OpenApiVersion: Optional[OpenApiVersion] = properties("OpenApiVersion")
231374
Domain: Optional[Domain] = properties("Domain")
232375
AlwaysDeploy: Optional[AlwaysDeploy] = properties("AlwaysDeploy")

0 commit comments

Comments
 (0)