Debian Codegraph @

src/auth0/management/anomaly/blocks/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.anomaly_ip_format import AnomalyIpFormat
8 from .raw_client import AsyncRawBlocksClient, RawBlocksClient
9
10
11 class BlocksClient:
12 def __init__(self, *, client_wrapper: SyncClientWrapper):
13 self._raw_client = RawBlocksClient(client_wrapper=client_wrapper)
14
15 @property
16 def with_raw_response(self) -> RawBlocksClient:
17 """
18 Retrieves a raw implementation of this client that returns raw responses.
19
20 Returns
21 -------
22 RawBlocksClient
23 """
24 return self._raw_client
25
26 def check_ip(self, id: AnomalyIpFormat, *, request_options: typing.Optional[RequestOptions] = None) -> None:
27 """
28 Check if the given IP address is blocked via the <a href="https://auth0.com/docs/configure/attack-protection/suspicious-ip-throttling">Suspicious IP Throttling</a> due to multiple suspicious attempts.
29
30 Parameters
31 ----------
32 id : AnomalyIpFormat
33 IP address to check.
34
35 request_options : typing.Optional[RequestOptions]
36 Request-specific configuration.
37
38 Returns
39 -------
40 None
41
42 Examples
43 --------
44 from auth0 import Auth0
45
46 client = Auth0(
47 token="YOUR_TOKEN",
48 )
49 client.anomaly.blocks.check_ip(
50 id="id",
51 )
52 """
53 _response = self._raw_client.check_ip(id, request_options=request_options)
54 return _response.data
55
56 def unblock_ip(self, id: AnomalyIpFormat, *, request_options: typing.Optional[RequestOptions] = None) -> None:
57 """
58 Remove a block imposed by <a href="https://auth0.com/docs/configure/attack-protection/suspicious-ip-throttling">Suspicious IP Throttling</a> for the given IP address.
59
60 Parameters
61 ----------
62 id : AnomalyIpFormat
63 IP address to unblock.
64
65 request_options : typing.Optional[RequestOptions]
66 Request-specific configuration.
67
68 Returns
69 -------
70 None
71
72 Examples
73 --------
74 from auth0 import Auth0
75
76 client = Auth0(
77 token="YOUR_TOKEN",
78 )
79 client.anomaly.blocks.unblock_ip(
80 id="id",
81 )
82 """
83 _response = self._raw_client.unblock_ip(id, request_options=request_options)
84 return _response.data
85
86
87 class AsyncBlocksClient:
88 def __init__(self, *, client_wrapper: AsyncClientWrapper):
89 self._raw_client = AsyncRawBlocksClient(client_wrapper=client_wrapper)
90
91 @property
92 def with_raw_response(self) -> AsyncRawBlocksClient:
93 """
94 Retrieves a raw implementation of this client that returns raw responses.
95
96 Returns
97 -------
98 AsyncRawBlocksClient
99 """
100 return self._raw_client
101
102 async def check_ip(self, id: AnomalyIpFormat, *, request_options: typing.Optional[RequestOptions] = None) -> None:
103 """
104 Check if the given IP address is blocked via the <a href="https://auth0.com/docs/configure/attack-protection/suspicious-ip-throttling">Suspicious IP Throttling</a> due to multiple suspicious attempts.
105
106 Parameters
107 ----------
108 id : AnomalyIpFormat
109 IP address to check.
110
111 request_options : typing.Optional[RequestOptions]
112 Request-specific configuration.
113
114 Returns
115 -------
116 None
117
118 Examples
119 --------
120 import asyncio
121
122 from auth0 import AsyncAuth0
123
124 client = AsyncAuth0(
125 token="YOUR_TOKEN",
126 )
127
128
129 async def main() -> None:
130 await client.anomaly.blocks.check_ip(
131 id="id",
132 )
133
134
135 asyncio.run(main())
136 """
137 _response = await self._raw_client.check_ip(id, request_options=request_options)
138 return _response.data
139
140 async def unblock_ip(self, id: AnomalyIpFormat, *, request_options: typing.Optional[RequestOptions] = None) -> None:
141 """
142 Remove a block imposed by <a href="https://auth0.com/docs/configure/attack-protection/suspicious-ip-throttling">Suspicious IP Throttling</a> for the given IP address.
143
144 Parameters
145 ----------
146 id : AnomalyIpFormat
147 IP address to unblock.
148
149 request_options : typing.Optional[RequestOptions]
150 Request-specific configuration.
151
152 Returns
153 -------
154 None
155
156 Examples
157 --------
158 import asyncio
159
160 from auth0 import AsyncAuth0
161
162 client = AsyncAuth0(
163 token="YOUR_TOKEN",
164 )
165
166
167 async def main() -> None:
168 await client.anomaly.blocks.unblock_ip(
169 id="id",
170 )
171
172
173 asyncio.run(main())
174 """
175 _response = await self._raw_client.unblock_ip(id, request_options=request_options)
176 return _response.data