Debian Codegraph @

src/auth0/management/attack_protection/brute_force_protection/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.brute_force_protection_mode_enum import BruteForceProtectionModeEnum
8 from ...types.brute_force_protection_shields_enum import BruteForceProtectionShieldsEnum
9 from ...types.get_brute_force_settings_response_content import GetBruteForceSettingsResponseContent
10 from ...types.update_brute_force_settings_response_content import UpdateBruteForceSettingsResponseContent
11 from .raw_client import AsyncRawBruteForceProtectionClient, RawBruteForceProtectionClient
12
13 # this is used as the default value for optional parameters
14 OMIT = typing.cast(typing.Any, ...)
15
16
17 class BruteForceProtectionClient:
18 def __init__(self, *, client_wrapper: SyncClientWrapper):
19 self._raw_client = RawBruteForceProtectionClient(client_wrapper=client_wrapper)
20
21 @property
22 def with_raw_response(self) -> RawBruteForceProtectionClient:
23 """
24 Retrieves a raw implementation of this client that returns raw responses.
25
26 Returns
27 -------
28 RawBruteForceProtectionClient
29 """
30 return self._raw_client
31
32 def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetBruteForceSettingsResponseContent:
33 """
34 Retrieve details of the Brute-force Protection configuration of your tenant.
35
36 Parameters
37 ----------
38 request_options : typing.Optional[RequestOptions]
39 Request-specific configuration.
40
41 Returns
42 -------
43 GetBruteForceSettingsResponseContent
44 Brute force configuration successfully retrieved.
45
46 Examples
47 --------
48 from auth0 import Auth0
49
50 client = Auth0(
51 token="YOUR_TOKEN",
52 )
53 client.attack_protection.brute_force_protection.get()
54 """
55 _response = self._raw_client.get(request_options=request_options)
56 return _response.data
57
58 def update(
59 self,
60 *,
61 enabled: typing.Optional[bool] = OMIT,
62 shields: typing.Optional[typing.Sequence[BruteForceProtectionShieldsEnum]] = OMIT,
63 allowlist: typing.Optional[typing.Sequence[str]] = OMIT,
64 mode: typing.Optional[BruteForceProtectionModeEnum] = OMIT,
65 max_attempts: typing.Optional[int] = OMIT,
66 request_options: typing.Optional[RequestOptions] = None,
67 ) -> UpdateBruteForceSettingsResponseContent:
68 """
69 Update the Brute-force Protection configuration of your tenant.
70
71 Parameters
72 ----------
73 enabled : typing.Optional[bool]
74 Whether or not brute force attack protections are active.
75
76 shields : typing.Optional[typing.Sequence[BruteForceProtectionShieldsEnum]]
77 Action to take when a brute force protection threshold is violated.
78 Possible values: <code>block</code>, <code>user_notification</code>.
79
80 allowlist : typing.Optional[typing.Sequence[str]]
81 List of trusted IP addresses that will not have attack protection enforced against them.
82
83 mode : typing.Optional[BruteForceProtectionModeEnum]
84
85 max_attempts : typing.Optional[int]
86 Maximum number of unsuccessful attempts.
87
88 request_options : typing.Optional[RequestOptions]
89 Request-specific configuration.
90
91 Returns
92 -------
93 UpdateBruteForceSettingsResponseContent
94 Brute force configuration successfully updated.
95
96 Examples
97 --------
98 from auth0 import Auth0
99
100 client = Auth0(
101 token="YOUR_TOKEN",
102 )
103 client.attack_protection.brute_force_protection.update()
104 """
105 _response = self._raw_client.update(
106 enabled=enabled,
107 shields=shields,
108 allowlist=allowlist,
109 mode=mode,
110 max_attempts=max_attempts,
111 request_options=request_options,
112 )
113 return _response.data
114
115
116 class AsyncBruteForceProtectionClient:
117 def __init__(self, *, client_wrapper: AsyncClientWrapper):
118 self._raw_client = AsyncRawBruteForceProtectionClient(client_wrapper=client_wrapper)
119
120 @property
121 def with_raw_response(self) -> AsyncRawBruteForceProtectionClient:
122 """
123 Retrieves a raw implementation of this client that returns raw responses.
124
125 Returns
126 -------
127 AsyncRawBruteForceProtectionClient
128 """
129 return self._raw_client
130
131 async def get(
132 self, *, request_options: typing.Optional[RequestOptions] = None
133 ) -> GetBruteForceSettingsResponseContent:
134 """
135 Retrieve details of the Brute-force Protection configuration of your tenant.
136
137 Parameters
138 ----------
139 request_options : typing.Optional[RequestOptions]
140 Request-specific configuration.
141
142 Returns
143 -------
144 GetBruteForceSettingsResponseContent
145 Brute force configuration successfully retrieved.
146
147 Examples
148 --------
149 import asyncio
150
151 from auth0 import AsyncAuth0
152
153 client = AsyncAuth0(
154 token="YOUR_TOKEN",
155 )
156
157
158 async def main() -> None:
159 await client.attack_protection.brute_force_protection.get()
160
161
162 asyncio.run(main())
163 """
164 _response = await self._raw_client.get(request_options=request_options)
165 return _response.data
166
167 async def update(
168 self,
169 *,
170 enabled: typing.Optional[bool] = OMIT,
171 shields: typing.Optional[typing.Sequence[BruteForceProtectionShieldsEnum]] = OMIT,
172 allowlist: typing.Optional[typing.Sequence[str]] = OMIT,
173 mode: typing.Optional[BruteForceProtectionModeEnum] = OMIT,
174 max_attempts: typing.Optional[int] = OMIT,
175 request_options: typing.Optional[RequestOptions] = None,
176 ) -> UpdateBruteForceSettingsResponseContent:
177 """
178 Update the Brute-force Protection configuration of your tenant.
179
180 Parameters
181 ----------
182 enabled : typing.Optional[bool]
183 Whether or not brute force attack protections are active.
184
185 shields : typing.Optional[typing.Sequence[BruteForceProtectionShieldsEnum]]
186 Action to take when a brute force protection threshold is violated.
187 Possible values: <code>block</code>, <code>user_notification</code>.
188
189 allowlist : typing.Optional[typing.Sequence[str]]
190 List of trusted IP addresses that will not have attack protection enforced against them.
191
192 mode : typing.Optional[BruteForceProtectionModeEnum]
193
194 max_attempts : typing.Optional[int]
195 Maximum number of unsuccessful attempts.
196
197 request_options : typing.Optional[RequestOptions]
198 Request-specific configuration.
199
200 Returns
201 -------
202 UpdateBruteForceSettingsResponseContent
203 Brute force configuration successfully updated.
204
205 Examples
206 --------
207 import asyncio
208
209 from auth0 import AsyncAuth0
210
211 client = AsyncAuth0(
212 token="YOUR_TOKEN",
213 )
214
215
216 async def main() -> None:
217 await client.attack_protection.brute_force_protection.update()
218
219
220 asyncio.run(main())
221 """
222 _response = await self._raw_client.update(
223 enabled=enabled,
224 shields=shields,
225 allowlist=allowlist,
226 mode=mode,
227 max_attempts=max_attempts,
228 request_options=request_options,
229 )
230 return _response.data