|
28 | 28 | devbox_execute_sync_params, |
29 | 29 | devbox_create_tunnel_params, |
30 | 30 | devbox_download_file_params, |
| 31 | + devbox_enable_tunnel_params, |
31 | 32 | devbox_execute_async_params, |
32 | 33 | devbox_remove_tunnel_params, |
33 | 34 | devbox_snapshot_disk_params, |
|
99 | 100 | ) |
100 | 101 | from ...lib.polling_async import async_poll_until |
101 | 102 | from ...types.devbox_view import DevboxView |
| 103 | +from ...types.tunnel_view import TunnelView |
102 | 104 | from ...types.devbox_tunnel_view import DevboxTunnelView |
103 | 105 | from ...types.shared_params.mount import Mount |
104 | 106 | from ...types.devbox_snapshot_view import DevboxSnapshotView |
@@ -787,6 +789,55 @@ def download_file( |
787 | 789 | cast_to=BinaryAPIResponse, |
788 | 790 | ) |
789 | 791 |
|
| 792 | + def enable_tunnel( |
| 793 | + self, |
| 794 | + id: str, |
| 795 | + *, |
| 796 | + auth_mode: Optional[Literal["open", "authenticated"]] | Omit = omit, |
| 797 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 798 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 799 | + extra_headers: Headers | None = None, |
| 800 | + extra_query: Query | None = None, |
| 801 | + extra_body: Body | None = None, |
| 802 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 803 | + idempotency_key: str | None = None, |
| 804 | + ) -> TunnelView: |
| 805 | + """Create a V2 tunnel for an existing running Devbox. |
| 806 | +
|
| 807 | + Tunnels provide encrypted |
| 808 | + URL-based access to the Devbox without exposing internal IDs. The tunnel URL |
| 809 | + format is: https://{port}-{tunnel_key}.tunnel.runloop.ai |
| 810 | +
|
| 811 | + Each Devbox can have one tunnel. |
| 812 | +
|
| 813 | + Args: |
| 814 | + auth_mode: Authentication mode for the tunnel. Defaults to 'public' if not specified. |
| 815 | +
|
| 816 | + extra_headers: Send extra headers |
| 817 | +
|
| 818 | + extra_query: Add additional query parameters to the request |
| 819 | +
|
| 820 | + extra_body: Add additional JSON properties to the request |
| 821 | +
|
| 822 | + timeout: Override the client-level default timeout for this request, in seconds |
| 823 | +
|
| 824 | + idempotency_key: Specify a custom idempotency key for this request |
| 825 | + """ |
| 826 | + if not id: |
| 827 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 828 | + return self._post( |
| 829 | + f"/v1/devboxes/{id}/enable_tunnel", |
| 830 | + body=maybe_transform({"auth_mode": auth_mode}, devbox_enable_tunnel_params.DevboxEnableTunnelParams), |
| 831 | + options=make_request_options( |
| 832 | + extra_headers=extra_headers, |
| 833 | + extra_query=extra_query, |
| 834 | + extra_body=extra_body, |
| 835 | + timeout=timeout, |
| 836 | + idempotency_key=idempotency_key, |
| 837 | + ), |
| 838 | + cast_to=TunnelView, |
| 839 | + ) |
| 840 | + |
790 | 841 | def execute( |
791 | 842 | self, |
792 | 843 | id: str, |
@@ -2347,6 +2398,57 @@ async def download_file( |
2347 | 2398 | cast_to=AsyncBinaryAPIResponse, |
2348 | 2399 | ) |
2349 | 2400 |
|
| 2401 | + async def enable_tunnel( |
| 2402 | + self, |
| 2403 | + id: str, |
| 2404 | + *, |
| 2405 | + auth_mode: Optional[Literal["open", "authenticated"]] | Omit = omit, |
| 2406 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 2407 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 2408 | + extra_headers: Headers | None = None, |
| 2409 | + extra_query: Query | None = None, |
| 2410 | + extra_body: Body | None = None, |
| 2411 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 2412 | + idempotency_key: str | None = None, |
| 2413 | + ) -> TunnelView: |
| 2414 | + """Create a V2 tunnel for an existing running Devbox. |
| 2415 | +
|
| 2416 | + Tunnels provide encrypted |
| 2417 | + URL-based access to the Devbox without exposing internal IDs. The tunnel URL |
| 2418 | + format is: https://{port}-{tunnel_key}.tunnel.runloop.ai |
| 2419 | +
|
| 2420 | + Each Devbox can have one tunnel. |
| 2421 | +
|
| 2422 | + Args: |
| 2423 | + auth_mode: Authentication mode for the tunnel. Defaults to 'public' if not specified. |
| 2424 | +
|
| 2425 | + extra_headers: Send extra headers |
| 2426 | +
|
| 2427 | + extra_query: Add additional query parameters to the request |
| 2428 | +
|
| 2429 | + extra_body: Add additional JSON properties to the request |
| 2430 | +
|
| 2431 | + timeout: Override the client-level default timeout for this request, in seconds |
| 2432 | +
|
| 2433 | + idempotency_key: Specify a custom idempotency key for this request |
| 2434 | + """ |
| 2435 | + if not id: |
| 2436 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 2437 | + return await self._post( |
| 2438 | + f"/v1/devboxes/{id}/enable_tunnel", |
| 2439 | + body=await async_maybe_transform( |
| 2440 | + {"auth_mode": auth_mode}, devbox_enable_tunnel_params.DevboxEnableTunnelParams |
| 2441 | + ), |
| 2442 | + options=make_request_options( |
| 2443 | + extra_headers=extra_headers, |
| 2444 | + extra_query=extra_query, |
| 2445 | + extra_body=extra_body, |
| 2446 | + timeout=timeout, |
| 2447 | + idempotency_key=idempotency_key, |
| 2448 | + ), |
| 2449 | + cast_to=TunnelView, |
| 2450 | + ) |
| 2451 | + |
2350 | 2452 | async def execute( |
2351 | 2453 | self, |
2352 | 2454 | id: str, |
@@ -3293,6 +3395,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
3293 | 3395 | devboxes.download_file, |
3294 | 3396 | BinaryAPIResponse, |
3295 | 3397 | ) |
| 3398 | + self.enable_tunnel = to_raw_response_wrapper( |
| 3399 | + devboxes.enable_tunnel, |
| 3400 | + ) |
3296 | 3401 | self.execute = to_raw_response_wrapper( |
3297 | 3402 | devboxes.execute, |
3298 | 3403 | ) |
@@ -3395,6 +3500,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
3395 | 3500 | devboxes.download_file, |
3396 | 3501 | AsyncBinaryAPIResponse, |
3397 | 3502 | ) |
| 3503 | + self.enable_tunnel = async_to_raw_response_wrapper( |
| 3504 | + devboxes.enable_tunnel, |
| 3505 | + ) |
3398 | 3506 | self.execute = async_to_raw_response_wrapper( |
3399 | 3507 | devboxes.execute, |
3400 | 3508 | ) |
@@ -3497,6 +3605,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: |
3497 | 3605 | devboxes.download_file, |
3498 | 3606 | StreamedBinaryAPIResponse, |
3499 | 3607 | ) |
| 3608 | + self.enable_tunnel = to_streamed_response_wrapper( |
| 3609 | + devboxes.enable_tunnel, |
| 3610 | + ) |
3500 | 3611 | self.execute = to_streamed_response_wrapper( |
3501 | 3612 | devboxes.execute, |
3502 | 3613 | ) |
@@ -3599,6 +3710,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: |
3599 | 3710 | devboxes.download_file, |
3600 | 3711 | AsyncStreamedBinaryAPIResponse, |
3601 | 3712 | ) |
| 3713 | + self.enable_tunnel = async_to_streamed_response_wrapper( |
| 3714 | + devboxes.enable_tunnel, |
| 3715 | + ) |
3602 | 3716 | self.execute = async_to_streamed_response_wrapper( |
3603 | 3717 | devboxes.execute, |
3604 | 3718 | ) |
|
0 commit comments