Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_user_scim.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_user_scim
15 short_description: Configure SCIM client entries.
16 version_added: "2.10.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 user_scim:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 auth_method:
34 aliases: ['auth-method']
35 type: str
36 description: TLS client authentication methods
37 choices: ['token', 'base']
38 base_url:
39 aliases: ['base-url']
40 type: str
41 description: Server URL to receive SCIM create, read, update, delete
42 certificate:
43 type: list
44 elements: str
45 description: Certificate for client verification during TLS handshake.
46 client_authentication_method:
47 aliases: ['client-authentication-method']
48 type: str
49 description: Client authentication method.
50 choices: ['token', 'base']
51 client_identity_check:
52 aliases: ['client-identity-check']
53 type: str
54 description: Enable/disable client identity check.
55 choices: ['disable', 'enable']
56 client_secret_token:
57 aliases: ['client-secret-token']
58 type: str
59 description: Client secret token.
60 id:
61 type: int
62 description: SCIM client ID.
63 required: true
64 name:
65 type: str
66 description: SCIM client name.
67 secret:
68 type: list
69 elements: str
70 description: Secret for token verification or base authentication.
71 status:
72 type: str
73 description: Enable/disable System for Cross-domain Identity Management
74 choices: ['disable', 'enable']
75 token_certificate:
76 aliases: ['token-certificate']
77 type: list
78 elements: str
79 description: Certificate for token verification.
80 cascade:
81 type: str
82 description: Enable/disable to follow SCIM users/groups changes in IDP.
83 choices: ['disable', 'enable']
84 '''
85
86 EXAMPLES = '''
87 - name: Example playbook (generated based on argument schema)
88 hosts: fortimanagers
89 connection: httpapi
90 gather_facts: false
91 tasks:
92 - name: Configure SCIM client entries.
93 fortinet.fortimanager.fmgr_user_scim:
94 # workspace_locking_adom: <global or your adom name>
95 adom: <your own value>
96 state: present # <value in [present, absent]>
97 user_scim:
98 id: 0 # Required variable, integer
99 # auth_method: <value in [token, base]>
100 # base_url: <string>
101 # certificate: <list or string>
102 # client_authentication_method: <value in [token, base]>
103 # client_identity_check: <value in [disable, enable]>
104 # client_secret_token: <string>
105 # name: <string>
106 # secret: <list or string>
107 # status: <value in [disable, enable]>
108 # token_certificate: <list or string>
109 # cascade: <value in [disable, enable]>
110 '''
111
112 RETURN = '''
113 meta:
114 description: The result of the request.
115 type: dict
116 returned: always
117 contains:
118 request_url:
119 description: The full url requested.
120 returned: always
121 type: str
122 sample: /sys/login/user
123 response_code:
124 description: The status of api request.
125 returned: always
126 type: int
127 sample: 0
128 response_data:
129 description: The api response.
130 type: list
131 returned: always
132 response_message:
133 description: The descriptive message of the api response.
134 type: str
135 returned: always
136 sample: OK.
137 system_information:
138 description: The information of the target system.
139 type: dict
140 returned: always
141 rc:
142 description: The status the request.
143 type: int
144 returned: always
145 sample: 0
146 version_check_warning:
147 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
148 type: list
149 returned: complex
150 '''
151 from ansible.module_utils.basic import AnsibleModule
152 from ansible.module_utils.connection import Connection
153 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
154 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
155
156
157 def main():
158 urls_list = [
159 '/pm/config/adom/{adom}/obj/user/scim',
160 '/pm/config/global/obj/user/scim'
161 ]
162 module_arg_spec = {
163 'adom': {'required': True, 'type': 'str'},
164 'revision_note': {'type': 'str'},
165 'user_scim': {
166 'type': 'dict', 'v_range': [['7.6.3', '']],
167 'options': {
168 'auth-method': {'v_range': [['7.6.3', '']], 'choices': ['token', 'base'], 'type': 'str'},
169 'base-url': {'v_range': [['7.6.3', '']], 'type': 'str'},
170 'certificate': {'v_range': [['7.6.3', '']], 'type': 'list', 'elements': 'str'},
171 'client-authentication-method': {'v_range': [['7.6.3', '']], 'choices': ['token', 'base'], 'type': 'str'},
172 'client-identity-check': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
173 'client-secret-token': {'v_range': [['7.6.3', '']], 'no_log': True, 'type': 'str'},
174 'id': {'v_range': [['7.6.3', '']], 'required': True, 'type': 'int'},
175 'name': {'v_range': [['7.6.3', '']], 'type': 'str'},
176 'secret': {'v_range': [['7.6.3', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
177 'status': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
178 'token-certificate': {'v_range': [['7.6.3', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
179 'cascade': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
180 }
181 }
182 }
183
184 module_option_spec = get_module_arg_spec('full crud')
185 module_arg_spec.update(module_option_spec)
186 check_galaxy_version(module_arg_spec)
187 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'user_scim'),
188 supports_check_mode=True)
189 if not module._socket_path:
190 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
191 connection = Connection(module._socket_path)
192 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
193 'id', 'data', module, connection)
194 fmgr.process_crud()
195 module.exit_json(meta=module.params)
196
197
198 if __name__ == '__main__':
199 main()