runloop-api-client 0.1.0a3__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.
- runloop_api_client-0.1.0a3.dist-info/METADATA +334 -0
- runloop_api_client-0.1.0a3.dist-info/RECORD +61 -0
- runloop_api_client-0.1.0a3.dist-info/WHEEL +4 -0
- runloop_api_client-0.1.0a3.dist-info/licenses/LICENSE +7 -0
- runloop_minus_api_minus_client/__init__.py +83 -0
- runloop_minus_api_minus_client/_base_client.py +2006 -0
- runloop_minus_api_minus_client/_client.py +422 -0
- runloop_minus_api_minus_client/_compat.py +222 -0
- runloop_minus_api_minus_client/_constants.py +14 -0
- runloop_minus_api_minus_client/_exceptions.py +108 -0
- runloop_minus_api_minus_client/_files.py +127 -0
- runloop_minus_api_minus_client/_models.py +739 -0
- runloop_minus_api_minus_client/_qs.py +150 -0
- runloop_minus_api_minus_client/_resource.py +43 -0
- runloop_minus_api_minus_client/_response.py +822 -0
- runloop_minus_api_minus_client/_streaming.py +333 -0
- runloop_minus_api_minus_client/_types.py +220 -0
- runloop_minus_api_minus_client/_utils/__init__.py +52 -0
- runloop_minus_api_minus_client/_utils/_logs.py +25 -0
- runloop_minus_api_minus_client/_utils/_proxy.py +63 -0
- runloop_minus_api_minus_client/_utils/_reflection.py +8 -0
- runloop_minus_api_minus_client/_utils/_streams.py +12 -0
- runloop_minus_api_minus_client/_utils/_sync.py +81 -0
- runloop_minus_api_minus_client/_utils/_transform.py +382 -0
- runloop_minus_api_minus_client/_utils/_typing.py +120 -0
- runloop_minus_api_minus_client/_utils/_utils.py +402 -0
- runloop_minus_api_minus_client/_version.py +4 -0
- runloop_minus_api_minus_client/lib/.keep +4 -0
- runloop_minus_api_minus_client/py.typed +0 -0
- runloop_minus_api_minus_client/resources/__init__.py +47 -0
- runloop_minus_api_minus_client/resources/devboxes/__init__.py +33 -0
- runloop_minus_api_minus_client/resources/devboxes/devboxes.py +560 -0
- runloop_minus_api_minus_client/resources/devboxes/logs.py +143 -0
- runloop_minus_api_minus_client/resources/functions/__init__.py +33 -0
- runloop_minus_api_minus_client/resources/functions/functions.py +376 -0
- runloop_minus_api_minus_client/resources/functions/invocations/__init__.py +33 -0
- runloop_minus_api_minus_client/resources/functions/invocations/invocations.py +310 -0
- runloop_minus_api_minus_client/resources/functions/invocations/spans.py +147 -0
- runloop_minus_api_minus_client/resources/projects/__init__.py +33 -0
- runloop_minus_api_minus_client/resources/projects/logs.py +143 -0
- runloop_minus_api_minus_client/resources/projects/projects.py +155 -0
- runloop_minus_api_minus_client/types/__init__.py +14 -0
- runloop_minus_api_minus_client/types/devbox_create_params.py +30 -0
- runloop_minus_api_minus_client/types/devbox_execution_detail_view.py +21 -0
- runloop_minus_api_minus_client/types/devbox_list_params.py +12 -0
- runloop_minus_api_minus_client/types/devbox_list_view.py +13 -0
- runloop_minus_api_minus_client/types/devbox_view.py +21 -0
- runloop_minus_api_minus_client/types/devboxes/__init__.py +5 -0
- runloop_minus_api_minus_client/types/devboxes/devbox_logs_list_view.py +23 -0
- runloop_minus_api_minus_client/types/function_invoke_async_params.py +23 -0
- runloop_minus_api_minus_client/types/function_invoke_sync_params.py +23 -0
- runloop_minus_api_minus_client/types/function_list_view.py +20 -0
- runloop_minus_api_minus_client/types/functions/__init__.py +5 -0
- runloop_minus_api_minus_client/types/functions/function_invocation_list_view.py +26 -0
- runloop_minus_api_minus_client/types/functions/invocations/__init__.py +5 -0
- runloop_minus_api_minus_client/types/functions/invocations/invocation_span_list_view.py +16 -0
- runloop_minus_api_minus_client/types/project_list_view.py +149 -0
- runloop_minus_api_minus_client/types/projects/__init__.py +3 -0
- runloop_minus_api_minus_client/types/shared/__init__.py +4 -0
- runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py +25 -0
- runloop_minus_api_minus_client/types/shared/project_logs_view.py +22 -0
|
@@ -0,0 +1,560 @@
|
|
|
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 Dict, List
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .logs import (
|
|
10
|
+
LogsResource,
|
|
11
|
+
AsyncLogsResource,
|
|
12
|
+
LogsResourceWithRawResponse,
|
|
13
|
+
AsyncLogsResourceWithRawResponse,
|
|
14
|
+
LogsResourceWithStreamingResponse,
|
|
15
|
+
AsyncLogsResourceWithStreamingResponse,
|
|
16
|
+
)
|
|
17
|
+
from ...types import devbox_list_params, devbox_create_params
|
|
18
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
19
|
+
from ..._utils import (
|
|
20
|
+
maybe_transform,
|
|
21
|
+
async_maybe_transform,
|
|
22
|
+
)
|
|
23
|
+
from ..._compat import cached_property
|
|
24
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
25
|
+
from ..._response import (
|
|
26
|
+
to_raw_response_wrapper,
|
|
27
|
+
to_streamed_response_wrapper,
|
|
28
|
+
async_to_raw_response_wrapper,
|
|
29
|
+
async_to_streamed_response_wrapper,
|
|
30
|
+
)
|
|
31
|
+
from ..._base_client import (
|
|
32
|
+
make_request_options,
|
|
33
|
+
)
|
|
34
|
+
from ...types.devbox_view import DevboxView
|
|
35
|
+
from ...types.devbox_list_view import DevboxListView
|
|
36
|
+
from ...types.devbox_execution_detail_view import DevboxExecutionDetailView
|
|
37
|
+
|
|
38
|
+
__all__ = ["DevboxesResource", "AsyncDevboxesResource"]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class DevboxesResource(SyncAPIResource):
|
|
42
|
+
@cached_property
|
|
43
|
+
def logs(self) -> LogsResource:
|
|
44
|
+
return LogsResource(self._client)
|
|
45
|
+
|
|
46
|
+
@cached_property
|
|
47
|
+
def with_raw_response(self) -> DevboxesResourceWithRawResponse:
|
|
48
|
+
return DevboxesResourceWithRawResponse(self)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def with_streaming_response(self) -> DevboxesResourceWithStreamingResponse:
|
|
52
|
+
return DevboxesResourceWithStreamingResponse(self)
|
|
53
|
+
|
|
54
|
+
def create(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
code_handle: str | NotGiven = NOT_GIVEN,
|
|
58
|
+
entrypoint: str | NotGiven = NOT_GIVEN,
|
|
59
|
+
environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
60
|
+
setup_commands: List[str] | NotGiven = NOT_GIVEN,
|
|
61
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
62
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
63
|
+
extra_headers: Headers | None = None,
|
|
64
|
+
extra_query: Query | None = None,
|
|
65
|
+
extra_body: Body | None = None,
|
|
66
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
67
|
+
) -> DevboxView:
|
|
68
|
+
"""Create a Devbox with the specified configuration.
|
|
69
|
+
|
|
70
|
+
The Devbox will be created in
|
|
71
|
+
the 'pending' state and will transition to 'running' once it is ready.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
code_handle: (Optional) Id of a code handle to mount to devbox.
|
|
75
|
+
|
|
76
|
+
entrypoint: (Optional) When specified, the Devbox will run this script as its main
|
|
77
|
+
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
|
|
78
|
+
the process is complete.
|
|
79
|
+
|
|
80
|
+
environment_variables: (Optional) Environment variables used to configure your Devbox.
|
|
81
|
+
|
|
82
|
+
setup_commands: (Optional) List of commands needed to set up your Devbox. Examples might include
|
|
83
|
+
fetching a tool or building your dependencies. Runloop will look optimize these
|
|
84
|
+
steps for you.
|
|
85
|
+
|
|
86
|
+
extra_headers: Send extra headers
|
|
87
|
+
|
|
88
|
+
extra_query: Add additional query parameters to the request
|
|
89
|
+
|
|
90
|
+
extra_body: Add additional JSON properties to the request
|
|
91
|
+
|
|
92
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
93
|
+
"""
|
|
94
|
+
return self._post(
|
|
95
|
+
"/v1/devboxes",
|
|
96
|
+
body=maybe_transform(
|
|
97
|
+
{
|
|
98
|
+
"code_handle": code_handle,
|
|
99
|
+
"entrypoint": entrypoint,
|
|
100
|
+
"environment_variables": environment_variables,
|
|
101
|
+
"setup_commands": setup_commands,
|
|
102
|
+
},
|
|
103
|
+
devbox_create_params.DevboxCreateParams,
|
|
104
|
+
),
|
|
105
|
+
options=make_request_options(
|
|
106
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
107
|
+
),
|
|
108
|
+
cast_to=DevboxView,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
def retrieve(
|
|
112
|
+
self,
|
|
113
|
+
id: str,
|
|
114
|
+
*,
|
|
115
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
116
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
117
|
+
extra_headers: Headers | None = None,
|
|
118
|
+
extra_query: Query | None = None,
|
|
119
|
+
extra_body: Body | None = None,
|
|
120
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
121
|
+
) -> DevboxView:
|
|
122
|
+
"""Get a devbox by id.
|
|
123
|
+
|
|
124
|
+
If the devbox does not exist, a 404 is returned.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
extra_headers: Send extra headers
|
|
128
|
+
|
|
129
|
+
extra_query: Add additional query parameters to the request
|
|
130
|
+
|
|
131
|
+
extra_body: Add additional JSON properties to the request
|
|
132
|
+
|
|
133
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
134
|
+
"""
|
|
135
|
+
if not id:
|
|
136
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
137
|
+
return self._get(
|
|
138
|
+
f"/v1/devboxes/{id}",
|
|
139
|
+
options=make_request_options(
|
|
140
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
141
|
+
),
|
|
142
|
+
cast_to=DevboxView,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
def list(
|
|
146
|
+
self,
|
|
147
|
+
*,
|
|
148
|
+
status: str | NotGiven = NOT_GIVEN,
|
|
149
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
150
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
151
|
+
extra_headers: Headers | None = None,
|
|
152
|
+
extra_query: Query | None = None,
|
|
153
|
+
extra_body: Body | None = None,
|
|
154
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
155
|
+
) -> DevboxListView:
|
|
156
|
+
"""List all devboxes or filter by status.
|
|
157
|
+
|
|
158
|
+
If no status is provided, all devboxes
|
|
159
|
+
are returned.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
status: Filter by status
|
|
163
|
+
|
|
164
|
+
extra_headers: Send extra headers
|
|
165
|
+
|
|
166
|
+
extra_query: Add additional query parameters to the request
|
|
167
|
+
|
|
168
|
+
extra_body: Add additional JSON properties to the request
|
|
169
|
+
|
|
170
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
171
|
+
"""
|
|
172
|
+
return self._get(
|
|
173
|
+
"/v1/devboxes",
|
|
174
|
+
options=make_request_options(
|
|
175
|
+
extra_headers=extra_headers,
|
|
176
|
+
extra_query=extra_query,
|
|
177
|
+
extra_body=extra_body,
|
|
178
|
+
timeout=timeout,
|
|
179
|
+
query=maybe_transform({"status": status}, devbox_list_params.DevboxListParams),
|
|
180
|
+
),
|
|
181
|
+
cast_to=DevboxListView,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
def execute_sync(
|
|
185
|
+
self,
|
|
186
|
+
id: str,
|
|
187
|
+
*,
|
|
188
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
189
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
190
|
+
extra_headers: Headers | None = None,
|
|
191
|
+
extra_query: Query | None = None,
|
|
192
|
+
extra_body: Body | None = None,
|
|
193
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
194
|
+
) -> DevboxExecutionDetailView:
|
|
195
|
+
"""
|
|
196
|
+
Synchronously execute a command on a devbox
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
extra_headers: Send extra headers
|
|
200
|
+
|
|
201
|
+
extra_query: Add additional query parameters to the request
|
|
202
|
+
|
|
203
|
+
extra_body: Add additional JSON properties to the request
|
|
204
|
+
|
|
205
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
206
|
+
"""
|
|
207
|
+
if not id:
|
|
208
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
209
|
+
return self._post(
|
|
210
|
+
f"/v1/devboxes/{id}/execute_sync",
|
|
211
|
+
options=make_request_options(
|
|
212
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
213
|
+
),
|
|
214
|
+
cast_to=DevboxExecutionDetailView,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
def shutdown(
|
|
218
|
+
self,
|
|
219
|
+
id: str,
|
|
220
|
+
*,
|
|
221
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
222
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
223
|
+
extra_headers: Headers | None = None,
|
|
224
|
+
extra_query: Query | None = None,
|
|
225
|
+
extra_body: Body | None = None,
|
|
226
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
227
|
+
) -> DevboxView:
|
|
228
|
+
"""Shutdown a running devbox by id.
|
|
229
|
+
|
|
230
|
+
This will take the devbox out of service.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
extra_headers: Send extra headers
|
|
234
|
+
|
|
235
|
+
extra_query: Add additional query parameters to the request
|
|
236
|
+
|
|
237
|
+
extra_body: Add additional JSON properties to the request
|
|
238
|
+
|
|
239
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
240
|
+
"""
|
|
241
|
+
if not id:
|
|
242
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
243
|
+
return self._post(
|
|
244
|
+
f"/v1/devboxes/{id}/shutdown",
|
|
245
|
+
options=make_request_options(
|
|
246
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
247
|
+
),
|
|
248
|
+
cast_to=DevboxView,
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class AsyncDevboxesResource(AsyncAPIResource):
|
|
253
|
+
@cached_property
|
|
254
|
+
def logs(self) -> AsyncLogsResource:
|
|
255
|
+
return AsyncLogsResource(self._client)
|
|
256
|
+
|
|
257
|
+
@cached_property
|
|
258
|
+
def with_raw_response(self) -> AsyncDevboxesResourceWithRawResponse:
|
|
259
|
+
return AsyncDevboxesResourceWithRawResponse(self)
|
|
260
|
+
|
|
261
|
+
@cached_property
|
|
262
|
+
def with_streaming_response(self) -> AsyncDevboxesResourceWithStreamingResponse:
|
|
263
|
+
return AsyncDevboxesResourceWithStreamingResponse(self)
|
|
264
|
+
|
|
265
|
+
async def create(
|
|
266
|
+
self,
|
|
267
|
+
*,
|
|
268
|
+
code_handle: str | NotGiven = NOT_GIVEN,
|
|
269
|
+
entrypoint: str | NotGiven = NOT_GIVEN,
|
|
270
|
+
environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
271
|
+
setup_commands: List[str] | NotGiven = NOT_GIVEN,
|
|
272
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
273
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
274
|
+
extra_headers: Headers | None = None,
|
|
275
|
+
extra_query: Query | None = None,
|
|
276
|
+
extra_body: Body | None = None,
|
|
277
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
278
|
+
) -> DevboxView:
|
|
279
|
+
"""Create a Devbox with the specified configuration.
|
|
280
|
+
|
|
281
|
+
The Devbox will be created in
|
|
282
|
+
the 'pending' state and will transition to 'running' once it is ready.
|
|
283
|
+
|
|
284
|
+
Args:
|
|
285
|
+
code_handle: (Optional) Id of a code handle to mount to devbox.
|
|
286
|
+
|
|
287
|
+
entrypoint: (Optional) When specified, the Devbox will run this script as its main
|
|
288
|
+
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
|
|
289
|
+
the process is complete.
|
|
290
|
+
|
|
291
|
+
environment_variables: (Optional) Environment variables used to configure your Devbox.
|
|
292
|
+
|
|
293
|
+
setup_commands: (Optional) List of commands needed to set up your Devbox. Examples might include
|
|
294
|
+
fetching a tool or building your dependencies. Runloop will look optimize these
|
|
295
|
+
steps for you.
|
|
296
|
+
|
|
297
|
+
extra_headers: Send extra headers
|
|
298
|
+
|
|
299
|
+
extra_query: Add additional query parameters to the request
|
|
300
|
+
|
|
301
|
+
extra_body: Add additional JSON properties to the request
|
|
302
|
+
|
|
303
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
304
|
+
"""
|
|
305
|
+
return await self._post(
|
|
306
|
+
"/v1/devboxes",
|
|
307
|
+
body=await async_maybe_transform(
|
|
308
|
+
{
|
|
309
|
+
"code_handle": code_handle,
|
|
310
|
+
"entrypoint": entrypoint,
|
|
311
|
+
"environment_variables": environment_variables,
|
|
312
|
+
"setup_commands": setup_commands,
|
|
313
|
+
},
|
|
314
|
+
devbox_create_params.DevboxCreateParams,
|
|
315
|
+
),
|
|
316
|
+
options=make_request_options(
|
|
317
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
318
|
+
),
|
|
319
|
+
cast_to=DevboxView,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
async def retrieve(
|
|
323
|
+
self,
|
|
324
|
+
id: str,
|
|
325
|
+
*,
|
|
326
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
327
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
328
|
+
extra_headers: Headers | None = None,
|
|
329
|
+
extra_query: Query | None = None,
|
|
330
|
+
extra_body: Body | None = None,
|
|
331
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
332
|
+
) -> DevboxView:
|
|
333
|
+
"""Get a devbox by id.
|
|
334
|
+
|
|
335
|
+
If the devbox does not exist, a 404 is returned.
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
extra_headers: Send extra headers
|
|
339
|
+
|
|
340
|
+
extra_query: Add additional query parameters to the request
|
|
341
|
+
|
|
342
|
+
extra_body: Add additional JSON properties to the request
|
|
343
|
+
|
|
344
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
345
|
+
"""
|
|
346
|
+
if not id:
|
|
347
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
348
|
+
return await self._get(
|
|
349
|
+
f"/v1/devboxes/{id}",
|
|
350
|
+
options=make_request_options(
|
|
351
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
352
|
+
),
|
|
353
|
+
cast_to=DevboxView,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
async def list(
|
|
357
|
+
self,
|
|
358
|
+
*,
|
|
359
|
+
status: str | NotGiven = NOT_GIVEN,
|
|
360
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
361
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
362
|
+
extra_headers: Headers | None = None,
|
|
363
|
+
extra_query: Query | None = None,
|
|
364
|
+
extra_body: Body | None = None,
|
|
365
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
366
|
+
) -> DevboxListView:
|
|
367
|
+
"""List all devboxes or filter by status.
|
|
368
|
+
|
|
369
|
+
If no status is provided, all devboxes
|
|
370
|
+
are returned.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
status: Filter by status
|
|
374
|
+
|
|
375
|
+
extra_headers: Send extra headers
|
|
376
|
+
|
|
377
|
+
extra_query: Add additional query parameters to the request
|
|
378
|
+
|
|
379
|
+
extra_body: Add additional JSON properties to the request
|
|
380
|
+
|
|
381
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
382
|
+
"""
|
|
383
|
+
return await self._get(
|
|
384
|
+
"/v1/devboxes",
|
|
385
|
+
options=make_request_options(
|
|
386
|
+
extra_headers=extra_headers,
|
|
387
|
+
extra_query=extra_query,
|
|
388
|
+
extra_body=extra_body,
|
|
389
|
+
timeout=timeout,
|
|
390
|
+
query=await async_maybe_transform({"status": status}, devbox_list_params.DevboxListParams),
|
|
391
|
+
),
|
|
392
|
+
cast_to=DevboxListView,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
async def execute_sync(
|
|
396
|
+
self,
|
|
397
|
+
id: str,
|
|
398
|
+
*,
|
|
399
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
400
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
401
|
+
extra_headers: Headers | None = None,
|
|
402
|
+
extra_query: Query | None = None,
|
|
403
|
+
extra_body: Body | None = None,
|
|
404
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
405
|
+
) -> DevboxExecutionDetailView:
|
|
406
|
+
"""
|
|
407
|
+
Synchronously execute a command on a devbox
|
|
408
|
+
|
|
409
|
+
Args:
|
|
410
|
+
extra_headers: Send extra headers
|
|
411
|
+
|
|
412
|
+
extra_query: Add additional query parameters to the request
|
|
413
|
+
|
|
414
|
+
extra_body: Add additional JSON properties to the request
|
|
415
|
+
|
|
416
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
417
|
+
"""
|
|
418
|
+
if not id:
|
|
419
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
420
|
+
return await self._post(
|
|
421
|
+
f"/v1/devboxes/{id}/execute_sync",
|
|
422
|
+
options=make_request_options(
|
|
423
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
424
|
+
),
|
|
425
|
+
cast_to=DevboxExecutionDetailView,
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
async def shutdown(
|
|
429
|
+
self,
|
|
430
|
+
id: str,
|
|
431
|
+
*,
|
|
432
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
433
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
434
|
+
extra_headers: Headers | None = None,
|
|
435
|
+
extra_query: Query | None = None,
|
|
436
|
+
extra_body: Body | None = None,
|
|
437
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
438
|
+
) -> DevboxView:
|
|
439
|
+
"""Shutdown a running devbox by id.
|
|
440
|
+
|
|
441
|
+
This will take the devbox out of service.
|
|
442
|
+
|
|
443
|
+
Args:
|
|
444
|
+
extra_headers: Send extra headers
|
|
445
|
+
|
|
446
|
+
extra_query: Add additional query parameters to the request
|
|
447
|
+
|
|
448
|
+
extra_body: Add additional JSON properties to the request
|
|
449
|
+
|
|
450
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
451
|
+
"""
|
|
452
|
+
if not id:
|
|
453
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
454
|
+
return await self._post(
|
|
455
|
+
f"/v1/devboxes/{id}/shutdown",
|
|
456
|
+
options=make_request_options(
|
|
457
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
458
|
+
),
|
|
459
|
+
cast_to=DevboxView,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class DevboxesResourceWithRawResponse:
|
|
464
|
+
def __init__(self, devboxes: DevboxesResource) -> None:
|
|
465
|
+
self._devboxes = devboxes
|
|
466
|
+
|
|
467
|
+
self.create = to_raw_response_wrapper(
|
|
468
|
+
devboxes.create,
|
|
469
|
+
)
|
|
470
|
+
self.retrieve = to_raw_response_wrapper(
|
|
471
|
+
devboxes.retrieve,
|
|
472
|
+
)
|
|
473
|
+
self.list = to_raw_response_wrapper(
|
|
474
|
+
devboxes.list,
|
|
475
|
+
)
|
|
476
|
+
self.execute_sync = to_raw_response_wrapper(
|
|
477
|
+
devboxes.execute_sync,
|
|
478
|
+
)
|
|
479
|
+
self.shutdown = to_raw_response_wrapper(
|
|
480
|
+
devboxes.shutdown,
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
@cached_property
|
|
484
|
+
def logs(self) -> LogsResourceWithRawResponse:
|
|
485
|
+
return LogsResourceWithRawResponse(self._devboxes.logs)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class AsyncDevboxesResourceWithRawResponse:
|
|
489
|
+
def __init__(self, devboxes: AsyncDevboxesResource) -> None:
|
|
490
|
+
self._devboxes = devboxes
|
|
491
|
+
|
|
492
|
+
self.create = async_to_raw_response_wrapper(
|
|
493
|
+
devboxes.create,
|
|
494
|
+
)
|
|
495
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
496
|
+
devboxes.retrieve,
|
|
497
|
+
)
|
|
498
|
+
self.list = async_to_raw_response_wrapper(
|
|
499
|
+
devboxes.list,
|
|
500
|
+
)
|
|
501
|
+
self.execute_sync = async_to_raw_response_wrapper(
|
|
502
|
+
devboxes.execute_sync,
|
|
503
|
+
)
|
|
504
|
+
self.shutdown = async_to_raw_response_wrapper(
|
|
505
|
+
devboxes.shutdown,
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
@cached_property
|
|
509
|
+
def logs(self) -> AsyncLogsResourceWithRawResponse:
|
|
510
|
+
return AsyncLogsResourceWithRawResponse(self._devboxes.logs)
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
class DevboxesResourceWithStreamingResponse:
|
|
514
|
+
def __init__(self, devboxes: DevboxesResource) -> None:
|
|
515
|
+
self._devboxes = devboxes
|
|
516
|
+
|
|
517
|
+
self.create = to_streamed_response_wrapper(
|
|
518
|
+
devboxes.create,
|
|
519
|
+
)
|
|
520
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
521
|
+
devboxes.retrieve,
|
|
522
|
+
)
|
|
523
|
+
self.list = to_streamed_response_wrapper(
|
|
524
|
+
devboxes.list,
|
|
525
|
+
)
|
|
526
|
+
self.execute_sync = to_streamed_response_wrapper(
|
|
527
|
+
devboxes.execute_sync,
|
|
528
|
+
)
|
|
529
|
+
self.shutdown = to_streamed_response_wrapper(
|
|
530
|
+
devboxes.shutdown,
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
@cached_property
|
|
534
|
+
def logs(self) -> LogsResourceWithStreamingResponse:
|
|
535
|
+
return LogsResourceWithStreamingResponse(self._devboxes.logs)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
class AsyncDevboxesResourceWithStreamingResponse:
|
|
539
|
+
def __init__(self, devboxes: AsyncDevboxesResource) -> None:
|
|
540
|
+
self._devboxes = devboxes
|
|
541
|
+
|
|
542
|
+
self.create = async_to_streamed_response_wrapper(
|
|
543
|
+
devboxes.create,
|
|
544
|
+
)
|
|
545
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
546
|
+
devboxes.retrieve,
|
|
547
|
+
)
|
|
548
|
+
self.list = async_to_streamed_response_wrapper(
|
|
549
|
+
devboxes.list,
|
|
550
|
+
)
|
|
551
|
+
self.execute_sync = async_to_streamed_response_wrapper(
|
|
552
|
+
devboxes.execute_sync,
|
|
553
|
+
)
|
|
554
|
+
self.shutdown = async_to_streamed_response_wrapper(
|
|
555
|
+
devboxes.shutdown,
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
@cached_property
|
|
559
|
+
def logs(self) -> AsyncLogsResourceWithStreamingResponse:
|
|
560
|
+
return AsyncLogsResourceWithStreamingResponse(self._devboxes.logs)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
8
|
+
from ..._compat import cached_property
|
|
9
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
10
|
+
from ..._response import (
|
|
11
|
+
to_raw_response_wrapper,
|
|
12
|
+
to_streamed_response_wrapper,
|
|
13
|
+
async_to_raw_response_wrapper,
|
|
14
|
+
async_to_streamed_response_wrapper,
|
|
15
|
+
)
|
|
16
|
+
from ..._base_client import (
|
|
17
|
+
make_request_options,
|
|
18
|
+
)
|
|
19
|
+
from ...types.devboxes.devbox_logs_list_view import DevboxLogsListView
|
|
20
|
+
|
|
21
|
+
__all__ = ["LogsResource", "AsyncLogsResource"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class LogsResource(SyncAPIResource):
|
|
25
|
+
@cached_property
|
|
26
|
+
def with_raw_response(self) -> LogsResourceWithRawResponse:
|
|
27
|
+
return LogsResourceWithRawResponse(self)
|
|
28
|
+
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_streaming_response(self) -> LogsResourceWithStreamingResponse:
|
|
31
|
+
return LogsResourceWithStreamingResponse(self)
|
|
32
|
+
|
|
33
|
+
def list(
|
|
34
|
+
self,
|
|
35
|
+
id: str,
|
|
36
|
+
*,
|
|
37
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
38
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
39
|
+
extra_headers: Headers | None = None,
|
|
40
|
+
extra_query: Query | None = None,
|
|
41
|
+
extra_body: Body | None = None,
|
|
42
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
43
|
+
) -> DevboxLogsListView:
|
|
44
|
+
"""
|
|
45
|
+
Get all logs from a Devbox by id.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
extra_headers: Send extra headers
|
|
49
|
+
|
|
50
|
+
extra_query: Add additional query parameters to the request
|
|
51
|
+
|
|
52
|
+
extra_body: Add additional JSON properties to the request
|
|
53
|
+
|
|
54
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
55
|
+
"""
|
|
56
|
+
if not id:
|
|
57
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
58
|
+
return self._get(
|
|
59
|
+
f"/v1/devboxes/{id}/logs",
|
|
60
|
+
options=make_request_options(
|
|
61
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
62
|
+
),
|
|
63
|
+
cast_to=DevboxLogsListView,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class AsyncLogsResource(AsyncAPIResource):
|
|
68
|
+
@cached_property
|
|
69
|
+
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse:
|
|
70
|
+
return AsyncLogsResourceWithRawResponse(self)
|
|
71
|
+
|
|
72
|
+
@cached_property
|
|
73
|
+
def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse:
|
|
74
|
+
return AsyncLogsResourceWithStreamingResponse(self)
|
|
75
|
+
|
|
76
|
+
async def list(
|
|
77
|
+
self,
|
|
78
|
+
id: str,
|
|
79
|
+
*,
|
|
80
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
81
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
82
|
+
extra_headers: Headers | None = None,
|
|
83
|
+
extra_query: Query | None = None,
|
|
84
|
+
extra_body: Body | None = None,
|
|
85
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
86
|
+
) -> DevboxLogsListView:
|
|
87
|
+
"""
|
|
88
|
+
Get all logs from a Devbox by id.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
extra_headers: Send extra headers
|
|
92
|
+
|
|
93
|
+
extra_query: Add additional query parameters to the request
|
|
94
|
+
|
|
95
|
+
extra_body: Add additional JSON properties to the request
|
|
96
|
+
|
|
97
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
98
|
+
"""
|
|
99
|
+
if not id:
|
|
100
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
101
|
+
return await self._get(
|
|
102
|
+
f"/v1/devboxes/{id}/logs",
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=DevboxLogsListView,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class LogsResourceWithRawResponse:
|
|
111
|
+
def __init__(self, logs: LogsResource) -> None:
|
|
112
|
+
self._logs = logs
|
|
113
|
+
|
|
114
|
+
self.list = to_raw_response_wrapper(
|
|
115
|
+
logs.list,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class AsyncLogsResourceWithRawResponse:
|
|
120
|
+
def __init__(self, logs: AsyncLogsResource) -> None:
|
|
121
|
+
self._logs = logs
|
|
122
|
+
|
|
123
|
+
self.list = async_to_raw_response_wrapper(
|
|
124
|
+
logs.list,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class LogsResourceWithStreamingResponse:
|
|
129
|
+
def __init__(self, logs: LogsResource) -> None:
|
|
130
|
+
self._logs = logs
|
|
131
|
+
|
|
132
|
+
self.list = to_streamed_response_wrapper(
|
|
133
|
+
logs.list,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class AsyncLogsResourceWithStreamingResponse:
|
|
138
|
+
def __init__(self, logs: AsyncLogsResource) -> None:
|
|
139
|
+
self._logs = logs
|
|
140
|
+
|
|
141
|
+
self.list = async_to_streamed_response_wrapper(
|
|
142
|
+
logs.list,
|
|
143
|
+
)
|