Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_webspam_fgdsetting.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_fmupdate_webspam_fgdsetting
15 short_description: Configure the FortiGuard run parameters.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_webspam_fgdsetting:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 as_cache:
27 aliases: ['as-cache']
28 type: int
29 description: Antispam service maximum memory usage in megabytes
30 as_log:
31 aliases: ['as-log']
32 type: str
33 description:
34 - Antispam log setting
35 - disable - Disable spam log.
36 - nospam - Log non-spam events.
37 - all - Log all spam lookups.
38 choices: ['disable', 'nospam', 'all']
39 as_preload:
40 aliases: ['as-preload']
41 type: str
42 description:
43 - Enable/disable preloading antispam database to memory
44 - disable - Disable antispam database preload.
45 - enable - Enable antispam database preload.
46 choices: ['disable', 'enable']
47 av_cache:
48 aliases: ['av-cache']
49 type: int
50 description: Antivirus service maximum memory usage, in megabytes
51 av_log:
52 aliases: ['av-log']
53 type: str
54 description:
55 - Antivirus log setting
56 - disable - Disable virus log.
57 - novirus - Log non-virus events.
58 - all - Log all virus lookups.
59 choices: ['disable', 'novirus', 'all']
60 av_preload:
61 aliases: ['av-preload']
62 type: str
63 description:
64 - Enable/disable preloading antivirus database to memory
65 - disable - Disable antivirus database preload.
66 - enable - Enable antivirus database preload.
67 choices: ['disable', 'enable']
68 av2_cache:
69 aliases: ['av2-cache']
70 type: int
71 description: Antispam service maximum memory usage in megabytes
72 av2_log:
73 aliases: ['av2-log']
74 type: str
75 description:
76 - Outbreak prevention log setting
77 - disable - Disable av2 log.
78 - noav2 - Log non-av2 events.
79 - all - Log all av2 lookups.
80 choices: ['disable', 'noav2', 'all']
81 av2_preload:
82 aliases: ['av2-preload']
83 type: str
84 description:
85 - Enable/disable preloading outbreak prevention database to memory
86 - disable - Disable outbreak prevention database preload.
87 - enable - Enable outbreak prevention database preload.
88 choices: ['disable', 'enable']
89 eventlog_query:
90 aliases: ['eventlog-query']
91 type: str
92 description:
93 - Enable/disable record query to event-log besides fgd-log
94 - disable - Record query to event-log besides fgd-log.
95 - enable - Do not log to event-log.
96 choices: ['disable', 'enable']
97 fgd_pull_interval:
98 aliases: ['fgd-pull-interval']
99 type: int
100 description: Fgd pull interval setting, in minutes
101 fq_cache:
102 aliases: ['fq-cache']
103 type: int
104 description: File query service maximum memory usage, in megabytes
105 fq_log:
106 aliases: ['fq-log']
107 type: str
108 description:
109 - File query log setting
110 - disable - Disable file query log.
111 - nofilequery - Log non-file query events.
112 - all - Log all file query events.
113 choices: ['disable', 'nofilequery', 'all']
114 fq_preload:
115 aliases: ['fq-preload']
116 type: str
117 description:
118 - Enable/disable preloading file query database to memory
119 - disable - Disable file query db preload.
120 - enable - Enable file query db preload.
121 choices: ['disable', 'enable']
122 linkd_log:
123 aliases: ['linkd-log']
124 type: str
125 description:
126 - Linkd log setting
127 - emergency - The unit is unusable.
128 - alert - Immediate action is required
129 - critical - Functionality is affected.
130 - error - Functionality is probably affected.
131 - warn - Functionality might be affected.
132 - notice - Information about normal events.
133 - info - General information.
134 - debug - Debug information.
135 - disable - Linkd logging is disabled.
136 choices: ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info',
137 'debug', 'disable']
138 max_client_worker:
139 aliases: ['max-client-worker']
140 type: int
141 description: Max worker for tcp client connection
142 max_log_quota:
143 aliases: ['max-log-quota']
144 type: int
145 description: Maximum log quota setting, in megabytes
146 max_unrated_site:
147 aliases: ['max-unrated-site']
148 type: int
149 description: Maximum number of unrated site in memory, in kilobytes
150 restrict_as1_dbver:
151 aliases: ['restrict-as1-dbver']
152 type: str
153 description: Restrict system update to indicated antispam
154 restrict_as2_dbver:
155 aliases: ['restrict-as2-dbver']
156 type: str
157 description: Restrict system update to indicated antispam
158 restrict_as4_dbver:
159 aliases: ['restrict-as4-dbver']
160 type: str
161 description: Restrict system update to indicated antispam
162 restrict_av_dbver:
163 aliases: ['restrict-av-dbver']
164 type: str
165 description: Restrict system update to indicated antivirus database version
166 restrict_av2_dbver:
167 aliases: ['restrict-av2-dbver']
168 type: str
169 description: Restrict system update to indicated outbreak prevention database version
170 restrict_fq_dbver:
171 aliases: ['restrict-fq-dbver']
172 type: str
173 description: Restrict system update to indicated file query database version
174 restrict_wf_dbver:
175 aliases: ['restrict-wf-dbver']
176 type: str
177 description: Restrict system update to indicated web filter database version
178 server_override:
179 aliases: ['server-override']
180 type: dict
181 description: Server override.
182 suboptions:
183 servlist:
184 type: list
185 elements: dict
186 description: Servlist.
187 suboptions:
188 id:
189 type: int
190 description: Override server ID
191 ip:
192 type: str
193 description: IPv4 address of the override server.
194 ip6:
195 type: str
196 description: IPv6 address of the override server.
197 port:
198 type: int
199 description: Port number to use when contacting FortiGuard
200 service_type:
201 aliases: ['service-type']
202 type: raw
203 description:
204 - (list or str)
205 - Override service type.
206 - fgd - Server override config for fgd
207 - fgc - Server override config for fgc
208 - fsa - Server override config for fsa
209 choices: ['fgd', 'fgc', 'fsa', 'fgfq', 'geoip', 'iot-collect']
210 status:
211 type: str
212 description:
213 - Override status.
214 - disable - Disable setting.
215 - enable - Enable setting.
216 choices: ['disable', 'enable']
217 stat_log_interval:
218 aliases: ['stat-log-interval']
219 type: int
220 description: Statistic log interval setting, in minutes
221 stat_sync_interval:
222 aliases: ['stat-sync-interval']
223 type: int
224 description: Synchronization interval for statistic of unrated site in minutes
225 update_interval:
226 aliases: ['update-interval']
227 type: int
228 description: FortiGuard database update wait time if not enough delta files, in hours
229 update_log:
230 aliases: ['update-log']
231 type: str
232 description:
233 - Enable/disable update log setting
234 - disable - Disable update log.
235 - enable - Enable update log.
236 choices: ['disable', 'enable']
237 wf_cache:
238 aliases: ['wf-cache']
239 type: int
240 description: Web filter service maximum memory usage, in megabytes
241 wf_dn_cache_expire_time:
242 aliases: ['wf-dn-cache-expire-time']
243 type: int
244 description: Web filter DN cache expire time, in minutes
245 wf_dn_cache_max_number:
246 aliases: ['wf-dn-cache-max-number']
247 type: int
248 description: Maximum number of Web filter DN cache
249 wf_log:
250 aliases: ['wf-log']
251 type: str
252 description:
253 - Web filter log setting
254 - disable - Disable URL log.
255 - nourl - Log non-URL events.
256 - all - Log all URL lookups.
257 choices: ['disable', 'nourl', 'all']
258 wf_preload:
259 aliases: ['wf-preload']
260 type: str
261 description:
262 - Enable/disable preloading the web filter database into memory
263 - disable - Disable web filter database preload.
264 - enable - Enable web filter database preload.
265 choices: ['disable', 'enable']
266 iot_cache:
267 aliases: ['iot-cache']
268 type: int
269 description: IoT service maximum memory usage, in megabytes
270 iot_log:
271 aliases: ['iot-log']
272 type: str
273 description:
274 - IoT log setting
275 - disable - Disable IoT log.
276 - nofilequery - Log non-IoT events.
277 - all - Log all IoT events.
278 choices: ['disable', 'nofilequery', 'all', 'noiot']
279 iot_preload:
280 aliases: ['iot-preload']
281 type: str
282 description:
283 - Enable/disable preloading IoT database to memory
284 - disable - Disable IoT db preload.
285 - enable - Enable IoT db preload.
286 choices: ['disable', 'enable']
287 restrict_iots_dbver:
288 aliases: ['restrict-iots-dbver']
289 type: str
290 description: Restrict system update to indicated file query database version
291 stat_log:
292 aliases: ['stat-log']
293 type: str
294 description:
295 - stat log setting
296 - emergency - The unit is unusable
297 - alert - Immediate action is required
298 - critical - Functionality is affected
299 - error - Functionality is probably affected
300 - warn - Functionality might be affected
301 - notice - Information about normal events
302 - info - General information
303 - debug - Debug information
304 - disable - Linkd logging is disabled.
305 choices: ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info',
306 'debug', 'disable']
307 iotv_preload:
308 aliases: ['iotv-preload']
309 type: str
310 description:
311 - Enable/disable preloading IoT-Vulnerability database to memory
312 - disable - Disable IoT-Vulnerability db preload.
313 - enable - Enable IoT-Vulnerability db preload.
314 choices: ['disable', 'enable']
315 '''
316
317 EXAMPLES = '''
318 - name: Example playbook (generated based on argument schema)
319 hosts: fortimanagers
320 connection: httpapi
321 gather_facts: false
322 tasks:
323 - name: Configure the FortiGuard run parameters.
324 fortinet.fortimanager.fmgr_fmupdate_webspam_fgdsetting:
325 # workspace_locking_adom: <global or your adom name>
326 fmupdate_webspam_fgdsetting:
327 # as_cache: <integer>
328 # as_log: <value in [disable, nospam, all]>
329 # as_preload: <value in [disable, enable]>
330 # av_cache: <integer>
331 # av_log: <value in [disable, novirus, all]>
332 # av_preload: <value in [disable, enable]>
333 # av2_cache: <integer>
334 # av2_log: <value in [disable, noav2, all]>
335 # av2_preload: <value in [disable, enable]>
336 # eventlog_query: <value in [disable, enable]>
337 # fgd_pull_interval: <integer>
338 # fq_cache: <integer>
339 # fq_log: <value in [disable, nofilequery, all]>
340 # fq_preload: <value in [disable, enable]>
341 # linkd_log: <value in [emergency, alert, critical, ...]>
342 # max_client_worker: <integer>
343 # max_log_quota: <integer>
344 # max_unrated_site: <integer>
345 # restrict_as1_dbver: <string>
346 # restrict_as2_dbver: <string>
347 # restrict_as4_dbver: <string>
348 # restrict_av_dbver: <string>
349 # restrict_av2_dbver: <string>
350 # restrict_fq_dbver: <string>
351 # restrict_wf_dbver: <string>
352 # server_override:
353 # servlist:
354 # - id: <integer>
355 # ip: <string>
356 # ip6: <string>
357 # port: <integer>
358 # service_type: ["fgd", "fgc", "fsa", "fgfq", "geoip", "iot-collect"]
359 # status: <value in [disable, enable]>
360 # stat_log_interval: <integer>
361 # stat_sync_interval: <integer>
362 # update_interval: <integer>
363 # update_log: <value in [disable, enable]>
364 # wf_cache: <integer>
365 # wf_dn_cache_expire_time: <integer>
366 # wf_dn_cache_max_number: <integer>
367 # wf_log: <value in [disable, nourl, all]>
368 # wf_preload: <value in [disable, enable]>
369 # iot_cache: <integer>
370 # iot_log: <value in [disable, nofilequery, all, ...]>
371 # iot_preload: <value in [disable, enable]>
372 # restrict_iots_dbver: <string>
373 # stat_log: <value in [emergency, alert, critical, ...]>
374 # iotv_preload: <value in [disable, enable]>
375 '''
376
377 RETURN = '''
378 meta:
379 description: The result of the request.
380 type: dict
381 returned: always
382 contains:
383 request_url:
384 description: The full url requested.
385 returned: always
386 type: str
387 sample: /sys/login/user
388 response_code:
389 description: The status of api request.
390 returned: always
391 type: int
392 sample: 0
393 response_data:
394 description: The api response.
395 type: list
396 returned: always
397 response_message:
398 description: The descriptive message of the api response.
399 type: str
400 returned: always
401 sample: OK.
402 system_information:
403 description: The information of the target system.
404 type: dict
405 returned: always
406 rc:
407 description: The status the request.
408 type: int
409 returned: always
410 sample: 0
411 version_check_warning:
412 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
413 type: list
414 returned: complex
415 '''
416 from ansible.module_utils.basic import AnsibleModule
417 from ansible.module_utils.connection import Connection
418 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
419 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
420
421
422 def main():
423 urls_list = [
424 '/cli/global/fmupdate/web-spam/fgd-setting'
425 ]
426 module_arg_spec = {
427 'fmupdate_webspam_fgdsetting': {
428 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
429 'options': {
430 'as-cache': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
431 'as-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'nospam', 'all'], 'type': 'str'},
432 'as-preload': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
433 'av-cache': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
434 'av-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'novirus', 'all'], 'type': 'str'},
435 'av-preload': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
436 'av2-cache': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
437 'av2-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'noav2', 'all'], 'type': 'str'},
438 'av2-preload': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
439 'eventlog-query': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
440 'fgd-pull-interval': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
441 'fq-cache': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
442 'fq-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'nofilequery', 'all'], 'type': 'str'},
443 'fq-preload': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
444 'linkd-log': {
445 'v_range': [['6.0.0', '7.6.2']],
446 'choices': ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug', 'disable'],
447 'type': 'str'
448 },
449 'max-client-worker': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
450 'max-log-quota': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
451 'max-unrated-site': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
452 'restrict-as1-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
453 'restrict-as2-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
454 'restrict-as4-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
455 'restrict-av-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
456 'restrict-av2-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
457 'restrict-fq-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
458 'restrict-wf-dbver': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
459 'server-override': {
460 'v_range': [['6.0.0', '7.6.2']],
461 'type': 'dict',
462 'options': {
463 'servlist': {
464 'v_range': [['6.0.0', '7.6.2']],
465 'type': 'list',
466 'options': {
467 'id': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
468 'ip': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
469 'ip6': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
470 'port': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
471 'service-type': {
472 'v_range': [['6.0.0', '7.6.2']],
473 'type': 'raw',
474 'choices': ['fgd', 'fgc', 'fsa', 'fgfq', 'geoip', 'iot-collect']
475 }
476 },
477 'elements': 'dict'
478 },
479 'status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
480 }
481 },
482 'stat-log-interval': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
483 'stat-sync-interval': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
484 'update-interval': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
485 'update-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
486 'wf-cache': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
487 'wf-dn-cache-expire-time': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
488 'wf-dn-cache-max-number': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
489 'wf-log': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'nourl', 'all'], 'type': 'str'},
490 'wf-preload': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
491 'iot-cache': {'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '7.6.2']], 'type': 'int'},
492 'iot-log': {'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '7.6.2']], 'choices': ['disable', 'nofilequery', 'all', 'noiot'], 'type': 'str'},
493 'iot-preload': {'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
494 'restrict-iots-dbver': {'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '7.6.2']], 'type': 'str'},
495 'stat-log': {
496 'v_range': [['7.0.10', '7.0.16'], ['7.2.5', '7.2.12'], ['7.4.2', '7.6.2']],
497 'choices': ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug', 'disable'],
498 'type': 'str'
499 },
500 'iotv-preload': {'v_range': [['7.2.2', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
501 }
502 }
503 }
504
505 module_option_spec = get_module_arg_spec('partial crud')
506 module_arg_spec.update(module_option_spec)
507 check_galaxy_version(module_arg_spec)
508 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_webspam_fgdsetting'),
509 supports_check_mode=True)
510 if not module._socket_path:
511 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
512 connection = Connection(module._socket_path)
513 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
514 None, 'data', module, connection)
515 fmgr.process_partial_crud()
516 module.exit_json(meta=module.params)
517
518
519 if __name__ == '__main__':
520 main()