heat.common.template_format 模块

heat.common.template_format.convert_json_to_yaml(json_str)[source]

将 AWS JSON 模板格式转换为 Heat YAML 格式。

参数:

json_str – 包含 AWS JSON 模板格式的字符串。

返回值:

包含 Heat YAML 格式的等效字符串。

heat.common.template_format.parse(tmpl_str, tmpl_url=None)[source]

接收一个字符串并返回一个包含解析结构的字典。

这包括确定字符串是使用 JSON 还是 YAML 格式。

heat.common.template_format.simple_parse(tmpl_str, tmpl_url=None)[source]
heat.common.template_format.validate_template_limit(contain_str)[source]

验证模板的限制。

检查内容是否超过允许的大小范围。

class heat.common.template_format.yaml_dumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]

基础: CSafeDumper

represent_ordered_dict(data)[source]
yaml_representers = {'<class 'NoneType'>': <function SafeRepresenter.represent_none>, <class 'bool'>': <function SafeRepresenter.represent_bool>, <class 'bytes'>': <function SafeRepresenter.represent_binary>, <class 'collections.OrderedDict'>': <function yaml_dumper.represent_ordered_dict>, <class 'datetime.date'>': <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>': <function SafeRepresenter.represent_datetime>, <class 'dict'>': <function SafeRepresenter.represent_dict>, <class 'float'>': <function SafeRepresenter.represent_float>, <class 'int'>': <function SafeRepresenter.represent_int>, <class 'list'>': <function SafeRepresenter.represent_list>, <class 'set'>': <function SafeRepresenter.represent_set>, <class 'str'>': <function SafeRepresenter.represent_str>, <class 'tuple'>': <function SafeRepresenter.represent_list>, None: <function SafeRepresenter.represent_undefined>}
class heat.common.template_format.yaml_loader(stream)[source]

基础: CSafeLoader

yaml_constructors = {'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function yaml_loader._construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function yaml_loader._construct_yaml_str>, None: <function SafeConstructor.construct_undefined>}