in rostran/providers/cloudformation/template.py [0:0]
def _transform_parameters(self, out_parameters: Parameters):
cf_params = self.source.get("Parameters")
if not cf_params:
return
association_property_rule = (
self.rule_manager.association_property_rule.association_property
)
cf_param_labels = (
self.source.get("Metadata", {})
.get("AWS::CloudFormation::Interface", {})
.pop("ParameterLabels", {})
)
for name, value in cf_params.items():
cf_param_type = value["Type"]
typer.secho(f"Transforming parameter {name}<{cf_param_type}>")
association_property = None
param_type = "String"
if cf_param_type in Parameter.TYPES:
param_type = cf_param_type
elif cf_param_type == "List<Number>":
param_type = "CommaDelimitedList"
elif cf_param_type in association_property_rule:
rule = association_property_rule[cf_param_type]
if rule.get("Ignore") or not rule.get("To"):
typer.secho(
f" Parameter type {cf_param_type!r} of {name!r} is not supported and will be ignored.",
fg="yellow",
)
else:
association_property = rule["To"]
param_type = rule.get("Type") or param_type
else:
typer.secho(
f" Parameter type {cf_param_type!r} of {name!r} is not supported and will be ignored.",
fg="yellow",
)
parameter = Parameter(
name=name,
type=param_type,
association_property=association_property,
default=value.get("Default"),
description=value.get("Description"),
constraint_description=value.get("ConstraintDescription"),
allowed_values=value.get("AllowedValues"),
allowed_pattern=value.get("AllowedPattern"),
min_length=value.get("MinLength"),
max_length=value.get("MaxLength"),
no_echo=value.get("NoEcho"),
min_value=value.get("MinValue"),
max_value=value.get("MaxValue"),
label=cf_param_labels.get(name, {}).get("default"),
)
out_parameters.add(parameter)