Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pkg_firewall_hyperscalepolicy64.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_pkg_firewall_hyperscalepolicy64
15 short_description: Configure IPv6 to IPv4 policies.
16 version_added: "2.2.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_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 pkg:
29 description: The parameter (pkg) in requested url.
30 type: str
31 required: true
32 pkg_firewall_hyperscalepolicy64:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 action:
38 type: str
39 description: Policy action.
40 choices: ['deny', 'accept']
41 cgn_eif:
42 aliases: ['cgn-eif']
43 type: str
44 description: Enable/disable CGN endpoint independent filtering.
45 choices: ['disable', 'enable']
46 cgn_eim:
47 aliases: ['cgn-eim']
48 type: str
49 description: Enable/disable CGN endpoint independent mapping.
50 choices: ['disable', 'enable']
51 cgn_log_server_grp:
52 aliases: ['cgn-log-server-grp']
53 type: str
54 description: NP log server group name
55 cgn_resource_quota:
56 aliases: ['cgn-resource-quota']
57 type: int
58 description: Resource quota
59 cgn_session_quota:
60 aliases: ['cgn-session-quota']
61 type: int
62 description: Session quota
63 comments:
64 type: str
65 description: Comment.
66 dstaddr:
67 type: raw
68 description: (list or str) Destination address name.
69 dstintf:
70 type: str
71 description: Destination interface name.
72 ippool:
73 type: str
74 description: Enable/disable policy64 IP pool.
75 choices: ['disable', 'enable']
76 name:
77 type: str
78 description: Policy name.
79 policy_offload:
80 aliases: ['policy-offload']
81 type: str
82 description: Enable/disable hardware session setup for CGNAT.
83 choices: ['disable', 'enable']
84 policyid:
85 type: int
86 description: Policy ID
87 required: true
88 poolname:
89 type: raw
90 description: (list or str) Policy IP pool names.
91 service:
92 type: raw
93 description: (list or str) Service name.
94 srcaddr:
95 type: raw
96 description: (list or str) Source address name.
97 srcintf:
98 type: str
99 description: Source interface name.
100 status:
101 type: str
102 description: Enable/disable policy status.
103 choices: ['disable', 'enable']
104 tcp_timeout_pid:
105 aliases: ['tcp-timeout-pid']
106 type: str
107 description: TCP timeout profile ID
108 traffic_shaper:
109 aliases: ['traffic-shaper']
110 type: str
111 description: Traffic shaper.
112 traffic_shaper_reverse:
113 aliases: ['traffic-shaper-reverse']
114 type: str
115 description: Reverse traffic shaper.
116 udp_timeout_pid:
117 aliases: ['udp-timeout-pid']
118 type: str
119 description: UDP timeout profile ID
120 uuid:
121 type: str
122 description: Universally Unique Identifier
123 '''
124
125 EXAMPLES = '''
126 - name: Example playbook (generated based on argument schema)
127 hosts: fortimanagers
128 connection: httpapi
129 gather_facts: false
130 tasks:
131 - name: Configure IPv6 to IPv4 policies.
132 fortinet.fortimanager.fmgr_pkg_firewall_hyperscalepolicy64:
133 # workspace_locking_adom: <global or your adom name>
134 adom: <your own value>
135 pkg: <your own value>
136 state: present # <value in [present, absent]>
137 pkg_firewall_hyperscalepolicy64:
138 policyid: 0 # Required variable, integer
139 # action: <value in [deny, accept]>
140 # cgn_eif: <value in [disable, enable]>
141 # cgn_eim: <value in [disable, enable]>
142 # cgn_log_server_grp: <string>
143 # cgn_resource_quota: <integer>
144 # cgn_session_quota: <integer>
145 # comments: <string>
146 # dstaddr: <list or string>
147 # dstintf: <string>
148 # ippool: <value in [disable, enable]>
149 # name: <string>
150 # policy_offload: <value in [disable, enable]>
151 # poolname: <list or string>
152 # service: <list or string>
153 # srcaddr: <list or string>
154 # srcintf: <string>
155 # status: <value in [disable, enable]>
156 # tcp_timeout_pid: <string>
157 # traffic_shaper: <string>
158 # traffic_shaper_reverse: <string>
159 # udp_timeout_pid: <string>
160 # uuid: <string>
161 '''
162
163 RETURN = '''
164 meta:
165 description: The result of the request.
166 type: dict
167 returned: always
168 contains:
169 request_url:
170 description: The full url requested.
171 returned: always
172 type: str
173 sample: /sys/login/user
174 response_code:
175 description: The status of api request.
176 returned: always
177 type: int
178 sample: 0
179 response_data:
180 description: The api response.
181 type: list
182 returned: always
183 response_message:
184 description: The descriptive message of the api response.
185 type: str
186 returned: always
187 sample: OK.
188 system_information:
189 description: The information of the target system.
190 type: dict
191 returned: always
192 rc:
193 description: The status the request.
194 type: int
195 returned: always
196 sample: 0
197 version_check_warning:
198 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
199 type: list
200 returned: complex
201 '''
202 from ansible.module_utils.basic import AnsibleModule
203 from ansible.module_utils.connection import Connection
204 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
205 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
206
207
208 def main():
209 urls_list = [
210 '/pm/config/adom/{adom}/pkg/{pkg}/firewall/hyperscale-policy64'
211 ]
212 module_arg_spec = {
213 'adom': {'required': True, 'type': 'str'},
214 'pkg': {'required': True, 'type': 'str'},
215 'revision_note': {'type': 'str'},
216 'pkg_firewall_hyperscalepolicy64': {
217 'type': 'dict', 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
218 'options': {
219 'action': {
220 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
221 'choices': ['deny', 'accept'],
222 'type': 'str'
223 },
224 'cgn-eif': {
225 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
226 'choices': ['disable', 'enable'],
227 'type': 'str'
228 },
229 'cgn-eim': {
230 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
231 'choices': ['disable', 'enable'],
232 'type': 'str'
233 },
234 'cgn-log-server-grp': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
235 'cgn-resource-quota': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'int'},
236 'cgn-session-quota': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'int'},
237 'comments': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
238 'dstaddr': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
239 'dstintf': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
240 'ippool': {
241 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
242 'choices': ['disable', 'enable'],
243 'type': 'str'
244 },
245 'name': {'v_range': [['6.4.8', '6.4.15'], ['7.0.3', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
246 'policy-offload': {
247 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
248 'choices': ['disable', 'enable'],
249 'type': 'str'
250 },
251 'policyid': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'required': True, 'type': 'int'},
252 'poolname': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
253 'service': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
254 'srcaddr': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
255 'srcintf': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
256 'status': {
257 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']],
258 'choices': ['disable', 'enable'],
259 'type': 'str'
260 },
261 'tcp-timeout-pid': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
262 'traffic-shaper': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
263 'traffic-shaper-reverse': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
264 'udp-timeout-pid': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
265 'uuid': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.2.0'], ['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'}
266 }
267 }
268 }
269
270 module_option_spec = get_module_arg_spec('full crud')
271 module_arg_spec.update(module_option_spec)
272 check_galaxy_version(module_arg_spec)
273 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'pkg_firewall_hyperscalepolicy64'),
274 supports_check_mode=True)
275 if not module._socket_path:
276 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
277 connection = Connection(module._socket_path)
278 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
279 'policyid', 'data', module, connection)
280 fmgr.process_crud()
281 module.exit_json(meta=module.params)
282
283
284 if __name__ == '__main__':
285 main()