Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_casbprofile.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_casbprofile
15 short_description: Firewall casb profile
16 version_added: "2.3.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_casbprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 name:
34 type: str
35 description: Name.
36 required: true
37 saas_application:
38 aliases: ['saas-application']
39 type: list
40 elements: dict
41 description: Saas application.
42 suboptions:
43 access_rule:
44 aliases: ['access-rule']
45 type: list
46 elements: dict
47 description: Access rule.
48 suboptions:
49 action:
50 type: str
51 description: Action.
52 choices: ['block', 'monitor', 'bypass']
53 bypass:
54 type: list
55 elements: str
56 description: Bypass.
57 choices: ['av', 'dlp', 'web-filter', 'file-filter', 'video-filter']
58 name:
59 type: str
60 description: Name.
61 custom_control:
62 aliases: ['custom-control']
63 type: list
64 elements: dict
65 description: Custom control.
66 suboptions:
67 name:
68 type: str
69 description: Name.
70 option:
71 type: list
72 elements: dict
73 description: Option.
74 suboptions:
75 name:
76 type: str
77 description: Name.
78 user_input:
79 aliases: ['user-input']
80 type: list
81 elements: str
82 description: User input.
83 domain_control:
84 aliases: ['domain-control']
85 type: str
86 description: Domain control.
87 choices: ['disable', 'enable']
88 domain_control_domains:
89 aliases: ['domain-control-domains']
90 type: list
91 elements: str
92 description: Domain control domains.
93 log:
94 type: str
95 description: Log.
96 choices: ['disable', 'enable']
97 name:
98 type: str
99 description: Name.
100 safe_search:
101 aliases: ['safe-search']
102 type: str
103 description: Safe search.
104 choices: ['disable', 'enable']
105 safe_search_control:
106 aliases: ['safe-search-control']
107 type: list
108 elements: str
109 description: Safe search control.
110 tenant_control:
111 aliases: ['tenant-control']
112 type: str
113 description: Tenant control.
114 choices: ['disable', 'enable']
115 tenant_control_tenants:
116 aliases: ['tenant-control-tenants']
117 type: list
118 elements: str
119 description: Tenant control tenants.
120 '''
121
122 EXAMPLES = '''
123 - name: Example playbook (generated based on argument schema)
124 hosts: fortimanagers
125 connection: httpapi
126 gather_facts: false
127 tasks:
128 - name: Firewall casb profile
129 fortinet.fortimanager.fmgr_firewall_casbprofile:
130 # workspace_locking_adom: <global or your adom name>
131 adom: <your own value>
132 state: present # <value in [present, absent]>
133 firewall_casbprofile:
134 name: "your value" # Required variable, string
135 # saas_application:
136 # - access_rule:
137 # - action: <value in [block, monitor, bypass]>
138 # bypass: ["av", "dlp", "web-filter", "file-filter", "video-filter"]
139 # name: <string>
140 # custom_control:
141 # - name: <string>
142 # option:
143 # - name: <string>
144 # user_input: <list or string>
145 # domain_control: <value in [disable, enable]>
146 # domain_control_domains: <list or string>
147 # log: <value in [disable, enable]>
148 # name: <string>
149 # safe_search: <value in [disable, enable]>
150 # safe_search_control: <list or string>
151 # tenant_control: <value in [disable, enable]>
152 # tenant_control_tenants: <list or string>
153 '''
154
155 RETURN = '''
156 meta:
157 description: The result of the request.
158 type: dict
159 returned: always
160 contains:
161 request_url:
162 description: The full url requested.
163 returned: always
164 type: str
165 sample: /sys/login/user
166 response_code:
167 description: The status of api request.
168 returned: always
169 type: int
170 sample: 0
171 response_data:
172 description: The api response.
173 type: list
174 returned: always
175 response_message:
176 description: The descriptive message of the api response.
177 type: str
178 returned: always
179 sample: OK.
180 system_information:
181 description: The information of the target system.
182 type: dict
183 returned: always
184 rc:
185 description: The status the request.
186 type: int
187 returned: always
188 sample: 0
189 version_check_warning:
190 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
191 type: list
192 returned: complex
193 '''
194 from ansible.module_utils.basic import AnsibleModule
195 from ansible.module_utils.connection import Connection
196 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
197 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
198
199
200 def main():
201 urls_list = [
202 '/pm/config/adom/{adom}/obj/firewall/casb-profile',
203 '/pm/config/global/obj/firewall/casb-profile'
204 ]
205 module_arg_spec = {
206 'adom': {'required': True, 'type': 'str'},
207 'revision_note': {'type': 'str'},
208 'firewall_casbprofile': {
209 'type': 'dict', 'v_range': [['7.4.1', '7.4.1']],
210 'options': {
211 'name': {'v_range': [['7.4.1', '7.4.1']], 'required': True, 'type': 'str'},
212 'saas-application': {
213 'v_range': [['7.4.1', '7.4.1']],
214 'type': 'list',
215 'options': {
216 'access-rule': {
217 'v_range': [['7.4.1', '7.4.1']],
218 'type': 'list',
219 'options': {
220 'action': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['block', 'monitor', 'bypass'], 'type': 'str'},
221 'bypass': {
222 'v_range': [['7.4.1', '7.4.1']],
223 'type': 'list',
224 'choices': ['av', 'dlp', 'web-filter', 'file-filter', 'video-filter'],
225 'elements': 'str'
226 },
227 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'}
228 },
229 'elements': 'dict'
230 },
231 'custom-control': {
232 'v_range': [['7.4.1', '7.4.1']],
233 'type': 'list',
234 'options': {
235 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'},
236 'option': {
237 'v_range': [['7.4.1', '7.4.1']],
238 'type': 'list',
239 'options': {
240 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'},
241 'user-input': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'}
242 },
243 'elements': 'dict'
244 }
245 },
246 'elements': 'dict'
247 },
248 'domain-control': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
249 'domain-control-domains': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'},
250 'log': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
251 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'},
252 'safe-search': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
253 'safe-search-control': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'},
254 'tenant-control': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
255 'tenant-control-tenants': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'}
256 },
257 'elements': 'dict'
258 }
259 }
260 }
261 }
262
263 module_option_spec = get_module_arg_spec('full crud')
264 module_arg_spec.update(module_option_spec)
265 check_galaxy_version(module_arg_spec)
266 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_casbprofile'),
267 supports_check_mode=True)
268 if not module._socket_path:
269 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
270 connection = Connection(module._socket_path)
271 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
272 'name', 'data', module, connection)
273 fmgr.process_crud()
274 module.exit_json(meta=module.params)
275
276
277 if __name__ == '__main__':
278 main()