Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_ztna_webportalbookmark.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_webportalbookmark
15 short_description: Configure ztna web-portal bookmark.
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_webportalbookmark:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 bookmarks:
34 type: list
35 elements: dict
36 description: Bookmarks.
37 suboptions:
38 apptype:
39 type: str
40 description: Application type.
41 choices: ['web', 'telnet', 'ssh', 'ftp', 'smb', 'vnc', 'rdp', 'sftp']
42 color_depth:
43 aliases: ['color-depth']
44 type: str
45 description: Color depth per pixel.
46 choices: ['8', '16', '32']
47 description:
48 type: str
49 description: Description.
50 domain:
51 type: str
52 description: Login domain.
53 folder:
54 type: str
55 description: Network shared file folder parameter.
56 height:
57 type: int
58 description: Screen height
59 host:
60 type: str
61 description: Host name/IP parameter.
62 keyboard_layout:
63 aliases: ['keyboard-layout']
64 type: str
65 description: Keyboard layout.
66 choices: ['da', 'de', 'de-ch', 'en-uk', 'en-us', 'es', 'fi', 'fr',
67 'fr-be', 'fr-ca', 'fr-ch', 'hr', 'hu', 'it', 'ja', 'lt', 'mk',
68 'no', 'pt', 'pt-br', 'ru', 'sl', 'sv', 'ar-101', 'ar-102',
69 'ar-102-azerty', 'can-mul', 'cz', 'cz-qwerty', 'cz-pr', 'nl',
70 'de-ibm', 'en-uk-ext', 'en-us-dvorak', 'es-var', 'fi-sami',
71 'hu-101', 'it-142', 'ko', 'lt-ibm', 'lt-std', 'lav-std',
72 'lav-leg', 'mk-std', 'no-sami', 'pol-214', 'pol-pr',
73 'pt-br-abnt2', 'ru-mne', 'ru-t', 'sv-sami', 'tuk', 'tur-f',
74 'tur-q', 'zh-sym-sg-us', 'zh-sym-us', 'zh-tr-hk', 'zh-tr-mo',
75 'zh-tr-us', 'fr-apple', 'la-am', 'ja-106']
76 load_balancing_info:
77 aliases: ['load-balancing-info']
78 type: str
79 description: The load balancing information or cookie which should be provided to the connection broker.
80 logon_password:
81 aliases: ['logon-password']
82 type: list
83 elements: str
84 description: Logon password.
85 logon_user:
86 aliases: ['logon-user']
87 type: str
88 description: Logon user.
89 name:
90 type: str
91 description: Bookmark name.
92 port:
93 type: int
94 description: Remote port.
95 preconnection_blob:
96 aliases: ['preconnection-blob']
97 type: str
98 description: An arbitrary string which identifies the RDP source.
99 preconnection_id:
100 aliases: ['preconnection-id']
101 type: int
102 description: The numeric ID of the RDP source
103 restricted_admin:
104 aliases: ['restricted-admin']
105 type: str
106 description: Enable/disable restricted admin mode for RDP.
107 choices: ['disable', 'enable']
108 security:
109 type: str
110 description: Security mode for RDP connection
111 choices: ['rdp', 'nla', 'tls', 'any']
112 send_preconnection_id:
113 aliases: ['send-preconnection-id']
114 type: str
115 description: Enable/disable sending of preconnection ID.
116 choices: ['disable', 'enable']
117 sso:
118 type: str
119 description: Single sign-on.
120 choices: ['disable', 'enable']
121 url:
122 type: str
123 description: URL parameter.
124 vnc_keyboard_layout:
125 aliases: ['vnc-keyboard-layout']
126 type: str
127 description: Keyboard layout.
128 choices: ['da', 'de', 'de-ch', 'en-uk', 'es', 'fi', 'fr', 'fr-be', 'it',
129 'no', 'pt', 'sv', 'nl', 'en-uk-ext', 'it-142', 'pt-br-abnt2',
130 'default', 'fr-ca-mul', 'gd', 'us-intl']
131 width:
132 type: int
133 description: Screen width
134 groups:
135 type: list
136 elements: str
137 description: User groups.
138 name:
139 type: str
140 description: Bookmark name.
141 required: true
142 type:
143 type: str
144 description: Type.
145 choices: ['user', 'ldap-dynamic', 'saml-dynamic']
146 users:
147 type: list
148 elements: str
149 description: User name.
150 llm_secure_proxy:
151 aliases: ['llm-secure-proxy']
152 type: dict
153 description: Llm secure proxy.
154 suboptions:
155 all_llm_servers:
156 aliases: ['all-llm-servers']
157 type: str
158 description: All llm servers.
159 choices: ['disable', 'enable']
160 llm_servers:
161 aliases: ['llm-servers']
162 type: list
163 elements: str
164 description: Llm servers.
165 '''
166
167 EXAMPLES = '''
168 - name: Example playbook (generated based on argument schema)
169 hosts: fortimanagers
170 connection: httpapi
171 gather_facts: false
172 tasks:
173 - name: Configure ztna web-portal bookmark.
174 fortinet.fortimanager.fmgr_ztna_webportalbookmark:
175 # workspace_locking_adom: <global or your adom name>
176 adom: <your own value>
177 state: present # <value in [present, absent]>
178 ztna_webportalbookmark:
179 name: "your value" # Required variable, string
180 # bookmarks:
181 # - apptype: <value in [web, telnet, ssh, ...]>
182 # color_depth: <value in [8, 16, 32]>
183 # description: <string>
184 # domain: <string>
185 # folder: <string>
186 # height: <integer>
187 # host: <string>
188 # keyboard_layout: <value in [da, de, de-ch, ...]>
189 # load_balancing_info: <string>
190 # logon_password: <list or string>
191 # logon_user: <string>
192 # name: <string>
193 # port: <integer>
194 # preconnection_blob: <string>
195 # preconnection_id: <integer>
196 # restricted_admin: <value in [disable, enable]>
197 # security: <value in [rdp, nla, tls, ...]>
198 # send_preconnection_id: <value in [disable, enable]>
199 # sso: <value in [disable, enable]>
200 # url: <string>
201 # vnc_keyboard_layout: <value in [da, de, de-ch, ...]>
202 # width: <integer>
203 # groups: <list or string>
204 # type: <value in [user, ldap-dynamic, saml-dynamic]>
205 # users: <list or string>
206 # llm_secure_proxy:
207 # all_llm_servers: <value in [disable, enable]>
208 # llm_servers: <list or string>
209 '''
210
211 RETURN = '''
212 meta:
213 description: The result of the request.
214 type: dict
215 returned: always
216 contains:
217 request_url:
218 description: The full url requested.
219 returned: always
220 type: str
221 sample: /sys/login/user
222 response_code:
223 description: The status of api request.
224 returned: always
225 type: int
226 sample: 0
227 response_data:
228 description: The api response.
229 type: list
230 returned: always
231 response_message:
232 description: The descriptive message of the api response.
233 type: str
234 returned: always
235 sample: OK.
236 system_information:
237 description: The information of the target system.
238 type: dict
239 returned: always
240 rc:
241 description: The status the request.
242 type: int
243 returned: always
244 sample: 0
245 version_check_warning:
246 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
247 type: list
248 returned: complex
249 '''
250 from ansible.module_utils.basic import AnsibleModule
251 from ansible.module_utils.connection import Connection
252 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
253 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
254
255
256 def main():
257 urls_list = [
258 '/pm/config/adom/{adom}/obj/ztna/web-portal-bookmark',
259 '/pm/config/global/obj/ztna/web-portal-bookmark'
260 ]
261 module_arg_spec = {
262 'adom': {'required': True, 'type': 'str'},
263 'revision_note': {'type': 'str'},
264 'ztna_webportalbookmark': {
265 'type': 'dict', 'v_range': [['7.6.4', '']],
266 'options': {
267 'bookmarks': {
268 'v_range': [['7.6.4', '']],
269 'type': 'list',
270 'options': {
271 'apptype': {'v_range': [['7.6.4', '']], 'choices': ['web', 'telnet', 'ssh', 'ftp', 'smb', 'vnc', 'rdp', 'sftp'], 'type': 'str'},
272 'color-depth': {'v_range': [['7.6.4', '']], 'choices': ['8', '16', '32'], 'type': 'str'},
273 'description': {'v_range': [['7.6.4', '']], 'type': 'str'},
274 'domain': {'v_range': [['7.6.4', '']], 'type': 'str'},
275 'folder': {'v_range': [['7.6.4', '']], 'type': 'str'},
276 'height': {'v_range': [['7.6.4', '']], 'type': 'int'},
277 'host': {'v_range': [['7.6.4', '']], 'type': 'str'},
278 'keyboard-layout': {
279 'v_range': [['7.6.4', '']],
280 'choices': [
281 'da', 'de', 'de-ch', 'en-uk', 'en-us', 'es', 'fi', 'fr', 'fr-be', 'fr-ca', 'fr-ch', 'hr', 'hu', 'it', 'ja', 'lt', 'mk',
282 'no', 'pt', 'pt-br', 'ru', 'sl', 'sv', 'ar-101', 'ar-102', 'ar-102-azerty', 'can-mul', 'cz', 'cz-qwerty', 'cz-pr', 'nl',
283 'de-ibm', 'en-uk-ext', 'en-us-dvorak', 'es-var', 'fi-sami', 'hu-101', 'it-142', 'ko', 'lt-ibm', 'lt-std', 'lav-std',
284 'lav-leg', 'mk-std', 'no-sami', 'pol-214', 'pol-pr', 'pt-br-abnt2', 'ru-mne', 'ru-t', 'sv-sami', 'tuk', 'tur-f', 'tur-q',
285 'zh-sym-sg-us', 'zh-sym-us', 'zh-tr-hk', 'zh-tr-mo', 'zh-tr-us', 'fr-apple', 'la-am', 'ja-106'
286 ],
287 'type': 'str'
288 },
289 'load-balancing-info': {'v_range': [['7.6.4', '']], 'type': 'str'},
290 'logon-password': {'v_range': [['7.6.4', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
291 'logon-user': {'v_range': [['7.6.4', '']], 'type': 'str'},
292 'name': {'v_range': [['7.6.4', '']], 'type': 'str'},
293 'port': {'v_range': [['7.6.4', '']], 'type': 'int'},
294 'preconnection-blob': {'v_range': [['7.6.4', '']], 'type': 'str'},
295 'preconnection-id': {'v_range': [['7.6.4', '']], 'type': 'int'},
296 'restricted-admin': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
297 'security': {'v_range': [['7.6.4', '']], 'choices': ['rdp', 'nla', 'tls', 'any'], 'type': 'str'},
298 'send-preconnection-id': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
299 'sso': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
300 'url': {'v_range': [['7.6.4', '']], 'type': 'str'},
301 'vnc-keyboard-layout': {
302 'v_range': [['7.6.4', '']],
303 'choices': [
304 'da', 'de', 'de-ch', 'en-uk', 'es', 'fi', 'fr', 'fr-be', 'it', 'no', 'pt', 'sv', 'nl', 'en-uk-ext', 'it-142',
305 'pt-br-abnt2', 'default', 'fr-ca-mul', 'gd', 'us-intl'
306 ],
307 'type': 'str'
308 },
309 'width': {'v_range': [['7.6.4', '']], 'type': 'int'}
310 },
311 'elements': 'dict'
312 },
313 'groups': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
314 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'},
315 'type': {'v_range': [['7.6.4', '']], 'choices': ['user', 'ldap-dynamic', 'saml-dynamic'], 'type': 'str'},
316 'users': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
317 'llm-secure-proxy': {
318 'v_range': [['7.6.5', '']],
319 'type': 'dict',
320 'options': {
321 'all-llm-servers': {'v_range': [['7.6.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
322 'llm-servers': {'v_range': [['7.6.5', '']], 'type': 'list', 'elements': 'str'}
323 }
324 }
325 }
326 }
327 }
328
329 module_option_spec = get_module_arg_spec('full crud')
330 module_arg_spec.update(module_option_spec)
331 check_galaxy_version(module_arg_spec)
332 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'ztna_webportalbookmark'),
333 supports_check_mode=True)
334 if not module._socket_path:
335 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
336 connection = Connection(module._socket_path)
337 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
338 'name', 'data', module, connection)
339 fmgr.process_crud()
340 module.exit_json(meta=module.params)
341
342
343 if __name__ == '__main__':
344 main()