-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
sam_api_provider.py
644 lines (548 loc) · 26.1 KB
/
sam_api_provider.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
"""Parses SAM given the template"""
import logging
from typing import Dict, List, Optional, Tuple, Union, cast
from samcli.commands.local.lib.swagger.integration_uri import LambdaUri
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException
from samcli.lib.providers.api_collector import ApiCollector
from samcli.lib.providers.cfn_base_api_provider import CfnBaseApiProvider
from samcli.lib.providers.provider import Stack
from samcli.lib.utils.colors import Colored
from samcli.lib.utils.resources import AWS_SERVERLESS_API, AWS_SERVERLESS_FUNCTION, AWS_SERVERLESS_HTTPAPI
from samcli.local.apigw.authorizers.authorizer import Authorizer
from samcli.local.apigw.authorizers.lambda_authorizer import LambdaAuthorizer
from samcli.local.apigw.route import Route
LOG = logging.getLogger(__name__)
class SamApiProvider(CfnBaseApiProvider):
TYPES = [AWS_SERVERLESS_FUNCTION, AWS_SERVERLESS_API, AWS_SERVERLESS_HTTPAPI]
_EVENT_TYPE_API = "Api"
_EVENT_TYPE_HTTP_API = "HttpApi"
_FUNCTION_EVENT = "Events"
_EVENT_PATH = "Path"
_EVENT_METHOD = "Method"
_EVENT_TYPE = "Type"
IMPLICIT_API_RESOURCE_ID = "ServerlessRestApi"
IMPLICIT_HTTP_API_RESOURCE_ID = "ServerlessHttpApi"
_AUTH = "Auth"
_AUTH_HEADER = "Header"
_AUTH_SIMPLE_RESPONSES = "EnableSimpleResponses"
_AUTHORIZER = "Authorizer"
_AUTHORIZERS = "Authorizers"
_DEFAULT_AUTHORIZER = "DefaultAuthorizer"
_FUNCTION_TYPE = "FunctionPayloadType"
_AUTHORIZER_PAYLOAD = "AuthorizerPayloadFormatVersion"
_FUNCTION_ARN = "FunctionArn"
_VALIDATION_EXPRESSION = "ValidationExpression"
_IDENTITY = "Identity"
_IDENTITY_QUERY = "QueryStrings"
_IDENTITY_HEADERS = "Headers"
_IDENTITY_CONTEXT = "Context"
_IDENTITY_STAGE = "StageVariables"
_API_IDENTITY_SOURCE_PREFIX = "method."
_HTTP_IDENTITY_SOURCE_PREFIX = "$"
def extract_resources(
self,
stacks: List[Stack],
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract the Route Object from a given resource and adds it to the RouteCollector.
Parameters
----------
stacks: List[Stack]
List of stacks apis are extracted from
collector: samcli.commands.local.lib.route_collector.ApiCollector
Instance of the API collector that where we will save the API information
cwd : str
Optional working directory with respect to which we will resolve relative path to Swagger file
disable_authorzer : bool
Optional flag to disable collection of lambda authorizers
"""
# AWS::Serverless::Function is currently included when parsing of Apis because when SamBaseProvider is run on
# the template we are creating the implicit apis due to plugins that translate it in the SAM repo,
# which we later merge with the explicit ones in SamApiProvider.merge_apis. This requires the code to be
# parsed here and in InvokeContext.
for stack in stacks:
for logical_id, resource in stack.resources.items():
resource_type = resource.get(CfnBaseApiProvider.RESOURCE_TYPE)
if resource_type == AWS_SERVERLESS_FUNCTION:
self._extract_routes_from_function(
stack.stack_path, logical_id, resource, collector, disable_authorizer=disable_authorizer
)
if resource_type == AWS_SERVERLESS_API:
self._extract_from_serverless_api(
stack.stack_path,
logical_id,
resource,
collector,
cwd=cwd,
disable_authorizer=disable_authorizer,
)
if resource_type == AWS_SERVERLESS_HTTPAPI:
self._extract_from_serverless_http(
stack.stack_path,
logical_id,
resource,
collector,
cwd=cwd,
disable_authorizer=disable_authorizer,
)
collector.routes = self.merge_routes(collector)
def _extract_from_serverless_api(
self,
stack_path: str,
logical_id: str,
api_resource: Dict,
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract APIs from AWS::Serverless::Api resource by reading and parsing Swagger documents. The result is added
to the collector.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of the resource
api_resource : dict
Resource definition, including its properties
collector: samcli.lib.providers.api_collector.ApiCollector
Instance of the API collector that where we will save the API information
cwd : str
Optional working directory with respect to which we will resolve relative path to Swagger file
disable_authorizer : bool
Optional flag to disable the collection of lambda authorizers
"""
properties = api_resource.get("Properties", {})
body = properties.get("DefinitionBody")
uri = properties.get("DefinitionUri")
binary_media = properties.get("BinaryMediaTypes", [])
cors = self.extract_cors(properties.get("Cors", {}))
stage_name = properties.get("StageName")
stage_variables = properties.get("Variables")
if not body and not uri:
# Swagger is not found anywhere.
LOG.debug(
"Skipping resource '%s'. Swagger document not found in DefinitionBody and DefinitionUri", logical_id
)
return
CfnBaseApiProvider.extract_swagger_route(
stack_path, logical_id, body, uri, binary_media, collector, cwd=cwd, disable_authorizer=disable_authorizer
)
collector.stage_name = stage_name
collector.stage_variables = stage_variables
collector.cors = cors
auth = properties.get(SamApiProvider._AUTH, {})
if not auth or disable_authorizer:
LOG.debug("Authorizer not found or disabled, returning early")
return
default_authorizer = auth.get(SamApiProvider._DEFAULT_AUTHORIZER)
if default_authorizer:
collector.set_default_authorizer(logical_id, default_authorizer)
self._extract_authorizers_from_props(logical_id, auth, collector, Route.API)
@staticmethod
def _extract_request_lambda_authorizer(
auth_name: str, function_name: str, prefix: str, properties: dict, event_type: str
) -> LambdaAuthorizer:
"""
Generates a request Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
Name of the authorizer
function_name: str
Name of the Lambda function this authorizer uses
prefix: str
The prefix to prepend to identity sources
properties: dict
The authorizer properties that contains identity sources and authorizer specific properties
event_type: str
The type of API this is (API or HTTP API)
Returns
-------
LambdaAuthorizer
The request based Lambda Authorizer object
"""
payload_version = properties.get(SamApiProvider._AUTHORIZER_PAYLOAD)
if payload_version is not None and not isinstance(payload_version, str):
raise InvalidSamDocumentException(
f"'{SamApiProvider._AUTHORIZER_PAYLOAD}' must be of type string for Lambda Authorizer '{auth_name}'."
)
if payload_version not in LambdaAuthorizer.PAYLOAD_VERSIONS and event_type == Route.HTTP:
raise InvalidSamDocumentException(
f"Lambda Authorizer '{auth_name}' must contain a valid "
f"'{SamApiProvider._AUTHORIZER_PAYLOAD}' for HTTP APIs."
)
simple_responses = properties.get(SamApiProvider._AUTH_SIMPLE_RESPONSES, False)
if simple_responses and payload_version == LambdaAuthorizer.PAYLOAD_V1:
raise InvalidSamDocumentException(
f"{SamApiProvider._AUTH_SIMPLE_RESPONSES} must be used with the 2.0 "
f"payload format version in Lambda Authorizer '{auth_name}'."
)
identity_sources = []
identity_object = properties.get(SamApiProvider._IDENTITY, {})
for query_string in identity_object.get(SamApiProvider._IDENTITY_QUERY, []):
identity_sources.append(f"{prefix}request.querystring.{query_string}")
for header in identity_object.get(SamApiProvider._IDENTITY_HEADERS, []):
identity_sources.append(f"{prefix}request.header.{header}")
# context and stageVariables do not have "method." for V1 APIGW
# but the V2 still expects "$"
prefix = SamApiProvider._HTTP_IDENTITY_SOURCE_PREFIX if event_type == Route.HTTP else ""
for context in identity_object.get(SamApiProvider._IDENTITY_CONTEXT, []):
identity_sources.append(f"{prefix}context.{context}")
for stage_variable in identity_object.get(SamApiProvider._IDENTITY_STAGE, []):
identity_sources.append(f"{prefix}stageVariables.{stage_variable}")
return LambdaAuthorizer(
payload_version=payload_version if payload_version else "1.0",
authorizer_name=auth_name,
type=LambdaAuthorizer.REQUEST,
lambda_name=function_name,
identity_sources=identity_sources,
use_simple_response=simple_responses,
)
@staticmethod
def _extract_token_lambda_authorizer(
auth_name: str, function_name: str, prefix: str, identity_object: dict
) -> LambdaAuthorizer:
"""
Generates a token Lambda Authorizer from the given identity object
Parameters
----------
auth_name: str
Name of the authorizer
function_name: str
Name of the Lambda function this authorizer uses
prefix: str
The prefix to prepend to identity sources
identity_object: dict
The identity source object that contains the various identity sources
Returns
-------
LambdaAuthorizer
The token based Lambda Authorizer object
"""
validation_expression = identity_object.get(SamApiProvider._VALIDATION_EXPRESSION)
header = identity_object.get(SamApiProvider._AUTH_HEADER, "Authorization")
header = f"{prefix}request.header.{header}"
return LambdaAuthorizer(
payload_version=LambdaAuthorizer.PAYLOAD_V1,
authorizer_name=auth_name,
type=LambdaAuthorizer.TOKEN,
lambda_name=function_name,
identity_sources=[header],
validation_string=validation_expression,
)
@staticmethod
def _extract_authorizers_from_props(logical_id: str, auth: dict, collector: ApiCollector, event_type: str) -> None:
"""
Extracts Authorizers from the Auth properties section of Serverless resources
Parameters
----------
logical_id: str
The logical ID of the Serverless resource
auth: dict
The Auth property dictionary
collector: ApiCollector
The Api Collector to send the Authorizers to
event_type: str
What kind of API this is (API, HTTP API)
"""
prefix = (
SamApiProvider._API_IDENTITY_SOURCE_PREFIX
if event_type == Route.API
else SamApiProvider._HTTP_IDENTITY_SOURCE_PREFIX
)
authorizers: Dict[str, Authorizer] = {}
for auth_name, auth_props in auth.get(SamApiProvider._AUTHORIZERS, {}).items():
authorizer_type = auth_props.get(SamApiProvider._FUNCTION_TYPE, LambdaAuthorizer.TOKEN)
identity_object = auth_props.get(SamApiProvider._IDENTITY, {})
function_arn = auth_props.get(SamApiProvider._FUNCTION_ARN)
if not function_arn:
LOG.debug("Authorizer '%s' is currently unsupported (must be a Lambda Authorizer), skipping", auth_name)
continue
function_name = LambdaUri.get_function_name(function_arn)
if not function_name:
LOG.warning("Unable to parse the Lambda ARN for Authorizer '%s', skipping", auth_name)
continue
if authorizer_type == LambdaAuthorizer.REQUEST.upper() or event_type == Route.HTTP:
authorizers[auth_name] = SamApiProvider._extract_request_lambda_authorizer(
auth_name, function_name, prefix, auth_props, event_type
)
elif authorizer_type == LambdaAuthorizer.TOKEN.upper():
authorizers[auth_name] = SamApiProvider._extract_token_lambda_authorizer(
auth_name, function_name, prefix, identity_object
)
else:
LOG.debug(
"Authorizer '%s' is currently unsupported (not of type TOKEN or REQUEST), skipping", auth_name
)
collector.add_authorizers(logical_id, authorizers)
def _extract_from_serverless_http(
self,
stack_path: str,
logical_id: str,
api_resource: Dict,
collector: ApiCollector,
cwd: Optional[str] = None,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Extract APIs from AWS::Serverless::HttpApi resource by reading and parsing Swagger documents.
The result is added to the collector.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of the resource
api_resource : dict
Resource definition, including its properties
collector: samcli.lib.providers.api_collector.ApiCollector
Instance of the API collector that where we will save the API information
cwd : str
Optional working directory with respect to which we will resolve relative path to Swagger file
disable_authorizer : bool
Optional flag to disable the collection of lambda authorizers
"""
properties = api_resource.get("Properties", {})
body = properties.get("DefinitionBody")
uri = properties.get("DefinitionUri")
cors = self.extract_cors_http(properties.get("CorsConfiguration", {}))
stage_name = properties.get("StageName")
stage_variables = properties.get("StageVariables")
if not body and not uri:
# Swagger is not found anywhere.
LOG.debug(
"Skipping resource '%s'. Swagger document not found in DefinitionBody and DefinitionUri", logical_id
)
return
CfnBaseApiProvider.extract_swagger_route(
stack_path,
logical_id,
body,
uri,
None,
collector,
cwd=cwd,
event_type=Route.HTTP,
disable_authorizer=disable_authorizer,
)
collector.stage_name = stage_name
collector.stage_variables = stage_variables
collector.cors = cors
auth = properties.get(SamApiProvider._AUTH, {})
if not auth or disable_authorizer:
LOG.debug("authorizer not found or disabled, returning early")
return
default_authorizer = auth.get(SamApiProvider._DEFAULT_AUTHORIZER)
if default_authorizer:
collector.set_default_authorizer(logical_id, default_authorizer)
self._extract_authorizers_from_props(logical_id, auth, collector, Route.HTTP)
def _extract_routes_from_function(
self,
stack_path: str,
logical_id: str,
function_resource: Dict,
collector: ApiCollector,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Fetches a list of routes configured for this SAM Function resource.
Parameters
----------
stack_path : str
Path of the stack the resource is located
logical_id : str
Logical ID of the resource
function_resource : dict
Contents of the function resource including its properties
collector: samcli.lib.providers.api_collector.ApiCollector
Instance of the API collector that where we will save the API information
disable_authorizer : bool
Optional flag to disable the extraction of authorizers
"""
resource_properties = function_resource.get("Properties", {})
serverless_function_events = resource_properties.get(self._FUNCTION_EVENT, {})
self.extract_routes_from_events(
stack_path, logical_id, serverless_function_events, collector, disable_authorizer=disable_authorizer
)
def extract_routes_from_events(
self,
stack_path: str,
function_logical_id: str,
serverless_function_events: Dict,
collector: ApiCollector,
disable_authorizer: Optional[bool] = False,
) -> None:
"""
Given an AWS::Serverless::Function Event Dictionary, extract out all 'route' events and store within the
collector
Parameters
----------
stack_path : str
Path of the stack the resource is located
function_logical_id : str
LogicalId of the AWS::Serverless::Function
serverless_function_events : dict
Event Dictionary of a AWS::Serverless::Function
collector: samcli.lib.providers.api_collector.ApiCollector
Instance of the Route collector that where we will save the route information
disable_authorizer : bool
Optional flag to disable extraction of authorizers
"""
count = 0
for _, event in serverless_function_events.items():
event_type = event.get(self._EVENT_TYPE)
if event_type in [self._EVENT_TYPE_API, self._EVENT_TYPE_HTTP_API]:
route_resource_id, route = self._convert_event_route(
stack_path,
function_logical_id,
event.get("Properties"),
event.get(SamApiProvider._EVENT_TYPE),
disable_authorizer=disable_authorizer,
)
collector.add_routes(route_resource_id, [route])
count += 1
LOG.debug("Found '%d' API Events in Serverless function with name '%s'", count, function_logical_id)
@staticmethod
def _convert_event_route(
stack_path: str,
lambda_logical_id: str,
event_properties: Dict,
event_type: str,
disable_authorizer: Optional[bool] = False,
) -> Tuple[str, Route]:
"""
Converts a AWS::Serverless::Function's Event Property to an Route configuration usable by the provider.
:param str stack_path: Path of the stack the resource is located
:param str lambda_logical_id: Logical Id of the AWS::Serverless::Function
:param dict event_properties: Dictionary of the Event's Property
:param event_type: The event type, 'Api' or 'HttpApi', see samcli/local/apigw/local_apigw_service.py:35
:param disable_authorizer: Optional flag to disable the extraction of authorizer
:return tuple: tuple of route resource name and route
"""
path = cast(str, event_properties.get(SamApiProvider._EVENT_PATH))
method = cast(str, event_properties.get(SamApiProvider._EVENT_METHOD))
# An RESTAPI (HTTPAPI) Event, can have RestApiId (ApiId) property which designates the resource that owns this
# API. If omitted, the API is owned by Implicit API resource. This could either be a direct resource logical ID
# or a "Ref" of the logicalID
api_resource_id: Union[str, Dict]
payload_format_version: Optional[str] = None
if event_type == SamApiProvider._EVENT_TYPE_API:
api_resource_id = event_properties.get("RestApiId", SamApiProvider.IMPLICIT_API_RESOURCE_ID)
else:
api_resource_id = event_properties.get("ApiId", SamApiProvider.IMPLICIT_HTTP_API_RESOURCE_ID)
payload_format_version = event_properties.get("PayloadFormatVersion")
if isinstance(api_resource_id, dict) and "Ref" in api_resource_id:
api_resource_id = api_resource_id["Ref"]
# This is still a dictionary. Something wrong with the template
if isinstance(api_resource_id, dict):
LOG.debug("Invalid RestApiId property of event %s", event_properties)
raise InvalidSamDocumentException(
"RestApiId property of resource with logicalId '{}' is invalid. "
"It should either be a LogicalId string or a Ref of a Logical Id string".format(lambda_logical_id)
)
use_default_authorizer = True
# Find Authorizer
authorizer_name = event_properties.get(SamApiProvider._AUTH, {}).get(SamApiProvider._AUTHORIZER, None)
if authorizer_name == "NONE" or disable_authorizer:
# do not use any authorizers
use_default_authorizer = False
authorizer_name = None
return (
api_resource_id,
Route(
path=path,
methods=[method],
function_name=lambda_logical_id,
event_type=event_type,
payload_format_version=payload_format_version,
stack_path=stack_path,
authorizer_name=authorizer_name,
use_default_authorizer=use_default_authorizer,
),
)
@staticmethod
def merge_routes(collector: ApiCollector) -> List[Route]:
"""
Quite often, an API is defined both in Implicit and Explicit Route definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two such list of routes with the right order of precedence. If a Path+Method combination is defined
in both the places, only one wins.
In a multi-stack situation, the API defined in the top level wins.
Parameters
----------
collector: samcli.lib.providers.api_collector.ApiCollector
Collector object that holds all the APIs specified in the template
Returns
-------
list of samcli.local.apigw.local_apigw_service.Route
List of routes obtained by combining both the input lists.
"""
implicit_routes = []
explicit_routes = []
# Store implicit and explicit APIs separately in order to merge them later in the correct order
# Implicit APIs are defined on a resource with logicalID ServerlessRestApi
for logical_id, apis in collector:
if logical_id in (SamApiProvider.IMPLICIT_API_RESOURCE_ID, SamApiProvider.IMPLICIT_HTTP_API_RESOURCE_ID):
implicit_routes.extend(apis)
else:
explicit_routes.extend(apis)
# We will use "path+method" combination as key to this dictionary and store the Api config for this combination.
# If an path+method combo already exists, then overwrite it if and only if this is an implicit API
all_routes: Dict[str, Route] = {}
# By adding implicit APIs to the end of the list, they will be iterated last. If a configuration was already
# written by explicit API, it will be overridden by implicit API, just by virtue of order of iteration.
# Within the explicit/implicit APIs, one defined in top level stack has the higher precedence. Here we
# use depth of stack_path to sort APIs (desc).
all_configs = sorted(explicit_routes, key=SamApiProvider._get_route_stack_depth, reverse=True) + sorted(
implicit_routes, key=SamApiProvider._get_route_stack_depth, reverse=True
)
for config in all_configs:
# Normalize the methods before de-duping to allow an ANY method in implicit API to override a regular HTTP
# method on explicit route.
for normalized_method in config.methods:
key = config.path + normalized_method
route = all_routes.get(key)
if route and route.payload_format_version and config.payload_format_version is None:
config.payload_format_version = route.payload_format_version
all_routes[key] = config
result = set(all_routes.values()) # Assign to a set() to de-dupe
LOG.debug(
"Removed duplicates from '%d' Explicit APIs and '%d' Implicit APIs to produce '%d' APIs",
len(explicit_routes),
len(implicit_routes),
len(result),
)
return list(result)
@staticmethod
def _get_route_stack_depth(route: Route) -> int:
"""
Returns stack depth, used for sorted(routes, _get_route_stack_depth).
Examples:
"" (root stack), depth = 0
"A" (1-level nested stack), depth = 1
"A/B/C" (3-level nested stack), depth = 3
"""
if not route.stack_path:
return 0
return route.stack_path.count("/") + 1
@staticmethod
def check_implicit_api_resource_ids(stacks: List[Stack]) -> None:
for stack in stacks:
for logical_id in stack.raw_resources:
if logical_id in (
SamApiProvider.IMPLICIT_API_RESOURCE_ID,
SamApiProvider.IMPLICIT_HTTP_API_RESOURCE_ID,
):
LOG.warning(
Colored().yellow(
'Your template contains a resource with logical ID "%s", '
"which is a reserved logical ID in AWS SAM. "
"It could result in unexpected behaviors and is not recommended."
),
logical_id,
)