Debian Codegraph @

src/auth0/management/guardian/policies/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.request_options import RequestOptions
7 from ...types.list_guardian_policies_response_content import ListGuardianPoliciesResponseContent
8 from ...types.set_guardian_policies_request_content import SetGuardianPoliciesRequestContent
9 from ...types.set_guardian_policies_response_content import SetGuardianPoliciesResponseContent
10 from .raw_client import AsyncRawPoliciesClient, RawPoliciesClient
11
12 # this is used as the default value for optional parameters
13 OMIT = typing.cast(typing.Any, ...)
14
15
16 class PoliciesClient:
17 def __init__(self, *, client_wrapper: SyncClientWrapper):
18 self._raw_client = RawPoliciesClient(client_wrapper=client_wrapper)
19
20 @property
21 def with_raw_response(self) -> RawPoliciesClient:
22 """
23 Retrieves a raw implementation of this client that returns raw responses.
24
25 Returns
26 -------
27 RawPoliciesClient
28 """
29 return self._raw_client
30
31 def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListGuardianPoliciesResponseContent:
32 """
33 Retrieve the [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) configured for your tenant.
34
35 The following policies are supported:
36
37 - `all-applications` policy prompts with MFA for all logins.
38 - `confidence-score` policy prompts with MFA only for low confidence logins.
39
40 **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
41
42 Parameters
43 ----------
44 request_options : typing.Optional[RequestOptions]
45 Request-specific configuration.
46
47 Returns
48 -------
49 ListGuardianPoliciesResponseContent
50 Success
51
52 Examples
53 --------
54 from auth0 import Auth0
55
56 client = Auth0(
57 token="YOUR_TOKEN",
58 )
59 client.guardian.policies.list()
60 """
61 _response = self._raw_client.list(request_options=request_options)
62 return _response.data
63
64 def set(
65 self, *, request: SetGuardianPoliciesRequestContent, request_options: typing.Optional[RequestOptions] = None
66 ) -> SetGuardianPoliciesResponseContent:
67 """
68 Set [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) for your tenant.
69
70 The following policies are supported:
71
72 - `all-applications` policy prompts with MFA for all logins.
73 - `confidence-score` policy prompts with MFA only for low confidence logins.
74
75 **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
76
77 Parameters
78 ----------
79 request : SetGuardianPoliciesRequestContent
80
81 request_options : typing.Optional[RequestOptions]
82 Request-specific configuration.
83
84 Returns
85 -------
86 SetGuardianPoliciesResponseContent
87 Policies updated
88
89 Examples
90 --------
91 from auth0 import Auth0
92
93 client = Auth0(
94 token="YOUR_TOKEN",
95 )
96 client.guardian.policies.set(
97 request=["all-applications"],
98 )
99 """
100 _response = self._raw_client.set(request=request, request_options=request_options)
101 return _response.data
102
103
104 class AsyncPoliciesClient:
105 def __init__(self, *, client_wrapper: AsyncClientWrapper):
106 self._raw_client = AsyncRawPoliciesClient(client_wrapper=client_wrapper)
107
108 @property
109 def with_raw_response(self) -> AsyncRawPoliciesClient:
110 """
111 Retrieves a raw implementation of this client that returns raw responses.
112
113 Returns
114 -------
115 AsyncRawPoliciesClient
116 """
117 return self._raw_client
118
119 async def list(
120 self, *, request_options: typing.Optional[RequestOptions] = None
121 ) -> ListGuardianPoliciesResponseContent:
122 """
123 Retrieve the [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) configured for your tenant.
124
125 The following policies are supported:
126
127 - `all-applications` policy prompts with MFA for all logins.
128 - `confidence-score` policy prompts with MFA only for low confidence logins.
129
130 **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
131
132 Parameters
133 ----------
134 request_options : typing.Optional[RequestOptions]
135 Request-specific configuration.
136
137 Returns
138 -------
139 ListGuardianPoliciesResponseContent
140 Success
141
142 Examples
143 --------
144 import asyncio
145
146 from auth0 import AsyncAuth0
147
148 client = AsyncAuth0(
149 token="YOUR_TOKEN",
150 )
151
152
153 async def main() -> None:
154 await client.guardian.policies.list()
155
156
157 asyncio.run(main())
158 """
159 _response = await self._raw_client.list(request_options=request_options)
160 return _response.data
161
162 async def set(
163 self, *, request: SetGuardianPoliciesRequestContent, request_options: typing.Optional[RequestOptions] = None
164 ) -> SetGuardianPoliciesResponseContent:
165 """
166 Set [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) for your tenant.
167
168 The following policies are supported:
169
170 - `all-applications` policy prompts with MFA for all logins.
171 - `confidence-score` policy prompts with MFA only for low confidence logins.
172
173 **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
174
175 Parameters
176 ----------
177 request : SetGuardianPoliciesRequestContent
178
179 request_options : typing.Optional[RequestOptions]
180 Request-specific configuration.
181
182 Returns
183 -------
184 SetGuardianPoliciesResponseContent
185 Policies updated
186
187 Examples
188 --------
189 import asyncio
190
191 from auth0 import AsyncAuth0
192
193 client = AsyncAuth0(
194 token="YOUR_TOKEN",
195 )
196
197
198 async def main() -> None:
199 await client.guardian.policies.set(
200 request=["all-applications"],
201 )
202
203
204 asyncio.run(main())
205 """
206 _response = await self._raw_client.set(request=request, request_options=request_options)
207 return _response.data