Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_npu_ssehascan.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_ssehascan
15 short_description: Configure driver HA 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_ssehascan:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 gap:
34 type: int
35 description: Scanning message gap
36 max_session_cnt:
37 aliases: ['max-session-cnt']
38 type: int
39 description: If the session count
40 min_duration:
41 aliases: ['min-duration']
42 type: int
43 description: Scanning filter for minimum duration of the session.
44 '''
45
46 EXAMPLES = '''
47 - name: Example playbook (generated based on argument schema)
48 hosts: fortimanagers
49 connection: httpapi
50 gather_facts: false
51 tasks:
52 - name: Configure driver HA scan for SSE.
53 fortinet.fortimanager.fmgr_system_npu_ssehascan:
54 # workspace_locking_adom: <global or your adom name>
55 adom: <your own value>
56 system_npu_ssehascan:
57 # gap: <integer>
58 # max_session_cnt: <integer>
59 # min_duration: <integer>
60 '''
61
62 RETURN = '''
63 meta:
64 description: The result of the request.
65 type: dict
66 returned: always
67 contains:
68 request_url:
69 description: The full url requested.
70 returned: always
71 type: str
72 sample: /sys/login/user
73 response_code:
74 description: The status of api request.
75 returned: always
76 type: int
77 sample: 0
78 response_data:
79 description: The api response.
80 type: list
81 returned: always
82 response_message:
83 description: The descriptive message of the api response.
84 type: str
85 returned: always
86 sample: OK.
87 system_information:
88 description: The information of the target system.
89 type: dict
90 returned: always
91 rc:
92 description: The status the request.
93 type: int
94 returned: always
95 sample: 0
96 version_check_warning:
97 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
98 type: list
99 returned: complex
100 '''
101 from ansible.module_utils.basic import AnsibleModule
102 from ansible.module_utils.connection import Connection
103 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
104 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
105
106
107 def main():
108 urls_list = [
109 '/pm/config/adom/{adom}/obj/system/npu/sse-ha-scan',
110 '/pm/config/global/obj/system/npu/sse-ha-scan'
111 ]
112 module_arg_spec = {
113 'adom': {'required': True, 'type': 'str'},
114 'revision_note': {'type': 'str'},
115 'system_npu_ssehascan': {
116 'type': 'dict', 'v_range': [['6.4.10', '6.4.15'], ['7.0.4', '7.0.16'], ['7.2.1', '']],
117 'options': {
118 'gap': {'v_range': [['6.4.10', '6.4.15'], ['7.0.4', '7.0.16'], ['7.2.1', '']], 'type': 'int'},
119 'max-session-cnt': {'v_range': [['6.4.10', '6.4.15'], ['7.0.4', '7.0.16'], ['7.2.1', '']], 'type': 'int'},
120 'min-duration': {'v_range': [['6.4.10', '6.4.15'], ['7.0.4', '7.0.16'], ['7.2.1', '']], 'type': 'int'}
121 }
122 }
123 }
124
125 module_option_spec = get_module_arg_spec('partial crud')
126 module_arg_spec.update(module_option_spec)
127 check_galaxy_version(module_arg_spec)
128 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_npu_ssehascan'),
129 supports_check_mode=True)
130 if not module._socket_path:
131 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
132 connection = Connection(module._socket_path)
133 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
134 None, 'data', module, connection)
135 fmgr.process_partial_crud()
136 module.exit_json(meta=module.params)
137
138
139 if __name__ == '__main__':
140 main()