Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_antivirus_profile_nntp.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_antivirus_profile_nntp
15 short_description: Configure NNTP AntiVirus options.
16 version_added: "2.0.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 profile:
29 description: The parameter (profile) in requested url.
30 type: str
31 required: true
32 antivirus_profile_nntp:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 archive_block:
38 aliases: ['archive-block']
39 type: list
40 elements: str
41 description: Select the archive types to block.
42 choices: ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb',
43 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout']
44 archive_log:
45 aliases: ['archive-log']
46 type: list
47 elements: str
48 description: Select the archive types to log.
49 choices: ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb',
50 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout']
51 emulator:
52 type: str
53 description: Enable/disable the virus emulator.
54 choices: ['disable', 'enable']
55 options:
56 type: list
57 elements: str
58 description: Enable/disable NNTP AntiVirus scanning, monitoring, and quarantine.
59 choices: ['scan', 'file-filter', 'quarantine', 'avquery', 'avmonitor']
60 outbreak_prevention:
61 aliases: ['outbreak-prevention']
62 type: str
63 description: Enable FortiGuard Virus Outbreak Prevention service.
64 choices: ['disabled', 'files', 'full-archive', 'disable', 'block', 'monitor']
65 av_scan:
66 aliases: ['av-scan']
67 type: str
68 description: Enable AntiVirus scan service.
69 choices: ['disable', 'monitor', 'block']
70 external_blocklist:
71 aliases: ['external-blocklist']
72 type: str
73 description: Enable external-blocklist.
74 choices: ['disable', 'monitor', 'block']
75 quarantine:
76 type: str
77 description: Enable/disable quarantine for infected files.
78 choices: ['disable', 'enable']
79 fortindr:
80 type: str
81 description: Enable scanning of files by FortiNDR.
82 choices: ['disable', 'block', 'monitor']
83 fortisandbox:
84 type: str
85 description: Enable scanning of files by FortiSandbox.
86 choices: ['disable', 'block', 'monitor']
87 fortiai:
88 type: str
89 description: Enable/disable scanning of files by FortiAI.
90 choices: ['disable', 'monitor', 'block']
91 malware_stream:
92 aliases: ['malware-stream']
93 type: str
94 description: Enable 0-day malware-stream scanning.
95 choices: ['disable', 'monitor', 'block']
96 '''
97
98 EXAMPLES = '''
99 - name: Example playbook (generated based on argument schema)
100 hosts: fortimanagers
101 connection: httpapi
102 gather_facts: false
103 tasks:
104 - name: Configure NNTP AntiVirus options.
105 fortinet.fortimanager.fmgr_antivirus_profile_nntp:
106 # workspace_locking_adom: <global or your adom name>
107 adom: <your own value>
108 profile: <your own value>
109 antivirus_profile_nntp:
110 # archive_block: ["encrypted", "corrupted", "multipart", "nested", "mailbomb",
111 # "unhandled", "partiallycorrupted", "fileslimit", "timeout"]
112 # archive_log: ["encrypted", "corrupted", "multipart", "nested", "mailbomb",
113 # "unhandled", "partiallycorrupted", "fileslimit", "timeout"]
114 # emulator: <value in [disable, enable]>
115 # options: ["scan", "file-filter", "quarantine", "avquery", "avmonitor"]
116 # outbreak_prevention: <value in [disabled, files, full-archive, ...]>
117 # av_scan: <value in [disable, monitor, block]>
118 # external_blocklist: <value in [disable, monitor, block]>
119 # quarantine: <value in [disable, enable]>
120 # fortindr: <value in [disable, block, monitor]>
121 # fortisandbox: <value in [disable, block, monitor]>
122 # fortiai: <value in [disable, monitor, block]>
123 # malware_stream: <value in [disable, monitor, block]>
124 '''
125
126 RETURN = '''
127 meta:
128 description: The result of the request.
129 type: dict
130 returned: always
131 contains:
132 request_url:
133 description: The full url requested.
134 returned: always
135 type: str
136 sample: /sys/login/user
137 response_code:
138 description: The status of api request.
139 returned: always
140 type: int
141 sample: 0
142 response_data:
143 description: The api response.
144 type: list
145 returned: always
146 response_message:
147 description: The descriptive message of the api response.
148 type: str
149 returned: always
150 sample: OK.
151 system_information:
152 description: The information of the target system.
153 type: dict
154 returned: always
155 rc:
156 description: The status the request.
157 type: int
158 returned: always
159 sample: 0
160 version_check_warning:
161 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
162 type: list
163 returned: complex
164 '''
165 from ansible.module_utils.basic import AnsibleModule
166 from ansible.module_utils.connection import Connection
167 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
168 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
169
170
171 def main():
172 urls_list = [
173 '/pm/config/adom/{adom}/obj/antivirus/profile/{profile}/nntp',
174 '/pm/config/global/obj/antivirus/profile/{profile}/nntp'
175 ]
176 module_arg_spec = {
177 'adom': {'required': True, 'type': 'str'},
178 'profile': {'required': True, 'type': 'str'},
179 'revision_note': {'type': 'str'},
180 'antivirus_profile_nntp': {
181 'type': 'dict', 'v_range': [['6.0.0', '']],
182 'options': {
183 'archive-block': {
184 'type': 'list',
185 'choices': ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb', 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout'],
186 'elements': 'str'
187 },
188 'archive-log': {
189 'type': 'list',
190 'choices': ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb', 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout'],
191 'elements': 'str'
192 },
193 'emulator': {'choices': ['disable', 'enable'], 'type': 'str'},
194 'options': {'type': 'list', 'choices': ['scan', 'file-filter', 'quarantine', 'avquery', 'avmonitor'], 'elements': 'str'},
195 'outbreak-prevention': {'choices': ['disabled', 'files', 'full-archive', 'disable', 'block', 'monitor'], 'type': 'str'},
196 'av-scan': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'monitor', 'block'], 'type': 'str'},
197 'external-blocklist': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'monitor', 'block'], 'type': 'str'},
198 'quarantine': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
199 'fortindr': {'v_range': [['7.0.5', '']], 'choices': ['disable', 'block', 'monitor'], 'type': 'str'},
200 'fortisandbox': {'v_range': [['7.2.0', '']], 'choices': ['disable', 'block', 'monitor'], 'type': 'str'},
201 'fortiai': {'v_range': [['7.0.1', '']], 'choices': ['disable', 'monitor', 'block'], 'type': 'str'},
202 'malware-stream': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'monitor', 'block'], 'type': 'str'}
203 }
204 }
205 }
206
207 module_option_spec = get_module_arg_spec('partial crud')
208 module_arg_spec.update(module_option_spec)
209 check_galaxy_version(module_arg_spec)
210 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'antivirus_profile_nntp'),
211 supports_check_mode=True)
212 if not module._socket_path:
213 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
214 connection = Connection(module._socket_path)
215 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
216 None, 'data', module, connection)
217 fmgr.process_partial_crud()
218 module.exit_json(meta=module.params)
219
220
221 if __name__ == '__main__':
222 main()