Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_proxyaddress6.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_proxyaddress6
15 short_description: Firewall proxy address6
16 version_added: "2.12.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 firewall_proxyaddress6:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 application:
34 type: list
35 elements: str
36 description: Application.
37 case_sensitivity:
38 aliases: ['case-sensitivity']
39 type: str
40 description: Case sensitivity.
41 choices: ['disable', 'enable']
42 category:
43 type: list
44 elements: int
45 description: Category.
46 color:
47 type: int
48 description: Color.
49 comment:
50 type: str
51 description: Comment.
52 header:
53 type: str
54 description: Header.
55 header_group:
56 aliases: ['header-group']
57 type: list
58 elements: dict
59 description: Header group.
60 suboptions:
61 case_sensitivity:
62 aliases: ['case-sensitivity']
63 type: str
64 description: Case sensitivity.
65 choices: ['disable', 'enable']
66 header:
67 type: str
68 description: Header.
69 header_name:
70 aliases: ['header-name']
71 type: str
72 description: Header name.
73 id:
74 type: int
75 description: Id.
76 header_name:
77 aliases: ['header-name']
78 type: str
79 description: Header name.
80 host:
81 type: list
82 elements: str
83 description: Host.
84 host_regex:
85 aliases: ['host-regex']
86 type: str
87 description: Host regex.
88 method:
89 type: list
90 elements: str
91 description: Method.
92 choices: ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'connect']
93 name:
94 type: str
95 description: Name.
96 required: true
97 path:
98 type: str
99 description: Path.
100 post_arg:
101 aliases: ['post-arg']
102 type: str
103 description: Post arg.
104 choices: ['disable', 'enable']
105 query:
106 type: str
107 description: Query.
108 referrer:
109 type: str
110 description: Referrer.
111 choices: ['disable', 'enable']
112 tagging:
113 type: list
114 elements: dict
115 description: Tagging.
116 suboptions:
117 category:
118 type: list
119 elements: str
120 description: Category.
121 name:
122 type: str
123 description: Name.
124 tags:
125 type: list
126 elements: str
127 description: Tags.
128 type:
129 type: str
130 description: Type.
131 choices: ['host-regex', 'url', 'category', 'method', 'ua', 'header',
132 'src-advanced', 'dst-advanced', 'url-list', 'saas', 'response-header',
133 'llm-server']
134 ua:
135 type: list
136 elements: str
137 description: Ua.
138 choices: ['chrome', 'ms', 'firefox', 'safari', 'other', 'ie', 'edge']
139 ua_max_ver:
140 aliases: ['ua-max-ver']
141 type: str
142 description: Ua max ver.
143 ua_min_ver:
144 aliases: ['ua-min-ver']
145 type: str
146 description: Ua min ver.
147 url_list:
148 aliases: ['url-list']
149 type: list
150 elements: str
151 description: Url list.
152 uuid:
153 type: str
154 description: Uuid.
155 llm_servers:
156 aliases: ['llm-servers']
157 type: list
158 elements: str
159 description: Llm servers.
160 '''
161
162 EXAMPLES = '''
163 - name: Example playbook (generated based on argument schema)
164 hosts: fortimanagers
165 connection: httpapi
166 gather_facts: false
167 tasks:
168 - name: Firewall proxy address6
169 fortinet.fortimanager.fmgr_firewall_proxyaddress6:
170 # workspace_locking_adom: <global or your adom name>
171 adom: <your own value>
172 state: present # <value in [present, absent]>
173 firewall_proxyaddress6:
174 name: "your value" # Required variable, string
175 # application: <list or string>
176 # case_sensitivity: <value in [disable, enable]>
177 # category: <list or integer>
178 # color: <integer>
179 # comment: <string>
180 # header: <string>
181 # header_group:
182 # - case_sensitivity: <value in [disable, enable]>
183 # header: <string>
184 # header_name: <string>
185 # id: <integer>
186 # header_name: <string>
187 # host: <list or string>
188 # host_regex: <string>
189 # method: ["delete", "get", "head", "options", "post", "put", "trace", "connect"]
190 # path: <string>
191 # post_arg: <value in [disable, enable]>
192 # query: <string>
193 # referrer: <value in [disable, enable]>
194 # tagging:
195 # - category: <list or string>
196 # name: <string>
197 # tags: <list or string>
198 # type: <value in [host-regex, url, category, ...]>
199 # ua: ["chrome", "ms", "firefox", "safari", "other", "ie", "edge"]
200 # ua_max_ver: <string>
201 # ua_min_ver: <string>
202 # url_list: <list or string>
203 # uuid: <string>
204 # llm_servers: <list or string>
205 '''
206
207 RETURN = '''
208 meta:
209 description: The result of the request.
210 type: dict
211 returned: always
212 contains:
213 request_url:
214 description: The full url requested.
215 returned: always
216 type: str
217 sample: /sys/login/user
218 response_code:
219 description: The status of api request.
220 returned: always
221 type: int
222 sample: 0
223 response_data:
224 description: The api response.
225 type: list
226 returned: always
227 response_message:
228 description: The descriptive message of the api response.
229 type: str
230 returned: always
231 sample: OK.
232 system_information:
233 description: The information of the target system.
234 type: dict
235 returned: always
236 rc:
237 description: The status the request.
238 type: int
239 returned: always
240 sample: 0
241 version_check_warning:
242 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
243 type: list
244 returned: complex
245 '''
246 from ansible.module_utils.basic import AnsibleModule
247 from ansible.module_utils.connection import Connection
248 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
249 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
250
251
252 def main():
253 urls_list = [
254 '/pm/config/adom/{adom}/obj/firewall/proxy-address6',
255 '/pm/config/global/obj/firewall/proxy-address6'
256 ]
257 module_arg_spec = {
258 'adom': {'required': True, 'type': 'str'},
259 'revision_note': {'type': 'str'},
260 'firewall_proxyaddress6': {
261 'type': 'dict', 'v_range': [['7.6.4', '']],
262 'options': {
263 'application': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
264 'case-sensitivity': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
265 'category': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'int'},
266 'color': {'v_range': [['7.6.4', '']], 'type': 'int'},
267 'comment': {'v_range': [['7.6.4', '']], 'type': 'str'},
268 'header': {'v_range': [['7.6.4', '']], 'type': 'str'},
269 'header-group': {
270 'v_range': [['7.6.4', '']],
271 'type': 'list',
272 'options': {
273 'case-sensitivity': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
274 'header': {'v_range': [['7.6.4', '']], 'type': 'str'},
275 'header-name': {'v_range': [['7.6.4', '']], 'type': 'str'},
276 'id': {'v_range': [['7.6.4', '']], 'type': 'int'}
277 },
278 'elements': 'dict'
279 },
280 'header-name': {'v_range': [['7.6.4', '']], 'type': 'str'},
281 'host': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
282 'host-regex': {'v_range': [['7.6.4', '']], 'type': 'str'},
283 'method': {
284 'v_range': [['7.6.4', '']],
285 'type': 'list',
286 'choices': ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'connect'],
287 'elements': 'str'
288 },
289 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'},
290 'path': {'v_range': [['7.6.4', '']], 'type': 'str'},
291 'post-arg': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
292 'query': {'v_range': [['7.6.4', '']], 'type': 'str'},
293 'referrer': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
294 'tagging': {
295 'v_range': [['7.6.4', '']],
296 'type': 'list',
297 'options': {
298 'category': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
299 'name': {'v_range': [['7.6.4', '']], 'type': 'str'},
300 'tags': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'}
301 },
302 'elements': 'dict'
303 },
304 'type': {
305 'v_range': [['7.6.4', '']],
306 'choices': [
307 'host-regex', 'url', 'category', 'method', 'ua', 'header', 'src-advanced', 'dst-advanced', 'url-list', 'saas', 'response-header',
308 'llm-server'
309 ],
310 'type': 'str'
311 },
312 'ua': {
313 'v_range': [['7.6.4', '']],
314 'type': 'list',
315 'choices': ['chrome', 'ms', 'firefox', 'safari', 'other', 'ie', 'edge'],
316 'elements': 'str'
317 },
318 'ua-max-ver': {'v_range': [['7.6.4', '']], 'type': 'str'},
319 'ua-min-ver': {'v_range': [['7.6.4', '']], 'type': 'str'},
320 'url-list': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
321 'uuid': {'v_range': [['7.6.4', '']], 'type': 'str'},
322 'llm-servers': {'v_range': [['7.6.5', '']], 'type': 'list', 'elements': 'str'}
323 }
324 }
325 }
326
327 module_option_spec = get_module_arg_spec('full crud')
328 module_arg_spec.update(module_option_spec)
329 check_galaxy_version(module_arg_spec)
330 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_proxyaddress6'),
331 supports_check_mode=True)
332 if not module._socket_path:
333 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
334 connection = Connection(module._socket_path)
335 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
336 'name', 'data', module, connection)
337 fmgr.process_crud()
338 module.exit_json(meta=module.params)
339
340
341 if __name__ == '__main__':
342 main()