Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_log_ioc.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_log_ioc
15 short_description: IoC settings.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_log_ioc:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 notification:
27 type: str
28 description:
29 - Disable/Enable IoC notification.
30 - disable - Disable IoC feature.
31 - enable - Enable IoC feature.
32 choices: ['disable', 'enable']
33 notification_throttle:
34 aliases: ['notification-throttle']
35 type: int
36 description: Minute value for throttling the rate of IoC notifications.
37 rescan_max_runner:
38 aliases: ['rescan-max-runner']
39 type: int
40 description: Max count of cocurrent runner of IoC rescan.
41 rescan_run_at:
42 aliases: ['rescan-run-at']
43 type: int
44 description: When to run IoC rescan.
45 rescan_status:
46 aliases: ['rescan-status']
47 type: str
48 description:
49 - Disable/Enable IoC rescan.
50 - disable - Disable IoC feature.
51 - enable - Enable IoC feature.
52 choices: ['disable', 'enable']
53 status:
54 type: str
55 description:
56 - Disable/Enable IoC feature.
57 - disable - Disable IoC feature.
58 - enable - Enable IoC feature.
59 choices: ['disable', 'enable']
60 '''
61
62 EXAMPLES = '''
63 - name: Example playbook (generated based on argument schema)
64 hosts: fortimanagers
65 connection: httpapi
66 gather_facts: false
67 tasks:
68 - name: IoC settings.
69 fortinet.fortimanager.fmgr_system_log_ioc:
70 # workspace_locking_adom: <global or your adom name>
71 system_log_ioc:
72 # notification: <value in [disable, enable]>
73 # notification_throttle: <integer>
74 # rescan_max_runner: <integer>
75 # rescan_run_at: <integer>
76 # rescan_status: <value in [disable, enable]>
77 # status: <value in [disable, enable]>
78 '''
79
80 RETURN = '''
81 meta:
82 description: The result of the request.
83 type: dict
84 returned: always
85 contains:
86 request_url:
87 description: The full url requested.
88 returned: always
89 type: str
90 sample: /sys/login/user
91 response_code:
92 description: The status of api request.
93 returned: always
94 type: int
95 sample: 0
96 response_data:
97 description: The api response.
98 type: list
99 returned: always
100 response_message:
101 description: The descriptive message of the api response.
102 type: str
103 returned: always
104 sample: OK.
105 system_information:
106 description: The information of the target system.
107 type: dict
108 returned: always
109 rc:
110 description: The status the request.
111 type: int
112 returned: always
113 sample: 0
114 version_check_warning:
115 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
116 type: list
117 returned: complex
118 '''
119 from ansible.module_utils.basic import AnsibleModule
120 from ansible.module_utils.connection import Connection
121 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
122 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
123
124
125 def main():
126 urls_list = [
127 '/cli/global/system/log/ioc'
128 ]
129 module_arg_spec = {
130 'system_log_ioc': {
131 'type': 'dict', 'v_range': [['6.0.0', '']],
132 'options': {
133 'notification': {'choices': ['disable', 'enable'], 'type': 'str'},
134 'notification-throttle': {'type': 'int'},
135 'rescan-max-runner': {'type': 'int'},
136 'rescan-run-at': {'type': 'int'},
137 'rescan-status': {'choices': ['disable', 'enable'], 'type': 'str'},
138 'status': {'choices': ['disable', 'enable'], 'type': 'str'}
139 }
140 }
141 }
142
143 module_option_spec = get_module_arg_spec('partial crud')
144 module_arg_spec.update(module_option_spec)
145 check_galaxy_version(module_arg_spec)
146 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_log_ioc'),
147 supports_check_mode=True)
148 if not module._socket_path:
149 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
150 connection = Connection(module._socket_path)
151 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
152 None, 'data', module, connection)
153 fmgr.process_partial_crud()
154 module.exit_json(meta=module.params)
155
156
157 if __name__ == '__main__':
158 main()