Skip to content

Commit c365395

Browse files
committed
Address comments
1 parent 2e8184c commit c365395

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

samtranslator/model/api/api_generator.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -833,14 +833,14 @@ def to_cloudformation(
833833
domain: Union[Resource, None]
834834
basepath_mapping: Union[List[ApiGatewayBasePathMapping], List[ApiGatewayBasePathMappingV2], None]
835835
rest_api = self._construct_rest_api()
836-
if isinstance(self.domain, dict) and self.domain.get("EndpointConfiguration") == "PRIVATE":
837-
api_domain_response = self._construct_api_domain_v2(rest_api, route53_record_set_groups)
838-
domain = api_domain_response.domain
839-
basepath_mapping = api_domain_response.apigw_basepath_mapping_list
840-
else:
841-
api_domain_response = self._construct_api_domain(rest_api, route53_record_set_groups)
842-
domain = api_domain_response.domain
843-
basepath_mapping = api_domain_response.apigw_basepath_mapping_list
836+
api_domain_response = (
837+
self._construct_api_domain_v2(rest_api, route53_record_set_groups)
838+
if isinstance(self.domain, dict) and self.domain.get("EndpointConfiguration") == "PRIVATE"
839+
else self._construct_api_domain(rest_api, route53_record_set_groups)
840+
)
841+
842+
domain = api_domain_response.domain
843+
basepath_mapping = api_domain_response.apigw_basepath_mapping_list
844844

845845
route53_recordsetGroup = api_domain_response.recordset_group
846846

@@ -864,7 +864,6 @@ def to_cloudformation(
864864
List[Resource],
865865
Tuple[Resource],
866866
List[LambdaPermission],
867-
List[Resource],
868867
List[ApiGatewayBasePathMapping],
869868
List[ApiGatewayBasePathMappingV2],
870869
],

tests/translator/input/api_with_custom_domains_private.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Parameters:
66

77
CertificateArn:
88
Type: String
9-
Default: arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd
9+
Default: another-api-arn
1010
Description: ARN of the ACM certificate for the domain
1111

1212
VpcEndpointId:

tests/translator/output/api_with_custom_domains_private.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"Parameters": {
1717
"CertificateArn": {
18-
"Default": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
18+
"Default": "another-api-arn",
1919
"Description": "ARN of the ACM certificate for the domain",
2020
"Type": "String"
2121
},
@@ -33,7 +33,7 @@
3333
"Resources": {
3434
"ApiGatewayDomainNameV27c603ed871": {
3535
"Properties": {
36-
"CertificateArn": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
36+
"CertificateArn": "another-api-arn",
3737
"DomainName": "private.example.com",
3838
"EndpointConfiguration": {
3939
"Types": [
@@ -116,9 +116,9 @@
116116
},
117117
"Type": "AWS::ApiGateway::BasePathMappingV2"
118118
},
119-
"MyApiDeployment305713bc0b": {
119+
"MyApiDeployment7c3b13a843": {
120120
"Properties": {
121-
"Description": "RestApi deployment id: 305713bc0b043df7d6fdb169ecf2f9d9844519da",
121+
"Description": "RestApi deployment id: 7c3b13a843cdd653d1310c6fd7881e8fe8e49da8",
122122
"RestApiId": {
123123
"Ref": "MyApi"
124124
},
@@ -129,7 +129,7 @@
129129
"MyApiprodStage": {
130130
"Properties": {
131131
"DeploymentId": {
132-
"Ref": "MyApiDeployment305713bc0b"
132+
"Ref": "MyApiDeployment7c3b13a843"
133133
},
134134
"RestApiId": {
135135
"Ref": "MyApi"

tests/translator/output/aws-cn/api_with_custom_domains_private.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"Parameters": {
1717
"CertificateArn": {
18-
"Default": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
18+
"Default": "another-api-arn",
1919
"Description": "ARN of the ACM certificate for the domain",
2020
"Type": "String"
2121
},
@@ -33,7 +33,7 @@
3333
"Resources": {
3434
"ApiGatewayDomainNameV27c603ed871": {
3535
"Properties": {
36-
"CertificateArn": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
36+
"CertificateArn": "another-api-arn",
3737
"DomainName": "private.example.com",
3838
"EndpointConfiguration": {
3939
"Types": [
@@ -124,9 +124,9 @@
124124
},
125125
"Type": "AWS::ApiGateway::BasePathMappingV2"
126126
},
127-
"MyApiDeployment305713bc0b": {
127+
"MyApiDeployment7c3b13a843": {
128128
"Properties": {
129-
"Description": "RestApi deployment id: 305713bc0b043df7d6fdb169ecf2f9d9844519da",
129+
"Description": "RestApi deployment id: 7c3b13a843cdd653d1310c6fd7881e8fe8e49da8",
130130
"RestApiId": {
131131
"Ref": "MyApi"
132132
},
@@ -137,7 +137,7 @@
137137
"MyApiprodStage": {
138138
"Properties": {
139139
"DeploymentId": {
140-
"Ref": "MyApiDeployment305713bc0b"
140+
"Ref": "MyApiDeployment7c3b13a843"
141141
},
142142
"RestApiId": {
143143
"Ref": "MyApi"

tests/translator/output/aws-us-gov/api_with_custom_domains_private.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"Parameters": {
1717
"CertificateArn": {
18-
"Default": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
18+
"Default": "another-api-arn",
1919
"Description": "ARN of the ACM certificate for the domain",
2020
"Type": "String"
2121
},
@@ -33,7 +33,7 @@
3333
"Resources": {
3434
"ApiGatewayDomainNameV27c603ed871": {
3535
"Properties": {
36-
"CertificateArn": "arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd",
36+
"CertificateArn": "another-api-arn",
3737
"DomainName": "private.example.com",
3838
"EndpointConfiguration": {
3939
"Types": [
@@ -124,9 +124,9 @@
124124
},
125125
"Type": "AWS::ApiGateway::BasePathMappingV2"
126126
},
127-
"MyApiDeployment305713bc0b": {
127+
"MyApiDeployment7c3b13a843": {
128128
"Properties": {
129-
"Description": "RestApi deployment id: 305713bc0b043df7d6fdb169ecf2f9d9844519da",
129+
"Description": "RestApi deployment id: 7c3b13a843cdd653d1310c6fd7881e8fe8e49da8",
130130
"RestApiId": {
131131
"Ref": "MyApi"
132132
},
@@ -137,7 +137,7 @@
137137
"MyApiprodStage": {
138138
"Properties": {
139139
"DeploymentId": {
140-
"Ref": "MyApiDeployment305713bc0b"
140+
"Ref": "MyApiDeployment7c3b13a843"
141141
},
142142
"RestApiId": {
143143
"Ref": "MyApi"

0 commit comments

Comments
 (0)