Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dynamic_virtualwanlink_server.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_server
15 short_description: Dynamic virtual wan link server
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_server:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 description:
34 type: str
35 description: Description.
36 dynamic_mapping:
37 type: list
38 elements: dict
39 description: Dynamic mapping.
40 suboptions:
41 _scope:
42 type: list
43 elements: dict
44 description: Scope.
45 suboptions:
46 name:
47 type: str
48 description: Name.
49 vdom:
50 type: str
51 description: Vdom.
52 server:
53 type: raw
54 description: (list) Server.
55 name:
56 type: str
57 description: Name.
58 required: true
59 server:
60 type: raw
61 description: (list) Server.
62 '''
63
64 EXAMPLES = '''
65 - name: Example playbook (generated based on argument schema)
66 hosts: fortimanagers
67 connection: httpapi
68 gather_facts: false
69 tasks:
70 - name: Dynamic virtual wan link server
71 fortinet.fortimanager.fmgr_dynamic_virtualwanlink_server:
72 # workspace_locking_adom: <global or your adom name>
73 adom: <your own value>
74 state: present # <value in [present, absent]>
75 dynamic_virtualwanlink_server:
76 name: "your value" # Required variable, string
77 # description: <string>
78 # dynamic_mapping:
79 # - _scope:
80 # - name: <string>
81 # vdom: <string>
82 # server: <list or string>
83 # server: <list or string>
84 '''
85
86 RETURN = '''
87 meta:
88 description: The result of the request.
89 type: dict
90 returned: always
91 contains:
92 request_url:
93 description: The full url requested.
94 returned: always
95 type: str
96 sample: /sys/login/user
97 response_code:
98 description: The status of api request.
99 returned: always
100 type: int
101 sample: 0
102 response_data:
103 description: The api response.
104 type: list
105 returned: always
106 response_message:
107 description: The descriptive message of the api response.
108 type: str
109 returned: always
110 sample: OK.
111 system_information:
112 description: The information of the target system.
113 type: dict
114 returned: always
115 rc:
116 description: The status the request.
117 type: int
118 returned: always
119 sample: 0
120 version_check_warning:
121 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
122 type: list
123 returned: complex
124 '''
125 from ansible.module_utils.basic import AnsibleModule
126 from ansible.module_utils.connection import Connection
127 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
128 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
129
130
131 def main():
132 urls_list = [
133 '/pm/config/adom/{adom}/obj/dynamic/virtual-wan-link/server',
134 '/pm/config/global/obj/dynamic/virtual-wan-link/server'
135 ]
136 module_arg_spec = {
137 'adom': {'required': True, 'type': 'str'},
138 'revision_note': {'type': 'str'},
139 'dynamic_virtualwanlink_server': {
140 'type': 'dict', 'v_range': [['6.0.0', '6.4.15']],
141 'options': {
142 'description': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
143 'dynamic_mapping': {
144 'v_range': [['6.0.0', '6.4.15']],
145 'type': 'list',
146 'options': {
147 '_scope': {
148 'v_range': [['6.0.0', '6.4.15']],
149 'type': 'list',
150 'options': {
151 'name': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'},
152 'vdom': {'v_range': [['6.0.0', '6.4.15']], 'type': 'str'}
153 },
154 'elements': 'dict'
155 },
156 'server': {'v_range': [['6.0.0', '6.4.15']], 'type': 'raw'}
157 },
158 'elements': 'dict'
159 },
160 'name': {'v_range': [['6.0.0', '6.4.15']], 'required': True, 'type': 'str'},
161 'server': {'v_range': [['6.0.0', '6.4.15']], 'type': 'raw'}
162 }
163 }
164 }
165
166 module_option_spec = get_module_arg_spec('full crud')
167 module_arg_spec.update(module_option_spec)
168 check_galaxy_version(module_arg_spec)
169 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dynamic_virtualwanlink_server'),
170 supports_check_mode=True)
171 if not module._socket_path:
172 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
173 connection = Connection(module._socket_path)
174 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
175 'name', 'data', module, connection)
176 fmgr.process_crud()
177 module.exit_json(meta=module.params)
178
179
180 if __name__ == '__main__':
181 main()