Debian Codegraph @

src/auth0/management/organizations/discovery_domains/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ...core.pagination import AsyncPager, SyncPager
7 from ...core.request_options import RequestOptions
8 from ...types.create_organization_discovery_domain_response_content import (
9 CreateOrganizationDiscoveryDomainResponseContent,
10 )
11 from ...types.get_organization_discovery_domain_by_name_response_content import (
12 GetOrganizationDiscoveryDomainByNameResponseContent,
13 )
14 from ...types.get_organization_discovery_domain_response_content import GetOrganizationDiscoveryDomainResponseContent
15 from ...types.list_organization_discovery_domains_response_content import (
16 ListOrganizationDiscoveryDomainsResponseContent,
17 )
18 from ...types.organization_discovery_domain import OrganizationDiscoveryDomain
19 from ...types.organization_discovery_domain_status import OrganizationDiscoveryDomainStatus
20 from ...types.update_organization_discovery_domain_response_content import (
21 UpdateOrganizationDiscoveryDomainResponseContent,
22 )
23 from .raw_client import AsyncRawDiscoveryDomainsClient, RawDiscoveryDomainsClient
24
25 # this is used as the default value for optional parameters
26 OMIT = typing.cast(typing.Any, ...)
27
28
29 class DiscoveryDomainsClient:
30 def __init__(self, *, client_wrapper: SyncClientWrapper):
31 self._raw_client = RawDiscoveryDomainsClient(client_wrapper=client_wrapper)
32
33 @property
34 def with_raw_response(self) -> RawDiscoveryDomainsClient:
35 """
36 Retrieves a raw implementation of this client that returns raw responses.
37
38 Returns
39 -------
40 RawDiscoveryDomainsClient
41 """
42 return self._raw_client
43
44 def list(
45 self,
46 id: str,
47 *,
48 from_: typing.Optional[str] = None,
49 take: typing.Optional[int] = 50,
50 request_options: typing.Optional[RequestOptions] = None,
51 ) -> SyncPager[OrganizationDiscoveryDomain, ListOrganizationDiscoveryDomainsResponseContent]:
52 """
53 Retrieve list of all organization discovery domains associated with the specified organization.
54 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
55
56 Parameters
57 ----------
58 id : str
59 ID of the organization.
60
61 from_ : typing.Optional[str]
62 Optional Id from which to start selection.
63
64 take : typing.Optional[int]
65 Number of results per page. Defaults to 50.
66
67 request_options : typing.Optional[RequestOptions]
68 Request-specific configuration.
69
70 Returns
71 -------
72 SyncPager[OrganizationDiscoveryDomain, ListOrganizationDiscoveryDomainsResponseContent]
73 Organization discovery domains retrieved successfully.
74
75 Examples
76 --------
77 from auth0 import Auth0
78
79 client = Auth0(
80 token="YOUR_TOKEN",
81 )
82 response = client.organizations.discovery_domains.list(
83 id="id",
84 from_="from",
85 take=1,
86 )
87 for item in response:
88 yield item
89 # alternatively, you can paginate page-by-page
90 for page in response.iter_pages():
91 yield page
92 """
93 return self._raw_client.list(id, from_=from_, take=take, request_options=request_options)
94
95 def create(
96 self,
97 id: str,
98 *,
99 domain: str,
100 status: typing.Optional[OrganizationDiscoveryDomainStatus] = OMIT,
101 use_for_organization_discovery: typing.Optional[bool] = OMIT,
102 request_options: typing.Optional[RequestOptions] = None,
103 ) -> CreateOrganizationDiscoveryDomainResponseContent:
104 """
105 Create a new discovery domain for an organization.
106
107 Parameters
108 ----------
109 id : str
110 ID of the organization.
111
112 domain : str
113 The domain name to associate with the organization e.g. acme.com.
114
115 status : typing.Optional[OrganizationDiscoveryDomainStatus]
116
117 use_for_organization_discovery : typing.Optional[bool]
118 Indicates whether this domain should be used for organization discovery.
119
120 request_options : typing.Optional[RequestOptions]
121 Request-specific configuration.
122
123 Returns
124 -------
125 CreateOrganizationDiscoveryDomainResponseContent
126 Organization discovery domain successfully created.
127
128 Examples
129 --------
130 from auth0 import Auth0
131
132 client = Auth0(
133 token="YOUR_TOKEN",
134 )
135 client.organizations.discovery_domains.create(
136 id="id",
137 domain="domain",
138 )
139 """
140 _response = self._raw_client.create(
141 id,
142 domain=domain,
143 status=status,
144 use_for_organization_discovery=use_for_organization_discovery,
145 request_options=request_options,
146 )
147 return _response.data
148
149 def get_by_name(
150 self, id: str, discovery_domain: str, *, request_options: typing.Optional[RequestOptions] = None
151 ) -> GetOrganizationDiscoveryDomainByNameResponseContent:
152 """
153 Retrieve details about a single organization discovery domain specified by domain name.
154 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
155
156 Parameters
157 ----------
158 id : str
159 ID of the organization.
160
161 discovery_domain : str
162 Domain name of the discovery domain.
163
164 request_options : typing.Optional[RequestOptions]
165 Request-specific configuration.
166
167 Returns
168 -------
169 GetOrganizationDiscoveryDomainByNameResponseContent
170 Organization discovery domain successfully retrieved.
171
172 Examples
173 --------
174 from auth0 import Auth0
175
176 client = Auth0(
177 token="YOUR_TOKEN",
178 )
179 client.organizations.discovery_domains.get_by_name(
180 id="id",
181 discovery_domain="discovery_domain",
182 )
183 """
184 _response = self._raw_client.get_by_name(id, discovery_domain, request_options=request_options)
185 return _response.data
186
187 def get(
188 self, id: str, discovery_domain_id: str, *, request_options: typing.Optional[RequestOptions] = None
189 ) -> GetOrganizationDiscoveryDomainResponseContent:
190 """
191 Retrieve details about a single organization discovery domain specified by ID.
192 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
193
194 Parameters
195 ----------
196 id : str
197 ID of the organization.
198
199 discovery_domain_id : str
200 ID of the discovery domain.
201
202 request_options : typing.Optional[RequestOptions]
203 Request-specific configuration.
204
205 Returns
206 -------
207 GetOrganizationDiscoveryDomainResponseContent
208 Organization discovery domain successfully retrieved.
209
210 Examples
211 --------
212 from auth0 import Auth0
213
214 client = Auth0(
215 token="YOUR_TOKEN",
216 )
217 client.organizations.discovery_domains.get(
218 id="id",
219 discovery_domain_id="discovery_domain_id",
220 )
221 """
222 _response = self._raw_client.get(id, discovery_domain_id, request_options=request_options)
223 return _response.data
224
225 def delete(
226 self, id: str, discovery_domain_id: str, *, request_options: typing.Optional[RequestOptions] = None
227 ) -> None:
228 """
229 Remove a discovery domain from an organization. This action cannot be undone.
230
231 Parameters
232 ----------
233 id : str
234 ID of the organization.
235
236 discovery_domain_id : str
237 ID of the discovery domain.
238
239 request_options : typing.Optional[RequestOptions]
240 Request-specific configuration.
241
242 Returns
243 -------
244 None
245
246 Examples
247 --------
248 from auth0 import Auth0
249
250 client = Auth0(
251 token="YOUR_TOKEN",
252 )
253 client.organizations.discovery_domains.delete(
254 id="id",
255 discovery_domain_id="discovery_domain_id",
256 )
257 """
258 _response = self._raw_client.delete(id, discovery_domain_id, request_options=request_options)
259 return _response.data
260
261 def update(
262 self,
263 id: str,
264 discovery_domain_id: str,
265 *,
266 status: typing.Optional[OrganizationDiscoveryDomainStatus] = OMIT,
267 use_for_organization_discovery: typing.Optional[bool] = OMIT,
268 request_options: typing.Optional[RequestOptions] = None,
269 ) -> UpdateOrganizationDiscoveryDomainResponseContent:
270 """
271 Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The `status` field must be either `pending` or `verified`. The `use_for_organization_discovery` field can be `true` or `false` (default: `true`).
272
273 Parameters
274 ----------
275 id : str
276 ID of the organization.
277
278 discovery_domain_id : str
279 ID of the discovery domain to update.
280
281 status : typing.Optional[OrganizationDiscoveryDomainStatus]
282
283 use_for_organization_discovery : typing.Optional[bool]
284 Indicates whether this domain should be used for organization discovery.
285
286 request_options : typing.Optional[RequestOptions]
287 Request-specific configuration.
288
289 Returns
290 -------
291 UpdateOrganizationDiscoveryDomainResponseContent
292 Organization discovery domain successfully updated.
293
294 Examples
295 --------
296 from auth0 import Auth0
297
298 client = Auth0(
299 token="YOUR_TOKEN",
300 )
301 client.organizations.discovery_domains.update(
302 id="id",
303 discovery_domain_id="discovery_domain_id",
304 )
305 """
306 _response = self._raw_client.update(
307 id,
308 discovery_domain_id,
309 status=status,
310 use_for_organization_discovery=use_for_organization_discovery,
311 request_options=request_options,
312 )
313 return _response.data
314
315
316 class AsyncDiscoveryDomainsClient:
317 def __init__(self, *, client_wrapper: AsyncClientWrapper):
318 self._raw_client = AsyncRawDiscoveryDomainsClient(client_wrapper=client_wrapper)
319
320 @property
321 def with_raw_response(self) -> AsyncRawDiscoveryDomainsClient:
322 """
323 Retrieves a raw implementation of this client that returns raw responses.
324
325 Returns
326 -------
327 AsyncRawDiscoveryDomainsClient
328 """
329 return self._raw_client
330
331 async def list(
332 self,
333 id: str,
334 *,
335 from_: typing.Optional[str] = None,
336 take: typing.Optional[int] = 50,
337 request_options: typing.Optional[RequestOptions] = None,
338 ) -> AsyncPager[OrganizationDiscoveryDomain, ListOrganizationDiscoveryDomainsResponseContent]:
339 """
340 Retrieve list of all organization discovery domains associated with the specified organization.
341 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
342
343 Parameters
344 ----------
345 id : str
346 ID of the organization.
347
348 from_ : typing.Optional[str]
349 Optional Id from which to start selection.
350
351 take : typing.Optional[int]
352 Number of results per page. Defaults to 50.
353
354 request_options : typing.Optional[RequestOptions]
355 Request-specific configuration.
356
357 Returns
358 -------
359 AsyncPager[OrganizationDiscoveryDomain, ListOrganizationDiscoveryDomainsResponseContent]
360 Organization discovery domains retrieved successfully.
361
362 Examples
363 --------
364 import asyncio
365
366 from auth0 import AsyncAuth0
367
368 client = AsyncAuth0(
369 token="YOUR_TOKEN",
370 )
371
372
373 async def main() -> None:
374 response = await client.organizations.discovery_domains.list(
375 id="id",
376 from_="from",
377 take=1,
378 )
379 async for item in response:
380 yield item
381
382 # alternatively, you can paginate page-by-page
383 async for page in response.iter_pages():
384 yield page
385
386
387 asyncio.run(main())
388 """
389 return await self._raw_client.list(id, from_=from_, take=take, request_options=request_options)
390
391 async def create(
392 self,
393 id: str,
394 *,
395 domain: str,
396 status: typing.Optional[OrganizationDiscoveryDomainStatus] = OMIT,
397 use_for_organization_discovery: typing.Optional[bool] = OMIT,
398 request_options: typing.Optional[RequestOptions] = None,
399 ) -> CreateOrganizationDiscoveryDomainResponseContent:
400 """
401 Create a new discovery domain for an organization.
402
403 Parameters
404 ----------
405 id : str
406 ID of the organization.
407
408 domain : str
409 The domain name to associate with the organization e.g. acme.com.
410
411 status : typing.Optional[OrganizationDiscoveryDomainStatus]
412
413 use_for_organization_discovery : typing.Optional[bool]
414 Indicates whether this domain should be used for organization discovery.
415
416 request_options : typing.Optional[RequestOptions]
417 Request-specific configuration.
418
419 Returns
420 -------
421 CreateOrganizationDiscoveryDomainResponseContent
422 Organization discovery domain successfully created.
423
424 Examples
425 --------
426 import asyncio
427
428 from auth0 import AsyncAuth0
429
430 client = AsyncAuth0(
431 token="YOUR_TOKEN",
432 )
433
434
435 async def main() -> None:
436 await client.organizations.discovery_domains.create(
437 id="id",
438 domain="domain",
439 )
440
441
442 asyncio.run(main())
443 """
444 _response = await self._raw_client.create(
445 id,
446 domain=domain,
447 status=status,
448 use_for_organization_discovery=use_for_organization_discovery,
449 request_options=request_options,
450 )
451 return _response.data
452
453 async def get_by_name(
454 self, id: str, discovery_domain: str, *, request_options: typing.Optional[RequestOptions] = None
455 ) -> GetOrganizationDiscoveryDomainByNameResponseContent:
456 """
457 Retrieve details about a single organization discovery domain specified by domain name.
458 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
459
460 Parameters
461 ----------
462 id : str
463 ID of the organization.
464
465 discovery_domain : str
466 Domain name of the discovery domain.
467
468 request_options : typing.Optional[RequestOptions]
469 Request-specific configuration.
470
471 Returns
472 -------
473 GetOrganizationDiscoveryDomainByNameResponseContent
474 Organization discovery domain successfully retrieved.
475
476 Examples
477 --------
478 import asyncio
479
480 from auth0 import AsyncAuth0
481
482 client = AsyncAuth0(
483 token="YOUR_TOKEN",
484 )
485
486
487 async def main() -> None:
488 await client.organizations.discovery_domains.get_by_name(
489 id="id",
490 discovery_domain="discovery_domain",
491 )
492
493
494 asyncio.run(main())
495 """
496 _response = await self._raw_client.get_by_name(id, discovery_domain, request_options=request_options)
497 return _response.data
498
499 async def get(
500 self, id: str, discovery_domain_id: str, *, request_options: typing.Optional[RequestOptions] = None
501 ) -> GetOrganizationDiscoveryDomainResponseContent:
502 """
503 Retrieve details about a single organization discovery domain specified by ID.
504 This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
505
506 Parameters
507 ----------
508 id : str
509 ID of the organization.
510
511 discovery_domain_id : str
512 ID of the discovery domain.
513
514 request_options : typing.Optional[RequestOptions]
515 Request-specific configuration.
516
517 Returns
518 -------
519 GetOrganizationDiscoveryDomainResponseContent
520 Organization discovery domain successfully retrieved.
521
522 Examples
523 --------
524 import asyncio
525
526 from auth0 import AsyncAuth0
527
528 client = AsyncAuth0(
529 token="YOUR_TOKEN",
530 )
531
532
533 async def main() -> None:
534 await client.organizations.discovery_domains.get(
535 id="id",
536 discovery_domain_id="discovery_domain_id",
537 )
538
539
540 asyncio.run(main())
541 """
542 _response = await self._raw_client.get(id, discovery_domain_id, request_options=request_options)
543 return _response.data
544
545 async def delete(
546 self, id: str, discovery_domain_id: str, *, request_options: typing.Optional[RequestOptions] = None
547 ) -> None:
548 """
549 Remove a discovery domain from an organization. This action cannot be undone.
550
551 Parameters
552 ----------
553 id : str
554 ID of the organization.
555
556 discovery_domain_id : str
557 ID of the discovery domain.
558
559 request_options : typing.Optional[RequestOptions]
560 Request-specific configuration.
561
562 Returns
563 -------
564 None
565
566 Examples
567 --------
568 import asyncio
569
570 from auth0 import AsyncAuth0
571
572 client = AsyncAuth0(
573 token="YOUR_TOKEN",
574 )
575
576
577 async def main() -> None:
578 await client.organizations.discovery_domains.delete(
579 id="id",
580 discovery_domain_id="discovery_domain_id",
581 )
582
583
584 asyncio.run(main())
585 """
586 _response = await self._raw_client.delete(id, discovery_domain_id, request_options=request_options)
587 return _response.data
588
589 async def update(
590 self,
591 id: str,
592 discovery_domain_id: str,
593 *,
594 status: typing.Optional[OrganizationDiscoveryDomainStatus] = OMIT,
595 use_for_organization_discovery: typing.Optional[bool] = OMIT,
596 request_options: typing.Optional[RequestOptions] = None,
597 ) -> UpdateOrganizationDiscoveryDomainResponseContent:
598 """
599 Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The `status` field must be either `pending` or `verified`. The `use_for_organization_discovery` field can be `true` or `false` (default: `true`).
600
601 Parameters
602 ----------
603 id : str
604 ID of the organization.
605
606 discovery_domain_id : str
607 ID of the discovery domain to update.
608
609 status : typing.Optional[OrganizationDiscoveryDomainStatus]
610
611 use_for_organization_discovery : typing.Optional[bool]
612 Indicates whether this domain should be used for organization discovery.
613
614 request_options : typing.Optional[RequestOptions]
615 Request-specific configuration.
616
617 Returns
618 -------
619 UpdateOrganizationDiscoveryDomainResponseContent
620 Organization discovery domain successfully updated.
621
622 Examples
623 --------
624 import asyncio
625
626 from auth0 import AsyncAuth0
627
628 client = AsyncAuth0(
629 token="YOUR_TOKEN",
630 )
631
632
633 async def main() -> None:
634 await client.organizations.discovery_domains.update(
635 id="id",
636 discovery_domain_id="discovery_domain_id",
637 )
638
639
640 asyncio.run(main())
641 """
642 _response = await self._raw_client.update(
643 id,
644 discovery_domain_id,
645 status=status,
646 use_for_organization_discovery=use_for_organization_discovery,
647 request_options=request_options,
648 )
649 return _response.data