Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 1 | tosca_definitions_version: tosca_simple_yaml_1_0 |
| 2 | |
| 3 | node_types: |
| 4 | {% for m in proto.messages %} |
| 5 | tosca.nodes.{{ m.name }}: |
| 6 | derived_from: tosca.nodes.Root |
Matteo Scandolo | 4c14b62 | 2017-08-17 12:25:18 -0700 | [diff] [blame^] | 7 | description: {% if m.options.description -%}{{ m.options.description}}{% else%}"An XOS {{ m.name }}"{%- endif %} |
Matteo Scandolo | 485b713 | 2017-06-30 11:46:47 -0700 | [diff] [blame] | 8 | capabilities: |
| 9 | {{ m.name|lower }}: |
| 10 | type: tosca.capabilities.xos.{{ m.name }} |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 11 | properties: |
Matteo Scandolo | d12be21 | 2017-07-07 10:44:34 -0700 | [diff] [blame] | 12 | must-exist: |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 13 | type: boolean |
| 14 | default: false |
Matteo Scandolo | d12be21 | 2017-07-07 10:44:34 -0700 | [diff] [blame] | 15 | description: Allow to reference existing models in TOSCA recipes |
Matteo Scandolo | 485b713 | 2017-06-30 11:46:47 -0700 | [diff] [blame] | 16 | {% for f in m.fields %} |
| 17 | {%- if not f.link -%} |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 18 | {{ f.name }}: |
Matteo Scandolo | 485b713 | 2017-06-30 11:46:47 -0700 | [diff] [blame] | 19 | type: {{ xproto_tosca_field_type(f.type) }} |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 20 | required: {{ xproto_tosca_required(f.options.null, f.options.blank, f.options.default) }} |
| 21 | description: {{ f.options.help_text }} |
Matteo Scandolo | 485b713 | 2017-06-30 11:46:47 -0700 | [diff] [blame] | 22 | {% endif %} |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 23 | {%- endfor %} |
Matteo Scandolo | 485b713 | 2017-06-30 11:46:47 -0700 | [diff] [blame] | 24 | |
| 25 | {% for l in m.links %} |
| 26 | {%- if l.link_type == "manytoone" -%} |
| 27 | tosca.relationships.BelongsToOne: |
| 28 | derived_from: tosca.relationships.Root |
| 29 | valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ] |
| 30 | {%- endif%} |
| 31 | {%- if l.link_type == "manytomany" -%} |
| 32 | tosca.relationships.BelongsToMany: |
| 33 | derived_from: tosca.relationships.Root |
| 34 | valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ] |
| 35 | {%- endif%} |
| 36 | {% endfor %} |
| 37 | |
| 38 | tosca.capabilities.xos.{{ m.name }}: |
| 39 | derived_from: tosca.capabilities.Root |
| 40 | description: {{ m.name }} |
Matteo Scandolo | 9ce1825 | 2017-06-22 10:48:25 -0700 | [diff] [blame] | 41 | {%- endfor %} |