Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_profileprotocoloptions_ftp.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_ftp
15 short_description: Configure FTP 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_ftp:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 comfort_amount:
40 aliases: ['comfort-amount']
41 type: int
42 description: Amount of data to send in a transmission for client comforting
43 comfort_interval:
44 aliases: ['comfort-interval']
45 type: int
46 description: Period of time between start, or last transmission, and the next client comfort transmission of data
47 inspect_all:
48 aliases: ['inspect-all']
49 type: str
50 description: Enable/disable the inspection of all ports for the protocol.
51 choices: ['disable', 'enable']
52 options:
53 type: list
54 elements: str
55 description: One or more options that can be applied to the session.
56 choices: ['clientcomfort', 'no-content-summary', 'oversize', 'splice',
57 'bypass-rest-command', 'bypass-mode-command']
58 oversize_limit:
59 aliases: ['oversize-limit']
60 type: int
61 description: Maximum in-memory file size that can be scanned
62 ports:
63 type: raw
64 description: (list) Ports to scan for content
65 scan_bzip2:
66 aliases: ['scan-bzip2']
67 type: str
68 description: Enable/disable scanning of BZip2 compressed files.
69 choices: ['disable', 'enable']
70 status:
71 type: str
72 description: Enable/disable the active status of scanning for this protocol.
73 choices: ['disable', 'enable']
74 uncompressed_nest_limit:
75 aliases: ['uncompressed-nest-limit']
76 type: int
77 description: Maximum nested levels of compression that can be uncompressed and scanned
78 uncompressed_oversize_limit:
79 aliases: ['uncompressed-oversize-limit']
80 type: int
81 description: Maximum in-memory uncompressed file size that can be scanned
82 ssl_offloaded:
83 aliases: ['ssl-offloaded']
84 type: str
85 description: SSL decryption and encryption performed by an external device.
86 choices: ['no', 'yes']
87 stream_based_uncompressed_limit:
88 aliases: ['stream-based-uncompressed-limit']
89 type: int
90 description: Maximum stream-based uncompressed data size that will be scanned
91 tcp_window_maximum:
92 aliases: ['tcp-window-maximum']
93 type: int
94 description: Maximum dynamic TCP window size.
95 tcp_window_minimum:
96 aliases: ['tcp-window-minimum']
97 type: int
98 description: Minimum dynamic TCP window size.
99 tcp_window_size:
100 aliases: ['tcp-window-size']
101 type: int
102 description: Set TCP static window size.
103 tcp_window_type:
104 aliases: ['tcp-window-type']
105 type: str
106 description: TCP window type to use for this protocol.
107 choices: ['system', 'static', 'dynamic', 'auto-tuning']
108 explicit_ftp_tls:
109 aliases: ['explicit-ftp-tls']
110 type: str
111 description: Enable/disable FTP redirection for explicit FTPS.
112 choices: ['disable', 'enable']
113 '''
114
115 EXAMPLES = '''
116 - name: Example playbook (generated based on argument schema)
117 hosts: fortimanagers
118 connection: httpapi
119 gather_facts: false
120 tasks:
121 - name: Configure FTP protocol options.
122 fortinet.fortimanager.fmgr_firewall_profileprotocoloptions_ftp:
123 # workspace_locking_adom: <global or your adom name>
124 adom: <your own value>
125 profile_protocol_options: <your own value>
126 firewall_profileprotocoloptions_ftp:
127 # comfort_amount: <integer>
128 # comfort_interval: <integer>
129 # inspect_all: <value in [disable, enable]>
130 # options: ["clientcomfort", "no-content-summary", "oversize", "splice",
131 # "bypass-rest-command", "bypass-mode-command"]
132 # oversize_limit: <integer>
133 # ports: <list or integer>
134 # scan_bzip2: <value in [disable, enable]>
135 # status: <value in [disable, enable]>
136 # uncompressed_nest_limit: <integer>
137 # uncompressed_oversize_limit: <integer>
138 # ssl_offloaded: <value in [no, yes]>
139 # stream_based_uncompressed_limit: <integer>
140 # tcp_window_maximum: <integer>
141 # tcp_window_minimum: <integer>
142 # tcp_window_size: <integer>
143 # tcp_window_type: <value in [system, static, dynamic, ...]>
144 # explicit_ftp_tls: <value in [disable, enable]>
145 '''
146
147 RETURN = '''
148 meta:
149 description: The result of the request.
150 type: dict
151 returned: always
152 contains:
153 request_url:
154 description: The full url requested.
155 returned: always
156 type: str
157 sample: /sys/login/user
158 response_code:
159 description: The status of api request.
160 returned: always
161 type: int
162 sample: 0
163 response_data:
164 description: The api response.
165 type: list
166 returned: always
167 response_message:
168 description: The descriptive message of the api response.
169 type: str
170 returned: always
171 sample: OK.
172 system_information:
173 description: The information of the target system.
174 type: dict
175 returned: always
176 rc:
177 description: The status the request.
178 type: int
179 returned: always
180 sample: 0
181 version_check_warning:
182 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
183 type: list
184 returned: complex
185 '''
186 from ansible.module_utils.basic import AnsibleModule
187 from ansible.module_utils.connection import Connection
188 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
189 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
190
191
192 def main():
193 urls_list = [
194 '/pm/config/adom/{adom}/obj/firewall/profile-protocol-options/{profile-protocol-options}/ftp',
195 '/pm/config/global/obj/firewall/profile-protocol-options/{profile-protocol-options}/ftp'
196 ]
197 module_arg_spec = {
198 'adom': {'required': True, 'type': 'str'},
199 'profile-protocol-options': {'type': 'str', 'api_name': 'profile_protocol_options'},
200 'profile_protocol_options': {'type': 'str'},
201 'revision_note': {'type': 'str'},
202 'firewall_profileprotocoloptions_ftp': {
203 'type': 'dict', 'v_range': [['6.0.0', '']],
204 'options': {
205 'comfort-amount': {'type': 'int'},
206 'comfort-interval': {'type': 'int'},
207 'inspect-all': {'choices': ['disable', 'enable'], 'type': 'str'},
208 'options': {
209 'type': 'list',
210 'choices': ['clientcomfort', 'no-content-summary', 'oversize', 'splice', 'bypass-rest-command', 'bypass-mode-command'],
211 'elements': 'str'
212 },
213 'oversize-limit': {'type': 'int'},
214 'ports': {'type': 'raw'},
215 'scan-bzip2': {'choices': ['disable', 'enable'], 'type': 'str'},
216 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
217 'uncompressed-nest-limit': {'type': 'int'},
218 'uncompressed-oversize-limit': {'type': 'int'},
219 'ssl-offloaded': {'v_range': [['6.2.2', '']], 'choices': ['no', 'yes'], 'type': 'str'},
220 'stream-based-uncompressed-limit': {'v_range': [['7.0.0', '']], 'type': 'int'},
221 'tcp-window-maximum': {'v_range': [['7.0.0', '']], 'type': 'int'},
222 'tcp-window-minimum': {'v_range': [['7.0.0', '']], 'type': 'int'},
223 'tcp-window-size': {'v_range': [['7.0.0', '']], 'type': 'int'},
224 'tcp-window-type': {'v_range': [['7.0.0', '']], 'choices': ['system', 'static', 'dynamic', 'auto-tuning'], 'type': 'str'},
225 'explicit-ftp-tls': {'v_range': [['7.0.5', '7.0.16'], ['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
226 }
227 }
228 }
229
230 module_option_spec = get_module_arg_spec('partial crud')
231 module_arg_spec.update(module_option_spec)
232 check_galaxy_version(module_arg_spec)
233 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_profileprotocoloptions_ftp'),
234 supports_check_mode=True)
235 if not module._socket_path:
236 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
237 connection = Connection(module._socket_path)
238 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
239 None, 'data', module, connection)
240 fmgr.process_partial_crud()
241 module.exit_json(meta=module.params)
242
243
244 if __name__ == '__main__':
245 main()