Debian Codegraph @

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