1818 async_to_streamed_response_wrapper ,
1919)
2020from ..._base_client import make_request_options
21- from ...types .devboxes import execution_execute_sync_params , execution_execute_async_params
21+ from ...types .devboxes import execution_retrieve_params , execution_execute_sync_params , execution_execute_async_params
22+ from ...types .devbox_execution_detail_view import DevboxExecutionDetailView
2223from ...types .devboxes .devbox_logs_list_view import DevboxLogsListView
23- from ...types .devboxes .devbox_execution_detail_view import DevboxExecutionDetailView
24- from ...types .devboxes .devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
24+ from ...types .devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
2525
2626__all__ = ["ExecutionsResource" , "AsyncExecutionsResource" ]
2727
@@ -35,6 +35,49 @@ def with_raw_response(self) -> ExecutionsResourceWithRawResponse:
3535 def with_streaming_response (self ) -> ExecutionsResourceWithStreamingResponse :
3636 return ExecutionsResourceWithStreamingResponse (self )
3737
38+ def retrieve (
39+ self ,
40+ execution_id : str ,
41+ * ,
42+ id : str ,
43+ last_n : str | NotGiven = NOT_GIVEN ,
44+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
45+ # The extra values given here take precedence over values defined on the client or passed to this method.
46+ extra_headers : Headers | None = None ,
47+ extra_query : Query | None = None ,
48+ extra_body : Body | None = None ,
49+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
50+ ) -> DevboxAsyncExecutionDetailView :
51+ """
52+ Get status of an execution on a devbox.
53+
54+ Args:
55+ last_n: Last n lines of standard error / standard out to return
56+
57+ extra_headers: Send extra headers
58+
59+ extra_query: Add additional query parameters to the request
60+
61+ extra_body: Add additional JSON properties to the request
62+
63+ timeout: Override the client-level default timeout for this request, in seconds
64+ """
65+ if not id :
66+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
67+ if not execution_id :
68+ raise ValueError (f"Expected a non-empty value for `execution_id` but received { execution_id !r} " )
69+ return self ._get (
70+ f"/v1/devboxes/{ id } /executions/{ execution_id } " ,
71+ options = make_request_options (
72+ extra_headers = extra_headers ,
73+ extra_query = extra_query ,
74+ extra_body = extra_body ,
75+ timeout = timeout ,
76+ query = maybe_transform ({"last_n" : last_n }, execution_retrieve_params .ExecutionRetrieveParams ),
77+ ),
78+ cast_to = DevboxAsyncExecutionDetailView ,
79+ )
80+
3881 def execute_async (
3982 self ,
4083 id : str ,
@@ -109,6 +152,42 @@ def execute_sync(
109152 cast_to = DevboxExecutionDetailView ,
110153 )
111154
155+ def kill (
156+ self ,
157+ execution_id : str ,
158+ * ,
159+ id : str ,
160+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
161+ # The extra values given here take precedence over values defined on the client or passed to this method.
162+ extra_headers : Headers | None = None ,
163+ extra_query : Query | None = None ,
164+ extra_body : Body | None = None ,
165+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
166+ ) -> DevboxAsyncExecutionDetailView :
167+ """
168+ Kill an asynchronous execution currently running on a devbox
169+
170+ Args:
171+ extra_headers: Send extra headers
172+
173+ extra_query: Add additional query parameters to the request
174+
175+ extra_body: Add additional JSON properties to the request
176+
177+ timeout: Override the client-level default timeout for this request, in seconds
178+ """
179+ if not id :
180+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
181+ if not execution_id :
182+ raise ValueError (f"Expected a non-empty value for `execution_id` but received { execution_id !r} " )
183+ return self ._post (
184+ f"/v1/devboxes/{ id } /executions/{ execution_id } /kill" ,
185+ options = make_request_options (
186+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
187+ ),
188+ cast_to = DevboxAsyncExecutionDetailView ,
189+ )
190+
112191 def logs (
113192 self ,
114193 execution_id : str ,
@@ -155,6 +234,51 @@ def with_raw_response(self) -> AsyncExecutionsResourceWithRawResponse:
155234 def with_streaming_response (self ) -> AsyncExecutionsResourceWithStreamingResponse :
156235 return AsyncExecutionsResourceWithStreamingResponse (self )
157236
237+ async def retrieve (
238+ self ,
239+ execution_id : str ,
240+ * ,
241+ id : str ,
242+ last_n : str | NotGiven = NOT_GIVEN ,
243+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
244+ # The extra values given here take precedence over values defined on the client or passed to this method.
245+ extra_headers : Headers | None = None ,
246+ extra_query : Query | None = None ,
247+ extra_body : Body | None = None ,
248+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
249+ ) -> DevboxAsyncExecutionDetailView :
250+ """
251+ Get status of an execution on a devbox.
252+
253+ Args:
254+ last_n: Last n lines of standard error / standard out to return
255+
256+ extra_headers: Send extra headers
257+
258+ extra_query: Add additional query parameters to the request
259+
260+ extra_body: Add additional JSON properties to the request
261+
262+ timeout: Override the client-level default timeout for this request, in seconds
263+ """
264+ if not id :
265+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
266+ if not execution_id :
267+ raise ValueError (f"Expected a non-empty value for `execution_id` but received { execution_id !r} " )
268+ return await self ._get (
269+ f"/v1/devboxes/{ id } /executions/{ execution_id } " ,
270+ options = make_request_options (
271+ extra_headers = extra_headers ,
272+ extra_query = extra_query ,
273+ extra_body = extra_body ,
274+ timeout = timeout ,
275+ query = await async_maybe_transform (
276+ {"last_n" : last_n }, execution_retrieve_params .ExecutionRetrieveParams
277+ ),
278+ ),
279+ cast_to = DevboxAsyncExecutionDetailView ,
280+ )
281+
158282 async def execute_async (
159283 self ,
160284 id : str ,
@@ -233,6 +357,42 @@ async def execute_sync(
233357 cast_to = DevboxExecutionDetailView ,
234358 )
235359
360+ async def kill (
361+ self ,
362+ execution_id : str ,
363+ * ,
364+ id : str ,
365+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
366+ # The extra values given here take precedence over values defined on the client or passed to this method.
367+ extra_headers : Headers | None = None ,
368+ extra_query : Query | None = None ,
369+ extra_body : Body | None = None ,
370+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
371+ ) -> DevboxAsyncExecutionDetailView :
372+ """
373+ Kill an asynchronous execution currently running on a devbox
374+
375+ Args:
376+ extra_headers: Send extra headers
377+
378+ extra_query: Add additional query parameters to the request
379+
380+ extra_body: Add additional JSON properties to the request
381+
382+ timeout: Override the client-level default timeout for this request, in seconds
383+ """
384+ if not id :
385+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
386+ if not execution_id :
387+ raise ValueError (f"Expected a non-empty value for `execution_id` but received { execution_id !r} " )
388+ return await self ._post (
389+ f"/v1/devboxes/{ id } /executions/{ execution_id } /kill" ,
390+ options = make_request_options (
391+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
392+ ),
393+ cast_to = DevboxAsyncExecutionDetailView ,
394+ )
395+
236396 async def logs (
237397 self ,
238398 execution_id : str ,
@@ -274,12 +434,18 @@ class ExecutionsResourceWithRawResponse:
274434 def __init__ (self , executions : ExecutionsResource ) -> None :
275435 self ._executions = executions
276436
437+ self .retrieve = to_raw_response_wrapper (
438+ executions .retrieve ,
439+ )
277440 self .execute_async = to_raw_response_wrapper (
278441 executions .execute_async ,
279442 )
280443 self .execute_sync = to_raw_response_wrapper (
281444 executions .execute_sync ,
282445 )
446+ self .kill = to_raw_response_wrapper (
447+ executions .kill ,
448+ )
283449 self .logs = to_raw_response_wrapper (
284450 executions .logs ,
285451 )
@@ -289,12 +455,18 @@ class AsyncExecutionsResourceWithRawResponse:
289455 def __init__ (self , executions : AsyncExecutionsResource ) -> None :
290456 self ._executions = executions
291457
458+ self .retrieve = async_to_raw_response_wrapper (
459+ executions .retrieve ,
460+ )
292461 self .execute_async = async_to_raw_response_wrapper (
293462 executions .execute_async ,
294463 )
295464 self .execute_sync = async_to_raw_response_wrapper (
296465 executions .execute_sync ,
297466 )
467+ self .kill = async_to_raw_response_wrapper (
468+ executions .kill ,
469+ )
298470 self .logs = async_to_raw_response_wrapper (
299471 executions .logs ,
300472 )
@@ -304,12 +476,18 @@ class ExecutionsResourceWithStreamingResponse:
304476 def __init__ (self , executions : ExecutionsResource ) -> None :
305477 self ._executions = executions
306478
479+ self .retrieve = to_streamed_response_wrapper (
480+ executions .retrieve ,
481+ )
307482 self .execute_async = to_streamed_response_wrapper (
308483 executions .execute_async ,
309484 )
310485 self .execute_sync = to_streamed_response_wrapper (
311486 executions .execute_sync ,
312487 )
488+ self .kill = to_streamed_response_wrapper (
489+ executions .kill ,
490+ )
313491 self .logs = to_streamed_response_wrapper (
314492 executions .logs ,
315493 )
@@ -319,12 +497,18 @@ class AsyncExecutionsResourceWithStreamingResponse:
319497 def __init__ (self , executions : AsyncExecutionsResource ) -> None :
320498 self ._executions = executions
321499
500+ self .retrieve = async_to_streamed_response_wrapper (
501+ executions .retrieve ,
502+ )
322503 self .execute_async = async_to_streamed_response_wrapper (
323504 executions .execute_async ,
324505 )
325506 self .execute_sync = async_to_streamed_response_wrapper (
326507 executions .execute_sync ,
327508 )
509+ self .kill = async_to_streamed_response_wrapper (
510+ executions .kill ,
511+ )
328512 self .logs = async_to_streamed_response_wrapper (
329513 executions .logs ,
330514 )
0 commit comments