Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_profileprotocoloptions_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_firewall_profileprotocoloptions_nntp
15 short_description: Configure NNTP 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_nntp:
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', '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 status:
62 type: str
63 description: Enable/disable the active status of scanning for this protocol.
64 choices: ['disable', 'enable']
65 uncompressed_nest_limit:
66 aliases: ['uncompressed-nest-limit']
67 type: int
68 description: Maximum nested levels of compression that can be uncompressed and scanned
69 uncompressed_oversize_limit:
70 aliases: ['uncompressed-oversize-limit']
71 type: int
72 description: Maximum in-memory uncompressed file size that can be scanned
73 proxy_after_tcp_handshake:
74 aliases: ['proxy-after-tcp-handshake']
75 type: str
76 description: Proxy traffic after the TCP 3-way handshake has been established
77 choices: ['disable', 'enable']
78 '''
79
80 EXAMPLES = '''
81 - name: Example playbook (generated based on argument schema)
82 hosts: fortimanagers
83 connection: httpapi
84 gather_facts: false
85 tasks:
86 - name: Configure NNTP protocol options.
87 fortinet.fortimanager.fmgr_firewall_profileprotocoloptions_nntp:
88 # workspace_locking_adom: <global or your adom name>
89 adom: <your own value>
90 profile_protocol_options: <your own value>
91 firewall_profileprotocoloptions_nntp:
92 # inspect_all: <value in [disable, enable]>
93 # options: ["oversize", "no-content-summary", "splice"]
94 # oversize_limit: <integer>
95 # ports: <list or integer>
96 # scan_bzip2: <value in [disable, enable]>
97 # status: <value in [disable, enable]>
98 # uncompressed_nest_limit: <integer>
99 # uncompressed_oversize_limit: <integer>
100 # proxy_after_tcp_handshake: <value in [disable, enable]>
101 '''
102
103 RETURN = '''
104 meta:
105 description: The result of the request.
106 type: dict
107 returned: always
108 contains:
109 request_url:
110 description: The full url requested.
111 returned: always
112 type: str
113 sample: /sys/login/user
114 response_code:
115 description: The status of api request.
116 returned: always
117 type: int
118 sample: 0
119 response_data:
120 description: The api response.
121 type: list
122 returned: always
123 response_message:
124 description: The descriptive message of the api response.
125 type: str
126 returned: always
127 sample: OK.
128 system_information:
129 description: The information of the target system.
130 type: dict
131 returned: always
132 rc:
133 description: The status the request.
134 type: int
135 returned: always
136 sample: 0
137 version_check_warning:
138 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
139 type: list
140 returned: complex
141 '''
142 from ansible.module_utils.basic import AnsibleModule
143 from ansible.module_utils.connection import Connection
144 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
145 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
146
147
148 def main():
149 urls_list = [
150 '/pm/config/adom/{adom}/obj/firewall/profile-protocol-options/{profile-protocol-options}/nntp',
151 '/pm/config/global/obj/firewall/profile-protocol-options/{profile-protocol-options}/nntp'
152 ]
153 module_arg_spec = {
154 'adom': {'required': True, 'type': 'str'},
155 'profile-protocol-options': {'type': 'str', 'api_name': 'profile_protocol_options'},
156 'profile_protocol_options': {'type': 'str'},
157 'revision_note': {'type': 'str'},
158 'firewall_profileprotocoloptions_nntp': {
159 'type': 'dict', 'v_range': [['6.0.0', '']],
160 'options': {
161 'inspect-all': {'choices': ['disable', 'enable'], 'type': 'str'},
162 'options': {'type': 'list', 'choices': ['oversize', 'no-content-summary', 'splice'], 'elements': 'str'},
163 'oversize-limit': {'type': 'int'},
164 'ports': {'type': 'raw'},
165 'scan-bzip2': {'choices': ['disable', 'enable'], 'type': 'str'},
166 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
167 'uncompressed-nest-limit': {'type': 'int'},
168 'uncompressed-oversize-limit': {'type': 'int'},
169 'proxy-after-tcp-handshake': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
170 }
171 }
172 }
173
174 module_option_spec = get_module_arg_spec('partial crud')
175 module_arg_spec.update(module_option_spec)
176 check_galaxy_version(module_arg_spec)
177 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_profileprotocoloptions_nntp'),
178 supports_check_mode=True)
179 if not module._socket_path:
180 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
181 connection = Connection(module._socket_path)
182 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
183 None, 'data', module, connection)
184 fmgr.process_partial_crud()
185 module.exit_json(meta=module.params)
186
187
188 if __name__ == '__main__':
189 main()