Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_antivirus_profile_smb.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_smb
15 short_description: Configure SMB 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_smb:
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 SMB AntiVirus scanning, monitoring, and quarantine.
59 choices: ['scan', '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']
65 '''
66
67 EXAMPLES = '''
68 - name: Example playbook (generated based on argument schema)
69 hosts: fortimanagers
70 connection: httpapi
71 gather_facts: false
72 tasks:
73 - name: Configure SMB AntiVirus options.
74 fortinet.fortimanager.fmgr_antivirus_profile_smb:
75 # workspace_locking_adom: <global or your adom name>
76 adom: <your own value>
77 profile: <your own value>
78 antivirus_profile_smb:
79 # archive_block: ["encrypted", "corrupted", "multipart", "nested", "mailbomb",
80 # "unhandled", "partiallycorrupted", "fileslimit", "timeout"]
81 # archive_log: ["encrypted", "corrupted", "multipart", "nested", "mailbomb",
82 # "unhandled", "partiallycorrupted", "fileslimit", "timeout"]
83 # emulator: <value in [disable, enable]>
84 # options: ["scan", "quarantine", "avquery", "avmonitor"]
85 # outbreak_prevention: <value in [disabled, files, full-archive]>
86 '''
87
88 RETURN = '''
89 meta:
90 description: The result of the request.
91 type: dict
92 returned: always
93 contains:
94 request_url:
95 description: The full url requested.
96 returned: always
97 type: str
98 sample: /sys/login/user
99 response_code:
100 description: The status of api request.
101 returned: always
102 type: int
103 sample: 0
104 response_data:
105 description: The api response.
106 type: list
107 returned: always
108 response_message:
109 description: The descriptive message of the api response.
110 type: str
111 returned: always
112 sample: OK.
113 system_information:
114 description: The information of the target system.
115 type: dict
116 returned: always
117 rc:
118 description: The status the request.
119 type: int
120 returned: always
121 sample: 0
122 version_check_warning:
123 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
124 type: list
125 returned: complex
126 '''
127 from ansible.module_utils.basic import AnsibleModule
128 from ansible.module_utils.connection import Connection
129 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
130 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
131
132
133 def main():
134 urls_list = [
135 '/pm/config/adom/{adom}/obj/antivirus/profile/{profile}/smb',
136 '/pm/config/global/obj/antivirus/profile/{profile}/smb'
137 ]
138 module_arg_spec = {
139 'adom': {'required': True, 'type': 'str'},
140 'profile': {'required': True, 'type': 'str'},
141 'revision_note': {'type': 'str'},
142 'antivirus_profile_smb': {
143 'type': 'dict', 'v_range': [['6.0.0', '7.2.1']],
144 'options': {
145 'archive-block': {
146 'v_range': [['6.0.0', '7.2.1']],
147 'type': 'list',
148 'choices': ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb', 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout'],
149 'elements': 'str'
150 },
151 'archive-log': {
152 'v_range': [['6.0.0', '7.2.1']],
153 'type': 'list',
154 'choices': ['encrypted', 'corrupted', 'multipart', 'nested', 'mailbomb', 'unhandled', 'partiallycorrupted', 'fileslimit', 'timeout'],
155 'elements': 'str'
156 },
157 'emulator': {'v_range': [['6.0.0', '7.2.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
158 'options': {'v_range': [['6.0.0', '7.2.1']], 'type': 'list', 'choices': ['scan', 'quarantine', 'avquery', 'avmonitor'], 'elements': 'str'},
159 'outbreak-prevention': {'v_range': [['6.0.0', '7.2.1']], 'choices': ['disabled', 'files', 'full-archive'], 'type': 'str'}
160 }
161 }
162 }
163
164 module_option_spec = get_module_arg_spec('partial crud')
165 module_arg_spec.update(module_option_spec)
166 check_galaxy_version(module_arg_spec)
167 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'antivirus_profile_smb'),
168 supports_check_mode=True)
169 if not module._socket_path:
170 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
171 connection = Connection(module._socket_path)
172 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
173 None, 'data', module, connection)
174 fmgr.process_partial_crud()
175 module.exit_json(meta=module.params)
176
177
178 if __name__ == '__main__':
179 main()