Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dynamic_virtualwanlink_members.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_dynamic_virtualwanlink_members
15 short_description: FortiGate interfaces added to the virtual-wan-link.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 dynamic_virtualwanlink_members:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comment:
34 type: str
35 description: Comment.
36 cost:
37 type: int
38 description: Cost.
39 detect_failtime:
40 aliases: ['detect-failtime']
41 type: int
42 description: Detect failtime.
43 detect_http_get:
44 aliases: ['detect-http-get']
45 type: str
46 description: Detect http get.
47 detect_http_match:
48 aliases: ['detect-http-match']
49 type: str
50 description: Detect http match.
51 detect_http_port:
52 aliases: ['detect-http-port']
53 type: int
54 description: Detect http port.
55 detect_interval:
56 aliases: ['detect-interval']
57 type: int
58 description: Detect interval.
59 detect_protocol:
60 aliases: ['detect-protocol']
61 type: str
62 description: Detect protocol.
63 choices: ['ping', 'tcp-echo', 'udp-echo', 'http']
64 detect_recoverytime:
65 aliases: ['detect-recoverytime']
66 type: int
67 description: Detect recoverytime.
68 detect_server:
69 aliases: ['detect-server']
70 type: str
71 description: Detect server.
72 detect_timeout:
73 aliases: ['detect-timeout']
74 type: int
75 description: Detect timeout.
76 dynamic_mapping:
77 type: list
78 elements: dict
79 description: Dynamic mapping.
80 suboptions:
81 _scope:
82 type: list
83 elements: dict
84 description: Scope.
85 suboptions:
86 name:
87 type: str
88 description: Name.
89 vdom:
90 type: str
91 description: Vdom.
92 comment:
93 type: str
94 description: Comment.
95 cost:
96 type: int
97 description: Cost.
98 detect_failtime:
99 aliases: ['detect-failtime']
100 type: int
101 description: Detect failtime.
102 detect_http_get:
103 aliases: ['detect-http-get']
104 type: str
105 description: Detect http get.
106 detect_http_match:
107 aliases: ['detect-http-match']
108 type: str
109 description: Detect http match.
110 detect_http_port:
111 aliases: ['detect-http-port']
112 type: int
113 description: Detect http port.
114 detect_interval:
115 aliases: ['detect-interval']
116 type: int
117 description: Detect interval.
118 detect_protocol:
119 aliases: ['detect-protocol']
120 type: str
121 description: Detect protocol.
122 choices: ['ping', 'tcp-echo', 'udp-echo', 'http']
123 detect_recoverytime:
124 aliases: ['detect-recoverytime']
125 type: int
126 description: Detect recoverytime.
127 detect_server:
128 aliases: ['detect-server']
129 type: str
130 description: Detect server.
131 detect_timeout:
132 aliases: ['detect-timeout']
133 type: int
134 description: Detect timeout.
135 gateway:
136 type: str
137 description: Gateway.
138 gateway6:
139 type: str
140 description: Gateway6.
141 ingress_spillover_threshold:
142 aliases: ['ingress-spillover-threshold']
143 type: int
144 description: Ingress spillover threshold.
145 interface:
146 type: str
147 description: Interface.
148 priority:
149 type: int
150 description: Priority.
151 source:
152 type: str
153 description: Source.
154 source6:
155 type: str
156 description: Source6.
157 spillover_threshold:
158 aliases: ['spillover-threshold']
159 type: int
160 description: Spillover threshold.
161 status:
162 type: str
163 description: Status.
164 choices: ['disable', 'enable']
165 volume_ratio:
166 aliases: ['volume-ratio']
167 type: int
168 description: Volume ratio.
169 weight:
170 type: int
171 description: Weight.
172 gateway:
173 type: str
174 description: Gateway.
175 gateway6:
176 type: str
177 description: Gateway6.
178 ingress_spillover_threshold:
179 aliases: ['ingress-spillover-threshold']
180 type: int
181 description: Ingress spillover threshold.
182 interface:
183 type: str
184 description: Interface.
185 name:
186 type: str
187 description: Name.
188 required: true
189 priority:
190 type: int
191 description: Priority.
192 source:
193 type: str
194 description: Source.
195 source6:
196 type: str
197 description: Source6.
198 spillover_threshold:
199 aliases: ['spillover-threshold']
200 type: int
201 description: Spillover threshold.
202 status:
203 type: str
204 description: Status.
205 choices: ['disable', 'enable']
206 volume_ratio:
207 aliases: ['volume-ratio']
208 type: int
209 description: Volume ratio.
210 weight:
211 type: int
212 description: Weight.
213 '''
214
215 EXAMPLES = '''
216 - name: Example playbook (generated based on argument schema)
217 hosts: fortimanagers
218 connection: httpapi
219 gather_facts: false
220 tasks:
221 - name: FortiGate interfaces added to the virtual-wan-link.
222 fortinet.fortimanager.fmgr_dynamic_virtualwanlink_members:
223 # workspace_locking_adom: <global or your adom name>
224 adom: <your own value>
225 state: present # <value in [present, absent]>
226 dynamic_virtualwanlink_members:
227 name: "your value" # Required variable, string
228 # comment: <string>
229 # cost: <integer>
230 # detect_failtime: <integer>
231 # detect_http_get: <string>
232 # detect_http_match: <string>
233 # detect_http_port: <integer>
234 # detect_interval: <integer>
235 # detect_protocol: <value in [ping, tcp-echo, udp-echo, ...]>
236 # detect_recoverytime: <integer>
237 # detect_server: <string>
238 # detect_timeout: <integer>
239 # dynamic_mapping:
240 # - _scope:
241 # - name: <string>
242 # vdom: <string>
243 # comment: <string>
244 # cost: <integer>
245 # detect_failtime: <integer>
246 # detect_http_get: <string>
247 # detect_http_match: <string>
248 # detect_http_port: <integer>
249 # detect_interval: <integer>
250 # detect_protocol: <value in [ping, tcp-echo, udp-echo, ...]>
251 # detect_recoverytime: <integer>
252 # detect_server: <string>
253 # detect_timeout: <integer>
254 # gateway: <string>
255 # gateway6: <string>
256 # ingress_spillover_threshold: <integer>
257 # interface: <string>
258 # priority: <integer>
259 # source: <string>
260 # source6: <string>
261 # spillover_threshold: <integer>
262 # status: <value in [disable, enable]>
263 # volume_ratio: <integer>
264 # weight: <integer>
265 # gateway: <string>
266 # gateway6: <string>
267 # ingress_spillover_threshold: <integer>
268 # interface: <string>
269 # priority: <integer>
270 # source: <string>
271 # source6: <string>
272 # spillover_threshold: <integer>
273 # status: <value in [disable, enable]>
274 # volume_ratio: <integer>
275 # weight: <integer>
276 '''
277
278 RETURN = '''
279 meta:
280 description: The result of the request.
281 type: dict
282 returned: always
283 contains:
284 request_url:
285 description: The full url requested.
286 returned: always
287 type: str
288 sample: /sys/login/user
289 response_code:
290 description: The status of api request.
291 returned: always
292 type: int
293 sample: 0
294 response_data:
295 description: The api response.
296 type: list
297 returned: always
298 response_message:
299 description: The descriptive message of the api response.
300 type: str
301 returned: always
302 sample: OK.
303 system_information:
304 description: The information of the target system.
305 type: dict
306 returned: always
307 rc:
308 description: The status the request.
309 type: int
310 returned: always
311 sample: 0
312 version_check_warning:
313 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
314 type: list
315 returned: complex
316 '''
317 from ansible.module_utils.basic import AnsibleModule
318 from ansible.module_utils.connection import Connection
319 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
320 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
321
322
323 def main():
324 urls_list = [
325 '/pm/config/adom/{adom}/obj/dynamic/virtual-wan-link/members',
326 '/pm/config/global/obj/dynamic/virtual-wan-link/members'
327 ]
328 module_arg_spec = {
329 'adom': {'required': True, 'type': 'str'},
330 'revision_note': {'type': 'str'},
331 'dynamic_virtualwanlink_members': {
332 'type': 'dict', 'v_range': [['6.0.0', '6.4.15']],
333 'options': {
334 'comment': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
335 'cost': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
336 'detect-failtime': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
337 'detect-http-get': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
338 'detect-http-match': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
339 'detect-http-port': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
340 'detect-interval': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
341 'detect-protocol': {'v_range': [['6.0.0', '6.4.15']], 'choices': ['ping', 'tcp-echo', 'udp-echo', 'http'], 'type': 'str'},
342 'detect-recoverytime': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
343 'detect-server': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
344 'detect-timeout': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
345 'dynamic_mapping': {
346 'v_range': [['6.0.0', '6.4.15']],
347 'type': 'list',
348 'options': {
349 '_scope': {
350 'v_range': [['6.0.0', '6.4.15']],
351 'type': 'list',
352 'options': {
353 'name': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
354 'vdom': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'}
355 },
356 'elements': 'dict'
357 },
358 'comment': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
359 'cost': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
360 'detect-failtime': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
361 'detect-http-get': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
362 'detect-http-match': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
363 'detect-http-port': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
364 'detect-interval': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
365 'detect-protocol': {'v_range': [['6.0.0', '6.4.15']], 'choices': ['ping', 'tcp-echo', 'udp-echo', 'http'], 'type': 'str'},
366 'detect-recoverytime': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
367 'detect-server': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
368 'detect-timeout': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
369 'gateway': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
370 'gateway6': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
371 'ingress-spillover-threshold': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
372 'interface': {'v_range': [['6.0.0', '6.4.0']], 'type': 'str'},
373 'priority': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
374 'source': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
375 'source6': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
376 'spillover-threshold': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
377 'status': {'v_range': [['6.0.0', '6.4.15']], 'choices': ['disable', 'enable'], 'type': 'str'},
378 'volume-ratio': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
379 'weight': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'}
380 },
381 'elements': 'dict'
382 },
383 'gateway': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
384 'gateway6': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
385 'ingress-spillover-threshold': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
386 'interface': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
387 'name': {'v_range': [['6.0.0', '6.4.15']], 'required': True, 'type': 'str'},
388 'priority': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
389 'source': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
390 'source6': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
391 'spillover-threshold': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
392 'status': {'v_range': [['6.0.0', '6.4.15']], 'choices': ['disable', 'enable'], 'type': 'str'},
393 'volume-ratio': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'},
394 'weight': {'v_range': [['6.0.0', '6.4.15']], 'type': 'int'}
395 }
396 }
397 }
398
399 module_option_spec = get_module_arg_spec('full crud')
400 module_arg_spec.update(module_option_spec)
401 check_galaxy_version(module_arg_spec)
402 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dynamic_virtualwanlink_members'),
403 supports_check_mode=True)
404 if not module._socket_path:
405 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
406 connection = Connection(module._socket_path)
407 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
408 'name', 'data', module, connection)
409 fmgr.process_crud()
410 module.exit_json(meta=module.params)
411
412
413 if __name__ == '__main__':
414 main()