Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_npu_backgroundssescan.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_system_npu_backgroundssescan
15 short_description: Configure driver background scan for SSE.
16 version_added: "2.2.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 system_npu_backgroundssescan:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 scan:
34 type: str
35 description: Enable/disable background SSE scan by driver thread
36 choices: ['disable', 'enable']
37 stats_update_interval:
38 aliases: ['stats-update-interval']
39 type: int
40 description: Stats update interval
41 udp_keepalive_interval:
42 aliases: ['udp-keepalive-interval']
43 type: int
44 description: UDP keepalive interval
45 scan_stale:
46 aliases: ['scan-stale']
47 type: int
48 description: Configure scanning of active or stale sessions
49 scan_vt:
50 aliases: ['scan-vt']
51 type: int
52 description: Select version/type to scan
53 stats_qual_access:
54 aliases: ['stats-qual-access']
55 type: int
56 description: Statistics update access qualification in seconds
57 stats_qual_duration:
58 aliases: ['stats-qual-duration']
59 type: int
60 description: Statistics update duration qualification in seconds
61 udp_qual_access:
62 aliases: ['udp-qual-access']
63 type: int
64 description: UDP keepalive access qualification in seconds
65 udp_qual_duration:
66 aliases: ['udp-qual-duration']
67 type: int
68 description: UDP keepalive duration qualification in seconds
69 '''
70
71 EXAMPLES = '''
72 - name: Example playbook (generated based on argument schema)
73 hosts: fortimanagers
74 connection: httpapi
75 gather_facts: false
76 tasks:
77 - name: Configure driver background scan for SSE.
78 fortinet.fortimanager.fmgr_system_npu_backgroundssescan:
79 # workspace_locking_adom: <global or your adom name>
80 adom: <your own value>
81 system_npu_backgroundssescan:
82 # scan: <value in [disable, enable]>
83 # stats_update_interval: <integer>
84 # udp_keepalive_interval: <integer>
85 # scan_stale: <integer>
86 # scan_vt: <integer>
87 # stats_qual_access: <integer>
88 # stats_qual_duration: <integer>
89 # udp_qual_access: <integer>
90 # udp_qual_duration: <integer>
91 '''
92
93 RETURN = '''
94 meta:
95 description: The result of the request.
96 type: dict
97 returned: always
98 contains:
99 request_url:
100 description: The full url requested.
101 returned: always
102 type: str
103 sample: /sys/login/user
104 response_code:
105 description: The status of api request.
106 returned: always
107 type: int
108 sample: 0
109 response_data:
110 description: The api response.
111 type: list
112 returned: always
113 response_message:
114 description: The descriptive message of the api response.
115 type: str
116 returned: always
117 sample: OK.
118 system_information:
119 description: The information of the target system.
120 type: dict
121 returned: always
122 rc:
123 description: The status the request.
124 type: int
125 returned: always
126 sample: 0
127 version_check_warning:
128 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
129 type: list
130 returned: complex
131 '''
132 from ansible.module_utils.basic import AnsibleModule
133 from ansible.module_utils.connection import Connection
134 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
135 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
136
137
138 def main():
139 urls_list = [
140 '/pm/config/adom/{adom}/obj/system/npu/background-sse-scan',
141 '/pm/config/global/obj/system/npu/background-sse-scan'
142 ]
143 module_arg_spec = {
144 'adom': {'required': True, 'type': 'str'},
145 'revision_note': {'type': 'str'},
146 'system_npu_backgroundssescan': {
147 'type': 'dict', 'v_range': [['6.4.8', '6.4.15'], ['7.0.3', '']],
148 'options': {
149 'scan': {'v_range': [['6.4.8', '6.4.15'], ['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
150 'stats-update-interval': {'v_range': [['6.4.8', '6.4.15'], ['7.0.3', '']], 'type': 'int'},
151 'udp-keepalive-interval': {'v_range': [['6.4.8', '6.4.15'], ['7.0.3', '']], 'type': 'int'},
152 'scan-stale': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'},
153 'scan-vt': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'},
154 'stats-qual-access': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'},
155 'stats-qual-duration': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'},
156 'udp-qual-access': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'},
157 'udp-qual-duration': {'v_range': [['7.0.12', '7.0.16'], ['7.2.6', '7.2.12'], ['7.4.1', '']], 'type': 'int'}
158 }
159 }
160 }
161
162 module_option_spec = get_module_arg_spec('partial crud')
163 module_arg_spec.update(module_option_spec)
164 check_galaxy_version(module_arg_spec)
165 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_npu_backgroundssescan'),
166 supports_check_mode=True)
167 if not module._socket_path:
168 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
169 connection = Connection(module._socket_path)
170 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
171 None, 'data', module, connection)
172 fmgr.process_partial_crud()
173 module.exit_json(meta=module.params)
174
175
176 if __name__ == '__main__':
177 main()