Debian Codegraph @

src/auth0/management/guardian/factors/push_notification/raw_client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4 from json.decoder import JSONDecodeError
5
6 from ....core.api_error import ApiError
7 from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8 from ....core.http_response import AsyncHttpResponse, HttpResponse
9 from ....core.parse_error import ParsingError
10 from ....core.pydantic_utilities import parse_obj_as
11 from ....core.request_options import RequestOptions
12 from ....errors.bad_request_error import BadRequestError
13 from ....errors.forbidden_error import ForbiddenError
14 from ....errors.unauthorized_error import UnauthorizedError
15 from ....types.get_guardian_factors_provider_apns_response_content import GetGuardianFactorsProviderApnsResponseContent
16 from ....types.get_guardian_factors_provider_push_notification_response_content import (
17 GetGuardianFactorsProviderPushNotificationResponseContent,
18 )
19 from ....types.get_guardian_factors_provider_sns_response_content import GetGuardianFactorsProviderSnsResponseContent
20 from ....types.guardian_factors_provider_push_notification_provider_data_enum import (
21 GuardianFactorsProviderPushNotificationProviderDataEnum,
22 )
23 from ....types.set_guardian_factors_provider_push_notification_apns_response_content import (
24 SetGuardianFactorsProviderPushNotificationApnsResponseContent,
25 )
26 from ....types.set_guardian_factors_provider_push_notification_fcm_response_content import (
27 SetGuardianFactorsProviderPushNotificationFcmResponseContent,
28 )
29 from ....types.set_guardian_factors_provider_push_notification_fcmv_1_response_content import (
30 SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
31 )
32 from ....types.set_guardian_factors_provider_push_notification_response_content import (
33 SetGuardianFactorsProviderPushNotificationResponseContent,
34 )
35 from ....types.set_guardian_factors_provider_push_notification_sns_response_content import (
36 SetGuardianFactorsProviderPushNotificationSnsResponseContent,
37 )
38 from ....types.update_guardian_factors_provider_push_notification_apns_response_content import (
39 UpdateGuardianFactorsProviderPushNotificationApnsResponseContent,
40 )
41 from ....types.update_guardian_factors_provider_push_notification_fcm_response_content import (
42 UpdateGuardianFactorsProviderPushNotificationFcmResponseContent,
43 )
44 from ....types.update_guardian_factors_provider_push_notification_fcmv_1_response_content import (
45 UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
46 )
47 from ....types.update_guardian_factors_provider_push_notification_sns_response_content import (
48 UpdateGuardianFactorsProviderPushNotificationSnsResponseContent,
49 )
50 from pydantic import ValidationError
51
52 # this is used as the default value for optional parameters
53 OMIT = typing.cast(typing.Any, ...)
54
55
56 class RawPushNotificationClient:
57 def __init__(self, *, client_wrapper: SyncClientWrapper):
58 self._client_wrapper = client_wrapper
59
60 def get_apns_provider(
61 self, *, request_options: typing.Optional[RequestOptions] = None
62 ) -> HttpResponse[GetGuardianFactorsProviderApnsResponseContent]:
63 """
64 Retrieve configuration details for the multi-factor authentication APNS provider associated with your tenant.
65
66 Parameters
67 ----------
68 request_options : typing.Optional[RequestOptions]
69 Request-specific configuration.
70
71 Returns
72 -------
73 HttpResponse[GetGuardianFactorsProviderApnsResponseContent]
74 APNS configuration successfully retrieved.
75 """
76 _response = self._client_wrapper.httpx_client.request(
77 "guardian/factors/push-notification/providers/apns",
78 method="GET",
79 request_options=request_options,
80 )
81 try:
82 if 200 <= _response.status_code < 300:
83 _data = typing.cast(
84 GetGuardianFactorsProviderApnsResponseContent,
85 parse_obj_as(
86 type_=GetGuardianFactorsProviderApnsResponseContent, # type: ignore
87 object_=_response.json(),
88 ),
89 )
90 return HttpResponse(response=_response, data=_data)
91 if _response.status_code == 400:
92 raise BadRequestError(
93 headers=dict(_response.headers),
94 body=typing.cast(
95 typing.Any,
96 parse_obj_as(
97 type_=typing.Any, # type: ignore
98 object_=_response.json(),
99 ),
100 ),
101 )
102 if _response.status_code == 401:
103 raise UnauthorizedError(
104 headers=dict(_response.headers),
105 body=typing.cast(
106 typing.Any,
107 parse_obj_as(
108 type_=typing.Any, # type: ignore
109 object_=_response.json(),
110 ),
111 ),
112 )
113 if _response.status_code == 403:
114 raise ForbiddenError(
115 headers=dict(_response.headers),
116 body=typing.cast(
117 typing.Any,
118 parse_obj_as(
119 type_=typing.Any, # type: ignore
120 object_=_response.json(),
121 ),
122 ),
123 )
124 _response_json = _response.json()
125 except JSONDecodeError:
126 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
127 except ValidationError as e:
128 raise ParsingError(
129 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
130 )
131 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
132
133 def set_apns_provider(
134 self,
135 *,
136 sandbox: typing.Optional[bool] = OMIT,
137 bundle_id: typing.Optional[str] = OMIT,
138 p_12: typing.Optional[str] = OMIT,
139 request_options: typing.Optional[RequestOptions] = None,
140 ) -> HttpResponse[SetGuardianFactorsProviderPushNotificationApnsResponseContent]:
141 """
142 Overwrite all configuration details of the multi-factor authentication APNS provider associated with your tenant.
143
144 Parameters
145 ----------
146 sandbox : typing.Optional[bool]
147
148 bundle_id : typing.Optional[str]
149
150 p_12 : typing.Optional[str]
151
152 request_options : typing.Optional[RequestOptions]
153 Request-specific configuration.
154
155 Returns
156 -------
157 HttpResponse[SetGuardianFactorsProviderPushNotificationApnsResponseContent]
158 APNS configuration successfully updated.
159 """
160 _response = self._client_wrapper.httpx_client.request(
161 "guardian/factors/push-notification/providers/apns",
162 method="PUT",
163 json={
164 "sandbox": sandbox,
165 "bundle_id": bundle_id,
166 "p12": p_12,
167 },
168 headers={
169 "content-type": "application/json",
170 },
171 request_options=request_options,
172 omit=OMIT,
173 )
174 try:
175 if 200 <= _response.status_code < 300:
176 _data = typing.cast(
177 SetGuardianFactorsProviderPushNotificationApnsResponseContent,
178 parse_obj_as(
179 type_=SetGuardianFactorsProviderPushNotificationApnsResponseContent, # type: ignore
180 object_=_response.json(),
181 ),
182 )
183 return HttpResponse(response=_response, data=_data)
184 if _response.status_code == 400:
185 raise BadRequestError(
186 headers=dict(_response.headers),
187 body=typing.cast(
188 typing.Any,
189 parse_obj_as(
190 type_=typing.Any, # type: ignore
191 object_=_response.json(),
192 ),
193 ),
194 )
195 if _response.status_code == 401:
196 raise UnauthorizedError(
197 headers=dict(_response.headers),
198 body=typing.cast(
199 typing.Any,
200 parse_obj_as(
201 type_=typing.Any, # type: ignore
202 object_=_response.json(),
203 ),
204 ),
205 )
206 if _response.status_code == 403:
207 raise ForbiddenError(
208 headers=dict(_response.headers),
209 body=typing.cast(
210 typing.Any,
211 parse_obj_as(
212 type_=typing.Any, # type: ignore
213 object_=_response.json(),
214 ),
215 ),
216 )
217 _response_json = _response.json()
218 except JSONDecodeError:
219 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
220 except ValidationError as e:
221 raise ParsingError(
222 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
223 )
224 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
225
226 def update_apns_provider(
227 self,
228 *,
229 sandbox: typing.Optional[bool] = OMIT,
230 bundle_id: typing.Optional[str] = OMIT,
231 p_12: typing.Optional[str] = OMIT,
232 request_options: typing.Optional[RequestOptions] = None,
233 ) -> HttpResponse[UpdateGuardianFactorsProviderPushNotificationApnsResponseContent]:
234 """
235 Modify configuration details of the multi-factor authentication APNS provider associated with your tenant.
236
237 Parameters
238 ----------
239 sandbox : typing.Optional[bool]
240
241 bundle_id : typing.Optional[str]
242
243 p_12 : typing.Optional[str]
244
245 request_options : typing.Optional[RequestOptions]
246 Request-specific configuration.
247
248 Returns
249 -------
250 HttpResponse[UpdateGuardianFactorsProviderPushNotificationApnsResponseContent]
251 APNS configuration successfully updated.
252 """
253 _response = self._client_wrapper.httpx_client.request(
254 "guardian/factors/push-notification/providers/apns",
255 method="PATCH",
256 json={
257 "sandbox": sandbox,
258 "bundle_id": bundle_id,
259 "p12": p_12,
260 },
261 headers={
262 "content-type": "application/json",
263 },
264 request_options=request_options,
265 omit=OMIT,
266 )
267 try:
268 if 200 <= _response.status_code < 300:
269 _data = typing.cast(
270 UpdateGuardianFactorsProviderPushNotificationApnsResponseContent,
271 parse_obj_as(
272 type_=UpdateGuardianFactorsProviderPushNotificationApnsResponseContent, # type: ignore
273 object_=_response.json(),
274 ),
275 )
276 return HttpResponse(response=_response, data=_data)
277 if _response.status_code == 400:
278 raise BadRequestError(
279 headers=dict(_response.headers),
280 body=typing.cast(
281 typing.Any,
282 parse_obj_as(
283 type_=typing.Any, # type: ignore
284 object_=_response.json(),
285 ),
286 ),
287 )
288 if _response.status_code == 401:
289 raise UnauthorizedError(
290 headers=dict(_response.headers),
291 body=typing.cast(
292 typing.Any,
293 parse_obj_as(
294 type_=typing.Any, # type: ignore
295 object_=_response.json(),
296 ),
297 ),
298 )
299 if _response.status_code == 403:
300 raise ForbiddenError(
301 headers=dict(_response.headers),
302 body=typing.cast(
303 typing.Any,
304 parse_obj_as(
305 type_=typing.Any, # type: ignore
306 object_=_response.json(),
307 ),
308 ),
309 )
310 _response_json = _response.json()
311 except JSONDecodeError:
312 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
313 except ValidationError as e:
314 raise ParsingError(
315 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
316 )
317 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
318
319 def set_fcm_provider(
320 self, *, server_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
321 ) -> HttpResponse[SetGuardianFactorsProviderPushNotificationFcmResponseContent]:
322 """
323 Overwrite all configuration details of the multi-factor authentication FCM provider associated with your tenant.
324
325 Parameters
326 ----------
327 server_key : typing.Optional[str]
328
329 request_options : typing.Optional[RequestOptions]
330 Request-specific configuration.
331
332 Returns
333 -------
334 HttpResponse[SetGuardianFactorsProviderPushNotificationFcmResponseContent]
335 FCM configuration updated
336 """
337 _response = self._client_wrapper.httpx_client.request(
338 "guardian/factors/push-notification/providers/fcm",
339 method="PUT",
340 json={
341 "server_key": server_key,
342 },
343 headers={
344 "content-type": "application/json",
345 },
346 request_options=request_options,
347 omit=OMIT,
348 )
349 try:
350 if 200 <= _response.status_code < 300:
351 _data = typing.cast(
352 SetGuardianFactorsProviderPushNotificationFcmResponseContent,
353 parse_obj_as(
354 type_=SetGuardianFactorsProviderPushNotificationFcmResponseContent, # type: ignore
355 object_=_response.json(),
356 ),
357 )
358 return HttpResponse(response=_response, data=_data)
359 if _response.status_code == 400:
360 raise BadRequestError(
361 headers=dict(_response.headers),
362 body=typing.cast(
363 typing.Any,
364 parse_obj_as(
365 type_=typing.Any, # type: ignore
366 object_=_response.json(),
367 ),
368 ),
369 )
370 if _response.status_code == 401:
371 raise UnauthorizedError(
372 headers=dict(_response.headers),
373 body=typing.cast(
374 typing.Any,
375 parse_obj_as(
376 type_=typing.Any, # type: ignore
377 object_=_response.json(),
378 ),
379 ),
380 )
381 if _response.status_code == 403:
382 raise ForbiddenError(
383 headers=dict(_response.headers),
384 body=typing.cast(
385 typing.Any,
386 parse_obj_as(
387 type_=typing.Any, # type: ignore
388 object_=_response.json(),
389 ),
390 ),
391 )
392 _response_json = _response.json()
393 except JSONDecodeError:
394 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
395 except ValidationError as e:
396 raise ParsingError(
397 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
398 )
399 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
400
401 def update_fcm_provider(
402 self, *, server_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
403 ) -> HttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmResponseContent]:
404 """
405 Modify configuration details of the multi-factor authentication FCM provider associated with your tenant.
406
407 Parameters
408 ----------
409 server_key : typing.Optional[str]
410
411 request_options : typing.Optional[RequestOptions]
412 Request-specific configuration.
413
414 Returns
415 -------
416 HttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmResponseContent]
417 FCM configuration updated
418 """
419 _response = self._client_wrapper.httpx_client.request(
420 "guardian/factors/push-notification/providers/fcm",
421 method="PATCH",
422 json={
423 "server_key": server_key,
424 },
425 headers={
426 "content-type": "application/json",
427 },
428 request_options=request_options,
429 omit=OMIT,
430 )
431 try:
432 if 200 <= _response.status_code < 300:
433 _data = typing.cast(
434 UpdateGuardianFactorsProviderPushNotificationFcmResponseContent,
435 parse_obj_as(
436 type_=UpdateGuardianFactorsProviderPushNotificationFcmResponseContent, # type: ignore
437 object_=_response.json(),
438 ),
439 )
440 return HttpResponse(response=_response, data=_data)
441 if _response.status_code == 400:
442 raise BadRequestError(
443 headers=dict(_response.headers),
444 body=typing.cast(
445 typing.Any,
446 parse_obj_as(
447 type_=typing.Any, # type: ignore
448 object_=_response.json(),
449 ),
450 ),
451 )
452 if _response.status_code == 401:
453 raise UnauthorizedError(
454 headers=dict(_response.headers),
455 body=typing.cast(
456 typing.Any,
457 parse_obj_as(
458 type_=typing.Any, # type: ignore
459 object_=_response.json(),
460 ),
461 ),
462 )
463 if _response.status_code == 403:
464 raise ForbiddenError(
465 headers=dict(_response.headers),
466 body=typing.cast(
467 typing.Any,
468 parse_obj_as(
469 type_=typing.Any, # type: ignore
470 object_=_response.json(),
471 ),
472 ),
473 )
474 _response_json = _response.json()
475 except JSONDecodeError:
476 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
477 except ValidationError as e:
478 raise ParsingError(
479 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
480 )
481 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
482
483 def set_fcmv_1_provider(
484 self,
485 *,
486 server_credentials: typing.Optional[str] = OMIT,
487 request_options: typing.Optional[RequestOptions] = None,
488 ) -> HttpResponse[SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent]:
489 """
490 Overwrite all configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.
491
492 Parameters
493 ----------
494 server_credentials : typing.Optional[str]
495
496 request_options : typing.Optional[RequestOptions]
497 Request-specific configuration.
498
499 Returns
500 -------
501 HttpResponse[SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent]
502 FCMV1 configuration updated
503 """
504 _response = self._client_wrapper.httpx_client.request(
505 "guardian/factors/push-notification/providers/fcmv1",
506 method="PUT",
507 json={
508 "server_credentials": server_credentials,
509 },
510 headers={
511 "content-type": "application/json",
512 },
513 request_options=request_options,
514 omit=OMIT,
515 )
516 try:
517 if 200 <= _response.status_code < 300:
518 _data = typing.cast(
519 SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
520 parse_obj_as(
521 type_=SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent, # type: ignore
522 object_=_response.json(),
523 ),
524 )
525 return HttpResponse(response=_response, data=_data)
526 if _response.status_code == 400:
527 raise BadRequestError(
528 headers=dict(_response.headers),
529 body=typing.cast(
530 typing.Any,
531 parse_obj_as(
532 type_=typing.Any, # type: ignore
533 object_=_response.json(),
534 ),
535 ),
536 )
537 if _response.status_code == 401:
538 raise UnauthorizedError(
539 headers=dict(_response.headers),
540 body=typing.cast(
541 typing.Any,
542 parse_obj_as(
543 type_=typing.Any, # type: ignore
544 object_=_response.json(),
545 ),
546 ),
547 )
548 if _response.status_code == 403:
549 raise ForbiddenError(
550 headers=dict(_response.headers),
551 body=typing.cast(
552 typing.Any,
553 parse_obj_as(
554 type_=typing.Any, # type: ignore
555 object_=_response.json(),
556 ),
557 ),
558 )
559 _response_json = _response.json()
560 except JSONDecodeError:
561 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
562 except ValidationError as e:
563 raise ParsingError(
564 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
565 )
566 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
567
568 def update_fcmv_1_provider(
569 self,
570 *,
571 server_credentials: typing.Optional[str] = OMIT,
572 request_options: typing.Optional[RequestOptions] = None,
573 ) -> HttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent]:
574 """
575 Modify configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.
576
577 Parameters
578 ----------
579 server_credentials : typing.Optional[str]
580
581 request_options : typing.Optional[RequestOptions]
582 Request-specific configuration.
583
584 Returns
585 -------
586 HttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent]
587 FCMV1 configuration updated
588 """
589 _response = self._client_wrapper.httpx_client.request(
590 "guardian/factors/push-notification/providers/fcmv1",
591 method="PATCH",
592 json={
593 "server_credentials": server_credentials,
594 },
595 headers={
596 "content-type": "application/json",
597 },
598 request_options=request_options,
599 omit=OMIT,
600 )
601 try:
602 if 200 <= _response.status_code < 300:
603 _data = typing.cast(
604 UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
605 parse_obj_as(
606 type_=UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent, # type: ignore
607 object_=_response.json(),
608 ),
609 )
610 return HttpResponse(response=_response, data=_data)
611 if _response.status_code == 400:
612 raise BadRequestError(
613 headers=dict(_response.headers),
614 body=typing.cast(
615 typing.Any,
616 parse_obj_as(
617 type_=typing.Any, # type: ignore
618 object_=_response.json(),
619 ),
620 ),
621 )
622 if _response.status_code == 401:
623 raise UnauthorizedError(
624 headers=dict(_response.headers),
625 body=typing.cast(
626 typing.Any,
627 parse_obj_as(
628 type_=typing.Any, # type: ignore
629 object_=_response.json(),
630 ),
631 ),
632 )
633 if _response.status_code == 403:
634 raise ForbiddenError(
635 headers=dict(_response.headers),
636 body=typing.cast(
637 typing.Any,
638 parse_obj_as(
639 type_=typing.Any, # type: ignore
640 object_=_response.json(),
641 ),
642 ),
643 )
644 _response_json = _response.json()
645 except JSONDecodeError:
646 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
647 except ValidationError as e:
648 raise ParsingError(
649 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
650 )
651 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
652
653 def get_sns_provider(
654 self, *, request_options: typing.Optional[RequestOptions] = None
655 ) -> HttpResponse[GetGuardianFactorsProviderSnsResponseContent]:
656 """
657 Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review [Configure Push Notifications for MFA](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa).
658
659 Parameters
660 ----------
661 request_options : typing.Optional[RequestOptions]
662 Request-specific configuration.
663
664 Returns
665 -------
666 HttpResponse[GetGuardianFactorsProviderSnsResponseContent]
667 AWS SNS configuration successfully retrieved.
668 """
669 _response = self._client_wrapper.httpx_client.request(
670 "guardian/factors/push-notification/providers/sns",
671 method="GET",
672 request_options=request_options,
673 )
674 try:
675 if 200 <= _response.status_code < 300:
676 _data = typing.cast(
677 GetGuardianFactorsProviderSnsResponseContent,
678 parse_obj_as(
679 type_=GetGuardianFactorsProviderSnsResponseContent, # type: ignore
680 object_=_response.json(),
681 ),
682 )
683 return HttpResponse(response=_response, data=_data)
684 if _response.status_code == 400:
685 raise BadRequestError(
686 headers=dict(_response.headers),
687 body=typing.cast(
688 typing.Any,
689 parse_obj_as(
690 type_=typing.Any, # type: ignore
691 object_=_response.json(),
692 ),
693 ),
694 )
695 if _response.status_code == 401:
696 raise UnauthorizedError(
697 headers=dict(_response.headers),
698 body=typing.cast(
699 typing.Any,
700 parse_obj_as(
701 type_=typing.Any, # type: ignore
702 object_=_response.json(),
703 ),
704 ),
705 )
706 if _response.status_code == 403:
707 raise ForbiddenError(
708 headers=dict(_response.headers),
709 body=typing.cast(
710 typing.Any,
711 parse_obj_as(
712 type_=typing.Any, # type: ignore
713 object_=_response.json(),
714 ),
715 ),
716 )
717 _response_json = _response.json()
718 except JSONDecodeError:
719 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
720 except ValidationError as e:
721 raise ParsingError(
722 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
723 )
724 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
725
726 def set_sns_provider(
727 self,
728 *,
729 aws_access_key_id: typing.Optional[str] = OMIT,
730 aws_secret_access_key: typing.Optional[str] = OMIT,
731 aws_region: typing.Optional[str] = OMIT,
732 sns_apns_platform_application_arn: typing.Optional[str] = OMIT,
733 sns_gcm_platform_application_arn: typing.Optional[str] = OMIT,
734 request_options: typing.Optional[RequestOptions] = None,
735 ) -> HttpResponse[SetGuardianFactorsProviderPushNotificationSnsResponseContent]:
736 """
737 Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
738
739 Parameters
740 ----------
741 aws_access_key_id : typing.Optional[str]
742
743 aws_secret_access_key : typing.Optional[str]
744
745 aws_region : typing.Optional[str]
746
747 sns_apns_platform_application_arn : typing.Optional[str]
748
749 sns_gcm_platform_application_arn : typing.Optional[str]
750
751 request_options : typing.Optional[RequestOptions]
752 Request-specific configuration.
753
754 Returns
755 -------
756 HttpResponse[SetGuardianFactorsProviderPushNotificationSnsResponseContent]
757 AWS SNS configuration successfully updated.
758 """
759 _response = self._client_wrapper.httpx_client.request(
760 "guardian/factors/push-notification/providers/sns",
761 method="PUT",
762 json={
763 "aws_access_key_id": aws_access_key_id,
764 "aws_secret_access_key": aws_secret_access_key,
765 "aws_region": aws_region,
766 "sns_apns_platform_application_arn": sns_apns_platform_application_arn,
767 "sns_gcm_platform_application_arn": sns_gcm_platform_application_arn,
768 },
769 headers={
770 "content-type": "application/json",
771 },
772 request_options=request_options,
773 omit=OMIT,
774 )
775 try:
776 if 200 <= _response.status_code < 300:
777 _data = typing.cast(
778 SetGuardianFactorsProviderPushNotificationSnsResponseContent,
779 parse_obj_as(
780 type_=SetGuardianFactorsProviderPushNotificationSnsResponseContent, # type: ignore
781 object_=_response.json(),
782 ),
783 )
784 return HttpResponse(response=_response, data=_data)
785 if _response.status_code == 400:
786 raise BadRequestError(
787 headers=dict(_response.headers),
788 body=typing.cast(
789 typing.Any,
790 parse_obj_as(
791 type_=typing.Any, # type: ignore
792 object_=_response.json(),
793 ),
794 ),
795 )
796 if _response.status_code == 401:
797 raise UnauthorizedError(
798 headers=dict(_response.headers),
799 body=typing.cast(
800 typing.Any,
801 parse_obj_as(
802 type_=typing.Any, # type: ignore
803 object_=_response.json(),
804 ),
805 ),
806 )
807 if _response.status_code == 403:
808 raise ForbiddenError(
809 headers=dict(_response.headers),
810 body=typing.cast(
811 typing.Any,
812 parse_obj_as(
813 type_=typing.Any, # type: ignore
814 object_=_response.json(),
815 ),
816 ),
817 )
818 _response_json = _response.json()
819 except JSONDecodeError:
820 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
821 except ValidationError as e:
822 raise ParsingError(
823 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
824 )
825 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
826
827 def update_sns_provider(
828 self,
829 *,
830 aws_access_key_id: typing.Optional[str] = OMIT,
831 aws_secret_access_key: typing.Optional[str] = OMIT,
832 aws_region: typing.Optional[str] = OMIT,
833 sns_apns_platform_application_arn: typing.Optional[str] = OMIT,
834 sns_gcm_platform_application_arn: typing.Optional[str] = OMIT,
835 request_options: typing.Optional[RequestOptions] = None,
836 ) -> HttpResponse[UpdateGuardianFactorsProviderPushNotificationSnsResponseContent]:
837 """
838 Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
839
840 Parameters
841 ----------
842 aws_access_key_id : typing.Optional[str]
843
844 aws_secret_access_key : typing.Optional[str]
845
846 aws_region : typing.Optional[str]
847
848 sns_apns_platform_application_arn : typing.Optional[str]
849
850 sns_gcm_platform_application_arn : typing.Optional[str]
851
852 request_options : typing.Optional[RequestOptions]
853 Request-specific configuration.
854
855 Returns
856 -------
857 HttpResponse[UpdateGuardianFactorsProviderPushNotificationSnsResponseContent]
858 AWS SNS configuration successfully updated.
859 """
860 _response = self._client_wrapper.httpx_client.request(
861 "guardian/factors/push-notification/providers/sns",
862 method="PATCH",
863 json={
864 "aws_access_key_id": aws_access_key_id,
865 "aws_secret_access_key": aws_secret_access_key,
866 "aws_region": aws_region,
867 "sns_apns_platform_application_arn": sns_apns_platform_application_arn,
868 "sns_gcm_platform_application_arn": sns_gcm_platform_application_arn,
869 },
870 headers={
871 "content-type": "application/json",
872 },
873 request_options=request_options,
874 omit=OMIT,
875 )
876 try:
877 if 200 <= _response.status_code < 300:
878 _data = typing.cast(
879 UpdateGuardianFactorsProviderPushNotificationSnsResponseContent,
880 parse_obj_as(
881 type_=UpdateGuardianFactorsProviderPushNotificationSnsResponseContent, # type: ignore
882 object_=_response.json(),
883 ),
884 )
885 return HttpResponse(response=_response, data=_data)
886 if _response.status_code == 400:
887 raise BadRequestError(
888 headers=dict(_response.headers),
889 body=typing.cast(
890 typing.Any,
891 parse_obj_as(
892 type_=typing.Any, # type: ignore
893 object_=_response.json(),
894 ),
895 ),
896 )
897 if _response.status_code == 401:
898 raise UnauthorizedError(
899 headers=dict(_response.headers),
900 body=typing.cast(
901 typing.Any,
902 parse_obj_as(
903 type_=typing.Any, # type: ignore
904 object_=_response.json(),
905 ),
906 ),
907 )
908 if _response.status_code == 403:
909 raise ForbiddenError(
910 headers=dict(_response.headers),
911 body=typing.cast(
912 typing.Any,
913 parse_obj_as(
914 type_=typing.Any, # type: ignore
915 object_=_response.json(),
916 ),
917 ),
918 )
919 _response_json = _response.json()
920 except JSONDecodeError:
921 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
922 except ValidationError as e:
923 raise ParsingError(
924 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
925 )
926 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
927
928 def get_selected_provider(
929 self, *, request_options: typing.Optional[RequestOptions] = None
930 ) -> HttpResponse[GetGuardianFactorsProviderPushNotificationResponseContent]:
931 """
932 Modify the push notification provider configured for your tenant. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa">Configure Push Notifications for MFA</a>.
933
934 Parameters
935 ----------
936 request_options : typing.Optional[RequestOptions]
937 Request-specific configuration.
938
939 Returns
940 -------
941 HttpResponse[GetGuardianFactorsProviderPushNotificationResponseContent]
942 Returns selected push notification provider
943 """
944 _response = self._client_wrapper.httpx_client.request(
945 "guardian/factors/push-notification/selected-provider",
946 method="GET",
947 request_options=request_options,
948 )
949 try:
950 if 200 <= _response.status_code < 300:
951 _data = typing.cast(
952 GetGuardianFactorsProviderPushNotificationResponseContent,
953 parse_obj_as(
954 type_=GetGuardianFactorsProviderPushNotificationResponseContent, # type: ignore
955 object_=_response.json(),
956 ),
957 )
958 return HttpResponse(response=_response, data=_data)
959 if _response.status_code == 400:
960 raise BadRequestError(
961 headers=dict(_response.headers),
962 body=typing.cast(
963 typing.Any,
964 parse_obj_as(
965 type_=typing.Any, # type: ignore
966 object_=_response.json(),
967 ),
968 ),
969 )
970 if _response.status_code == 401:
971 raise UnauthorizedError(
972 headers=dict(_response.headers),
973 body=typing.cast(
974 typing.Any,
975 parse_obj_as(
976 type_=typing.Any, # type: ignore
977 object_=_response.json(),
978 ),
979 ),
980 )
981 if _response.status_code == 403:
982 raise ForbiddenError(
983 headers=dict(_response.headers),
984 body=typing.cast(
985 typing.Any,
986 parse_obj_as(
987 type_=typing.Any, # type: ignore
988 object_=_response.json(),
989 ),
990 ),
991 )
992 _response_json = _response.json()
993 except JSONDecodeError:
994 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
995 except ValidationError as e:
996 raise ParsingError(
997 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
998 )
999 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1000
1001 def set_provider(
1002 self,
1003 *,
1004 provider: GuardianFactorsProviderPushNotificationProviderDataEnum,
1005 request_options: typing.Optional[RequestOptions] = None,
1006 ) -> HttpResponse[SetGuardianFactorsProviderPushNotificationResponseContent]:
1007 """
1008 Modify the push notification provider configured for your tenant. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa">Configure Push Notifications for MFA</a>.
1009
1010 Parameters
1011 ----------
1012 provider : GuardianFactorsProviderPushNotificationProviderDataEnum
1013
1014 request_options : typing.Optional[RequestOptions]
1015 Request-specific configuration.
1016
1017 Returns
1018 -------
1019 HttpResponse[SetGuardianFactorsProviderPushNotificationResponseContent]
1020 Returns selected push notification provider configuration
1021 """
1022 _response = self._client_wrapper.httpx_client.request(
1023 "guardian/factors/push-notification/selected-provider",
1024 method="PUT",
1025 json={
1026 "provider": provider,
1027 },
1028 headers={
1029 "content-type": "application/json",
1030 },
1031 request_options=request_options,
1032 omit=OMIT,
1033 )
1034 try:
1035 if 200 <= _response.status_code < 300:
1036 _data = typing.cast(
1037 SetGuardianFactorsProviderPushNotificationResponseContent,
1038 parse_obj_as(
1039 type_=SetGuardianFactorsProviderPushNotificationResponseContent, # type: ignore
1040 object_=_response.json(),
1041 ),
1042 )
1043 return HttpResponse(response=_response, data=_data)
1044 if _response.status_code == 400:
1045 raise BadRequestError(
1046 headers=dict(_response.headers),
1047 body=typing.cast(
1048 typing.Any,
1049 parse_obj_as(
1050 type_=typing.Any, # type: ignore
1051 object_=_response.json(),
1052 ),
1053 ),
1054 )
1055 if _response.status_code == 401:
1056 raise UnauthorizedError(
1057 headers=dict(_response.headers),
1058 body=typing.cast(
1059 typing.Any,
1060 parse_obj_as(
1061 type_=typing.Any, # type: ignore
1062 object_=_response.json(),
1063 ),
1064 ),
1065 )
1066 if _response.status_code == 403:
1067 raise ForbiddenError(
1068 headers=dict(_response.headers),
1069 body=typing.cast(
1070 typing.Any,
1071 parse_obj_as(
1072 type_=typing.Any, # type: ignore
1073 object_=_response.json(),
1074 ),
1075 ),
1076 )
1077 _response_json = _response.json()
1078 except JSONDecodeError:
1079 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1080 except ValidationError as e:
1081 raise ParsingError(
1082 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1083 )
1084 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1085
1086
1087 class AsyncRawPushNotificationClient:
1088 def __init__(self, *, client_wrapper: AsyncClientWrapper):
1089 self._client_wrapper = client_wrapper
1090
1091 async def get_apns_provider(
1092 self, *, request_options: typing.Optional[RequestOptions] = None
1093 ) -> AsyncHttpResponse[GetGuardianFactorsProviderApnsResponseContent]:
1094 """
1095 Retrieve configuration details for the multi-factor authentication APNS provider associated with your tenant.
1096
1097 Parameters
1098 ----------
1099 request_options : typing.Optional[RequestOptions]
1100 Request-specific configuration.
1101
1102 Returns
1103 -------
1104 AsyncHttpResponse[GetGuardianFactorsProviderApnsResponseContent]
1105 APNS configuration successfully retrieved.
1106 """
1107 _response = await self._client_wrapper.httpx_client.request(
1108 "guardian/factors/push-notification/providers/apns",
1109 method="GET",
1110 request_options=request_options,
1111 )
1112 try:
1113 if 200 <= _response.status_code < 300:
1114 _data = typing.cast(
1115 GetGuardianFactorsProviderApnsResponseContent,
1116 parse_obj_as(
1117 type_=GetGuardianFactorsProviderApnsResponseContent, # type: ignore
1118 object_=_response.json(),
1119 ),
1120 )
1121 return AsyncHttpResponse(response=_response, data=_data)
1122 if _response.status_code == 400:
1123 raise BadRequestError(
1124 headers=dict(_response.headers),
1125 body=typing.cast(
1126 typing.Any,
1127 parse_obj_as(
1128 type_=typing.Any, # type: ignore
1129 object_=_response.json(),
1130 ),
1131 ),
1132 )
1133 if _response.status_code == 401:
1134 raise UnauthorizedError(
1135 headers=dict(_response.headers),
1136 body=typing.cast(
1137 typing.Any,
1138 parse_obj_as(
1139 type_=typing.Any, # type: ignore
1140 object_=_response.json(),
1141 ),
1142 ),
1143 )
1144 if _response.status_code == 403:
1145 raise ForbiddenError(
1146 headers=dict(_response.headers),
1147 body=typing.cast(
1148 typing.Any,
1149 parse_obj_as(
1150 type_=typing.Any, # type: ignore
1151 object_=_response.json(),
1152 ),
1153 ),
1154 )
1155 _response_json = _response.json()
1156 except JSONDecodeError:
1157 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1158 except ValidationError as e:
1159 raise ParsingError(
1160 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1161 )
1162 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1163
1164 async def set_apns_provider(
1165 self,
1166 *,
1167 sandbox: typing.Optional[bool] = OMIT,
1168 bundle_id: typing.Optional[str] = OMIT,
1169 p_12: typing.Optional[str] = OMIT,
1170 request_options: typing.Optional[RequestOptions] = None,
1171 ) -> AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationApnsResponseContent]:
1172 """
1173 Overwrite all configuration details of the multi-factor authentication APNS provider associated with your tenant.
1174
1175 Parameters
1176 ----------
1177 sandbox : typing.Optional[bool]
1178
1179 bundle_id : typing.Optional[str]
1180
1181 p_12 : typing.Optional[str]
1182
1183 request_options : typing.Optional[RequestOptions]
1184 Request-specific configuration.
1185
1186 Returns
1187 -------
1188 AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationApnsResponseContent]
1189 APNS configuration successfully updated.
1190 """
1191 _response = await self._client_wrapper.httpx_client.request(
1192 "guardian/factors/push-notification/providers/apns",
1193 method="PUT",
1194 json={
1195 "sandbox": sandbox,
1196 "bundle_id": bundle_id,
1197 "p12": p_12,
1198 },
1199 headers={
1200 "content-type": "application/json",
1201 },
1202 request_options=request_options,
1203 omit=OMIT,
1204 )
1205 try:
1206 if 200 <= _response.status_code < 300:
1207 _data = typing.cast(
1208 SetGuardianFactorsProviderPushNotificationApnsResponseContent,
1209 parse_obj_as(
1210 type_=SetGuardianFactorsProviderPushNotificationApnsResponseContent, # type: ignore
1211 object_=_response.json(),
1212 ),
1213 )
1214 return AsyncHttpResponse(response=_response, data=_data)
1215 if _response.status_code == 400:
1216 raise BadRequestError(
1217 headers=dict(_response.headers),
1218 body=typing.cast(
1219 typing.Any,
1220 parse_obj_as(
1221 type_=typing.Any, # type: ignore
1222 object_=_response.json(),
1223 ),
1224 ),
1225 )
1226 if _response.status_code == 401:
1227 raise UnauthorizedError(
1228 headers=dict(_response.headers),
1229 body=typing.cast(
1230 typing.Any,
1231 parse_obj_as(
1232 type_=typing.Any, # type: ignore
1233 object_=_response.json(),
1234 ),
1235 ),
1236 )
1237 if _response.status_code == 403:
1238 raise ForbiddenError(
1239 headers=dict(_response.headers),
1240 body=typing.cast(
1241 typing.Any,
1242 parse_obj_as(
1243 type_=typing.Any, # type: ignore
1244 object_=_response.json(),
1245 ),
1246 ),
1247 )
1248 _response_json = _response.json()
1249 except JSONDecodeError:
1250 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1251 except ValidationError as e:
1252 raise ParsingError(
1253 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1254 )
1255 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1256
1257 async def update_apns_provider(
1258 self,
1259 *,
1260 sandbox: typing.Optional[bool] = OMIT,
1261 bundle_id: typing.Optional[str] = OMIT,
1262 p_12: typing.Optional[str] = OMIT,
1263 request_options: typing.Optional[RequestOptions] = None,
1264 ) -> AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationApnsResponseContent]:
1265 """
1266 Modify configuration details of the multi-factor authentication APNS provider associated with your tenant.
1267
1268 Parameters
1269 ----------
1270 sandbox : typing.Optional[bool]
1271
1272 bundle_id : typing.Optional[str]
1273
1274 p_12 : typing.Optional[str]
1275
1276 request_options : typing.Optional[RequestOptions]
1277 Request-specific configuration.
1278
1279 Returns
1280 -------
1281 AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationApnsResponseContent]
1282 APNS configuration successfully updated.
1283 """
1284 _response = await self._client_wrapper.httpx_client.request(
1285 "guardian/factors/push-notification/providers/apns",
1286 method="PATCH",
1287 json={
1288 "sandbox": sandbox,
1289 "bundle_id": bundle_id,
1290 "p12": p_12,
1291 },
1292 headers={
1293 "content-type": "application/json",
1294 },
1295 request_options=request_options,
1296 omit=OMIT,
1297 )
1298 try:
1299 if 200 <= _response.status_code < 300:
1300 _data = typing.cast(
1301 UpdateGuardianFactorsProviderPushNotificationApnsResponseContent,
1302 parse_obj_as(
1303 type_=UpdateGuardianFactorsProviderPushNotificationApnsResponseContent, # type: ignore
1304 object_=_response.json(),
1305 ),
1306 )
1307 return AsyncHttpResponse(response=_response, data=_data)
1308 if _response.status_code == 400:
1309 raise BadRequestError(
1310 headers=dict(_response.headers),
1311 body=typing.cast(
1312 typing.Any,
1313 parse_obj_as(
1314 type_=typing.Any, # type: ignore
1315 object_=_response.json(),
1316 ),
1317 ),
1318 )
1319 if _response.status_code == 401:
1320 raise UnauthorizedError(
1321 headers=dict(_response.headers),
1322 body=typing.cast(
1323 typing.Any,
1324 parse_obj_as(
1325 type_=typing.Any, # type: ignore
1326 object_=_response.json(),
1327 ),
1328 ),
1329 )
1330 if _response.status_code == 403:
1331 raise ForbiddenError(
1332 headers=dict(_response.headers),
1333 body=typing.cast(
1334 typing.Any,
1335 parse_obj_as(
1336 type_=typing.Any, # type: ignore
1337 object_=_response.json(),
1338 ),
1339 ),
1340 )
1341 _response_json = _response.json()
1342 except JSONDecodeError:
1343 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1344 except ValidationError as e:
1345 raise ParsingError(
1346 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1347 )
1348 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1349
1350 async def set_fcm_provider(
1351 self, *, server_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
1352 ) -> AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationFcmResponseContent]:
1353 """
1354 Overwrite all configuration details of the multi-factor authentication FCM provider associated with your tenant.
1355
1356 Parameters
1357 ----------
1358 server_key : typing.Optional[str]
1359
1360 request_options : typing.Optional[RequestOptions]
1361 Request-specific configuration.
1362
1363 Returns
1364 -------
1365 AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationFcmResponseContent]
1366 FCM configuration updated
1367 """
1368 _response = await self._client_wrapper.httpx_client.request(
1369 "guardian/factors/push-notification/providers/fcm",
1370 method="PUT",
1371 json={
1372 "server_key": server_key,
1373 },
1374 headers={
1375 "content-type": "application/json",
1376 },
1377 request_options=request_options,
1378 omit=OMIT,
1379 )
1380 try:
1381 if 200 <= _response.status_code < 300:
1382 _data = typing.cast(
1383 SetGuardianFactorsProviderPushNotificationFcmResponseContent,
1384 parse_obj_as(
1385 type_=SetGuardianFactorsProviderPushNotificationFcmResponseContent, # type: ignore
1386 object_=_response.json(),
1387 ),
1388 )
1389 return AsyncHttpResponse(response=_response, data=_data)
1390 if _response.status_code == 400:
1391 raise BadRequestError(
1392 headers=dict(_response.headers),
1393 body=typing.cast(
1394 typing.Any,
1395 parse_obj_as(
1396 type_=typing.Any, # type: ignore
1397 object_=_response.json(),
1398 ),
1399 ),
1400 )
1401 if _response.status_code == 401:
1402 raise UnauthorizedError(
1403 headers=dict(_response.headers),
1404 body=typing.cast(
1405 typing.Any,
1406 parse_obj_as(
1407 type_=typing.Any, # type: ignore
1408 object_=_response.json(),
1409 ),
1410 ),
1411 )
1412 if _response.status_code == 403:
1413 raise ForbiddenError(
1414 headers=dict(_response.headers),
1415 body=typing.cast(
1416 typing.Any,
1417 parse_obj_as(
1418 type_=typing.Any, # type: ignore
1419 object_=_response.json(),
1420 ),
1421 ),
1422 )
1423 _response_json = _response.json()
1424 except JSONDecodeError:
1425 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1426 except ValidationError as e:
1427 raise ParsingError(
1428 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1429 )
1430 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1431
1432 async def update_fcm_provider(
1433 self, *, server_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
1434 ) -> AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmResponseContent]:
1435 """
1436 Modify configuration details of the multi-factor authentication FCM provider associated with your tenant.
1437
1438 Parameters
1439 ----------
1440 server_key : typing.Optional[str]
1441
1442 request_options : typing.Optional[RequestOptions]
1443 Request-specific configuration.
1444
1445 Returns
1446 -------
1447 AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmResponseContent]
1448 FCM configuration updated
1449 """
1450 _response = await self._client_wrapper.httpx_client.request(
1451 "guardian/factors/push-notification/providers/fcm",
1452 method="PATCH",
1453 json={
1454 "server_key": server_key,
1455 },
1456 headers={
1457 "content-type": "application/json",
1458 },
1459 request_options=request_options,
1460 omit=OMIT,
1461 )
1462 try:
1463 if 200 <= _response.status_code < 300:
1464 _data = typing.cast(
1465 UpdateGuardianFactorsProviderPushNotificationFcmResponseContent,
1466 parse_obj_as(
1467 type_=UpdateGuardianFactorsProviderPushNotificationFcmResponseContent, # type: ignore
1468 object_=_response.json(),
1469 ),
1470 )
1471 return AsyncHttpResponse(response=_response, data=_data)
1472 if _response.status_code == 400:
1473 raise BadRequestError(
1474 headers=dict(_response.headers),
1475 body=typing.cast(
1476 typing.Any,
1477 parse_obj_as(
1478 type_=typing.Any, # type: ignore
1479 object_=_response.json(),
1480 ),
1481 ),
1482 )
1483 if _response.status_code == 401:
1484 raise UnauthorizedError(
1485 headers=dict(_response.headers),
1486 body=typing.cast(
1487 typing.Any,
1488 parse_obj_as(
1489 type_=typing.Any, # type: ignore
1490 object_=_response.json(),
1491 ),
1492 ),
1493 )
1494 if _response.status_code == 403:
1495 raise ForbiddenError(
1496 headers=dict(_response.headers),
1497 body=typing.cast(
1498 typing.Any,
1499 parse_obj_as(
1500 type_=typing.Any, # type: ignore
1501 object_=_response.json(),
1502 ),
1503 ),
1504 )
1505 _response_json = _response.json()
1506 except JSONDecodeError:
1507 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1508 except ValidationError as e:
1509 raise ParsingError(
1510 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1511 )
1512 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1513
1514 async def set_fcmv_1_provider(
1515 self,
1516 *,
1517 server_credentials: typing.Optional[str] = OMIT,
1518 request_options: typing.Optional[RequestOptions] = None,
1519 ) -> AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent]:
1520 """
1521 Overwrite all configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.
1522
1523 Parameters
1524 ----------
1525 server_credentials : typing.Optional[str]
1526
1527 request_options : typing.Optional[RequestOptions]
1528 Request-specific configuration.
1529
1530 Returns
1531 -------
1532 AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent]
1533 FCMV1 configuration updated
1534 """
1535 _response = await self._client_wrapper.httpx_client.request(
1536 "guardian/factors/push-notification/providers/fcmv1",
1537 method="PUT",
1538 json={
1539 "server_credentials": server_credentials,
1540 },
1541 headers={
1542 "content-type": "application/json",
1543 },
1544 request_options=request_options,
1545 omit=OMIT,
1546 )
1547 try:
1548 if 200 <= _response.status_code < 300:
1549 _data = typing.cast(
1550 SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
1551 parse_obj_as(
1552 type_=SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent, # type: ignore
1553 object_=_response.json(),
1554 ),
1555 )
1556 return AsyncHttpResponse(response=_response, data=_data)
1557 if _response.status_code == 400:
1558 raise BadRequestError(
1559 headers=dict(_response.headers),
1560 body=typing.cast(
1561 typing.Any,
1562 parse_obj_as(
1563 type_=typing.Any, # type: ignore
1564 object_=_response.json(),
1565 ),
1566 ),
1567 )
1568 if _response.status_code == 401:
1569 raise UnauthorizedError(
1570 headers=dict(_response.headers),
1571 body=typing.cast(
1572 typing.Any,
1573 parse_obj_as(
1574 type_=typing.Any, # type: ignore
1575 object_=_response.json(),
1576 ),
1577 ),
1578 )
1579 if _response.status_code == 403:
1580 raise ForbiddenError(
1581 headers=dict(_response.headers),
1582 body=typing.cast(
1583 typing.Any,
1584 parse_obj_as(
1585 type_=typing.Any, # type: ignore
1586 object_=_response.json(),
1587 ),
1588 ),
1589 )
1590 _response_json = _response.json()
1591 except JSONDecodeError:
1592 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1593 except ValidationError as e:
1594 raise ParsingError(
1595 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1596 )
1597 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1598
1599 async def update_fcmv_1_provider(
1600 self,
1601 *,
1602 server_credentials: typing.Optional[str] = OMIT,
1603 request_options: typing.Optional[RequestOptions] = None,
1604 ) -> AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent]:
1605 """
1606 Modify configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.
1607
1608 Parameters
1609 ----------
1610 server_credentials : typing.Optional[str]
1611
1612 request_options : typing.Optional[RequestOptions]
1613 Request-specific configuration.
1614
1615 Returns
1616 -------
1617 AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent]
1618 FCMV1 configuration updated
1619 """
1620 _response = await self._client_wrapper.httpx_client.request(
1621 "guardian/factors/push-notification/providers/fcmv1",
1622 method="PATCH",
1623 json={
1624 "server_credentials": server_credentials,
1625 },
1626 headers={
1627 "content-type": "application/json",
1628 },
1629 request_options=request_options,
1630 omit=OMIT,
1631 )
1632 try:
1633 if 200 <= _response.status_code < 300:
1634 _data = typing.cast(
1635 UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent,
1636 parse_obj_as(
1637 type_=UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent, # type: ignore
1638 object_=_response.json(),
1639 ),
1640 )
1641 return AsyncHttpResponse(response=_response, data=_data)
1642 if _response.status_code == 400:
1643 raise BadRequestError(
1644 headers=dict(_response.headers),
1645 body=typing.cast(
1646 typing.Any,
1647 parse_obj_as(
1648 type_=typing.Any, # type: ignore
1649 object_=_response.json(),
1650 ),
1651 ),
1652 )
1653 if _response.status_code == 401:
1654 raise UnauthorizedError(
1655 headers=dict(_response.headers),
1656 body=typing.cast(
1657 typing.Any,
1658 parse_obj_as(
1659 type_=typing.Any, # type: ignore
1660 object_=_response.json(),
1661 ),
1662 ),
1663 )
1664 if _response.status_code == 403:
1665 raise ForbiddenError(
1666 headers=dict(_response.headers),
1667 body=typing.cast(
1668 typing.Any,
1669 parse_obj_as(
1670 type_=typing.Any, # type: ignore
1671 object_=_response.json(),
1672 ),
1673 ),
1674 )
1675 _response_json = _response.json()
1676 except JSONDecodeError:
1677 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1678 except ValidationError as e:
1679 raise ParsingError(
1680 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1681 )
1682 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1683
1684 async def get_sns_provider(
1685 self, *, request_options: typing.Optional[RequestOptions] = None
1686 ) -> AsyncHttpResponse[GetGuardianFactorsProviderSnsResponseContent]:
1687 """
1688 Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review [Configure Push Notifications for MFA](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa).
1689
1690 Parameters
1691 ----------
1692 request_options : typing.Optional[RequestOptions]
1693 Request-specific configuration.
1694
1695 Returns
1696 -------
1697 AsyncHttpResponse[GetGuardianFactorsProviderSnsResponseContent]
1698 AWS SNS configuration successfully retrieved.
1699 """
1700 _response = await self._client_wrapper.httpx_client.request(
1701 "guardian/factors/push-notification/providers/sns",
1702 method="GET",
1703 request_options=request_options,
1704 )
1705 try:
1706 if 200 <= _response.status_code < 300:
1707 _data = typing.cast(
1708 GetGuardianFactorsProviderSnsResponseContent,
1709 parse_obj_as(
1710 type_=GetGuardianFactorsProviderSnsResponseContent, # type: ignore
1711 object_=_response.json(),
1712 ),
1713 )
1714 return AsyncHttpResponse(response=_response, data=_data)
1715 if _response.status_code == 400:
1716 raise BadRequestError(
1717 headers=dict(_response.headers),
1718 body=typing.cast(
1719 typing.Any,
1720 parse_obj_as(
1721 type_=typing.Any, # type: ignore
1722 object_=_response.json(),
1723 ),
1724 ),
1725 )
1726 if _response.status_code == 401:
1727 raise UnauthorizedError(
1728 headers=dict(_response.headers),
1729 body=typing.cast(
1730 typing.Any,
1731 parse_obj_as(
1732 type_=typing.Any, # type: ignore
1733 object_=_response.json(),
1734 ),
1735 ),
1736 )
1737 if _response.status_code == 403:
1738 raise ForbiddenError(
1739 headers=dict(_response.headers),
1740 body=typing.cast(
1741 typing.Any,
1742 parse_obj_as(
1743 type_=typing.Any, # type: ignore
1744 object_=_response.json(),
1745 ),
1746 ),
1747 )
1748 _response_json = _response.json()
1749 except JSONDecodeError:
1750 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1751 except ValidationError as e:
1752 raise ParsingError(
1753 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1754 )
1755 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1756
1757 async def set_sns_provider(
1758 self,
1759 *,
1760 aws_access_key_id: typing.Optional[str] = OMIT,
1761 aws_secret_access_key: typing.Optional[str] = OMIT,
1762 aws_region: typing.Optional[str] = OMIT,
1763 sns_apns_platform_application_arn: typing.Optional[str] = OMIT,
1764 sns_gcm_platform_application_arn: typing.Optional[str] = OMIT,
1765 request_options: typing.Optional[RequestOptions] = None,
1766 ) -> AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationSnsResponseContent]:
1767 """
1768 Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
1769
1770 Parameters
1771 ----------
1772 aws_access_key_id : typing.Optional[str]
1773
1774 aws_secret_access_key : typing.Optional[str]
1775
1776 aws_region : typing.Optional[str]
1777
1778 sns_apns_platform_application_arn : typing.Optional[str]
1779
1780 sns_gcm_platform_application_arn : typing.Optional[str]
1781
1782 request_options : typing.Optional[RequestOptions]
1783 Request-specific configuration.
1784
1785 Returns
1786 -------
1787 AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationSnsResponseContent]
1788 AWS SNS configuration successfully updated.
1789 """
1790 _response = await self._client_wrapper.httpx_client.request(
1791 "guardian/factors/push-notification/providers/sns",
1792 method="PUT",
1793 json={
1794 "aws_access_key_id": aws_access_key_id,
1795 "aws_secret_access_key": aws_secret_access_key,
1796 "aws_region": aws_region,
1797 "sns_apns_platform_application_arn": sns_apns_platform_application_arn,
1798 "sns_gcm_platform_application_arn": sns_gcm_platform_application_arn,
1799 },
1800 headers={
1801 "content-type": "application/json",
1802 },
1803 request_options=request_options,
1804 omit=OMIT,
1805 )
1806 try:
1807 if 200 <= _response.status_code < 300:
1808 _data = typing.cast(
1809 SetGuardianFactorsProviderPushNotificationSnsResponseContent,
1810 parse_obj_as(
1811 type_=SetGuardianFactorsProviderPushNotificationSnsResponseContent, # type: ignore
1812 object_=_response.json(),
1813 ),
1814 )
1815 return AsyncHttpResponse(response=_response, data=_data)
1816 if _response.status_code == 400:
1817 raise BadRequestError(
1818 headers=dict(_response.headers),
1819 body=typing.cast(
1820 typing.Any,
1821 parse_obj_as(
1822 type_=typing.Any, # type: ignore
1823 object_=_response.json(),
1824 ),
1825 ),
1826 )
1827 if _response.status_code == 401:
1828 raise UnauthorizedError(
1829 headers=dict(_response.headers),
1830 body=typing.cast(
1831 typing.Any,
1832 parse_obj_as(
1833 type_=typing.Any, # type: ignore
1834 object_=_response.json(),
1835 ),
1836 ),
1837 )
1838 if _response.status_code == 403:
1839 raise ForbiddenError(
1840 headers=dict(_response.headers),
1841 body=typing.cast(
1842 typing.Any,
1843 parse_obj_as(
1844 type_=typing.Any, # type: ignore
1845 object_=_response.json(),
1846 ),
1847 ),
1848 )
1849 _response_json = _response.json()
1850 except JSONDecodeError:
1851 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1852 except ValidationError as e:
1853 raise ParsingError(
1854 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1855 )
1856 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1857
1858 async def update_sns_provider(
1859 self,
1860 *,
1861 aws_access_key_id: typing.Optional[str] = OMIT,
1862 aws_secret_access_key: typing.Optional[str] = OMIT,
1863 aws_region: typing.Optional[str] = OMIT,
1864 sns_apns_platform_application_arn: typing.Optional[str] = OMIT,
1865 sns_gcm_platform_application_arn: typing.Optional[str] = OMIT,
1866 request_options: typing.Optional[RequestOptions] = None,
1867 ) -> AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationSnsResponseContent]:
1868 """
1869 Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
1870
1871 Parameters
1872 ----------
1873 aws_access_key_id : typing.Optional[str]
1874
1875 aws_secret_access_key : typing.Optional[str]
1876
1877 aws_region : typing.Optional[str]
1878
1879 sns_apns_platform_application_arn : typing.Optional[str]
1880
1881 sns_gcm_platform_application_arn : typing.Optional[str]
1882
1883 request_options : typing.Optional[RequestOptions]
1884 Request-specific configuration.
1885
1886 Returns
1887 -------
1888 AsyncHttpResponse[UpdateGuardianFactorsProviderPushNotificationSnsResponseContent]
1889 AWS SNS configuration successfully updated.
1890 """
1891 _response = await self._client_wrapper.httpx_client.request(
1892 "guardian/factors/push-notification/providers/sns",
1893 method="PATCH",
1894 json={
1895 "aws_access_key_id": aws_access_key_id,
1896 "aws_secret_access_key": aws_secret_access_key,
1897 "aws_region": aws_region,
1898 "sns_apns_platform_application_arn": sns_apns_platform_application_arn,
1899 "sns_gcm_platform_application_arn": sns_gcm_platform_application_arn,
1900 },
1901 headers={
1902 "content-type": "application/json",
1903 },
1904 request_options=request_options,
1905 omit=OMIT,
1906 )
1907 try:
1908 if 200 <= _response.status_code < 300:
1909 _data = typing.cast(
1910 UpdateGuardianFactorsProviderPushNotificationSnsResponseContent,
1911 parse_obj_as(
1912 type_=UpdateGuardianFactorsProviderPushNotificationSnsResponseContent, # type: ignore
1913 object_=_response.json(),
1914 ),
1915 )
1916 return AsyncHttpResponse(response=_response, data=_data)
1917 if _response.status_code == 400:
1918 raise BadRequestError(
1919 headers=dict(_response.headers),
1920 body=typing.cast(
1921 typing.Any,
1922 parse_obj_as(
1923 type_=typing.Any, # type: ignore
1924 object_=_response.json(),
1925 ),
1926 ),
1927 )
1928 if _response.status_code == 401:
1929 raise UnauthorizedError(
1930 headers=dict(_response.headers),
1931 body=typing.cast(
1932 typing.Any,
1933 parse_obj_as(
1934 type_=typing.Any, # type: ignore
1935 object_=_response.json(),
1936 ),
1937 ),
1938 )
1939 if _response.status_code == 403:
1940 raise ForbiddenError(
1941 headers=dict(_response.headers),
1942 body=typing.cast(
1943 typing.Any,
1944 parse_obj_as(
1945 type_=typing.Any, # type: ignore
1946 object_=_response.json(),
1947 ),
1948 ),
1949 )
1950 _response_json = _response.json()
1951 except JSONDecodeError:
1952 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1953 except ValidationError as e:
1954 raise ParsingError(
1955 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1956 )
1957 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1958
1959 async def get_selected_provider(
1960 self, *, request_options: typing.Optional[RequestOptions] = None
1961 ) -> AsyncHttpResponse[GetGuardianFactorsProviderPushNotificationResponseContent]:
1962 """
1963 Modify the push notification provider configured for your tenant. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa">Configure Push Notifications for MFA</a>.
1964
1965 Parameters
1966 ----------
1967 request_options : typing.Optional[RequestOptions]
1968 Request-specific configuration.
1969
1970 Returns
1971 -------
1972 AsyncHttpResponse[GetGuardianFactorsProviderPushNotificationResponseContent]
1973 Returns selected push notification provider
1974 """
1975 _response = await self._client_wrapper.httpx_client.request(
1976 "guardian/factors/push-notification/selected-provider",
1977 method="GET",
1978 request_options=request_options,
1979 )
1980 try:
1981 if 200 <= _response.status_code < 300:
1982 _data = typing.cast(
1983 GetGuardianFactorsProviderPushNotificationResponseContent,
1984 parse_obj_as(
1985 type_=GetGuardianFactorsProviderPushNotificationResponseContent, # type: ignore
1986 object_=_response.json(),
1987 ),
1988 )
1989 return AsyncHttpResponse(response=_response, data=_data)
1990 if _response.status_code == 400:
1991 raise BadRequestError(
1992 headers=dict(_response.headers),
1993 body=typing.cast(
1994 typing.Any,
1995 parse_obj_as(
1996 type_=typing.Any, # type: ignore
1997 object_=_response.json(),
1998 ),
1999 ),
2000 )
2001 if _response.status_code == 401:
2002 raise UnauthorizedError(
2003 headers=dict(_response.headers),
2004 body=typing.cast(
2005 typing.Any,
2006 parse_obj_as(
2007 type_=typing.Any, # type: ignore
2008 object_=_response.json(),
2009 ),
2010 ),
2011 )
2012 if _response.status_code == 403:
2013 raise ForbiddenError(
2014 headers=dict(_response.headers),
2015 body=typing.cast(
2016 typing.Any,
2017 parse_obj_as(
2018 type_=typing.Any, # type: ignore
2019 object_=_response.json(),
2020 ),
2021 ),
2022 )
2023 _response_json = _response.json()
2024 except JSONDecodeError:
2025 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2026 except ValidationError as e:
2027 raise ParsingError(
2028 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2029 )
2030 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2031
2032 async def set_provider(
2033 self,
2034 *,
2035 provider: GuardianFactorsProviderPushNotificationProviderDataEnum,
2036 request_options: typing.Optional[RequestOptions] = None,
2037 ) -> AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationResponseContent]:
2038 """
2039 Modify the push notification provider configured for your tenant. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa">Configure Push Notifications for MFA</a>.
2040
2041 Parameters
2042 ----------
2043 provider : GuardianFactorsProviderPushNotificationProviderDataEnum
2044
2045 request_options : typing.Optional[RequestOptions]
2046 Request-specific configuration.
2047
2048 Returns
2049 -------
2050 AsyncHttpResponse[SetGuardianFactorsProviderPushNotificationResponseContent]
2051 Returns selected push notification provider configuration
2052 """
2053 _response = await self._client_wrapper.httpx_client.request(
2054 "guardian/factors/push-notification/selected-provider",
2055 method="PUT",
2056 json={
2057 "provider": provider,
2058 },
2059 headers={
2060 "content-type": "application/json",
2061 },
2062 request_options=request_options,
2063 omit=OMIT,
2064 )
2065 try:
2066 if 200 <= _response.status_code < 300:
2067 _data = typing.cast(
2068 SetGuardianFactorsProviderPushNotificationResponseContent,
2069 parse_obj_as(
2070 type_=SetGuardianFactorsProviderPushNotificationResponseContent, # type: ignore
2071 object_=_response.json(),
2072 ),
2073 )
2074 return AsyncHttpResponse(response=_response, data=_data)
2075 if _response.status_code == 400:
2076 raise BadRequestError(
2077 headers=dict(_response.headers),
2078 body=typing.cast(
2079 typing.Any,
2080 parse_obj_as(
2081 type_=typing.Any, # type: ignore
2082 object_=_response.json(),
2083 ),
2084 ),
2085 )
2086 if _response.status_code == 401:
2087 raise UnauthorizedError(
2088 headers=dict(_response.headers),
2089 body=typing.cast(
2090 typing.Any,
2091 parse_obj_as(
2092 type_=typing.Any, # type: ignore
2093 object_=_response.json(),
2094 ),
2095 ),
2096 )
2097 if _response.status_code == 403:
2098 raise ForbiddenError(
2099 headers=dict(_response.headers),
2100 body=typing.cast(
2101 typing.Any,
2102 parse_obj_as(
2103 type_=typing.Any, # type: ignore
2104 object_=_response.json(),
2105 ),
2106 ),
2107 )
2108 _response_json = _response.json()
2109 except JSONDecodeError:
2110 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2111 except ValidationError as e:
2112 raise ParsingError(
2113 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2114 )
2115 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)