Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_ztna_webportal.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_ztna_webportal
15 short_description: Configure ztna web-portal.
16 version_added: "2.12.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 ztna_webportal:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 auth_portal:
34 aliases: ['auth-portal']
35 type: str
36 description: Enable/disable authentication portal.
37 choices: ['disable', 'enable']
38 auth_rule:
39 aliases: ['auth-rule']
40 type: list
41 elements: str
42 description: Authentication Rule.
43 auth_virtual_host:
44 aliases: ['auth-virtual-host']
45 type: list
46 elements: str
47 description: Virtual host for authentication portal.
48 bookmarks:
49 type: list
50 elements: str
51 description: Bookmarks.
52 clipboard:
53 type: str
54 description: Enable to support RDP/VPC clipboard functionality.
55 choices: ['disable', 'enable']
56 cookie_age:
57 aliases: ['cookie-age']
58 type: int
59 description: Time in minutes that client web browsers should keep a cookie.
60 customize_forticlient_download_url:
61 aliases: ['customize-forticlient-download-url']
62 type: str
63 description: Enable support of customized download URL for FortiClient.
64 choices: ['disable', 'enable']
65 decrypted_traffic_mirror:
66 aliases: ['decrypted-traffic-mirror']
67 type: list
68 elements: str
69 description: Decrypted traffic mirror.
70 default_window_height:
71 aliases: ['default-window-height']
72 type: int
73 description: Screen height
74 default_window_width:
75 aliases: ['default-window-width']
76 type: int
77 description: Screen width
78 display_bookmark:
79 aliases: ['display-bookmark']
80 type: str
81 description: Enable to display the web portal bookmark widget.
82 choices: ['disable', 'enable']
83 display_history:
84 aliases: ['display-history']
85 type: str
86 description: Enable to display the web portal user login history widget.
87 choices: ['disable', 'enable']
88 display_status:
89 aliases: ['display-status']
90 type: str
91 description: Enable to display the web portal status widget.
92 choices: ['disable', 'enable']
93 focus_bookmark:
94 aliases: ['focus-bookmark']
95 type: str
96 description: Enable to prioritize the placement of the bookmark section over the quick-connection section in the ztna web-portal.
97 choices: ['disable', 'enable']
98 forticlient_download:
99 aliases: ['forticlient-download']
100 type: str
101 description: Enable/disable download option for FortiClient.
102 choices: ['disable', 'enable']
103 forticlient_download_method:
104 aliases: ['forticlient-download-method']
105 type: str
106 description: Forticlient download method.
107 choices: ['direct', 'ssl-vpn']
108 heading:
109 type: str
110 description: Web portal heading message.
111 host:
112 type: list
113 elements: str
114 description: Virtual or real host name.
115 log_blocked_traffic:
116 aliases: ['log-blocked-traffic']
117 type: str
118 description: Enable/disable logging of blocked traffic.
119 choices: ['disable', 'enable']
120 macos_forticlient_download_url:
121 aliases: ['macos-forticlient-download-url']
122 type: str
123 description: Download URL for Mac FortiClient.
124 name:
125 type: str
126 description: ZTNA proxy name.
127 required: true
128 policy_auth_sso:
129 aliases: ['policy-auth-sso']
130 type: str
131 description: Enable policy sso authentication.
132 choices: ['disable', 'enable']
133 theme:
134 type: str
135 description: Web portal color scheme.
136 choices: ['melongene', 'mariner', 'neutrino', 'jade', 'graphite', 'dark-matter',
137 'onyx', 'eclipse', 'jet-stream', 'security-fabric']
138 vip:
139 type: list
140 elements: str
141 description: Virtual IP name.
142 windows_forticlient_download_url:
143 aliases: ['windows-forticlient-download-url']
144 type: str
145 description: Download URL for Windows FortiClient.
146 vip6:
147 type: list
148 elements: str
149 description: Virtual IPv6 name.
150 llm_profile:
151 aliases: ['llm-profile']
152 type: list
153 elements: str
154 description: Llm profile.
155 llm_proxy:
156 aliases: ['llm-proxy']
157 type: str
158 description: Llm proxy.
159 choices: ['disable', 'enable']
160 '''
161
162 EXAMPLES = '''
163 - name: Example playbook (generated based on argument schema)
164 hosts: fortimanagers
165 connection: httpapi
166 gather_facts: false
167 tasks:
168 - name: Configure ztna web-portal.
169 fortinet.fortimanager.fmgr_ztna_webportal:
170 # workspace_locking_adom: <global or your adom name>
171 adom: <your own value>
172 state: present # <value in [present, absent]>
173 ztna_webportal:
174 name: "your value" # Required variable, string
175 # auth_portal: <value in [disable, enable]>
176 # auth_rule: <list or string>
177 # auth_virtual_host: <list or string>
178 # bookmarks: <list or string>
179 # clipboard: <value in [disable, enable]>
180 # cookie_age: <integer>
181 # customize_forticlient_download_url: <value in [disable, enable]>
182 # decrypted_traffic_mirror: <list or string>
183 # default_window_height: <integer>
184 # default_window_width: <integer>
185 # display_bookmark: <value in [disable, enable]>
186 # display_history: <value in [disable, enable]>
187 # display_status: <value in [disable, enable]>
188 # focus_bookmark: <value in [disable, enable]>
189 # forticlient_download: <value in [disable, enable]>
190 # forticlient_download_method: <value in [direct, ssl-vpn]>
191 # heading: <string>
192 # host: <list or string>
193 # log_blocked_traffic: <value in [disable, enable]>
194 # macos_forticlient_download_url: <string>
195 # policy_auth_sso: <value in [disable, enable]>
196 # theme: <value in [melongene, mariner, neutrino, ...]>
197 # vip: <list or string>
198 # windows_forticlient_download_url: <string>
199 # vip6: <list or string>
200 # llm_profile: <list or string>
201 # llm_proxy: <value in [disable, enable]>
202 '''
203
204 RETURN = '''
205 meta:
206 description: The result of the request.
207 type: dict
208 returned: always
209 contains:
210 request_url:
211 description: The full url requested.
212 returned: always
213 type: str
214 sample: /sys/login/user
215 response_code:
216 description: The status of api request.
217 returned: always
218 type: int
219 sample: 0
220 response_data:
221 description: The api response.
222 type: list
223 returned: always
224 response_message:
225 description: The descriptive message of the api response.
226 type: str
227 returned: always
228 sample: OK.
229 system_information:
230 description: The information of the target system.
231 type: dict
232 returned: always
233 rc:
234 description: The status the request.
235 type: int
236 returned: always
237 sample: 0
238 version_check_warning:
239 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
240 type: list
241 returned: complex
242 '''
243 from ansible.module_utils.basic import AnsibleModule
244 from ansible.module_utils.connection import Connection
245 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
246 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
247
248
249 def main():
250 urls_list = [
251 '/pm/config/adom/{adom}/obj/ztna/web-portal',
252 '/pm/config/global/obj/ztna/web-portal'
253 ]
254 module_arg_spec = {
255 'adom': {'required': True, 'type': 'str'},
256 'revision_note': {'type': 'str'},
257 'ztna_webportal': {
258 'type': 'dict', 'v_range': [['7.6.4', '']],
259 'options': {
260 'auth-portal': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
261 'auth-rule': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
262 'auth-virtual-host': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
263 'bookmarks': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
264 'clipboard': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
265 'cookie-age': {'v_range': [['7.6.4', '']], 'type': 'int'},
266 'customize-forticlient-download-url': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
267 'decrypted-traffic-mirror': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
268 'default-window-height': {'v_range': [['7.6.4', '']], 'type': 'int'},
269 'default-window-width': {'v_range': [['7.6.4', '']], 'type': 'int'},
270 'display-bookmark': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
271 'display-history': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
272 'display-status': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
273 'focus-bookmark': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
274 'forticlient-download': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
275 'forticlient-download-method': {'v_range': [['7.6.4', '']], 'choices': ['direct', 'ssl-vpn'], 'type': 'str'},
276 'heading': {'v_range': [['7.6.4', '']], 'type': 'str'},
277 'host': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
278 'log-blocked-traffic': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
279 'macos-forticlient-download-url': {'v_range': [['7.6.4', '']], 'type': 'str'},
280 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'},
281 'policy-auth-sso': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
282 'theme': {
283 'v_range': [['7.6.4', '']],
284 'choices': ['melongene', 'mariner', 'neutrino', 'jade', 'graphite', 'dark-matter', 'onyx', 'eclipse', 'jet-stream', 'security-fabric'],
285 'type': 'str'
286 },
287 'vip': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
288 'windows-forticlient-download-url': {'v_range': [['7.6.4', '']], 'type': 'str'},
289 'vip6': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
290 'llm-profile': {'v_range': [['7.6.5', '']], 'type': 'list', 'elements': 'str'},
291 'llm-proxy': {'v_range': [['7.6.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
292 }
293 }
294 }
295
296 module_option_spec = get_module_arg_spec('full crud')
297 module_arg_spec.update(module_option_spec)
298 check_galaxy_version(module_arg_spec)
299 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'ztna_webportal'),
300 supports_check_mode=True)
301 if not module._socket_path:
302 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
303 connection = Connection(module._socket_path)
304 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
305 'name', 'data', module, connection)
306 fmgr.process_crud()
307 module.exit_json(meta=module.params)
308
309
310 if __name__ == '__main__':
311 main()