Debian Codegraph @

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