|
1 | 1 | {% macro render(action) %} |
2 | 2 | {% include "_roles.rst.j2" %} |
3 | 3 | {% import "group_action_params.rst.j2" as params_tmpl %} |
| 4 | +{% import "group_action_usage.rst.j2" as usage_tmpl %} |
| 5 | +{% import "group_action_samples.rst.j2" as samples_tmpl %} |
| 6 | +{% import "group_action_arguments.rst.j2" as args_tmpl %} |
| 7 | +{% import "group_action_filterable.rst.j2" as filterable_tmpl %} |
| 8 | +{% import "group_action_attributes.rst.j2" as attrs_tmpl %} |
4 | 9 |
|
5 | 10 | {% set action_title = action.action[0] %} |
6 | 11 | {% set action_title_format = "`%s <%s>`_" % (action_title, action.api_documentation_url) if action.api_documentation_url else action_title %} |
|
20 | 25 |
|
21 | 26 | {{ action.description }} |
22 | 27 | {% if action.usage %} |
23 | | - |
24 | | -.. rst-class:: action-subheading |
25 | | - |
26 | | -Usage |
27 | | - |
28 | | -.. rst-class:: action-subheading-description |
29 | | - |
30 | | -The format accepted by this command. |
31 | | - |
32 | | -.. code-block:: bash |
33 | | - |
34 | | -{{ action.usage | indent(first=True) }} |
35 | | - |
| 28 | +{{ usage_tmpl.render(action.usage) }} |
36 | 29 | {% endif %} |
37 | | -{% if action.samples | length > 0 %} |
38 | | - |
39 | | -.. rst-class:: action-subheading |
40 | | - |
41 | | -Sample{% if action.samples | length > 1 %}s{% endif %} |
42 | | - |
43 | | - |
44 | | -.. rst-class:: action-subheading-description |
45 | | - |
46 | | -Examples of how this command might be used. |
47 | | - |
48 | | -{% for sample in action.samples %} |
49 | 30 |
|
50 | | -.. code-block:: bash |
51 | | - |
52 | | -{{ sample | indent(first=True) }} |
53 | | - |
54 | | -{% endfor %} |
| 31 | +{% if action.samples | length > 0 %} |
| 32 | +{{ samples_tmpl.render(action.samples) }} |
55 | 33 | {% endif %} |
56 | | -{{ params_tmpl.render(action) }} |
57 | | -{% if action.argument_sections | length > 0 %} |
58 | | - |
59 | | -.. rst-class:: action-subheading |
60 | | - |
61 | | -Arguments |
62 | | - |
63 | | -.. rst-class:: action-subheading-description |
64 | | - |
65 | | -Additional fields used to execute this request. |
66 | | - |
67 | | -{% for section in action.argument_sections %} |
68 | | -{% if section.name | length > 0 %} |
69 | | -.. _commands_{{ action.command }}_{{ action.action[0] }}_argument_sections_{{ section.name }}: |
70 | | - |
71 | | -.. rst-class:: action-section-header |
72 | | - |
73 | | -{{ section.name }} |
74 | 34 |
|
| 35 | +{% if action.parameters | length > 0 %} |
| 36 | +{{ params_tmpl.render(action.parameters) }} |
75 | 37 | {% endif %} |
76 | | -.. rst-class:: action-argument-section-table |
77 | | - |
78 | | -.. list-table:: |
79 | | - :header-rows: 1 |
80 | | - :width: 100% |
81 | | - :widths: 1 1 1 97 |
82 | | - |
83 | | - * - Name |
84 | | - - Required |
85 | | - - Type |
86 | | - - Description |
87 | | - |
88 | | -{% for argument in section.entries %} |
89 | | - * - :action-table-field-name:`\-\-{{ argument.path }}` |
90 | | - {% if argument.is_parent and argument.path in action.argument_sections_names %} |
91 | | - :ref:`(section) <commands_{{ action.command }}_{{ action.action[0] }}_argument_sections_{{ argument.path }}>` |
92 | | - {% endif %} |
93 | | - - {% if argument.required %}:action-table-field-required:`Yes`{% else %}:action-table-field-optional:`No`{% endif %} |
94 | 38 |
|
95 | | - - :action-table-field-type:`{{ argument.type }}` |
96 | | - - {% if argument.description %}{{ argument.description }}{% else %}N/A{% endif %} |
97 | | - |
98 | | -{% endfor %} |
99 | | -{% endfor %} |
| 39 | +{% if action.argument_sections | length > 0 %} |
| 40 | +{{ args_tmpl.render(action.command, action.action[0], action.argument_sections, action.argument_sections_names) }} |
100 | 41 | {% endif %} |
101 | | -{% if action.filterable_attributes | length > 0 %} |
102 | | - |
103 | | -.. rst-class:: action-subheading |
104 | | - |
105 | | -Filterable Attributes |
106 | | - |
107 | | -.. rst-class:: action-subheading-description |
108 | | - |
109 | | -Arguments used to define a filter for response entries. |
110 | 42 |
|
111 | | -.. rst-class:: action-filterable-field-table |
112 | | - |
113 | | -.. list-table:: |
114 | | - :header-rows: 1 |
115 | | - :width: 100% |
116 | | - :widths: 1 1 98 |
117 | | - |
118 | | - * - Name |
119 | | - - Type |
120 | | - - Description |
121 | | - |
122 | | -{% for attr in action.filterable_attributes %} |
123 | | - * - :action-table-field-name:`\-\-{{ attr.name }}` |
124 | | - - :action-table-field-type:`{{ attr.type }}` |
125 | | - - {% if attr.description %}{{ attr.description }}{% else %}N/A{% endif %} |
126 | | - |
127 | | -{% endfor %} |
| 43 | +{% if action.filterable_attributes | length > 0 %} |
| 44 | +{{ filterable_tmpl.render(action.filterable_attributes) }} |
128 | 45 | {% endif %} |
129 | | -{% if action.attribute_sections | length > 0%} |
130 | | - |
131 | | -.. rst-class:: action-subheading |
132 | | - |
133 | | -Result Attributes |
134 | | - |
135 | | -.. rst-class:: action-subheading-description |
136 | | - |
137 | | -The attributes returned by this command. |
138 | | - |
139 | | -.. rst-class:: action-attribute-table |
140 | | - |
141 | | -{% for section in action.attribute_sections %} |
142 | | -{% if section.name | length > 0 %} |
143 | | -.. _commands_{{ action.command }}_{{ action.action[0] }}_attribute_sections_{{ section.name }}: |
144 | | - |
145 | | -.. rst-class:: action-section-header |
146 | | - |
147 | | -{{ section.name }} |
148 | 46 |
|
| 47 | +{% if action.attribute_sections | length > 0%} |
| 48 | +{{ attrs_tmpl.render(action.command, action.action[0], action.attribute_sections, action.attribute_sections_names) }} |
149 | 49 | {% endif %} |
150 | | -.. rst-class:: action-attribute-section-table |
151 | | - |
152 | | -.. list-table:: |
153 | | - :header-rows: 1 |
154 | | - :width: 100% |
155 | | - :widths: 1 1 1 97 |
156 | | - |
157 | | - * - Name |
158 | | - - Type |
159 | | - - Example |
160 | | - - Description |
161 | 50 |
|
162 | | -{% for attribute in section.entries %} |
163 | | - * - :action-table-field-name:`{{ attribute.name }}` |
164 | | - {% if attribute.name in action.attribute_sections_names %} |
165 | | - :ref:`(section) <commands_{{ action.command }}_{{ action.action[0] }}_attribute_sections_{{ attribute.path }}>` |
166 | | - {% endif %} |
167 | | - - :action-table-field-type:`{{ attribute.type }}` |
168 | | - - {% if attribute.example %}:json:`{{ attribute.example | tojson }}`{% else %}?{% endif %} |
169 | | - |
170 | | - - {% if attribute.description %}{{ attribute.description }}{% else %}N/A{% endif %} |
171 | | - |
172 | | -{% endfor %} |
173 | | -{% endfor %} |
174 | | -{% endif %} |
175 | 51 | {% endmacro %} |
0 commit comments