Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_profileprotocoloptions_smtp.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_firewall_profileprotocoloptions_smtp
15 short_description: Configure SMTP protocol 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-protocol-options:
29 description: Deprecated, please use "profile_protocol_options"
30 type: str
31 profile_protocol_options:
32 description: The parameter (profile-protocol-options) in requested url.
33 type: str
34 firewall_profileprotocoloptions_smtp:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 inspect_all:
40 aliases: ['inspect-all']
41 type: str
42 description: Enable/disable the inspection of all ports for the protocol.
43 choices: ['disable', 'enable']
44 options:
45 type: list
46 elements: str
47 description: One or more options that can be applied to the session.
48 choices: ['oversize', 'fragmail', 'no-content-summary', 'splice']
49 oversize_limit:
50 aliases: ['oversize-limit']
51 type: int
52 description: Maximum in-memory file size that can be scanned
53 ports:
54 type: raw
55 description: (list) Ports to scan for content
56 scan_bzip2:
57 aliases: ['scan-bzip2']
58 type: str
59 description: Enable/disable scanning of BZip2 compressed files.
60 choices: ['disable', 'enable']
61 server_busy:
62 aliases: ['server-busy']
63 type: str
64 description: Enable/disable SMTP server busy when server not available.
65 choices: ['disable', 'enable']
66 status:
67 type: str
68 description: Enable/disable the active status of scanning for this protocol.
69 choices: ['disable', 'enable']
70 uncompressed_nest_limit:
71 aliases: ['uncompressed-nest-limit']
72 type: int
73 description: Maximum nested levels of compression that can be uncompressed and scanned
74 uncompressed_oversize_limit:
75 aliases: ['uncompressed-oversize-limit']
76 type: int
77 description: Maximum in-memory uncompressed file size that can be scanned
78 ssl_offloaded:
79 aliases: ['ssl-offloaded']
80 type: str
81 description: SSL decryption and encryption performed by an external device.
82 choices: ['no', 'yes']
83 proxy_after_tcp_handshake:
84 aliases: ['proxy-after-tcp-handshake']
85 type: str
86 description: Proxy traffic after the TCP 3-way handshake has been established
87 choices: ['disable', 'enable']
88 '''
89
90 EXAMPLES = '''
91 - name: Example playbook (generated based on argument schema)
92 hosts: fortimanagers
93 connection: httpapi
94 gather_facts: false
95 tasks:
96 - name: Configure SMTP protocol options.
97 fortinet.fortimanager.fmgr_firewall_profileprotocoloptions_smtp:
98 # workspace_locking_adom: <global or your adom name>
99 adom: <your own value>
100 profile_protocol_options: <your own value>
101 firewall_profileprotocoloptions_smtp:
102 # inspect_all: <value in [disable, enable]>
103 # options: ["oversize", "fragmail", "no-content-summary", "splice"]
104 # oversize_limit: <integer>
105 # ports: <list or integer>
106 # scan_bzip2: <value in [disable, enable]>
107 # server_busy: <value in [disable, enable]>
108 # status: <value in [disable, enable]>
109 # uncompressed_nest_limit: <integer>
110 # uncompressed_oversize_limit: <integer>
111 # ssl_offloaded: <value in [no, yes]>
112 # proxy_after_tcp_handshake: <value in [disable, enable]>
113 '''
114
115 RETURN = '''
116 meta:
117 description: The result of the request.
118 type: dict
119 returned: always
120 contains:
121 request_url:
122 description: The full url requested.
123 returned: always
124 type: str
125 sample: /sys/login/user
126 response_code:
127 description: The status of api request.
128 returned: always
129 type: int
130 sample: 0
131 response_data:
132 description: The api response.
133 type: list
134 returned: always
135 response_message:
136 description: The descriptive message of the api response.
137 type: str
138 returned: always
139 sample: OK.
140 system_information:
141 description: The information of the target system.
142 type: dict
143 returned: always
144 rc:
145 description: The status the request.
146 type: int
147 returned: always
148 sample: 0
149 version_check_warning:
150 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
151 type: list
152 returned: complex
153 '''
154 from ansible.module_utils.basic import AnsibleModule
155 from ansible.module_utils.connection import Connection
156 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
157 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
158
159
160 def main():
161 urls_list = [
162 '/pm/config/adom/{adom}/obj/firewall/profile-protocol-options/{profile-protocol-options}/smtp',
163 '/pm/config/global/obj/firewall/profile-protocol-options/{profile-protocol-options}/smtp'
164 ]
165 module_arg_spec = {
166 'adom': {'required': True, 'type': 'str'},
167 'profile-protocol-options': {'type': 'str', 'api_name': 'profile_protocol_options'},
168 'profile_protocol_options': {'type': 'str'},
169 'revision_note': {'type': 'str'},
170 'firewall_profileprotocoloptions_smtp': {
171 'type': 'dict', 'v_range': [['6.0.0', '']],
172 'options': {
173 'inspect-all': {'choices': ['disable', 'enable'], 'type': 'str'},
174 'options': {'type': 'list', 'choices': ['oversize', 'fragmail', 'no-content-summary', 'splice'], 'elements': 'str'},
175 'oversize-limit': {'type': 'int'},
176 'ports': {'type': 'raw'},
177 'scan-bzip2': {'choices': ['disable', 'enable'], 'type': 'str'},
178 'server-busy': {'choices': ['disable', 'enable'], 'type': 'str'},
179 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
180 'uncompressed-nest-limit': {'type': 'int'},
181 'uncompressed-oversize-limit': {'type': 'int'},
182 'ssl-offloaded': {'v_range': [['6.2.2', '']], 'choices': ['no', 'yes'], 'type': 'str'},
183 'proxy-after-tcp-handshake': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
184 }
185 }
186 }
187
188 module_option_spec = get_module_arg_spec('partial crud')
189 module_arg_spec.update(module_option_spec)
190 check_galaxy_version(module_arg_spec)
191 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_profileprotocoloptions_smtp'),
192 supports_check_mode=True)
193 if not module._socket_path:
194 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
195 connection = Connection(module._socket_path)
196 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
197 None, 'data', module, connection)
198 fmgr.process_partial_crud()
199 module.exit_json(meta=module.params)
200
201
202 if __name__ == '__main__':
203 main()