Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_casbprofile_saasapplication.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_saasapplication
15 short_description: Firewall casb profile saas application
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 casb-profile:
29 description: Deprecated, please use "casb_profile"
30 type: str
31 casb_profile:
32 description: The parameter (casb-profile) in requested url.
33 type: str
34 firewall_casbprofile_saasapplication:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 access_rule:
40 aliases: ['access-rule']
41 type: list
42 elements: dict
43 description: Access rule.
44 suboptions:
45 action:
46 type: str
47 description: Action.
48 choices: ['block', 'monitor', 'bypass']
49 bypass:
50 type: list
51 elements: str
52 description: Bypass.
53 choices: ['av', 'dlp', 'web-filter', 'file-filter', 'video-filter']
54 name:
55 type: str
56 description: Name.
57 custom_control:
58 aliases: ['custom-control']
59 type: list
60 elements: dict
61 description: Custom control.
62 suboptions:
63 name:
64 type: str
65 description: Name.
66 option:
67 type: list
68 elements: dict
69 description: Option.
70 suboptions:
71 name:
72 type: str
73 description: Name.
74 user_input:
75 aliases: ['user-input']
76 type: list
77 elements: str
78 description: User input.
79 domain_control:
80 aliases: ['domain-control']
81 type: str
82 description: Domain control.
83 choices: ['disable', 'enable']
84 domain_control_domains:
85 aliases: ['domain-control-domains']
86 type: list
87 elements: str
88 description: Domain control domains.
89 log:
90 type: str
91 description: Log.
92 choices: ['disable', 'enable']
93 name:
94 type: str
95 description: Name.
96 required: true
97 safe_search:
98 aliases: ['safe-search']
99 type: str
100 description: Safe search.
101 choices: ['disable', 'enable']
102 safe_search_control:
103 aliases: ['safe-search-control']
104 type: list
105 elements: str
106 description: Safe search control.
107 tenant_control:
108 aliases: ['tenant-control']
109 type: str
110 description: Tenant control.
111 choices: ['disable', 'enable']
112 tenant_control_tenants:
113 aliases: ['tenant-control-tenants']
114 type: list
115 elements: str
116 description: Tenant control tenants.
117 '''
118
119 EXAMPLES = '''
120 - name: Example playbook (generated based on argument schema)
121 hosts: fortimanagers
122 connection: httpapi
123 gather_facts: false
124 tasks:
125 - name: Firewall casb profile saas application
126 fortinet.fortimanager.fmgr_firewall_casbprofile_saasapplication:
127 # workspace_locking_adom: <global or your adom name>
128 adom: <your own value>
129 casb_profile: <your own value>
130 state: present # <value in [present, absent]>
131 firewall_casbprofile_saasapplication:
132 name: "your value" # Required variable, string
133 # access_rule:
134 # - action: <value in [block, monitor, bypass]>
135 # bypass: ["av", "dlp", "web-filter", "file-filter", "video-filter"]
136 # name: <string>
137 # custom_control:
138 # - name: <string>
139 # option:
140 # - name: <string>
141 # user_input: <list or string>
142 # domain_control: <value in [disable, enable]>
143 # domain_control_domains: <list or string>
144 # log: <value in [disable, enable]>
145 # safe_search: <value in [disable, enable]>
146 # safe_search_control: <list or string>
147 # tenant_control: <value in [disable, enable]>
148 # tenant_control_tenants: <list or string>
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/casb-profile/{casb-profile}/saas-application',
199 '/pm/config/global/obj/firewall/casb-profile/{casb-profile}/saas-application'
200 ]
201 module_arg_spec = {
202 'adom': {'required': True, 'type': 'str'},
203 'casb-profile': {'type': 'str', 'api_name': 'casb_profile'},
204 'casb_profile': {'type': 'str'},
205 'revision_note': {'type': 'str'},
206 'firewall_casbprofile_saasapplication': {
207 'type': 'dict', 'v_range': [['7.4.1', '7.4.1']],
208 'options': {
209 'access-rule': {
210 'v_range': [['7.4.1', '7.4.1']],
211 'type': 'list',
212 'options': {
213 'action': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['block', 'monitor', 'bypass'], 'type': 'str'},
214 'bypass': {
215 'v_range': [['7.4.1', '7.4.1']],
216 'type': 'list',
217 'choices': ['av', 'dlp', 'web-filter', 'file-filter', 'video-filter'],
218 'elements': 'str'
219 },
220 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'}
221 },
222 'elements': 'dict'
223 },
224 'custom-control': {
225 'v_range': [['7.4.1', '7.4.1']],
226 'type': 'list',
227 'options': {
228 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'},
229 'option': {
230 'v_range': [['7.4.1', '7.4.1']],
231 'type': 'list',
232 'options': {
233 'name': {'v_range': [['7.4.1', '7.4.1']], 'type': 'str'},
234 'user-input': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'}
235 },
236 'elements': 'dict'
237 }
238 },
239 'elements': 'dict'
240 },
241 'domain-control': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
242 'domain-control-domains': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'},
243 'log': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
244 'name': {'v_range': [['7.4.1', '7.4.1']], 'required': True, 'type': 'str'},
245 'safe-search': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
246 'safe-search-control': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'},
247 'tenant-control': {'v_range': [['7.4.1', '7.4.1']], 'choices': ['disable', 'enable'], 'type': 'str'},
248 'tenant-control-tenants': {'v_range': [['7.4.1', '7.4.1']], 'type': 'list', 'elements': 'str'}
249 }
250 }
251 }
252
253 module_option_spec = get_module_arg_spec('full crud')
254 module_arg_spec.update(module_option_spec)
255 check_galaxy_version(module_arg_spec)
256 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_casbprofile_saasapplication'),
257 supports_check_mode=True)
258 if not module._socket_path:
259 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
260 connection = Connection(module._socket_path)
261 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
262 'name', 'data', module, connection)
263 fmgr.process_crud()
264 module.exit_json(meta=module.params)
265
266
267 if __name__ == '__main__':
268 main()