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