Debian Codegraph @

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