Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_wtpprofile_lan.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_wtpprofile_lan
15 short_description: WTP LAN port mapping.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 wtp-profile:
29 description: Deprecated, please use "wtp_profile"
30 type: str
31 wtp_profile:
32 description: The parameter (wtp-profile) in requested url.
33 type: str
34 wtpprofile_lan:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 port_mode:
40 aliases: ['port-mode']
41 type: str
42 description: LAN port mode.
43 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
44 port_ssid:
45 aliases: ['port-ssid']
46 type: str
47 description: Bridge LAN port to SSID.
48 port1_mode:
49 aliases: ['port1-mode']
50 type: str
51 description: LAN port 1 mode.
52 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
53 port1_ssid:
54 aliases: ['port1-ssid']
55 type: str
56 description: Bridge LAN port 1 to SSID.
57 port2_mode:
58 aliases: ['port2-mode']
59 type: str
60 description: LAN port 2 mode.
61 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
62 port2_ssid:
63 aliases: ['port2-ssid']
64 type: str
65 description: Bridge LAN port 2 to SSID.
66 port3_mode:
67 aliases: ['port3-mode']
68 type: str
69 description: LAN port 3 mode.
70 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
71 port3_ssid:
72 aliases: ['port3-ssid']
73 type: str
74 description: Bridge LAN port 3 to SSID.
75 port4_mode:
76 aliases: ['port4-mode']
77 type: str
78 description: LAN port 4 mode.
79 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
80 port4_ssid:
81 aliases: ['port4-ssid']
82 type: str
83 description: Bridge LAN port 4 to SSID.
84 port5_mode:
85 aliases: ['port5-mode']
86 type: str
87 description: LAN port 5 mode.
88 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
89 port5_ssid:
90 aliases: ['port5-ssid']
91 type: str
92 description: Bridge LAN port 5 to SSID.
93 port6_mode:
94 aliases: ['port6-mode']
95 type: str
96 description: LAN port 6 mode.
97 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
98 port6_ssid:
99 aliases: ['port6-ssid']
100 type: str
101 description: Bridge LAN port 6 to SSID.
102 port7_mode:
103 aliases: ['port7-mode']
104 type: str
105 description: LAN port 7 mode.
106 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
107 port7_ssid:
108 aliases: ['port7-ssid']
109 type: str
110 description: Bridge LAN port 7 to SSID.
111 port8_mode:
112 aliases: ['port8-mode']
113 type: str
114 description: LAN port 8 mode.
115 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
116 port8_ssid:
117 aliases: ['port8-ssid']
118 type: str
119 description: Bridge LAN port 8 to SSID.
120 port_esl_mode:
121 aliases: ['port-esl-mode']
122 type: str
123 description: ESL port mode.
124 choices: ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan']
125 port_esl_ssid:
126 aliases: ['port-esl-ssid']
127 type: str
128 description: Bridge ESL port to SSID.
129 '''
130
131 EXAMPLES = '''
132 - name: Example playbook (generated based on argument schema)
133 hosts: fortimanagers
134 connection: httpapi
135 gather_facts: false
136 tasks:
137 - name: WTP LAN port mapping.
138 fortinet.fortimanager.fmgr_wtpprofile_lan:
139 # workspace_locking_adom: <global or your adom name>
140 adom: <your own value>
141 wtp_profile: <your own value>
142 wtpprofile_lan:
143 # port_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
144 # port_ssid: <string>
145 # port1_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
146 # port1_ssid: <string>
147 # port2_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
148 # port2_ssid: <string>
149 # port3_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
150 # port3_ssid: <string>
151 # port4_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
152 # port4_ssid: <string>
153 # port5_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
154 # port5_ssid: <string>
155 # port6_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
156 # port6_ssid: <string>
157 # port7_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
158 # port7_ssid: <string>
159 # port8_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
160 # port8_ssid: <string>
161 # port_esl_mode: <value in [offline, bridge-to-wan, bridge-to-ssid, ...]>
162 # port_esl_ssid: <string>
163 '''
164
165 RETURN = '''
166 meta:
167 description: The result of the request.
168 type: dict
169 returned: always
170 contains:
171 request_url:
172 description: The full url requested.
173 returned: always
174 type: str
175 sample: /sys/login/user
176 response_code:
177 description: The status of api request.
178 returned: always
179 type: int
180 sample: 0
181 response_data:
182 description: The api response.
183 type: list
184 returned: always
185 response_message:
186 description: The descriptive message of the api response.
187 type: str
188 returned: always
189 sample: OK.
190 system_information:
191 description: The information of the target system.
192 type: dict
193 returned: always
194 rc:
195 description: The status the request.
196 type: int
197 returned: always
198 sample: 0
199 version_check_warning:
200 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
201 type: list
202 returned: complex
203 '''
204 from ansible.module_utils.basic import AnsibleModule
205 from ansible.module_utils.connection import Connection
206 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
207 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
208
209
210 def main():
211 urls_list = [
212 '/pm/config/adom/{adom}/obj/wireless-controller/wtp-profile/{wtp-profile}/lan',
213 '/pm/config/global/obj/wireless-controller/wtp-profile/{wtp-profile}/lan'
214 ]
215 module_arg_spec = {
216 'adom': {'required': True, 'type': 'str'},
217 'wtp-profile': {'type': 'str', 'api_name': 'wtp_profile'},
218 'wtp_profile': {'type': 'str'},
219 'revision_note': {'type': 'str'},
220 'wtpprofile_lan': {
221 'type': 'dict', 'v_range': [['6.0.0', '']],
222 'options': {
223 'port-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
224 'port-ssid': {'type': 'str'},
225 'port1-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
226 'port1-ssid': {'type': 'str'},
227 'port2-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
228 'port2-ssid': {'type': 'str'},
229 'port3-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
230 'port3-ssid': {'type': 'str'},
231 'port4-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
232 'port4-ssid': {'type': 'str'},
233 'port5-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
234 'port5-ssid': {'type': 'str'},
235 'port6-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
236 'port6-ssid': {'type': 'str'},
237 'port7-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
238 'port7-ssid': {'type': 'str'},
239 'port8-mode': {'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
240 'port8-ssid': {'type': 'str'},
241 'port-esl-mode': {'v_range': [['6.4.2', '']], 'choices': ['offline', 'bridge-to-wan', 'bridge-to-ssid', 'nat-to-wan'], 'type': 'str'},
242 'port-esl-ssid': {'v_range': [['6.4.2', '']], 'type': 'str'}
243 }
244 }
245 }
246
247 module_option_spec = get_module_arg_spec('partial crud')
248 module_arg_spec.update(module_option_spec)
249 check_galaxy_version(module_arg_spec)
250 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'wtpprofile_lan'),
251 supports_check_mode=True)
252 if not module._socket_path:
253 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
254 connection = Connection(module._socket_path)
255 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
256 None, 'data', module, connection)
257 fmgr.process_partial_crud()
258 module.exit_json(meta=module.params)
259
260
261 if __name__ == '__main__':
262 main()