alchemy-python 0.1.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.
- alchemy/.fern/metadata.json +18 -0
- alchemy/CONTRIBUTING.md +125 -0
- alchemy/__init__.py +380 -0
- alchemy/_default_clients.py +30 -0
- alchemy/auth/__init__.py +4 -0
- alchemy/auth/client.py +767 -0
- alchemy/auth/raw_client.py +866 -0
- alchemy/client.py +717 -0
- alchemy/core/__init__.py +127 -0
- alchemy/core/api_error.py +23 -0
- alchemy/core/client_wrapper.py +155 -0
- alchemy/core/datetime_utils.py +70 -0
- alchemy/core/file.py +67 -0
- alchemy/core/force_multipart.py +18 -0
- alchemy/core/http_client.py +940 -0
- alchemy/core/http_response.py +63 -0
- alchemy/core/http_sse/__init__.py +42 -0
- alchemy/core/http_sse/_api.py +455 -0
- alchemy/core/http_sse/_decoders.py +74 -0
- alchemy/core/http_sse/_exceptions.py +7 -0
- alchemy/core/http_sse/_models.py +17 -0
- alchemy/core/jsonable_encoder.py +133 -0
- alchemy/core/logging.py +107 -0
- alchemy/core/oauth_token_provider.py +73 -0
- alchemy/core/parse_error.py +36 -0
- alchemy/core/pydantic_utilities.py +486 -0
- alchemy/core/query_encoder.py +58 -0
- alchemy/core/remove_none_from_dict.py +11 -0
- alchemy/core/request_options.py +40 -0
- alchemy/core/serialization.py +347 -0
- alchemy/environment.py +7 -0
- alchemy/function/__init__.py +34 -0
- alchemy/function/client.py +808 -0
- alchemy/function/raw_client.py +903 -0
- alchemy/function/version/__init__.py +4 -0
- alchemy/function/version/client.py +364 -0
- alchemy/function/version/raw_client.py +410 -0
- alchemy/host/__init__.py +4 -0
- alchemy/host/client.py +227 -0
- alchemy/host/raw_client.py +242 -0
- alchemy/instance/__init__.py +4 -0
- alchemy/instance/client.py +136 -0
- alchemy/instance/raw_client.py +141 -0
- alchemy/invocation/__init__.py +4 -0
- alchemy/invocation/client.py +570 -0
- alchemy/invocation/raw_client.py +636 -0
- alchemy/member/__init__.py +4 -0
- alchemy/member/client.py +441 -0
- alchemy/member/raw_client.py +504 -0
- alchemy/metrics/__init__.py +4 -0
- alchemy/metrics/client.py +428 -0
- alchemy/metrics/raw_client.py +478 -0
- alchemy/py.typed +0 -0
- alchemy/raw_client.py +138 -0
- alchemy/reference.md +3300 -0
- alchemy/runtime/__init__.py +4 -0
- alchemy/runtime/client.py +141 -0
- alchemy/runtime/raw_client.py +140 -0
- alchemy/service_account/__init__.py +4 -0
- alchemy/service_account/client.py +429 -0
- alchemy/service_account/raw_client.py +490 -0
- alchemy/template/__init__.py +4 -0
- alchemy/template/client.py +141 -0
- alchemy/template/raw_client.py +140 -0
- alchemy/types/__init__.py +344 -0
- alchemy/types/auth_v1accept_invite_response.py +5 -0
- alchemy/types/auth_v1create_service_account_response.py +34 -0
- alchemy/types/auth_v1get_auth_config_request.py +5 -0
- alchemy/types/auth_v1get_auth_config_response.py +53 -0
- alchemy/types/auth_v1get_session_request.py +9 -0
- alchemy/types/auth_v1get_session_response.py +28 -0
- alchemy/types/auth_v1get_token_response.py +29 -0
- alchemy/types/auth_v1invite_member_response.py +29 -0
- alchemy/types/auth_v1list_members_request.py +5 -0
- alchemy/types/auth_v1list_members_response.py +34 -0
- alchemy/types/auth_v1list_service_accounts_request.py +5 -0
- alchemy/types/auth_v1list_service_accounts_response.py +29 -0
- alchemy/types/auth_v1login_response.py +5 -0
- alchemy/types/auth_v1logout_request.py +8 -0
- alchemy/types/auth_v1logout_response.py +5 -0
- alchemy/types/auth_v1member.py +31 -0
- alchemy/types/auth_v1register_response.py +23 -0
- alchemy/types/auth_v1remove_member_response.py +5 -0
- alchemy/types/auth_v1remove_service_account_response.py +5 -0
- alchemy/types/auth_v1role.py +5 -0
- alchemy/types/auth_v1rotate_service_account_secret_response.py +31 -0
- alchemy/types/auth_v1service_account.py +35 -0
- alchemy/types/auth_v1set_member_role_response.py +5 -0
- alchemy/types/connect_error.py +38 -0
- alchemy/types/connect_error_code.py +25 -0
- alchemy/types/connect_error_details_any.py +36 -0
- alchemy/types/connect_protocol_version.py +5 -0
- alchemy/types/connect_timeout_header.py +6 -0
- alchemy/types/functions_v1arrow_contract.py +50 -0
- alchemy/types/functions_v1contract.py +8 -0
- alchemy/types/functions_v1contract_arrow.py +20 -0
- alchemy/types/functions_v1contract_json_schema.py +26 -0
- alchemy/types/functions_v1contract_violation.py +32 -0
- alchemy/types/functions_v1create_function_response.py +22 -0
- alchemy/types/functions_v1create_function_version_response.py +20 -0
- alchemy/types/functions_v1delete_function_response.py +5 -0
- alchemy/types/functions_v1function.py +100 -0
- alchemy/types/functions_v1function_error.py +30 -0
- alchemy/types/functions_v1function_error_kind.py +15 -0
- alchemy/types/functions_v1function_spec.py +58 -0
- alchemy/types/functions_v1function_version.py +81 -0
- alchemy/types/functions_v1function_version_status.py +13 -0
- alchemy/types/functions_v1get_function_response.py +20 -0
- alchemy/types/functions_v1get_function_version_response.py +20 -0
- alchemy/types/functions_v1get_host_request.py +5 -0
- alchemy/types/functions_v1get_host_response.py +20 -0
- alchemy/types/functions_v1get_invocation_logs_request.py +31 -0
- alchemy/types/functions_v1get_invocation_logs_response.py +24 -0
- alchemy/types/functions_v1get_invocation_response.py +20 -0
- alchemy/types/functions_v1get_version_request.py +5 -0
- alchemy/types/functions_v1get_version_response.py +25 -0
- alchemy/types/functions_v1host.py +58 -0
- alchemy/types/functions_v1instance.py +54 -0
- alchemy/types/functions_v1instance_status.py +14 -0
- alchemy/types/functions_v1invocation.py +106 -0
- alchemy/types/functions_v1invocation_protocol.py +8 -0
- alchemy/types/functions_v1invocation_stats.py +41 -0
- alchemy/types/functions_v1invocation_status.py +18 -0
- alchemy/types/functions_v1invoke_async_response.py +34 -0
- alchemy/types/functions_v1invoke_response.py +8 -0
- alchemy/types/functions_v1invoke_response_error.py +20 -0
- alchemy/types/functions_v1invoke_response_output.py +19 -0
- alchemy/types/functions_v1json_schema_contract.py +28 -0
- alchemy/types/functions_v1list_function_versions_response.py +22 -0
- alchemy/types/functions_v1list_functions_response.py +22 -0
- alchemy/types/functions_v1list_hosts_request.py +5 -0
- alchemy/types/functions_v1list_hosts_response.py +23 -0
- alchemy/types/functions_v1list_instances_response.py +20 -0
- alchemy/types/functions_v1list_invocations_response.py +22 -0
- alchemy/types/functions_v1list_runtimes_request.py +5 -0
- alchemy/types/functions_v1list_runtimes_response.py +22 -0
- alchemy/types/functions_v1list_templates_request.py +5 -0
- alchemy/types/functions_v1list_templates_response.py +20 -0
- alchemy/types/functions_v1network.py +5 -0
- alchemy/types/functions_v1pagination_request.py +31 -0
- alchemy/types/functions_v1pagination_response.py +33 -0
- alchemy/types/functions_v1resources.py +28 -0
- alchemy/types/functions_v1runtime.py +59 -0
- alchemy/types/functions_v1runtime_starters.py +29 -0
- alchemy/types/functions_v1source.py +31 -0
- alchemy/types/functions_v1source_file.py +28 -0
- alchemy/types/functions_v1source_layer.py +27 -0
- alchemy/types/functions_v1source_limits.py +30 -0
- alchemy/types/functions_v1start_kind.py +8 -0
- alchemy/types/functions_v1tail_invocations_request.py +32 -0
- alchemy/types/functions_v1tail_invocations_response.py +34 -0
- alchemy/types/functions_v1template.py +94 -0
- alchemy/types/functions_v1template_source.py +27 -0
- alchemy/types/functions_v1update_function_response.py +20 -0
- alchemy/types/google_protobuf_list_value.py +10 -0
- alchemy/types/google_protobuf_null_value.py +5 -0
- alchemy/types/google_protobuf_struct.py +10 -0
- alchemy/types/google_protobuf_value.py +5 -0
- alchemy/types/metrics_v1aggregate_row.py +24 -0
- alchemy/types/metrics_v1get_queue_response.py +25 -0
- alchemy/types/metrics_v1metric.py +16 -0
- alchemy/types/metrics_v1metric_dimension.py +14 -0
- alchemy/types/metrics_v1metric_filter.py +26 -0
- alchemy/types/metrics_v1metric_granularity.py +13 -0
- alchemy/types/metrics_v1query_aggregate_response.py +20 -0
- alchemy/types/metrics_v1query_timeseries_response.py +20 -0
- alchemy/types/metrics_v1timeseries.py +28 -0
- alchemy/types/metrics_v1timeseries_point.py +28 -0
- alchemy_python-0.1.0.dist-info/METADATA +196 -0
- alchemy_python-0.1.0.dist-info/RECORD +172 -0
- alchemy_python-0.1.0.dist-info/WHEEL +4 -0
- alchemy_python-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.parse_error import ParsingError
|
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..types.connect_timeout_header import ConnectTimeoutHeader
|
|
13
|
+
from ..types.functions_v1get_host_request import FunctionsV1GetHostRequest
|
|
14
|
+
from ..types.functions_v1get_host_response import FunctionsV1GetHostResponse
|
|
15
|
+
from ..types.functions_v1list_hosts_request import FunctionsV1ListHostsRequest
|
|
16
|
+
from ..types.functions_v1list_hosts_response import FunctionsV1ListHostsResponse
|
|
17
|
+
from pydantic import ValidationError
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawHostClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def get(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
request: FunctionsV1GetHostRequest,
|
|
31
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
32
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
33
|
+
) -> HttpResponse[FunctionsV1GetHostResponse]:
|
|
34
|
+
"""
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
request : FunctionsV1GetHostRequest
|
|
38
|
+
|
|
39
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
40
|
+
Define the timeout, in ms
|
|
41
|
+
|
|
42
|
+
request_options : typing.Optional[RequestOptions]
|
|
43
|
+
Request-specific configuration.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
HttpResponse[FunctionsV1GetHostResponse]
|
|
48
|
+
Success
|
|
49
|
+
"""
|
|
50
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
51
|
+
"functions.v1.FunctionsService/GetHost",
|
|
52
|
+
method="POST",
|
|
53
|
+
json=request,
|
|
54
|
+
headers={
|
|
55
|
+
"content-type": "application/json",
|
|
56
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
57
|
+
},
|
|
58
|
+
request_options=request_options,
|
|
59
|
+
omit=OMIT,
|
|
60
|
+
)
|
|
61
|
+
try:
|
|
62
|
+
if 200 <= _response.status_code < 300:
|
|
63
|
+
_data = typing.cast(
|
|
64
|
+
FunctionsV1GetHostResponse,
|
|
65
|
+
parse_obj_as(
|
|
66
|
+
type_=FunctionsV1GetHostResponse, # type: ignore
|
|
67
|
+
object_=_response.json(),
|
|
68
|
+
),
|
|
69
|
+
)
|
|
70
|
+
return HttpResponse(response=_response, data=_data)
|
|
71
|
+
_response_json = _response.json()
|
|
72
|
+
except JSONDecodeError:
|
|
73
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
74
|
+
except ValidationError as e:
|
|
75
|
+
raise ParsingError(
|
|
76
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
77
|
+
)
|
|
78
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
79
|
+
|
|
80
|
+
def list(
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
request: FunctionsV1ListHostsRequest,
|
|
84
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
85
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
86
|
+
) -> HttpResponse[FunctionsV1ListHostsResponse]:
|
|
87
|
+
"""
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
request : FunctionsV1ListHostsRequest
|
|
91
|
+
|
|
92
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
93
|
+
Define the timeout, in ms
|
|
94
|
+
|
|
95
|
+
request_options : typing.Optional[RequestOptions]
|
|
96
|
+
Request-specific configuration.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
HttpResponse[FunctionsV1ListHostsResponse]
|
|
101
|
+
Success
|
|
102
|
+
"""
|
|
103
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
104
|
+
"functions.v1.FunctionsService/ListHosts",
|
|
105
|
+
method="POST",
|
|
106
|
+
json=request,
|
|
107
|
+
headers={
|
|
108
|
+
"content-type": "application/json",
|
|
109
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
110
|
+
},
|
|
111
|
+
request_options=request_options,
|
|
112
|
+
omit=OMIT,
|
|
113
|
+
)
|
|
114
|
+
try:
|
|
115
|
+
if 200 <= _response.status_code < 300:
|
|
116
|
+
_data = typing.cast(
|
|
117
|
+
FunctionsV1ListHostsResponse,
|
|
118
|
+
parse_obj_as(
|
|
119
|
+
type_=FunctionsV1ListHostsResponse, # type: ignore
|
|
120
|
+
object_=_response.json(),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
return HttpResponse(response=_response, data=_data)
|
|
124
|
+
_response_json = _response.json()
|
|
125
|
+
except JSONDecodeError:
|
|
126
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
127
|
+
except ValidationError as e:
|
|
128
|
+
raise ParsingError(
|
|
129
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
130
|
+
)
|
|
131
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class AsyncRawHostClient:
|
|
135
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
136
|
+
self._client_wrapper = client_wrapper
|
|
137
|
+
|
|
138
|
+
async def get(
|
|
139
|
+
self,
|
|
140
|
+
*,
|
|
141
|
+
request: FunctionsV1GetHostRequest,
|
|
142
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
143
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
144
|
+
) -> AsyncHttpResponse[FunctionsV1GetHostResponse]:
|
|
145
|
+
"""
|
|
146
|
+
Parameters
|
|
147
|
+
----------
|
|
148
|
+
request : FunctionsV1GetHostRequest
|
|
149
|
+
|
|
150
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
151
|
+
Define the timeout, in ms
|
|
152
|
+
|
|
153
|
+
request_options : typing.Optional[RequestOptions]
|
|
154
|
+
Request-specific configuration.
|
|
155
|
+
|
|
156
|
+
Returns
|
|
157
|
+
-------
|
|
158
|
+
AsyncHttpResponse[FunctionsV1GetHostResponse]
|
|
159
|
+
Success
|
|
160
|
+
"""
|
|
161
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
162
|
+
"functions.v1.FunctionsService/GetHost",
|
|
163
|
+
method="POST",
|
|
164
|
+
json=request,
|
|
165
|
+
headers={
|
|
166
|
+
"content-type": "application/json",
|
|
167
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
168
|
+
},
|
|
169
|
+
request_options=request_options,
|
|
170
|
+
omit=OMIT,
|
|
171
|
+
)
|
|
172
|
+
try:
|
|
173
|
+
if 200 <= _response.status_code < 300:
|
|
174
|
+
_data = typing.cast(
|
|
175
|
+
FunctionsV1GetHostResponse,
|
|
176
|
+
parse_obj_as(
|
|
177
|
+
type_=FunctionsV1GetHostResponse, # type: ignore
|
|
178
|
+
object_=_response.json(),
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
182
|
+
_response_json = _response.json()
|
|
183
|
+
except JSONDecodeError:
|
|
184
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
185
|
+
except ValidationError as e:
|
|
186
|
+
raise ParsingError(
|
|
187
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
188
|
+
)
|
|
189
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
190
|
+
|
|
191
|
+
async def list(
|
|
192
|
+
self,
|
|
193
|
+
*,
|
|
194
|
+
request: FunctionsV1ListHostsRequest,
|
|
195
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
196
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
197
|
+
) -> AsyncHttpResponse[FunctionsV1ListHostsResponse]:
|
|
198
|
+
"""
|
|
199
|
+
Parameters
|
|
200
|
+
----------
|
|
201
|
+
request : FunctionsV1ListHostsRequest
|
|
202
|
+
|
|
203
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
204
|
+
Define the timeout, in ms
|
|
205
|
+
|
|
206
|
+
request_options : typing.Optional[RequestOptions]
|
|
207
|
+
Request-specific configuration.
|
|
208
|
+
|
|
209
|
+
Returns
|
|
210
|
+
-------
|
|
211
|
+
AsyncHttpResponse[FunctionsV1ListHostsResponse]
|
|
212
|
+
Success
|
|
213
|
+
"""
|
|
214
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
215
|
+
"functions.v1.FunctionsService/ListHosts",
|
|
216
|
+
method="POST",
|
|
217
|
+
json=request,
|
|
218
|
+
headers={
|
|
219
|
+
"content-type": "application/json",
|
|
220
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
221
|
+
},
|
|
222
|
+
request_options=request_options,
|
|
223
|
+
omit=OMIT,
|
|
224
|
+
)
|
|
225
|
+
try:
|
|
226
|
+
if 200 <= _response.status_code < 300:
|
|
227
|
+
_data = typing.cast(
|
|
228
|
+
FunctionsV1ListHostsResponse,
|
|
229
|
+
parse_obj_as(
|
|
230
|
+
type_=FunctionsV1ListHostsResponse, # type: ignore
|
|
231
|
+
object_=_response.json(),
|
|
232
|
+
),
|
|
233
|
+
)
|
|
234
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
235
|
+
_response_json = _response.json()
|
|
236
|
+
except JSONDecodeError:
|
|
237
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
238
|
+
except ValidationError as e:
|
|
239
|
+
raise ParsingError(
|
|
240
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
241
|
+
)
|
|
242
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,136 @@
|
|
|
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.connect_timeout_header import ConnectTimeoutHeader
|
|
8
|
+
from ..types.functions_v1list_instances_response import FunctionsV1ListInstancesResponse
|
|
9
|
+
from .raw_client import AsyncRawInstanceClient, RawInstanceClient
|
|
10
|
+
|
|
11
|
+
# this is used as the default value for optional parameters
|
|
12
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class InstanceClient:
|
|
16
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
17
|
+
self._raw_client = RawInstanceClient(client_wrapper=client_wrapper)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def with_raw_response(self) -> RawInstanceClient:
|
|
21
|
+
"""
|
|
22
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
RawInstanceClient
|
|
27
|
+
"""
|
|
28
|
+
return self._raw_client
|
|
29
|
+
|
|
30
|
+
def list(
|
|
31
|
+
self,
|
|
32
|
+
*,
|
|
33
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
34
|
+
function_id: typing.Optional[str] = OMIT,
|
|
35
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
+
) -> FunctionsV1ListInstancesResponse:
|
|
37
|
+
"""
|
|
38
|
+
Host; what the hosts are running right now.
|
|
39
|
+
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
43
|
+
Define the timeout, in ms
|
|
44
|
+
|
|
45
|
+
function_id : typing.Optional[str]
|
|
46
|
+
|
|
47
|
+
request_options : typing.Optional[RequestOptions]
|
|
48
|
+
Request-specific configuration.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
FunctionsV1ListInstancesResponse
|
|
53
|
+
Success
|
|
54
|
+
|
|
55
|
+
Examples
|
|
56
|
+
--------
|
|
57
|
+
from alchemy import Alchemy
|
|
58
|
+
|
|
59
|
+
client = Alchemy(
|
|
60
|
+
client_id="YOUR_CLIENT_ID",
|
|
61
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
62
|
+
)
|
|
63
|
+
client.instance.list(
|
|
64
|
+
connect_timeout_ms=1000.0,
|
|
65
|
+
)
|
|
66
|
+
"""
|
|
67
|
+
_response = self._raw_client.list(
|
|
68
|
+
connect_timeout_ms=connect_timeout_ms, function_id=function_id, request_options=request_options
|
|
69
|
+
)
|
|
70
|
+
return _response.data
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class AsyncInstanceClient:
|
|
74
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
75
|
+
self._raw_client = AsyncRawInstanceClient(client_wrapper=client_wrapper)
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def with_raw_response(self) -> AsyncRawInstanceClient:
|
|
79
|
+
"""
|
|
80
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
AsyncRawInstanceClient
|
|
85
|
+
"""
|
|
86
|
+
return self._raw_client
|
|
87
|
+
|
|
88
|
+
async def list(
|
|
89
|
+
self,
|
|
90
|
+
*,
|
|
91
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
92
|
+
function_id: typing.Optional[str] = OMIT,
|
|
93
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
94
|
+
) -> FunctionsV1ListInstancesResponse:
|
|
95
|
+
"""
|
|
96
|
+
Host; what the hosts are running right now.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
101
|
+
Define the timeout, in ms
|
|
102
|
+
|
|
103
|
+
function_id : typing.Optional[str]
|
|
104
|
+
|
|
105
|
+
request_options : typing.Optional[RequestOptions]
|
|
106
|
+
Request-specific configuration.
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
FunctionsV1ListInstancesResponse
|
|
111
|
+
Success
|
|
112
|
+
|
|
113
|
+
Examples
|
|
114
|
+
--------
|
|
115
|
+
import asyncio
|
|
116
|
+
|
|
117
|
+
from alchemy import AsyncAlchemy
|
|
118
|
+
|
|
119
|
+
client = AsyncAlchemy(
|
|
120
|
+
client_id="YOUR_CLIENT_ID",
|
|
121
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
async def main() -> None:
|
|
126
|
+
await client.instance.list(
|
|
127
|
+
connect_timeout_ms=1000.0,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
asyncio.run(main())
|
|
132
|
+
"""
|
|
133
|
+
_response = await self._raw_client.list(
|
|
134
|
+
connect_timeout_ms=connect_timeout_ms, function_id=function_id, request_options=request_options
|
|
135
|
+
)
|
|
136
|
+
return _response.data
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.parse_error import ParsingError
|
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..types.connect_timeout_header import ConnectTimeoutHeader
|
|
13
|
+
from ..types.functions_v1list_instances_response import FunctionsV1ListInstancesResponse
|
|
14
|
+
from pydantic import ValidationError
|
|
15
|
+
|
|
16
|
+
# this is used as the default value for optional parameters
|
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RawInstanceClient:
|
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
|
+
self._client_wrapper = client_wrapper
|
|
23
|
+
|
|
24
|
+
def list(
|
|
25
|
+
self,
|
|
26
|
+
*,
|
|
27
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
28
|
+
function_id: typing.Optional[str] = OMIT,
|
|
29
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
+
) -> HttpResponse[FunctionsV1ListInstancesResponse]:
|
|
31
|
+
"""
|
|
32
|
+
Host; what the hosts are running right now.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
37
|
+
Define the timeout, in ms
|
|
38
|
+
|
|
39
|
+
function_id : typing.Optional[str]
|
|
40
|
+
|
|
41
|
+
request_options : typing.Optional[RequestOptions]
|
|
42
|
+
Request-specific configuration.
|
|
43
|
+
|
|
44
|
+
Returns
|
|
45
|
+
-------
|
|
46
|
+
HttpResponse[FunctionsV1ListInstancesResponse]
|
|
47
|
+
Success
|
|
48
|
+
"""
|
|
49
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
50
|
+
"functions.v1.FunctionsService/ListInstances",
|
|
51
|
+
method="POST",
|
|
52
|
+
json={
|
|
53
|
+
"functionId": function_id,
|
|
54
|
+
},
|
|
55
|
+
headers={
|
|
56
|
+
"content-type": "application/json",
|
|
57
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
58
|
+
},
|
|
59
|
+
request_options=request_options,
|
|
60
|
+
omit=OMIT,
|
|
61
|
+
)
|
|
62
|
+
try:
|
|
63
|
+
if 200 <= _response.status_code < 300:
|
|
64
|
+
_data = typing.cast(
|
|
65
|
+
FunctionsV1ListInstancesResponse,
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=FunctionsV1ListInstancesResponse, # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
return HttpResponse(response=_response, data=_data)
|
|
72
|
+
_response_json = _response.json()
|
|
73
|
+
except JSONDecodeError:
|
|
74
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
75
|
+
except ValidationError as e:
|
|
76
|
+
raise ParsingError(
|
|
77
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
78
|
+
)
|
|
79
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class AsyncRawInstanceClient:
|
|
83
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
84
|
+
self._client_wrapper = client_wrapper
|
|
85
|
+
|
|
86
|
+
async def list(
|
|
87
|
+
self,
|
|
88
|
+
*,
|
|
89
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
90
|
+
function_id: typing.Optional[str] = OMIT,
|
|
91
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
92
|
+
) -> AsyncHttpResponse[FunctionsV1ListInstancesResponse]:
|
|
93
|
+
"""
|
|
94
|
+
Host; what the hosts are running right now.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
99
|
+
Define the timeout, in ms
|
|
100
|
+
|
|
101
|
+
function_id : typing.Optional[str]
|
|
102
|
+
|
|
103
|
+
request_options : typing.Optional[RequestOptions]
|
|
104
|
+
Request-specific configuration.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
AsyncHttpResponse[FunctionsV1ListInstancesResponse]
|
|
109
|
+
Success
|
|
110
|
+
"""
|
|
111
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
112
|
+
"functions.v1.FunctionsService/ListInstances",
|
|
113
|
+
method="POST",
|
|
114
|
+
json={
|
|
115
|
+
"functionId": function_id,
|
|
116
|
+
},
|
|
117
|
+
headers={
|
|
118
|
+
"content-type": "application/json",
|
|
119
|
+
"Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
|
|
120
|
+
},
|
|
121
|
+
request_options=request_options,
|
|
122
|
+
omit=OMIT,
|
|
123
|
+
)
|
|
124
|
+
try:
|
|
125
|
+
if 200 <= _response.status_code < 300:
|
|
126
|
+
_data = typing.cast(
|
|
127
|
+
FunctionsV1ListInstancesResponse,
|
|
128
|
+
parse_obj_as(
|
|
129
|
+
type_=FunctionsV1ListInstancesResponse, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
134
|
+
_response_json = _response.json()
|
|
135
|
+
except JSONDecodeError:
|
|
136
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
137
|
+
except ValidationError as e:
|
|
138
|
+
raise ParsingError(
|
|
139
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
140
|
+
)
|
|
141
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|