Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_explicitproxyaddress.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_explicitproxyaddress
15 short_description: Explicit web proxy address configuration.
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 firewall_explicitproxyaddress:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 case_sensitivity:
34 aliases: ['case-sensitivity']
35 type: str
36 description: Case sensitivity in pattern.
37 choices: ['disable', 'enable']
38 category:
39 type: str
40 description: FortiGuard category ID.
41 color:
42 type: int
43 description: GUI icon color.
44 comment:
45 type: str
46 description: Comment.
47 header:
48 type: str
49 description: HTTP header regular expression.
50 header_group:
51 aliases: ['header-group']
52 type: list
53 elements: dict
54 description: Header group.
55 suboptions:
56 case_sensitivity:
57 aliases: ['case-sensitivity']
58 type: str
59 description: Case sensitivity in pattern.
60 choices: ['disable', 'enable']
61 header:
62 type: str
63 description: HTTP header regular expression.
64 header_name:
65 aliases: ['header-name']
66 type: str
67 description: HTTP header.
68 id:
69 type: int
70 description: ID.
71 header_name:
72 aliases: ['header-name']
73 type: str
74 description: HTTP header.
75 host:
76 type: str
77 description: Host address
78 host_regex:
79 aliases: ['host-regex']
80 type: str
81 description: Host regular expression.
82 method:
83 type: list
84 elements: str
85 description: HTTP methods.
86 choices: ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'connect']
87 name:
88 type: str
89 description: Address name.
90 required: true
91 path:
92 type: str
93 description: URL path regular expression.
94 tags:
95 type: str
96 description: Applied object tags.
97 type:
98 type: str
99 description: Address type.
100 choices: ['host-regex', 'url', 'category', 'method', 'ua', 'header',
101 'src-advanced', 'dst-advanced']
102 ua:
103 type: list
104 elements: str
105 description: User agent.
106 choices: ['chrome', 'ms', 'firefox', 'safari', 'other']
107 uuid:
108 type: str
109 description: Universally Unique IDentifier.
110 visibility:
111 type: str
112 description: Enable/disable address visibility.
113 choices: ['disable', 'enable']
114 '''
115
116 EXAMPLES = '''
117 - name: Example playbook (generated based on argument schema)
118 hosts: fortimanagers
119 connection: httpapi
120 gather_facts: false
121 tasks:
122 - name: Explicit web proxy address configuration.
123 fortinet.fortimanager.fmgr_firewall_explicitproxyaddress:
124 # workspace_locking_adom: <global or your adom name>
125 adom: <your own value>
126 state: present # <value in [present, absent]>
127 firewall_explicitproxyaddress:
128 name: "your value" # Required variable, string
129 # case_sensitivity: <value in [disable, enable]>
130 # category: <string>
131 # color: <integer>
132 # comment: <string>
133 # header: <string>
134 # header_group:
135 # - case_sensitivity: <value in [disable, enable]>
136 # header: <string>
137 # header_name: <string>
138 # id: <integer>
139 # header_name: <string>
140 # host: <string>
141 # host_regex: <string>
142 # method: ["delete", "get", "head", "options", "post", "put", "trace", "connect"]
143 # path: <string>
144 # tags: <string>
145 # type: <value in [host-regex, url, category, ...]>
146 # ua: ["chrome", "ms", "firefox", "safari", "other"]
147 # uuid: <string>
148 # visibility: <value in [disable, enable]>
149 '''
150
151 RETURN = '''
152 meta:
153 description: The result of the request.
154 type: dict
155 returned: always
156 contains:
157 request_url:
158 description: The full url requested.
159 returned: always
160 type: str
161 sample: /sys/login/user
162 response_code:
163 description: The status of api request.
164 returned: always
165 type: int
166 sample: 0
167 response_data:
168 description: The api response.
169 type: list
170 returned: always
171 response_message:
172 description: The descriptive message of the api response.
173 type: str
174 returned: always
175 sample: OK.
176 system_information:
177 description: The information of the target system.
178 type: dict
179 returned: always
180 rc:
181 description: The status the request.
182 type: int
183 returned: always
184 sample: 0
185 version_check_warning:
186 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
187 type: list
188 returned: complex
189 '''
190 from ansible.module_utils.basic import AnsibleModule
191 from ansible.module_utils.connection import Connection
192 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
193 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
194
195
196 def main():
197 urls_list = [
198 '/pm/config/adom/{adom}/obj/firewall/explicit-proxy-address',
199 '/pm/config/global/obj/firewall/explicit-proxy-address'
200 ]
201 module_arg_spec = {
202 'adom': {'required': True, 'type': 'str'},
203 'revision_note': {'type': 'str'},
204 'firewall_explicitproxyaddress': {
205 'type': 'dict', 'v_range': [['6.2.0', '6.2.13']],
206 'options': {
207 'case-sensitivity': {'v_range': [['6.2.0', '6.2.13']], 'choices': ['disable', 'enable'], 'type': 'str'},
208 'category': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
209 'color': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
210 'comment': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
211 'header': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
212 'header-group': {
213 'v_range': [['6.2.0', '6.2.13']],
214 'type': 'list',
215 'options': {
216 'case-sensitivity': {'v_range': [['6.2.0', '6.2.13']], 'choices': ['disable', 'enable'], 'type': 'str'},
217 'header': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
218 'header-name': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
219 'id': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'}
220 },
221 'elements': 'dict'
222 },
223 'header-name': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
224 'host': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
225 'host-regex': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
226 'method': {
227 'v_range': [['6.2.0', '6.2.13']],
228 'type': 'list',
229 'choices': ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'connect'],
230 'elements': 'str'
231 },
232 'name': {'v_range': [['6.2.0', '6.2.13']], 'required': True, 'type': 'str'},
233 'path': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
234 'tags': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
235 'type': {
236 'v_range': [['6.2.0', '6.2.13']],
237 'choices': ['host-regex', 'url', 'category', 'method', 'ua', 'header', 'src-advanced', 'dst-advanced'],
238 'type': 'str'
239 },
240 'ua': {'v_range': [['6.2.0', '6.2.13']], 'type': 'list', 'choices': ['chrome', 'ms', 'firefox', 'safari', 'other'], 'elements': 'str'},
241 'uuid': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
242 'visibility': {'v_range': [['6.2.0', '6.2.13']], 'choices': ['disable', 'enable'], 'type': 'str'}
243 }
244 }
245 }
246
247 module_option_spec = get_module_arg_spec('full crud')
248 module_arg_spec.update(module_option_spec)
249 check_galaxy_version(module_arg_spec)
250 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_explicitproxyaddress'),
251 supports_check_mode=True)
252 if not module._socket_path:
253 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
254 connection = Connection(module._socket_path)
255 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
256 'name', 'data', module, connection)
257 fmgr.process_crud()
258 module.exit_json(meta=module.params)
259
260
261 if __name__ == '__main__':
262 main()