gcore 0.5.0__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gcore might be problematic. Click here for more details.
- gcore/_version.py +1 -1
- gcore/resources/cloud/__init__.py +14 -0
- gcore/resources/cloud/audit_logs.py +480 -0
- gcore/resources/cloud/cloud.py +32 -0
- gcore/resources/cloud/file_shares/file_shares.py +64 -9
- gcore/resources/cloud/inference/__init__.py +14 -0
- gcore/resources/cloud/inference/api_keys.py +621 -0
- gcore/resources/cloud/inference/inference.py +32 -0
- gcore/resources/cloud/load_balancers/pools/members.py +22 -6
- gcore/types/cloud/__init__.py +2 -0
- gcore/types/cloud/audit_log_entry.py +254 -0
- gcore/types/cloud/audit_log_list_params.py +158 -0
- gcore/types/cloud/file_share_update_params.py +29 -3
- gcore/types/cloud/inference/__init__.py +5 -0
- gcore/types/cloud/inference/api_key_create_params.py +21 -0
- gcore/types/cloud/inference/api_key_list_params.py +21 -0
- gcore/types/cloud/inference/api_key_update_params.py +16 -0
- gcore/types/cloud/inference/inference_api_key.py +24 -0
- gcore/types/cloud/inference/inference_api_key_create.py +27 -0
- gcore/types/cloud/load_balancer_create_params.py +14 -3
- gcore/types/cloud/load_balancers/pool_create_params.py +14 -3
- gcore/types/cloud/load_balancers/pool_update_params.py +14 -3
- gcore/types/cloud/load_balancers/pools/member_add_params.py +14 -3
- gcore/types/cloud/member.py +12 -4
- {gcore-0.5.0.dist-info → gcore-0.6.0.dist-info}/METADATA +2 -3
- {gcore-0.5.0.dist-info → gcore-0.6.0.dist-info}/RECORD +28 -19
- {gcore-0.5.0.dist-info → gcore-0.6.0.dist-info}/WHEEL +0 -0
- {gcore-0.5.0.dist-info → gcore-0.6.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
|
10
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
11
|
+
from ...._compat import cached_property
|
|
12
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
13
|
+
from ...._response import (
|
|
14
|
+
to_raw_response_wrapper,
|
|
15
|
+
to_streamed_response_wrapper,
|
|
16
|
+
async_to_raw_response_wrapper,
|
|
17
|
+
async_to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
19
|
+
from ....pagination import SyncOffsetPage, AsyncOffsetPage
|
|
20
|
+
from ...._base_client import AsyncPaginator, make_request_options
|
|
21
|
+
from ....types.cloud.inference import api_key_list_params, api_key_create_params, api_key_update_params
|
|
22
|
+
from ....types.cloud.inference.inference_api_key import InferenceAPIKey
|
|
23
|
+
from ....types.cloud.inference.inference_api_key_create import InferenceAPIKeyCreate
|
|
24
|
+
|
|
25
|
+
__all__ = ["APIKeysResource", "AsyncAPIKeysResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class APIKeysResource(SyncAPIResource):
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_raw_response(self) -> APIKeysResourceWithRawResponse:
|
|
31
|
+
"""
|
|
32
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
33
|
+
the raw response object instead of the parsed content.
|
|
34
|
+
|
|
35
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
36
|
+
"""
|
|
37
|
+
return APIKeysResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> APIKeysResourceWithStreamingResponse:
|
|
41
|
+
"""
|
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
45
|
+
"""
|
|
46
|
+
return APIKeysResourceWithStreamingResponse(self)
|
|
47
|
+
|
|
48
|
+
def create(
|
|
49
|
+
self,
|
|
50
|
+
*,
|
|
51
|
+
project_id: int | None = None,
|
|
52
|
+
name: str,
|
|
53
|
+
description: str | NotGiven = NOT_GIVEN,
|
|
54
|
+
expires_at: str | NotGiven = NOT_GIVEN,
|
|
55
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
56
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
57
|
+
extra_headers: Headers | None = None,
|
|
58
|
+
extra_query: Query | None = None,
|
|
59
|
+
extra_body: Body | None = None,
|
|
60
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
61
|
+
) -> InferenceAPIKeyCreate:
|
|
62
|
+
"""This endpoint creates a new API key for everywhere inference.
|
|
63
|
+
|
|
64
|
+
It returs api
|
|
65
|
+
key's actual secret only once after creation.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
project_id: Project ID
|
|
69
|
+
|
|
70
|
+
name: Name of the API Key.
|
|
71
|
+
|
|
72
|
+
description: Description of the API Key.
|
|
73
|
+
|
|
74
|
+
expires_at: Expiration date of the API Key in ISO 8601 format.
|
|
75
|
+
|
|
76
|
+
extra_headers: Send extra headers
|
|
77
|
+
|
|
78
|
+
extra_query: Add additional query parameters to the request
|
|
79
|
+
|
|
80
|
+
extra_body: Add additional JSON properties to the request
|
|
81
|
+
|
|
82
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
83
|
+
"""
|
|
84
|
+
if project_id is None:
|
|
85
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
86
|
+
return self._post(
|
|
87
|
+
f"/cloud/v3/inference/{project_id}/api_keys",
|
|
88
|
+
body=maybe_transform(
|
|
89
|
+
{
|
|
90
|
+
"name": name,
|
|
91
|
+
"description": description,
|
|
92
|
+
"expires_at": expires_at,
|
|
93
|
+
},
|
|
94
|
+
api_key_create_params.APIKeyCreateParams,
|
|
95
|
+
),
|
|
96
|
+
options=make_request_options(
|
|
97
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
98
|
+
),
|
|
99
|
+
cast_to=InferenceAPIKeyCreate,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def update(
|
|
103
|
+
self,
|
|
104
|
+
api_key_name: str,
|
|
105
|
+
*,
|
|
106
|
+
project_id: int | None = None,
|
|
107
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
108
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
109
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
110
|
+
extra_headers: Headers | None = None,
|
|
111
|
+
extra_query: Query | None = None,
|
|
112
|
+
extra_body: Body | None = None,
|
|
113
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
114
|
+
) -> InferenceAPIKey:
|
|
115
|
+
"""
|
|
116
|
+
This endpoint updates a specific API key for everywhere inference.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
project_id: Project ID
|
|
120
|
+
|
|
121
|
+
api_key_name: Api key name.
|
|
122
|
+
|
|
123
|
+
description: Description of the API Key.
|
|
124
|
+
|
|
125
|
+
extra_headers: Send extra headers
|
|
126
|
+
|
|
127
|
+
extra_query: Add additional query parameters to the request
|
|
128
|
+
|
|
129
|
+
extra_body: Add additional JSON properties to the request
|
|
130
|
+
|
|
131
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
132
|
+
"""
|
|
133
|
+
if project_id is None:
|
|
134
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
135
|
+
if not api_key_name:
|
|
136
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
137
|
+
return self._patch(
|
|
138
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
139
|
+
body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams),
|
|
140
|
+
options=make_request_options(
|
|
141
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
142
|
+
),
|
|
143
|
+
cast_to=InferenceAPIKey,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
def list(
|
|
147
|
+
self,
|
|
148
|
+
*,
|
|
149
|
+
project_id: int | None = None,
|
|
150
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
151
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
152
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
153
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
154
|
+
extra_headers: Headers | None = None,
|
|
155
|
+
extra_query: Query | None = None,
|
|
156
|
+
extra_body: Body | None = None,
|
|
157
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
158
|
+
) -> SyncOffsetPage[InferenceAPIKey]:
|
|
159
|
+
"""
|
|
160
|
+
This endpoint retrieves a list of API keys for everywhere inference.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
project_id: Project ID
|
|
164
|
+
|
|
165
|
+
limit: Optional. Limit the number of returned items
|
|
166
|
+
|
|
167
|
+
offset: Optional. Offset value is used to exclude the first set of records from the
|
|
168
|
+
result
|
|
169
|
+
|
|
170
|
+
extra_headers: Send extra headers
|
|
171
|
+
|
|
172
|
+
extra_query: Add additional query parameters to the request
|
|
173
|
+
|
|
174
|
+
extra_body: Add additional JSON properties to the request
|
|
175
|
+
|
|
176
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
177
|
+
"""
|
|
178
|
+
if project_id is None:
|
|
179
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
180
|
+
return self._get_api_list(
|
|
181
|
+
f"/cloud/v3/inference/{project_id}/api_keys",
|
|
182
|
+
page=SyncOffsetPage[InferenceAPIKey],
|
|
183
|
+
options=make_request_options(
|
|
184
|
+
extra_headers=extra_headers,
|
|
185
|
+
extra_query=extra_query,
|
|
186
|
+
extra_body=extra_body,
|
|
187
|
+
timeout=timeout,
|
|
188
|
+
query=maybe_transform(
|
|
189
|
+
{
|
|
190
|
+
"limit": limit,
|
|
191
|
+
"offset": offset,
|
|
192
|
+
},
|
|
193
|
+
api_key_list_params.APIKeyListParams,
|
|
194
|
+
),
|
|
195
|
+
),
|
|
196
|
+
model=InferenceAPIKey,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def delete(
|
|
200
|
+
self,
|
|
201
|
+
api_key_name: str,
|
|
202
|
+
*,
|
|
203
|
+
project_id: int | None = None,
|
|
204
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
205
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
206
|
+
extra_headers: Headers | None = None,
|
|
207
|
+
extra_query: Query | None = None,
|
|
208
|
+
extra_body: Body | None = None,
|
|
209
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
210
|
+
) -> None:
|
|
211
|
+
"""This endpoint deletes a specific API key for everywhere inference.
|
|
212
|
+
|
|
213
|
+
If the API
|
|
214
|
+
key is attached to any inference deployments, it will not be removed.
|
|
215
|
+
ConflictError will be raised
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
project_id: Project ID
|
|
219
|
+
|
|
220
|
+
api_key_name: Api key name.
|
|
221
|
+
|
|
222
|
+
extra_headers: Send extra headers
|
|
223
|
+
|
|
224
|
+
extra_query: Add additional query parameters to the request
|
|
225
|
+
|
|
226
|
+
extra_body: Add additional JSON properties to the request
|
|
227
|
+
|
|
228
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
229
|
+
"""
|
|
230
|
+
if project_id is None:
|
|
231
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
232
|
+
if not api_key_name:
|
|
233
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
234
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
235
|
+
return self._delete(
|
|
236
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
237
|
+
options=make_request_options(
|
|
238
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
239
|
+
),
|
|
240
|
+
cast_to=NoneType,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
def get(
|
|
244
|
+
self,
|
|
245
|
+
api_key_name: str,
|
|
246
|
+
*,
|
|
247
|
+
project_id: int | None = None,
|
|
248
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
249
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
250
|
+
extra_headers: Headers | None = None,
|
|
251
|
+
extra_query: Query | None = None,
|
|
252
|
+
extra_body: Body | None = None,
|
|
253
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
254
|
+
) -> InferenceAPIKey:
|
|
255
|
+
"""
|
|
256
|
+
This endpoint retrieves a specific API key for everywhere inference.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
project_id: Project ID
|
|
260
|
+
|
|
261
|
+
api_key_name: Api key name.
|
|
262
|
+
|
|
263
|
+
extra_headers: Send extra headers
|
|
264
|
+
|
|
265
|
+
extra_query: Add additional query parameters to the request
|
|
266
|
+
|
|
267
|
+
extra_body: Add additional JSON properties to the request
|
|
268
|
+
|
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
270
|
+
"""
|
|
271
|
+
if project_id is None:
|
|
272
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
273
|
+
if not api_key_name:
|
|
274
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
275
|
+
return self._get(
|
|
276
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
277
|
+
options=make_request_options(
|
|
278
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
279
|
+
),
|
|
280
|
+
cast_to=InferenceAPIKey,
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class AsyncAPIKeysResource(AsyncAPIResource):
|
|
285
|
+
@cached_property
|
|
286
|
+
def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse:
|
|
287
|
+
"""
|
|
288
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
289
|
+
the raw response object instead of the parsed content.
|
|
290
|
+
|
|
291
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
292
|
+
"""
|
|
293
|
+
return AsyncAPIKeysResourceWithRawResponse(self)
|
|
294
|
+
|
|
295
|
+
@cached_property
|
|
296
|
+
def with_streaming_response(self) -> AsyncAPIKeysResourceWithStreamingResponse:
|
|
297
|
+
"""
|
|
298
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
299
|
+
|
|
300
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
301
|
+
"""
|
|
302
|
+
return AsyncAPIKeysResourceWithStreamingResponse(self)
|
|
303
|
+
|
|
304
|
+
async def create(
|
|
305
|
+
self,
|
|
306
|
+
*,
|
|
307
|
+
project_id: int | None = None,
|
|
308
|
+
name: str,
|
|
309
|
+
description: str | NotGiven = NOT_GIVEN,
|
|
310
|
+
expires_at: str | NotGiven = NOT_GIVEN,
|
|
311
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
312
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
313
|
+
extra_headers: Headers | None = None,
|
|
314
|
+
extra_query: Query | None = None,
|
|
315
|
+
extra_body: Body | None = None,
|
|
316
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
317
|
+
) -> InferenceAPIKeyCreate:
|
|
318
|
+
"""This endpoint creates a new API key for everywhere inference.
|
|
319
|
+
|
|
320
|
+
It returs api
|
|
321
|
+
key's actual secret only once after creation.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
project_id: Project ID
|
|
325
|
+
|
|
326
|
+
name: Name of the API Key.
|
|
327
|
+
|
|
328
|
+
description: Description of the API Key.
|
|
329
|
+
|
|
330
|
+
expires_at: Expiration date of the API Key in ISO 8601 format.
|
|
331
|
+
|
|
332
|
+
extra_headers: Send extra headers
|
|
333
|
+
|
|
334
|
+
extra_query: Add additional query parameters to the request
|
|
335
|
+
|
|
336
|
+
extra_body: Add additional JSON properties to the request
|
|
337
|
+
|
|
338
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
339
|
+
"""
|
|
340
|
+
if project_id is None:
|
|
341
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
342
|
+
return await self._post(
|
|
343
|
+
f"/cloud/v3/inference/{project_id}/api_keys",
|
|
344
|
+
body=await async_maybe_transform(
|
|
345
|
+
{
|
|
346
|
+
"name": name,
|
|
347
|
+
"description": description,
|
|
348
|
+
"expires_at": expires_at,
|
|
349
|
+
},
|
|
350
|
+
api_key_create_params.APIKeyCreateParams,
|
|
351
|
+
),
|
|
352
|
+
options=make_request_options(
|
|
353
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
354
|
+
),
|
|
355
|
+
cast_to=InferenceAPIKeyCreate,
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
async def update(
|
|
359
|
+
self,
|
|
360
|
+
api_key_name: str,
|
|
361
|
+
*,
|
|
362
|
+
project_id: int | None = None,
|
|
363
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
364
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
365
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
366
|
+
extra_headers: Headers | None = None,
|
|
367
|
+
extra_query: Query | None = None,
|
|
368
|
+
extra_body: Body | None = None,
|
|
369
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
370
|
+
) -> InferenceAPIKey:
|
|
371
|
+
"""
|
|
372
|
+
This endpoint updates a specific API key for everywhere inference.
|
|
373
|
+
|
|
374
|
+
Args:
|
|
375
|
+
project_id: Project ID
|
|
376
|
+
|
|
377
|
+
api_key_name: Api key name.
|
|
378
|
+
|
|
379
|
+
description: Description of the API Key.
|
|
380
|
+
|
|
381
|
+
extra_headers: Send extra headers
|
|
382
|
+
|
|
383
|
+
extra_query: Add additional query parameters to the request
|
|
384
|
+
|
|
385
|
+
extra_body: Add additional JSON properties to the request
|
|
386
|
+
|
|
387
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
388
|
+
"""
|
|
389
|
+
if project_id is None:
|
|
390
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
391
|
+
if not api_key_name:
|
|
392
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
393
|
+
return await self._patch(
|
|
394
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
395
|
+
body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams),
|
|
396
|
+
options=make_request_options(
|
|
397
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
398
|
+
),
|
|
399
|
+
cast_to=InferenceAPIKey,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def list(
|
|
403
|
+
self,
|
|
404
|
+
*,
|
|
405
|
+
project_id: int | None = None,
|
|
406
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
407
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
408
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
409
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
410
|
+
extra_headers: Headers | None = None,
|
|
411
|
+
extra_query: Query | None = None,
|
|
412
|
+
extra_body: Body | None = None,
|
|
413
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
414
|
+
) -> AsyncPaginator[InferenceAPIKey, AsyncOffsetPage[InferenceAPIKey]]:
|
|
415
|
+
"""
|
|
416
|
+
This endpoint retrieves a list of API keys for everywhere inference.
|
|
417
|
+
|
|
418
|
+
Args:
|
|
419
|
+
project_id: Project ID
|
|
420
|
+
|
|
421
|
+
limit: Optional. Limit the number of returned items
|
|
422
|
+
|
|
423
|
+
offset: Optional. Offset value is used to exclude the first set of records from the
|
|
424
|
+
result
|
|
425
|
+
|
|
426
|
+
extra_headers: Send extra headers
|
|
427
|
+
|
|
428
|
+
extra_query: Add additional query parameters to the request
|
|
429
|
+
|
|
430
|
+
extra_body: Add additional JSON properties to the request
|
|
431
|
+
|
|
432
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
433
|
+
"""
|
|
434
|
+
if project_id is None:
|
|
435
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
436
|
+
return self._get_api_list(
|
|
437
|
+
f"/cloud/v3/inference/{project_id}/api_keys",
|
|
438
|
+
page=AsyncOffsetPage[InferenceAPIKey],
|
|
439
|
+
options=make_request_options(
|
|
440
|
+
extra_headers=extra_headers,
|
|
441
|
+
extra_query=extra_query,
|
|
442
|
+
extra_body=extra_body,
|
|
443
|
+
timeout=timeout,
|
|
444
|
+
query=maybe_transform(
|
|
445
|
+
{
|
|
446
|
+
"limit": limit,
|
|
447
|
+
"offset": offset,
|
|
448
|
+
},
|
|
449
|
+
api_key_list_params.APIKeyListParams,
|
|
450
|
+
),
|
|
451
|
+
),
|
|
452
|
+
model=InferenceAPIKey,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
async def delete(
|
|
456
|
+
self,
|
|
457
|
+
api_key_name: str,
|
|
458
|
+
*,
|
|
459
|
+
project_id: int | None = None,
|
|
460
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
461
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
462
|
+
extra_headers: Headers | None = None,
|
|
463
|
+
extra_query: Query | None = None,
|
|
464
|
+
extra_body: Body | None = None,
|
|
465
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
466
|
+
) -> None:
|
|
467
|
+
"""This endpoint deletes a specific API key for everywhere inference.
|
|
468
|
+
|
|
469
|
+
If the API
|
|
470
|
+
key is attached to any inference deployments, it will not be removed.
|
|
471
|
+
ConflictError will be raised
|
|
472
|
+
|
|
473
|
+
Args:
|
|
474
|
+
project_id: Project ID
|
|
475
|
+
|
|
476
|
+
api_key_name: Api key name.
|
|
477
|
+
|
|
478
|
+
extra_headers: Send extra headers
|
|
479
|
+
|
|
480
|
+
extra_query: Add additional query parameters to the request
|
|
481
|
+
|
|
482
|
+
extra_body: Add additional JSON properties to the request
|
|
483
|
+
|
|
484
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
485
|
+
"""
|
|
486
|
+
if project_id is None:
|
|
487
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
488
|
+
if not api_key_name:
|
|
489
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
490
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
491
|
+
return await self._delete(
|
|
492
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
493
|
+
options=make_request_options(
|
|
494
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
495
|
+
),
|
|
496
|
+
cast_to=NoneType,
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
async def get(
|
|
500
|
+
self,
|
|
501
|
+
api_key_name: str,
|
|
502
|
+
*,
|
|
503
|
+
project_id: int | None = None,
|
|
504
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
505
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
506
|
+
extra_headers: Headers | None = None,
|
|
507
|
+
extra_query: Query | None = None,
|
|
508
|
+
extra_body: Body | None = None,
|
|
509
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
510
|
+
) -> InferenceAPIKey:
|
|
511
|
+
"""
|
|
512
|
+
This endpoint retrieves a specific API key for everywhere inference.
|
|
513
|
+
|
|
514
|
+
Args:
|
|
515
|
+
project_id: Project ID
|
|
516
|
+
|
|
517
|
+
api_key_name: Api key name.
|
|
518
|
+
|
|
519
|
+
extra_headers: Send extra headers
|
|
520
|
+
|
|
521
|
+
extra_query: Add additional query parameters to the request
|
|
522
|
+
|
|
523
|
+
extra_body: Add additional JSON properties to the request
|
|
524
|
+
|
|
525
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
526
|
+
"""
|
|
527
|
+
if project_id is None:
|
|
528
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
529
|
+
if not api_key_name:
|
|
530
|
+
raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}")
|
|
531
|
+
return await self._get(
|
|
532
|
+
f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}",
|
|
533
|
+
options=make_request_options(
|
|
534
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
535
|
+
),
|
|
536
|
+
cast_to=InferenceAPIKey,
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
class APIKeysResourceWithRawResponse:
|
|
541
|
+
def __init__(self, api_keys: APIKeysResource) -> None:
|
|
542
|
+
self._api_keys = api_keys
|
|
543
|
+
|
|
544
|
+
self.create = to_raw_response_wrapper(
|
|
545
|
+
api_keys.create,
|
|
546
|
+
)
|
|
547
|
+
self.update = to_raw_response_wrapper(
|
|
548
|
+
api_keys.update,
|
|
549
|
+
)
|
|
550
|
+
self.list = to_raw_response_wrapper(
|
|
551
|
+
api_keys.list,
|
|
552
|
+
)
|
|
553
|
+
self.delete = to_raw_response_wrapper(
|
|
554
|
+
api_keys.delete,
|
|
555
|
+
)
|
|
556
|
+
self.get = to_raw_response_wrapper(
|
|
557
|
+
api_keys.get,
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
class AsyncAPIKeysResourceWithRawResponse:
|
|
562
|
+
def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
|
|
563
|
+
self._api_keys = api_keys
|
|
564
|
+
|
|
565
|
+
self.create = async_to_raw_response_wrapper(
|
|
566
|
+
api_keys.create,
|
|
567
|
+
)
|
|
568
|
+
self.update = async_to_raw_response_wrapper(
|
|
569
|
+
api_keys.update,
|
|
570
|
+
)
|
|
571
|
+
self.list = async_to_raw_response_wrapper(
|
|
572
|
+
api_keys.list,
|
|
573
|
+
)
|
|
574
|
+
self.delete = async_to_raw_response_wrapper(
|
|
575
|
+
api_keys.delete,
|
|
576
|
+
)
|
|
577
|
+
self.get = async_to_raw_response_wrapper(
|
|
578
|
+
api_keys.get,
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
class APIKeysResourceWithStreamingResponse:
|
|
583
|
+
def __init__(self, api_keys: APIKeysResource) -> None:
|
|
584
|
+
self._api_keys = api_keys
|
|
585
|
+
|
|
586
|
+
self.create = to_streamed_response_wrapper(
|
|
587
|
+
api_keys.create,
|
|
588
|
+
)
|
|
589
|
+
self.update = to_streamed_response_wrapper(
|
|
590
|
+
api_keys.update,
|
|
591
|
+
)
|
|
592
|
+
self.list = to_streamed_response_wrapper(
|
|
593
|
+
api_keys.list,
|
|
594
|
+
)
|
|
595
|
+
self.delete = to_streamed_response_wrapper(
|
|
596
|
+
api_keys.delete,
|
|
597
|
+
)
|
|
598
|
+
self.get = to_streamed_response_wrapper(
|
|
599
|
+
api_keys.get,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
class AsyncAPIKeysResourceWithStreamingResponse:
|
|
604
|
+
def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
|
|
605
|
+
self._api_keys = api_keys
|
|
606
|
+
|
|
607
|
+
self.create = async_to_streamed_response_wrapper(
|
|
608
|
+
api_keys.create,
|
|
609
|
+
)
|
|
610
|
+
self.update = async_to_streamed_response_wrapper(
|
|
611
|
+
api_keys.update,
|
|
612
|
+
)
|
|
613
|
+
self.list = async_to_streamed_response_wrapper(
|
|
614
|
+
api_keys.list,
|
|
615
|
+
)
|
|
616
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
617
|
+
api_keys.delete,
|
|
618
|
+
)
|
|
619
|
+
self.get = async_to_streamed_response_wrapper(
|
|
620
|
+
api_keys.get,
|
|
621
|
+
)
|
|
@@ -28,6 +28,14 @@ from .secrets import (
|
|
|
28
28
|
SecretsResourceWithStreamingResponse,
|
|
29
29
|
AsyncSecretsResourceWithStreamingResponse,
|
|
30
30
|
)
|
|
31
|
+
from .api_keys import (
|
|
32
|
+
APIKeysResource,
|
|
33
|
+
AsyncAPIKeysResource,
|
|
34
|
+
APIKeysResourceWithRawResponse,
|
|
35
|
+
AsyncAPIKeysResourceWithRawResponse,
|
|
36
|
+
APIKeysResourceWithStreamingResponse,
|
|
37
|
+
AsyncAPIKeysResourceWithStreamingResponse,
|
|
38
|
+
)
|
|
31
39
|
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
32
40
|
from ...._compat import cached_property
|
|
33
41
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -80,6 +88,10 @@ class InferenceResource(SyncAPIResource):
|
|
|
80
88
|
def secrets(self) -> SecretsResource:
|
|
81
89
|
return SecretsResource(self._client)
|
|
82
90
|
|
|
91
|
+
@cached_property
|
|
92
|
+
def api_keys(self) -> APIKeysResource:
|
|
93
|
+
return APIKeysResource(self._client)
|
|
94
|
+
|
|
83
95
|
@cached_property
|
|
84
96
|
def with_raw_response(self) -> InferenceResourceWithRawResponse:
|
|
85
97
|
"""
|
|
@@ -140,6 +152,10 @@ class AsyncInferenceResource(AsyncAPIResource):
|
|
|
140
152
|
def secrets(self) -> AsyncSecretsResource:
|
|
141
153
|
return AsyncSecretsResource(self._client)
|
|
142
154
|
|
|
155
|
+
@cached_property
|
|
156
|
+
def api_keys(self) -> AsyncAPIKeysResource:
|
|
157
|
+
return AsyncAPIKeysResource(self._client)
|
|
158
|
+
|
|
143
159
|
@cached_property
|
|
144
160
|
def with_raw_response(self) -> AsyncInferenceResourceWithRawResponse:
|
|
145
161
|
"""
|
|
@@ -207,6 +223,10 @@ class InferenceResourceWithRawResponse:
|
|
|
207
223
|
def secrets(self) -> SecretsResourceWithRawResponse:
|
|
208
224
|
return SecretsResourceWithRawResponse(self._inference.secrets)
|
|
209
225
|
|
|
226
|
+
@cached_property
|
|
227
|
+
def api_keys(self) -> APIKeysResourceWithRawResponse:
|
|
228
|
+
return APIKeysResourceWithRawResponse(self._inference.api_keys)
|
|
229
|
+
|
|
210
230
|
|
|
211
231
|
class AsyncInferenceResourceWithRawResponse:
|
|
212
232
|
def __init__(self, inference: AsyncInferenceResource) -> None:
|
|
@@ -236,6 +256,10 @@ class AsyncInferenceResourceWithRawResponse:
|
|
|
236
256
|
def secrets(self) -> AsyncSecretsResourceWithRawResponse:
|
|
237
257
|
return AsyncSecretsResourceWithRawResponse(self._inference.secrets)
|
|
238
258
|
|
|
259
|
+
@cached_property
|
|
260
|
+
def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse:
|
|
261
|
+
return AsyncAPIKeysResourceWithRawResponse(self._inference.api_keys)
|
|
262
|
+
|
|
239
263
|
|
|
240
264
|
class InferenceResourceWithStreamingResponse:
|
|
241
265
|
def __init__(self, inference: InferenceResource) -> None:
|
|
@@ -265,6 +289,10 @@ class InferenceResourceWithStreamingResponse:
|
|
|
265
289
|
def secrets(self) -> SecretsResourceWithStreamingResponse:
|
|
266
290
|
return SecretsResourceWithStreamingResponse(self._inference.secrets)
|
|
267
291
|
|
|
292
|
+
@cached_property
|
|
293
|
+
def api_keys(self) -> APIKeysResourceWithStreamingResponse:
|
|
294
|
+
return APIKeysResourceWithStreamingResponse(self._inference.api_keys)
|
|
295
|
+
|
|
268
296
|
|
|
269
297
|
class AsyncInferenceResourceWithStreamingResponse:
|
|
270
298
|
def __init__(self, inference: AsyncInferenceResource) -> None:
|
|
@@ -293,3 +321,7 @@ class AsyncInferenceResourceWithStreamingResponse:
|
|
|
293
321
|
@cached_property
|
|
294
322
|
def secrets(self) -> AsyncSecretsResourceWithStreamingResponse:
|
|
295
323
|
return AsyncSecretsResourceWithStreamingResponse(self._inference.secrets)
|
|
324
|
+
|
|
325
|
+
@cached_property
|
|
326
|
+
def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse:
|
|
327
|
+
return AsyncAPIKeysResourceWithStreamingResponse(self._inference.api_keys)
|