heat.engine.cfn.template module

class heat.engine.cfn.template.CfnTemplate(template, *args, **kwargs)[source]

Bases: CfnTemplateBase

CONDITIONS = 'Conditions'
HOT_TO_CFN_RES_ATTRS = {'condition': 'Condition', 'deletion_policy': 'DeletionPolicy', 'depends_on': 'DependsOn', 'metadata': 'Metadata', 'properties': 'Properties', 'type': 'Type', 'update_policy': 'UpdatePolicy'}
OUTPUT_CONDITION = 'Condition'
OUTPUT_KEYS = ('Description', 'Value', 'Condition')
RES_CONDITION = 'Condition'
SECTIONS = ('AWSTemplateFormatVersion', 'HeatTemplateFormatVersion', 'Description', 'Mappings', 'Parameters', 'Resources', 'Outputs', 'Conditions')
SECTIONS_NO_DIRECT_ACCESS = {'AWSTemplateFormatVersion', 'Conditions', 'HeatTemplateFormatVersion', 'Parameters'}
condition_functions = {'Fn::And': <class 'heat.engine.cfn.functions.And'>, 'Fn::Equals': <class 'heat.engine.cfn.functions.Equals'>, 'Fn::FindInMap': <class 'heat.engine.cfn.functions.FindInMap'>, 'Fn::Not': <class 'heat.engine.cfn.functions.Not'>, 'Fn::Or': <class 'heat.engine.cfn.functions.Or'>, 'Ref': <class 'heat.engine.cfn.functions.ParamRef'>}
functions = {'Fn::Base64': <class 'heat.engine.cfn.functions.Base64'>, 'Fn::FindInMap': <class 'heat.engine.cfn.functions.FindInMap'>, 'Fn::GetAZs': <class 'heat.engine.cfn.functions.GetAZs'>, 'Fn::GetAtt': <class 'heat.engine.cfn.functions.GetAtt'>, 'Fn::If': <class 'heat.engine.cfn.functions.If'>, 'Fn::Join': <class 'heat.engine.cfn.functions.Join'>, 'Fn::MemberListToMap': <class 'heat.engine.cfn.functions.MemberListToMap'>, 'Fn::Replace': <class 'heat.engine.cfn.functions.Replace'>, 'Fn::ResourceFacade': <class 'heat.engine.cfn.functions.ResourceFacade'>, 'Fn::Select': <class 'heat.engine.cfn.functions.Select'>, 'Fn::Split': <class 'heat.engine.cfn.functions.Split'>, 'Ref': <function Ref>}
class heat.engine.cfn.template.CfnTemplateBase(template, *args, **kwargs)[source]

Bases: CommonTemplate

The base implementation of cfn template.

ALTERNATE_VERSION = 'HeatTemplateFormatVersion'
DESCRIPTION = 'Description'
HOT_TO_CFN_OUTPUT_ATTRS = {'description': 'Description', 'value': 'Value'}
HOT_TO_CFN_RES_ATTRS = {'condition': 'Condition', 'deletion_policy': 'DeletionPolicy', 'depends_on': 'DependsOn', 'metadata': 'Metadata', 'properties': 'Properties', 'type': 'Type', 'update_policy': 'UpdatePolicy'}
MAPPINGS = 'Mappings'
OUTPUTS = 'Outputs'
OUTPUT_DESCRIPTION = 'Description'
OUTPUT_KEYS = ('Description', 'Value')
OUTPUT_VALUE = 'Value'
PARAMETERS = 'Parameters'
RESOURCES = 'Resources'
RES_DELETION_POLICY = 'DeletionPolicy'
RES_DEPENDS_ON = 'DependsOn'
RES_DESCRIPTION = 'Description'
RES_METADATA = 'Metadata'
RES_PROPERTIES = 'Properties'
RES_TYPE = 'Type'
RES_UPDATE_POLICY = 'UpdatePolicy'
SECTIONS = ('AWSTemplateFormatVersion', 'HeatTemplateFormatVersion', 'Description', 'Mappings', 'Parameters', 'Resources', 'Outputs')
SECTIONS_NO_DIRECT_ACCESS = {'AWSTemplateFormatVersion', 'HeatTemplateFormatVersion', 'Parameters'}
VERSION = 'AWSTemplateFormatVersion'
add_output(definition)[source]

Add an output to the template.

The output is passed as a OutputDefinition object.

add_resource(definition, name=None)[source]

Add a resource to the template.

The resource is passed as a ResourceDefinition object. If no name is specified, the name from the ResourceDefinition should be used.

deletion_policies = {'Delete': 'Delete', 'Retain': 'Retain', 'Snapshot': 'Snapshot'}
functions = {'Fn::Base64': <class 'heat.engine.cfn.functions.Base64'>, 'Fn::FindInMap': <class 'heat.engine.cfn.functions.FindInMap'>, 'Fn::GetAZs': <class 'heat.engine.cfn.functions.GetAZs'>, 'Fn::GetAtt': <class 'heat.engine.cfn.functions.GetAtt'>, 'Fn::Join': <class 'heat.engine.cfn.functions.Join'>, 'Fn::Select': <class 'heat.engine.cfn.functions.Select'>, 'Ref': <function Ref>}
get_section_name(section)[source]

Get the name of a field within a resource or output definition.

Return the name of the given field (specified by the constants given in heat.engine.rsrc_defn and heat.engine.output) in the template format. This is used in error reporting to help users find the location of errors in the template.

Note that ‘section’ here does not refer to a top-level section of the template (like parameters, resources, &c.) as it does everywhere else.

param_schemata(param_defaults=None)[source]

Return a dict of parameters.Schema objects for the parameters.

parameters(stack_identifier, user_params, param_defaults=None)[source]

Return a parameters.Parameters object for the stack.

resource_definitions(stack)[source]

Return a dictionary of ResourceDefinition objects.

class heat.engine.cfn.template.HeatTemplate(template, *args, **kwargs)[source]

Bases: CfnTemplateBase

functions = {'Fn::Base64': <class 'heat.engine.cfn.functions.Base64'>, 'Fn::FindInMap': <class 'heat.engine.cfn.functions.FindInMap'>, 'Fn::GetAZs': <class 'heat.engine.cfn.functions.GetAZs'>, 'Fn::GetAtt': <class 'heat.engine.cfn.functions.GetAtt'>, 'Fn::Join': <class 'heat.engine.cfn.functions.Join'>, 'Fn::MemberListToMap': <class 'heat.engine.cfn.functions.MemberListToMap'>, 'Fn::Replace': <class 'heat.engine.cfn.functions.Replace'>, 'Fn::ResourceFacade': <class 'heat.engine.cfn.functions.ResourceFacade'>, 'Fn::Select': <class 'heat.engine.cfn.functions.Select'>, 'Fn::Split': <class 'heat.engine.cfn.functions.Split'>, 'Ref': <function Ref>}