Debian Codegraph @

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