Debian Codegraph @

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