| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.get_suspicious_ip_throttling_settings_response_content import ( |
| 8 |
GetSuspiciousIpThrottlingSettingsResponseContent, |
| 9 |
) |
| 10 |
from ...types.suspicious_ip_throttling_allowlist import SuspiciousIpThrottlingAllowlist |
| 11 |
from ...types.suspicious_ip_throttling_shields_enum import SuspiciousIpThrottlingShieldsEnum |
| 12 |
from ...types.suspicious_ip_throttling_stage import SuspiciousIpThrottlingStage |
| 13 |
from ...types.update_suspicious_ip_throttling_settings_response_content import ( |
| 14 |
UpdateSuspiciousIpThrottlingSettingsResponseContent, |
| 15 |
) |
| 16 |
from .raw_client import AsyncRawSuspiciousIpThrottlingClient, RawSuspiciousIpThrottlingClient |
| 17 |
|
| 18 |
|
| 19 |
OMIT = typing.cast(typing.Any, ...) |
| 20 |
|
| 21 |
|
| 22 |
class SuspiciousIpThrottlingClient: |
| 23 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 24 |
self._raw_client = RawSuspiciousIpThrottlingClient(client_wrapper=client_wrapper) |
| 25 |
|
| 26 |
@property |
| 27 |
def with_raw_response(self) -> RawSuspiciousIpThrottlingClient: |
| 28 |
""" |
| 29 |
Retrieves a raw implementation of this client that returns raw responses. |
| 30 |
|
| 31 |
Returns |
| 32 |
------- |
| 33 |
RawSuspiciousIpThrottlingClient |
| 34 |
""" |
| 35 |
return self._raw_client |
| 36 |
|
| 37 |
def get( |
| 38 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 39 |
) -> GetSuspiciousIpThrottlingSettingsResponseContent: |
| 40 |
""" |
| 41 |
Retrieve details of the Suspicious IP Throttling configuration of your tenant. |
| 42 |
|
| 43 |
Parameters |
| 44 |
---------- |
| 45 |
request_options : typing.Optional[RequestOptions] |
| 46 |
Request-specific configuration. |
| 47 |
|
| 48 |
Returns |
| 49 |
------- |
| 50 |
GetSuspiciousIpThrottlingSettingsResponseContent |
| 51 |
Suspicious IP throttling configuration successfully retrieved. |
| 52 |
|
| 53 |
Examples |
| 54 |
-------- |
| 55 |
from auth0 import Auth0 |
| 56 |
|
| 57 |
client = Auth0( |
| 58 |
token="YOUR_TOKEN", |
| 59 |
) |
| 60 |
client.attack_protection.suspicious_ip_throttling.get() |
| 61 |
""" |
| 62 |
_response = self._raw_client.get(request_options=request_options) |
| 63 |
return _response.data |
| 64 |
|
| 65 |
def update( |
| 66 |
self, |
| 67 |
*, |
| 68 |
enabled: typing.Optional[bool] = OMIT, |
| 69 |
shields: typing.Optional[typing.Sequence[SuspiciousIpThrottlingShieldsEnum]] = OMIT, |
| 70 |
allowlist: typing.Optional[SuspiciousIpThrottlingAllowlist] = OMIT, |
| 71 |
stage: typing.Optional[SuspiciousIpThrottlingStage] = OMIT, |
| 72 |
request_options: typing.Optional[RequestOptions] = None, |
| 73 |
) -> UpdateSuspiciousIpThrottlingSettingsResponseContent: |
| 74 |
""" |
| 75 |
Update the details of the Suspicious IP Throttling configuration of your tenant. |
| 76 |
|
| 77 |
Parameters |
| 78 |
---------- |
| 79 |
enabled : typing.Optional[bool] |
| 80 |
Whether or not suspicious IP throttling attack protections are active. |
| 81 |
|
| 82 |
shields : typing.Optional[typing.Sequence[SuspiciousIpThrottlingShieldsEnum]] |
| 83 |
Action to take when a suspicious IP throttling threshold is violated. |
| 84 |
Possible values: <code>block</code>, <code>admin_notification</code>. |
| 85 |
|
| 86 |
allowlist : typing.Optional[SuspiciousIpThrottlingAllowlist] |
| 87 |
|
| 88 |
stage : typing.Optional[SuspiciousIpThrottlingStage] |
| 89 |
|
| 90 |
request_options : typing.Optional[RequestOptions] |
| 91 |
Request-specific configuration. |
| 92 |
|
| 93 |
Returns |
| 94 |
------- |
| 95 |
UpdateSuspiciousIpThrottlingSettingsResponseContent |
| 96 |
Suspicious IP throttling configuration successfully updated. |
| 97 |
|
| 98 |
Examples |
| 99 |
-------- |
| 100 |
from auth0 import Auth0 |
| 101 |
|
| 102 |
client = Auth0( |
| 103 |
token="YOUR_TOKEN", |
| 104 |
) |
| 105 |
client.attack_protection.suspicious_ip_throttling.update() |
| 106 |
""" |
| 107 |
_response = self._raw_client.update( |
| 108 |
enabled=enabled, shields=shields, allowlist=allowlist, stage=stage, request_options=request_options |
| 109 |
) |
| 110 |
return _response.data |
| 111 |
|
| 112 |
|
| 113 |
class AsyncSuspiciousIpThrottlingClient: |
| 114 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 115 |
self._raw_client = AsyncRawSuspiciousIpThrottlingClient(client_wrapper=client_wrapper) |
| 116 |
|
| 117 |
@property |
| 118 |
def with_raw_response(self) -> AsyncRawSuspiciousIpThrottlingClient: |
| 119 |
""" |
| 120 |
Retrieves a raw implementation of this client that returns raw responses. |
| 121 |
|
| 122 |
Returns |
| 123 |
------- |
| 124 |
AsyncRawSuspiciousIpThrottlingClient |
| 125 |
""" |
| 126 |
return self._raw_client |
| 127 |
|
| 128 |
async def get( |
| 129 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 130 |
) -> GetSuspiciousIpThrottlingSettingsResponseContent: |
| 131 |
""" |
| 132 |
Retrieve details of the Suspicious IP Throttling configuration of your tenant. |
| 133 |
|
| 134 |
Parameters |
| 135 |
---------- |
| 136 |
request_options : typing.Optional[RequestOptions] |
| 137 |
Request-specific configuration. |
| 138 |
|
| 139 |
Returns |
| 140 |
------- |
| 141 |
GetSuspiciousIpThrottlingSettingsResponseContent |
| 142 |
Suspicious IP throttling configuration successfully retrieved. |
| 143 |
|
| 144 |
Examples |
| 145 |
-------- |
| 146 |
import asyncio |
| 147 |
|
| 148 |
from auth0 import AsyncAuth0 |
| 149 |
|
| 150 |
client = AsyncAuth0( |
| 151 |
token="YOUR_TOKEN", |
| 152 |
) |
| 153 |
|
| 154 |
|
| 155 |
async def main() -> None: |
| 156 |
await client.attack_protection.suspicious_ip_throttling.get() |
| 157 |
|
| 158 |
|
| 159 |
asyncio.run(main()) |
| 160 |
""" |
| 161 |
_response = await self._raw_client.get(request_options=request_options) |
| 162 |
return _response.data |
| 163 |
|
| 164 |
async def update( |
| 165 |
self, |
| 166 |
*, |
| 167 |
enabled: typing.Optional[bool] = OMIT, |
| 168 |
shields: typing.Optional[typing.Sequence[SuspiciousIpThrottlingShieldsEnum]] = OMIT, |
| 169 |
allowlist: typing.Optional[SuspiciousIpThrottlingAllowlist] = OMIT, |
| 170 |
stage: typing.Optional[SuspiciousIpThrottlingStage] = OMIT, |
| 171 |
request_options: typing.Optional[RequestOptions] = None, |
| 172 |
) -> UpdateSuspiciousIpThrottlingSettingsResponseContent: |
| 173 |
""" |
| 174 |
Update the details of the Suspicious IP Throttling configuration of your tenant. |
| 175 |
|
| 176 |
Parameters |
| 177 |
---------- |
| 178 |
enabled : typing.Optional[bool] |
| 179 |
Whether or not suspicious IP throttling attack protections are active. |
| 180 |
|
| 181 |
shields : typing.Optional[typing.Sequence[SuspiciousIpThrottlingShieldsEnum]] |
| 182 |
Action to take when a suspicious IP throttling threshold is violated. |
| 183 |
Possible values: <code>block</code>, <code>admin_notification</code>. |
| 184 |
|
| 185 |
allowlist : typing.Optional[SuspiciousIpThrottlingAllowlist] |
| 186 |
|
| 187 |
stage : typing.Optional[SuspiciousIpThrottlingStage] |
| 188 |
|
| 189 |
request_options : typing.Optional[RequestOptions] |
| 190 |
Request-specific configuration. |
| 191 |
|
| 192 |
Returns |
| 193 |
------- |
| 194 |
UpdateSuspiciousIpThrottlingSettingsResponseContent |
| 195 |
Suspicious IP throttling configuration successfully updated. |
| 196 |
|
| 197 |
Examples |
| 198 |
-------- |
| 199 |
import asyncio |
| 200 |
|
| 201 |
from auth0 import AsyncAuth0 |
| 202 |
|
| 203 |
client = AsyncAuth0( |
| 204 |
token="YOUR_TOKEN", |
| 205 |
) |
| 206 |
|
| 207 |
|
| 208 |
async def main() -> None: |
| 209 |
await client.attack_protection.suspicious_ip_throttling.update() |
| 210 |
|
| 211 |
|
| 212 |
asyncio.run(main()) |
| 213 |
""" |
| 214 |
_response = await self._raw_client.update( |
| 215 |
enabled=enabled, shields=shields, allowlist=allowlist, stage=stage, request_options=request_options |
| 216 |
) |
| 217 |
return _response.data |