Debian Codegraph @

src/auth0/management/connections/keys/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.connection_key import ConnectionKey
8 from ...types.post_connection_keys_request_content import PostConnectionKeysRequestContent
9 from ...types.post_connections_keys_response_content import PostConnectionsKeysResponseContent
10 from ...types.rotate_connection_keys_request_content import RotateConnectionKeysRequestContent
11 from ...types.rotate_connections_keys_response_content import RotateConnectionsKeysResponseContent
12 from .raw_client import AsyncRawKeysClient, RawKeysClient
13
14 # this is used as the default value for optional parameters
15 OMIT = typing.cast(typing.Any, ...)
16
17
18 class KeysClient:
19 def __init__(self, *, client_wrapper: SyncClientWrapper):
20 self._raw_client = RawKeysClient(client_wrapper=client_wrapper)
21
22 @property
23 def with_raw_response(self) -> RawKeysClient:
24 """
25 Retrieves a raw implementation of this client that returns raw responses.
26
27 Returns
28 -------
29 RawKeysClient
30 """
31 return self._raw_client
32
33 def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[ConnectionKey]:
34 """
35 Gets the connection keys for the Okta or OIDC connection strategy.
36
37 Parameters
38 ----------
39 id : str
40 ID of the connection
41
42 request_options : typing.Optional[RequestOptions]
43 Request-specific configuration.
44
45 Returns
46 -------
47 typing.List[ConnectionKey]
48 Connection keys successfully retrieved.
49
50 Examples
51 --------
52 from auth0 import Auth0
53
54 client = Auth0(
55 token="YOUR_TOKEN",
56 )
57 client.connections.keys.get(
58 id="id",
59 )
60 """
61 _response = self._raw_client.get(id, request_options=request_options)
62 return _response.data
63
64 def create(
65 self,
66 id: str,
67 *,
68 request: typing.Optional[PostConnectionKeysRequestContent] = None,
69 request_options: typing.Optional[RequestOptions] = None,
70 ) -> PostConnectionsKeysResponseContent:
71 """
72 Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
73
74 Parameters
75 ----------
76 id : str
77 ID of the connection
78
79 request : typing.Optional[PostConnectionKeysRequestContent]
80
81 request_options : typing.Optional[RequestOptions]
82 Request-specific configuration.
83
84 Returns
85 -------
86 PostConnectionsKeysResponseContent
87 Connection keys successfully created.
88
89 Examples
90 --------
91 from auth0 import Auth0, PostConnectionKeysRequestContent
92
93 client = Auth0(
94 token="YOUR_TOKEN",
95 )
96 client.connections.keys.create(
97 id="id",
98 request=PostConnectionKeysRequestContent(),
99 )
100 """
101 _response = self._raw_client.create(id, request=request, request_options=request_options)
102 return _response.data
103
104 def rotate(
105 self,
106 id: str,
107 *,
108 request: typing.Optional[RotateConnectionKeysRequestContent] = None,
109 request_options: typing.Optional[RequestOptions] = None,
110 ) -> RotateConnectionsKeysResponseContent:
111 """
112 Rotates the connection keys for the Okta or OIDC connection strategies.
113
114 Parameters
115 ----------
116 id : str
117 ID of the connection
118
119 request : typing.Optional[RotateConnectionKeysRequestContent]
120
121 request_options : typing.Optional[RequestOptions]
122 Request-specific configuration.
123
124 Returns
125 -------
126 RotateConnectionsKeysResponseContent
127 Connection keys successfully rotated.
128
129 Examples
130 --------
131 from auth0 import Auth0, RotateConnectionKeysRequestContent
132
133 client = Auth0(
134 token="YOUR_TOKEN",
135 )
136 client.connections.keys.rotate(
137 id="id",
138 request=RotateConnectionKeysRequestContent(),
139 )
140 """
141 _response = self._raw_client.rotate(id, request=request, request_options=request_options)
142 return _response.data
143
144
145 class AsyncKeysClient:
146 def __init__(self, *, client_wrapper: AsyncClientWrapper):
147 self._raw_client = AsyncRawKeysClient(client_wrapper=client_wrapper)
148
149 @property
150 def with_raw_response(self) -> AsyncRawKeysClient:
151 """
152 Retrieves a raw implementation of this client that returns raw responses.
153
154 Returns
155 -------
156 AsyncRawKeysClient
157 """
158 return self._raw_client
159
160 async def get(
161 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
162 ) -> typing.List[ConnectionKey]:
163 """
164 Gets the connection keys for the Okta or OIDC connection strategy.
165
166 Parameters
167 ----------
168 id : str
169 ID of the connection
170
171 request_options : typing.Optional[RequestOptions]
172 Request-specific configuration.
173
174 Returns
175 -------
176 typing.List[ConnectionKey]
177 Connection keys successfully retrieved.
178
179 Examples
180 --------
181 import asyncio
182
183 from auth0 import AsyncAuth0
184
185 client = AsyncAuth0(
186 token="YOUR_TOKEN",
187 )
188
189
190 async def main() -> None:
191 await client.connections.keys.get(
192 id="id",
193 )
194
195
196 asyncio.run(main())
197 """
198 _response = await self._raw_client.get(id, request_options=request_options)
199 return _response.data
200
201 async def create(
202 self,
203 id: str,
204 *,
205 request: typing.Optional[PostConnectionKeysRequestContent] = None,
206 request_options: typing.Optional[RequestOptions] = None,
207 ) -> PostConnectionsKeysResponseContent:
208 """
209 Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
210
211 Parameters
212 ----------
213 id : str
214 ID of the connection
215
216 request : typing.Optional[PostConnectionKeysRequestContent]
217
218 request_options : typing.Optional[RequestOptions]
219 Request-specific configuration.
220
221 Returns
222 -------
223 PostConnectionsKeysResponseContent
224 Connection keys successfully created.
225
226 Examples
227 --------
228 import asyncio
229
230 from auth0 import AsyncAuth0, PostConnectionKeysRequestContent
231
232 client = AsyncAuth0(
233 token="YOUR_TOKEN",
234 )
235
236
237 async def main() -> None:
238 await client.connections.keys.create(
239 id="id",
240 request=PostConnectionKeysRequestContent(),
241 )
242
243
244 asyncio.run(main())
245 """
246 _response = await self._raw_client.create(id, request=request, request_options=request_options)
247 return _response.data
248
249 async def rotate(
250 self,
251 id: str,
252 *,
253 request: typing.Optional[RotateConnectionKeysRequestContent] = None,
254 request_options: typing.Optional[RequestOptions] = None,
255 ) -> RotateConnectionsKeysResponseContent:
256 """
257 Rotates the connection keys for the Okta or OIDC connection strategies.
258
259 Parameters
260 ----------
261 id : str
262 ID of the connection
263
264 request : typing.Optional[RotateConnectionKeysRequestContent]
265
266 request_options : typing.Optional[RequestOptions]
267 Request-specific configuration.
268
269 Returns
270 -------
271 RotateConnectionsKeysResponseContent
272 Connection keys successfully rotated.
273
274 Examples
275 --------
276 import asyncio
277
278 from auth0 import AsyncAuth0, RotateConnectionKeysRequestContent
279
280 client = AsyncAuth0(
281 token="YOUR_TOKEN",
282 )
283
284
285 async def main() -> None:
286 await client.connections.keys.rotate(
287 id="id",
288 request=RotateConnectionKeysRequestContent(),
289 )
290
291
292 asyncio.run(main())
293 """
294 _response = await self._raw_client.rotate(id, request=request, request_options=request_options)
295 return _response.data