in samtranslator/model/sam_resources.py [0:0]
def to_cloudformation(self, **kwargs) -> List[Resource]: # type: ignore[no-untyped-def]
"""Returns the API Gateway RestApi, Deployment, and Stage to which this SAM Api corresponds.
:param dict kwargs: already-converted resources that may need to be modified when converting this \
macro to pure CloudFormation
:returns: a list of vanilla CloudFormation Resources, to which this Function expands
:rtype: list
"""
intrinsics_resolver = kwargs["intrinsics_resolver"]
self.BinaryMediaTypes = intrinsics_resolver.resolve_parameter_refs(self.BinaryMediaTypes)
self.Domain = intrinsics_resolver.resolve_parameter_refs(self.Domain)
self.Auth = intrinsics_resolver.resolve_parameter_refs(self.Auth)
redeploy_restapi_parameters = kwargs.get("redeploy_restapi_parameters")
shared_api_usage_plan = kwargs.get("shared_api_usage_plan")
template_conditions = kwargs.get("conditions")
route53_record_set_groups = kwargs.get("route53_record_set_groups", {})
feature_toggle = kwargs.get("feature_toggle")
api_generator = ApiGenerator(
self.logical_id,
self.CacheClusterEnabled,
self.CacheClusterSize,
self.Variables,
self.depends_on,
self.DefinitionBody,
self.DefinitionUri,
self.Name,
self.StageName,
shared_api_usage_plan,
template_conditions,
tags=self.Tags,
endpoint_configuration=self.EndpointConfiguration,
merge_definitions=self.MergeDefinitions,
method_settings=self.MethodSettings,
binary_media=self.BinaryMediaTypes,
minimum_compression_size=self.MinimumCompressionSize,
disable_execute_api_endpoint=self.DisableExecuteApiEndpoint,
cors=self.Cors,
auth=self.Auth,
gateway_responses=self.GatewayResponses,
access_log_setting=self.AccessLogSetting,
canary_setting=self.CanarySetting,
tracing_enabled=self.TracingEnabled,
resource_attributes=self.resource_attributes,
passthrough_resource_attributes=self.get_passthrough_resource_attributes(),
open_api_version=self.OpenApiVersion,
models=self.Models,
domain=self.Domain,
fail_on_warnings=self.FailOnWarnings,
description=self.Description,
mode=self.Mode,
api_key_source_type=self.ApiKeySourceType,
always_deploy=self.AlwaysDeploy,
feature_toggle=feature_toggle,
policy=self.Policy,
)
generated_resources = api_generator.to_cloudformation(redeploy_restapi_parameters, route53_record_set_groups)
self.propagate_tags(generated_resources, self.Tags, self.PropagateTags)
return generated_resources