Debian Codegraph @

src/auth0/management/connections/scim_configuration/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 from __future__ import annotations
4
5 import typing
6
7 from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8 from ...core.pagination import AsyncPager, SyncPager
9 from ...core.request_options import RequestOptions
10 from ...types.create_scim_configuration_request_content import CreateScimConfigurationRequestContent
11 from ...types.create_scim_configuration_response_content import CreateScimConfigurationResponseContent
12 from ...types.get_scim_configuration_default_mapping_response_content import (
13 GetScimConfigurationDefaultMappingResponseContent,
14 )
15 from ...types.get_scim_configuration_response_content import GetScimConfigurationResponseContent
16 from ...types.list_scim_configurations_response_content import ListScimConfigurationsResponseContent
17 from ...types.scim_configuration import ScimConfiguration
18 from ...types.scim_mapping_item import ScimMappingItem
19 from ...types.update_scim_configuration_response_content import UpdateScimConfigurationResponseContent
20 from .raw_client import AsyncRawScimConfigurationClient, RawScimConfigurationClient
21
22 if typing.TYPE_CHECKING:
23 from .tokens.client import AsyncTokensClient, TokensClient
24 # this is used as the default value for optional parameters
25 OMIT = typing.cast(typing.Any, ...)
26
27
28 class ScimConfigurationClient:
29 def __init__(self, *, client_wrapper: SyncClientWrapper):
30 self._raw_client = RawScimConfigurationClient(client_wrapper=client_wrapper)
31 self._client_wrapper = client_wrapper
32 self._tokens: typing.Optional[TokensClient] = None
33
34 @property
35 def with_raw_response(self) -> RawScimConfigurationClient:
36 """
37 Retrieves a raw implementation of this client that returns raw responses.
38
39 Returns
40 -------
41 RawScimConfigurationClient
42 """
43 return self._raw_client
44
45 def list(
46 self,
47 *,
48 from_: typing.Optional[str] = None,
49 take: typing.Optional[int] = 50,
50 request_options: typing.Optional[RequestOptions] = None,
51 ) -> SyncPager[ScimConfiguration, ListScimConfigurationsResponseContent]:
52 """
53 Retrieve a list of SCIM configurations of a tenant.
54
55 Parameters
56 ----------
57 from_ : typing.Optional[str]
58 Optional Id from which to start selection.
59
60 take : typing.Optional[int]
61 Number of results per page. Defaults to 50.
62
63 request_options : typing.Optional[RequestOptions]
64 Request-specific configuration.
65
66 Returns
67 -------
68 SyncPager[ScimConfiguration, ListScimConfigurationsResponseContent]
69 The tenant's SCIM configurations. See <strong>Response Schema</strong> for schema.
70
71 Examples
72 --------
73 from auth0 import Auth0
74
75 client = Auth0(
76 token="YOUR_TOKEN",
77 )
78 response = client.connections.scim_configuration.list(
79 from_="from",
80 take=1,
81 )
82 for item in response:
83 yield item
84 # alternatively, you can paginate page-by-page
85 for page in response.iter_pages():
86 yield page
87 """
88 return self._raw_client.list(from_=from_, take=take, request_options=request_options)
89
90 def get(
91 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
92 ) -> GetScimConfigurationResponseContent:
93 """
94 Retrieves a scim configuration by its `connectionId`.
95
96 Parameters
97 ----------
98 id : str
99 The id of the connection to retrieve its SCIM configuration
100
101 request_options : typing.Optional[RequestOptions]
102 Request-specific configuration.
103
104 Returns
105 -------
106 GetScimConfigurationResponseContent
107 The connection's SCIM configuration was retrieved. See <strong>Response Schemas</strong> for schema.
108
109 Examples
110 --------
111 from auth0 import Auth0
112
113 client = Auth0(
114 token="YOUR_TOKEN",
115 )
116 client.connections.scim_configuration.get(
117 id="id",
118 )
119 """
120 _response = self._raw_client.get(id, request_options=request_options)
121 return _response.data
122
123 def create(
124 self,
125 id: str,
126 *,
127 request: typing.Optional[CreateScimConfigurationRequestContent] = None,
128 request_options: typing.Optional[RequestOptions] = None,
129 ) -> CreateScimConfigurationResponseContent:
130 """
131 Create a scim configuration for a connection.
132
133 Parameters
134 ----------
135 id : str
136 The id of the connection to create its SCIM configuration
137
138 request : typing.Optional[CreateScimConfigurationRequestContent]
139
140 request_options : typing.Optional[RequestOptions]
141 Request-specific configuration.
142
143 Returns
144 -------
145 CreateScimConfigurationResponseContent
146 The connection's SCIM configuration was created. See <strong>Response Schemas</strong> for schema.
147
148 Examples
149 --------
150 from auth0 import Auth0, CreateScimConfigurationRequestContent
151
152 client = Auth0(
153 token="YOUR_TOKEN",
154 )
155 client.connections.scim_configuration.create(
156 id="id",
157 request=CreateScimConfigurationRequestContent(),
158 )
159 """
160 _response = self._raw_client.create(id, request=request, request_options=request_options)
161 return _response.data
162
163 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
164 """
165 Deletes a scim configuration by its `connectionId`.
166
167 Parameters
168 ----------
169 id : str
170 The id of the connection to delete its SCIM configuration
171
172 request_options : typing.Optional[RequestOptions]
173 Request-specific configuration.
174
175 Returns
176 -------
177 None
178
179 Examples
180 --------
181 from auth0 import Auth0
182
183 client = Auth0(
184 token="YOUR_TOKEN",
185 )
186 client.connections.scim_configuration.delete(
187 id="id",
188 )
189 """
190 _response = self._raw_client.delete(id, request_options=request_options)
191 return _response.data
192
193 def update(
194 self,
195 id: str,
196 *,
197 user_id_attribute: str,
198 mapping: typing.Sequence[ScimMappingItem],
199 request_options: typing.Optional[RequestOptions] = None,
200 ) -> UpdateScimConfigurationResponseContent:
201 """
202 Update a scim configuration by its `connectionId`.
203
204 Parameters
205 ----------
206 id : str
207 The id of the connection to update its SCIM configuration
208
209 user_id_attribute : str
210 User ID attribute for generating unique user ids
211
212 mapping : typing.Sequence[ScimMappingItem]
213 The mapping between auth0 and SCIM
214
215 request_options : typing.Optional[RequestOptions]
216 Request-specific configuration.
217
218 Returns
219 -------
220 UpdateScimConfigurationResponseContent
221 The connection's SCIM configuration was updated. See <strong>Response Schemas</strong> for schema.
222
223 Examples
224 --------
225 from auth0 import Auth0, ScimMappingItem
226
227 client = Auth0(
228 token="YOUR_TOKEN",
229 )
230 client.connections.scim_configuration.update(
231 id="id",
232 user_id_attribute="user_id_attribute",
233 mapping=[ScimMappingItem()],
234 )
235 """
236 _response = self._raw_client.update(
237 id, user_id_attribute=user_id_attribute, mapping=mapping, request_options=request_options
238 )
239 return _response.data
240
241 def get_default_mapping(
242 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
243 ) -> GetScimConfigurationDefaultMappingResponseContent:
244 """
245 Retrieves a scim configuration's default mapping by its `connectionId`.
246
247 Parameters
248 ----------
249 id : str
250 The id of the connection to retrieve its default SCIM mapping
251
252 request_options : typing.Optional[RequestOptions]
253 Request-specific configuration.
254
255 Returns
256 -------
257 GetScimConfigurationDefaultMappingResponseContent
258 The connection's default SCIM mapping was retrieved. See <strong>Response Schemas</strong> for schema.
259
260 Examples
261 --------
262 from auth0 import Auth0
263
264 client = Auth0(
265 token="YOUR_TOKEN",
266 )
267 client.connections.scim_configuration.get_default_mapping(
268 id="id",
269 )
270 """
271 _response = self._raw_client.get_default_mapping(id, request_options=request_options)
272 return _response.data
273
274 @property
275 def tokens(self):
276 if self._tokens is None:
277 from .tokens.client import TokensClient # noqa: E402
278
279 self._tokens = TokensClient(client_wrapper=self._client_wrapper)
280 return self._tokens
281
282
283 class AsyncScimConfigurationClient:
284 def __init__(self, *, client_wrapper: AsyncClientWrapper):
285 self._raw_client = AsyncRawScimConfigurationClient(client_wrapper=client_wrapper)
286 self._client_wrapper = client_wrapper
287 self._tokens: typing.Optional[AsyncTokensClient] = None
288
289 @property
290 def with_raw_response(self) -> AsyncRawScimConfigurationClient:
291 """
292 Retrieves a raw implementation of this client that returns raw responses.
293
294 Returns
295 -------
296 AsyncRawScimConfigurationClient
297 """
298 return self._raw_client
299
300 async def list(
301 self,
302 *,
303 from_: typing.Optional[str] = None,
304 take: typing.Optional[int] = 50,
305 request_options: typing.Optional[RequestOptions] = None,
306 ) -> AsyncPager[ScimConfiguration, ListScimConfigurationsResponseContent]:
307 """
308 Retrieve a list of SCIM configurations of a tenant.
309
310 Parameters
311 ----------
312 from_ : typing.Optional[str]
313 Optional Id from which to start selection.
314
315 take : typing.Optional[int]
316 Number of results per page. Defaults to 50.
317
318 request_options : typing.Optional[RequestOptions]
319 Request-specific configuration.
320
321 Returns
322 -------
323 AsyncPager[ScimConfiguration, ListScimConfigurationsResponseContent]
324 The tenant's SCIM configurations. See <strong>Response Schema</strong> for schema.
325
326 Examples
327 --------
328 import asyncio
329
330 from auth0 import AsyncAuth0
331
332 client = AsyncAuth0(
333 token="YOUR_TOKEN",
334 )
335
336
337 async def main() -> None:
338 response = await client.connections.scim_configuration.list(
339 from_="from",
340 take=1,
341 )
342 async for item in response:
343 yield item
344
345 # alternatively, you can paginate page-by-page
346 async for page in response.iter_pages():
347 yield page
348
349
350 asyncio.run(main())
351 """
352 return await self._raw_client.list(from_=from_, take=take, request_options=request_options)
353
354 async def get(
355 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
356 ) -> GetScimConfigurationResponseContent:
357 """
358 Retrieves a scim configuration by its `connectionId`.
359
360 Parameters
361 ----------
362 id : str
363 The id of the connection to retrieve its SCIM configuration
364
365 request_options : typing.Optional[RequestOptions]
366 Request-specific configuration.
367
368 Returns
369 -------
370 GetScimConfigurationResponseContent
371 The connection's SCIM configuration was retrieved. See <strong>Response Schemas</strong> for schema.
372
373 Examples
374 --------
375 import asyncio
376
377 from auth0 import AsyncAuth0
378
379 client = AsyncAuth0(
380 token="YOUR_TOKEN",
381 )
382
383
384 async def main() -> None:
385 await client.connections.scim_configuration.get(
386 id="id",
387 )
388
389
390 asyncio.run(main())
391 """
392 _response = await self._raw_client.get(id, request_options=request_options)
393 return _response.data
394
395 async def create(
396 self,
397 id: str,
398 *,
399 request: typing.Optional[CreateScimConfigurationRequestContent] = None,
400 request_options: typing.Optional[RequestOptions] = None,
401 ) -> CreateScimConfigurationResponseContent:
402 """
403 Create a scim configuration for a connection.
404
405 Parameters
406 ----------
407 id : str
408 The id of the connection to create its SCIM configuration
409
410 request : typing.Optional[CreateScimConfigurationRequestContent]
411
412 request_options : typing.Optional[RequestOptions]
413 Request-specific configuration.
414
415 Returns
416 -------
417 CreateScimConfigurationResponseContent
418 The connection's SCIM configuration was created. See <strong>Response Schemas</strong> for schema.
419
420 Examples
421 --------
422 import asyncio
423
424 from auth0 import AsyncAuth0, CreateScimConfigurationRequestContent
425
426 client = AsyncAuth0(
427 token="YOUR_TOKEN",
428 )
429
430
431 async def main() -> None:
432 await client.connections.scim_configuration.create(
433 id="id",
434 request=CreateScimConfigurationRequestContent(),
435 )
436
437
438 asyncio.run(main())
439 """
440 _response = await self._raw_client.create(id, request=request, request_options=request_options)
441 return _response.data
442
443 async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
444 """
445 Deletes a scim configuration by its `connectionId`.
446
447 Parameters
448 ----------
449 id : str
450 The id of the connection to delete its SCIM configuration
451
452 request_options : typing.Optional[RequestOptions]
453 Request-specific configuration.
454
455 Returns
456 -------
457 None
458
459 Examples
460 --------
461 import asyncio
462
463 from auth0 import AsyncAuth0
464
465 client = AsyncAuth0(
466 token="YOUR_TOKEN",
467 )
468
469
470 async def main() -> None:
471 await client.connections.scim_configuration.delete(
472 id="id",
473 )
474
475
476 asyncio.run(main())
477 """
478 _response = await self._raw_client.delete(id, request_options=request_options)
479 return _response.data
480
481 async def update(
482 self,
483 id: str,
484 *,
485 user_id_attribute: str,
486 mapping: typing.Sequence[ScimMappingItem],
487 request_options: typing.Optional[RequestOptions] = None,
488 ) -> UpdateScimConfigurationResponseContent:
489 """
490 Update a scim configuration by its `connectionId`.
491
492 Parameters
493 ----------
494 id : str
495 The id of the connection to update its SCIM configuration
496
497 user_id_attribute : str
498 User ID attribute for generating unique user ids
499
500 mapping : typing.Sequence[ScimMappingItem]
501 The mapping between auth0 and SCIM
502
503 request_options : typing.Optional[RequestOptions]
504 Request-specific configuration.
505
506 Returns
507 -------
508 UpdateScimConfigurationResponseContent
509 The connection's SCIM configuration was updated. See <strong>Response Schemas</strong> for schema.
510
511 Examples
512 --------
513 import asyncio
514
515 from auth0 import AsyncAuth0, ScimMappingItem
516
517 client = AsyncAuth0(
518 token="YOUR_TOKEN",
519 )
520
521
522 async def main() -> None:
523 await client.connections.scim_configuration.update(
524 id="id",
525 user_id_attribute="user_id_attribute",
526 mapping=[ScimMappingItem()],
527 )
528
529
530 asyncio.run(main())
531 """
532 _response = await self._raw_client.update(
533 id, user_id_attribute=user_id_attribute, mapping=mapping, request_options=request_options
534 )
535 return _response.data
536
537 async def get_default_mapping(
538 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
539 ) -> GetScimConfigurationDefaultMappingResponseContent:
540 """
541 Retrieves a scim configuration's default mapping by its `connectionId`.
542
543 Parameters
544 ----------
545 id : str
546 The id of the connection to retrieve its default SCIM mapping
547
548 request_options : typing.Optional[RequestOptions]
549 Request-specific configuration.
550
551 Returns
552 -------
553 GetScimConfigurationDefaultMappingResponseContent
554 The connection's default SCIM mapping was retrieved. See <strong>Response Schemas</strong> for schema.
555
556 Examples
557 --------
558 import asyncio
559
560 from auth0 import AsyncAuth0
561
562 client = AsyncAuth0(
563 token="YOUR_TOKEN",
564 )
565
566
567 async def main() -> None:
568 await client.connections.scim_configuration.get_default_mapping(
569 id="id",
570 )
571
572
573 asyncio.run(main())
574 """
575 _response = await self._raw_client.get_default_mapping(id, request_options=request_options)
576 return _response.data
577
578 @property
579 def tokens(self):
580 if self._tokens is None:
581 from .tokens.client import AsyncTokensClient # noqa: E402
582
583 self._tokens = AsyncTokensClient(client_wrapper=self._client_wrapper)
584 return self._tokens