|
69 | 69 | LONG_POLL_CLIENT_BUFFER_SECONDS, |
70 | 70 | EXEC_LONG_POLL_SERVER_MAX_SECONDS, |
71 | 71 | ) |
| 72 | +from ..._streaming import Stream, AsyncStream |
72 | 73 | from ...pagination import ( |
73 | 74 | SyncDevboxesCursorIDPage, |
74 | 75 | AsyncDevboxesCursorIDPage, |
|
94 | 95 | from ...types.shared_params.mount import Mount |
95 | 96 | from ...types.devbox_snapshot_view import DevboxSnapshotView |
96 | 97 | from ...types.shared.launch_parameters import LaunchParameters as SharedLaunchParameters |
| 98 | +from ...types.devbox_eviction_event_view import DevboxEvictionEventView |
97 | 99 | from ...types.devbox_resource_usage_view import DevboxResourceUsageView |
98 | 100 | from ...types.devbox_execution_detail_view import DevboxExecutionDetailView |
99 | 101 | from ...types.devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse |
@@ -1742,6 +1744,33 @@ def wait_for_command( |
1742 | 1744 | cast_to=DevboxAsyncExecutionDetailView, |
1743 | 1745 | ) |
1744 | 1746 |
|
| 1747 | + def watch_evictions( |
| 1748 | + self, |
| 1749 | + *, |
| 1750 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 1751 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 1752 | + extra_headers: Headers | None = None, |
| 1753 | + extra_query: Query | None = None, |
| 1754 | + extra_body: Body | None = None, |
| 1755 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 1756 | + ) -> Stream[DevboxEvictionEventView]: |
| 1757 | + """ |
| 1758 | + Subscribe, via server-sent events, to pending infrastructure evictions for every |
| 1759 | + Devbox in the account. On connect the stream emits one event per Devbox that |
| 1760 | + currently has a pending eviction, then one event as each further eviction is |
| 1761 | + scheduled. Best-effort and advisory: a Devbox stays running until its deadline, |
| 1762 | + and delivery is not guaranteed. |
| 1763 | + """ |
| 1764 | + return self._get( |
| 1765 | + "/v1/devboxes/evictions/watch", |
| 1766 | + options=make_request_options( |
| 1767 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 1768 | + ), |
| 1769 | + cast_to=DevboxEvictionEventView, |
| 1770 | + stream=True, |
| 1771 | + stream_cls=Stream[DevboxEvictionEventView], |
| 1772 | + ) |
| 1773 | + |
1745 | 1774 | def write_file_contents( |
1746 | 1775 | self, |
1747 | 1776 | id: str, |
@@ -3417,6 +3446,33 @@ async def wait_for_command( |
3417 | 3446 | cast_to=DevboxAsyncExecutionDetailView, |
3418 | 3447 | ) |
3419 | 3448 |
|
| 3449 | + async def watch_evictions( |
| 3450 | + self, |
| 3451 | + *, |
| 3452 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 3453 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 3454 | + extra_headers: Headers | None = None, |
| 3455 | + extra_query: Query | None = None, |
| 3456 | + extra_body: Body | None = None, |
| 3457 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 3458 | + ) -> AsyncStream[DevboxEvictionEventView]: |
| 3459 | + """ |
| 3460 | + Subscribe, via server-sent events, to pending infrastructure evictions for every |
| 3461 | + Devbox in the account. On connect the stream emits one event per Devbox that |
| 3462 | + currently has a pending eviction, then one event as each further eviction is |
| 3463 | + scheduled. Best-effort and advisory: a Devbox stays running until its deadline, |
| 3464 | + and delivery is not guaranteed. |
| 3465 | + """ |
| 3466 | + return await self._get( |
| 3467 | + "/v1/devboxes/evictions/watch", |
| 3468 | + options=make_request_options( |
| 3469 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 3470 | + ), |
| 3471 | + cast_to=DevboxEvictionEventView, |
| 3472 | + stream=True, |
| 3473 | + stream_cls=AsyncStream[DevboxEvictionEventView], |
| 3474 | + ) |
| 3475 | + |
3420 | 3476 | async def write_file_contents( |
3421 | 3477 | self, |
3422 | 3478 | id: str, |
@@ -3555,6 +3611,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
3555 | 3611 | self.wait_for_command = to_raw_response_wrapper( |
3556 | 3612 | devboxes.wait_for_command, |
3557 | 3613 | ) |
| 3614 | + self.watch_evictions = to_raw_response_wrapper( |
| 3615 | + devboxes.watch_evictions, |
| 3616 | + ) |
3558 | 3617 | self.write_file_contents = to_raw_response_wrapper( |
3559 | 3618 | devboxes.write_file_contents, |
3560 | 3619 | ) |
@@ -3651,6 +3710,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
3651 | 3710 | self.wait_for_command = async_to_raw_response_wrapper( |
3652 | 3711 | devboxes.wait_for_command, |
3653 | 3712 | ) |
| 3713 | + self.watch_evictions = async_to_raw_response_wrapper( |
| 3714 | + devboxes.watch_evictions, |
| 3715 | + ) |
3654 | 3716 | self.write_file_contents = async_to_raw_response_wrapper( |
3655 | 3717 | devboxes.write_file_contents, |
3656 | 3718 | ) |
@@ -3747,6 +3809,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
3747 | 3809 | self.wait_for_command = to_streamed_response_wrapper( |
3748 | 3810 | devboxes.wait_for_command, |
3749 | 3811 | ) |
| 3812 | + self.watch_evictions = to_streamed_response_wrapper( |
| 3813 | + devboxes.watch_evictions, |
| 3814 | + ) |
3750 | 3815 | self.write_file_contents = to_streamed_response_wrapper( |
3751 | 3816 | devboxes.write_file_contents, |
3752 | 3817 | ) |
@@ -3843,6 +3908,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
3843 | 3908 | self.wait_for_command = async_to_streamed_response_wrapper( |
3844 | 3909 | devboxes.wait_for_command, |
3845 | 3910 | ) |
| 3911 | + self.watch_evictions = async_to_streamed_response_wrapper( |
| 3912 | + devboxes.watch_evictions, |
| 3913 | + ) |
3846 | 3914 | self.write_file_contents = async_to_streamed_response_wrapper( |
3847 | 3915 | devboxes.write_file_contents, |
3848 | 3916 | ) |
|
0 commit comments