Debian Codegraph @

src/auth0/management/attack_protection/breached_password_detection/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.breached_password_detection_admin_notification_frequency_enum import (
8 BreachedPasswordDetectionAdminNotificationFrequencyEnum,
9 )
10 from ...types.breached_password_detection_method_enum import BreachedPasswordDetectionMethodEnum
11 from ...types.breached_password_detection_shields_enum import BreachedPasswordDetectionShieldsEnum
12 from ...types.breached_password_detection_stage import BreachedPasswordDetectionStage
13 from ...types.get_breached_password_detection_settings_response_content import (
14 GetBreachedPasswordDetectionSettingsResponseContent,
15 )
16 from ...types.update_breached_password_detection_settings_response_content import (
17 UpdateBreachedPasswordDetectionSettingsResponseContent,
18 )
19 from .raw_client import AsyncRawBreachedPasswordDetectionClient, RawBreachedPasswordDetectionClient
20
21 # this is used as the default value for optional parameters
22 OMIT = typing.cast(typing.Any, ...)
23
24
25 class BreachedPasswordDetectionClient:
26 def __init__(self, *, client_wrapper: SyncClientWrapper):
27 self._raw_client = RawBreachedPasswordDetectionClient(client_wrapper=client_wrapper)
28
29 @property
30 def with_raw_response(self) -> RawBreachedPasswordDetectionClient:
31 """
32 Retrieves a raw implementation of this client that returns raw responses.
33
34 Returns
35 -------
36 RawBreachedPasswordDetectionClient
37 """
38 return self._raw_client
39
40 def get(
41 self, *, request_options: typing.Optional[RequestOptions] = None
42 ) -> GetBreachedPasswordDetectionSettingsResponseContent:
43 """
44 Retrieve details of the Breached Password Detection configuration of your tenant.
45
46 Parameters
47 ----------
48 request_options : typing.Optional[RequestOptions]
49 Request-specific configuration.
50
51 Returns
52 -------
53 GetBreachedPasswordDetectionSettingsResponseContent
54 Breached password detection settings successfully retrieved.
55
56 Examples
57 --------
58 from auth0 import Auth0
59
60 client = Auth0(
61 token="YOUR_TOKEN",
62 )
63 client.attack_protection.breached_password_detection.get()
64 """
65 _response = self._raw_client.get(request_options=request_options)
66 return _response.data
67
68 def update(
69 self,
70 *,
71 enabled: typing.Optional[bool] = OMIT,
72 shields: typing.Optional[typing.Sequence[BreachedPasswordDetectionShieldsEnum]] = OMIT,
73 admin_notification_frequency: typing.Optional[
74 typing.Sequence[BreachedPasswordDetectionAdminNotificationFrequencyEnum]
75 ] = OMIT,
76 method: typing.Optional[BreachedPasswordDetectionMethodEnum] = OMIT,
77 stage: typing.Optional[BreachedPasswordDetectionStage] = OMIT,
78 request_options: typing.Optional[RequestOptions] = None,
79 ) -> UpdateBreachedPasswordDetectionSettingsResponseContent:
80 """
81 Update details of the Breached Password Detection configuration of your tenant.
82
83 Parameters
84 ----------
85 enabled : typing.Optional[bool]
86 Whether or not breached password detection is active.
87
88 shields : typing.Optional[typing.Sequence[BreachedPasswordDetectionShieldsEnum]]
89 Action to take when a breached password is detected during a login.
90 Possible values: <code>block</code>, <code>user_notification</code>, <code>admin_notification</code>.
91
92 admin_notification_frequency : typing.Optional[typing.Sequence[BreachedPasswordDetectionAdminNotificationFrequencyEnum]]
93 When "admin_notification" is enabled, determines how often email notifications are sent.
94 Possible values: <code>immediately</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code>.
95
96 method : typing.Optional[BreachedPasswordDetectionMethodEnum]
97
98 stage : typing.Optional[BreachedPasswordDetectionStage]
99
100 request_options : typing.Optional[RequestOptions]
101 Request-specific configuration.
102
103 Returns
104 -------
105 UpdateBreachedPasswordDetectionSettingsResponseContent
106 Breached password detection settings successfully updated.
107
108 Examples
109 --------
110 from auth0 import Auth0
111
112 client = Auth0(
113 token="YOUR_TOKEN",
114 )
115 client.attack_protection.breached_password_detection.update()
116 """
117 _response = self._raw_client.update(
118 enabled=enabled,
119 shields=shields,
120 admin_notification_frequency=admin_notification_frequency,
121 method=method,
122 stage=stage,
123 request_options=request_options,
124 )
125 return _response.data
126
127
128 class AsyncBreachedPasswordDetectionClient:
129 def __init__(self, *, client_wrapper: AsyncClientWrapper):
130 self._raw_client = AsyncRawBreachedPasswordDetectionClient(client_wrapper=client_wrapper)
131
132 @property
133 def with_raw_response(self) -> AsyncRawBreachedPasswordDetectionClient:
134 """
135 Retrieves a raw implementation of this client that returns raw responses.
136
137 Returns
138 -------
139 AsyncRawBreachedPasswordDetectionClient
140 """
141 return self._raw_client
142
143 async def get(
144 self, *, request_options: typing.Optional[RequestOptions] = None
145 ) -> GetBreachedPasswordDetectionSettingsResponseContent:
146 """
147 Retrieve details of the Breached Password Detection configuration of your tenant.
148
149 Parameters
150 ----------
151 request_options : typing.Optional[RequestOptions]
152 Request-specific configuration.
153
154 Returns
155 -------
156 GetBreachedPasswordDetectionSettingsResponseContent
157 Breached password detection settings successfully retrieved.
158
159 Examples
160 --------
161 import asyncio
162
163 from auth0 import AsyncAuth0
164
165 client = AsyncAuth0(
166 token="YOUR_TOKEN",
167 )
168
169
170 async def main() -> None:
171 await client.attack_protection.breached_password_detection.get()
172
173
174 asyncio.run(main())
175 """
176 _response = await self._raw_client.get(request_options=request_options)
177 return _response.data
178
179 async def update(
180 self,
181 *,
182 enabled: typing.Optional[bool] = OMIT,
183 shields: typing.Optional[typing.Sequence[BreachedPasswordDetectionShieldsEnum]] = OMIT,
184 admin_notification_frequency: typing.Optional[
185 typing.Sequence[BreachedPasswordDetectionAdminNotificationFrequencyEnum]
186 ] = OMIT,
187 method: typing.Optional[BreachedPasswordDetectionMethodEnum] = OMIT,
188 stage: typing.Optional[BreachedPasswordDetectionStage] = OMIT,
189 request_options: typing.Optional[RequestOptions] = None,
190 ) -> UpdateBreachedPasswordDetectionSettingsResponseContent:
191 """
192 Update details of the Breached Password Detection configuration of your tenant.
193
194 Parameters
195 ----------
196 enabled : typing.Optional[bool]
197 Whether or not breached password detection is active.
198
199 shields : typing.Optional[typing.Sequence[BreachedPasswordDetectionShieldsEnum]]
200 Action to take when a breached password is detected during a login.
201 Possible values: <code>block</code>, <code>user_notification</code>, <code>admin_notification</code>.
202
203 admin_notification_frequency : typing.Optional[typing.Sequence[BreachedPasswordDetectionAdminNotificationFrequencyEnum]]
204 When "admin_notification" is enabled, determines how often email notifications are sent.
205 Possible values: <code>immediately</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code>.
206
207 method : typing.Optional[BreachedPasswordDetectionMethodEnum]
208
209 stage : typing.Optional[BreachedPasswordDetectionStage]
210
211 request_options : typing.Optional[RequestOptions]
212 Request-specific configuration.
213
214 Returns
215 -------
216 UpdateBreachedPasswordDetectionSettingsResponseContent
217 Breached password detection settings successfully updated.
218
219 Examples
220 --------
221 import asyncio
222
223 from auth0 import AsyncAuth0
224
225 client = AsyncAuth0(
226 token="YOUR_TOKEN",
227 )
228
229
230 async def main() -> None:
231 await client.attack_protection.breached_password_detection.update()
232
233
234 asyncio.run(main())
235 """
236 _response = await self._raw_client.update(
237 enabled=enabled,
238 shields=shields,
239 admin_notification_frequency=admin_notification_frequency,
240 method=method,
241 stage=stage,
242 request_options=request_options,
243 )
244 return _response.data