diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10f309169..b06ba9199 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0" + ".": "0.2.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d9a0a6044..87416d7da 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-d5b31b4bbf540f07391766a9217f0dc872e3c9015dc2282b7b346f6594acbe0c.yml +configured_endpoints: 29 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-9637e8217fe437592df1d3e503321093cd72be915633e35aada927c3336148da.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f5785e22..64a8472f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.2.1 (2024-10-11) + +Full Changelog: [v0.2.0...v0.2.1](https://github.com/runloopai/api-client-python/compare/v0.2.0...v0.2.1) + +### Features + +* **api:** api update ([#190](https://github.com/runloopai/api-client-python/issues/190)) ([4b40a20](https://github.com/runloopai/api-client-python/commit/4b40a20d3603f8a0dfdb0ecf8884682193e986d9)) +* **api:** api update ([#192](https://github.com/runloopai/api-client-python/issues/192)) ([51358a5](https://github.com/runloopai/api-client-python/commit/51358a52a59b31729f05c40a6f84af467313f568)) +* **api:** api update ([#193](https://github.com/runloopai/api-client-python/issues/193)) ([d4c04da](https://github.com/runloopai/api-client-python/commit/d4c04da4e1726dd70a638748034e2c86ead63142)) +* **api:** api update ([#194](https://github.com/runloopai/api-client-python/issues/194)) ([31fcc6c](https://github.com/runloopai/api-client-python/commit/31fcc6cc52cc1e7cf782b9fd00d75049f455bb98)) +* **api:** api update ([#195](https://github.com/runloopai/api-client-python/issues/195)) ([4b3112b](https://github.com/runloopai/api-client-python/commit/4b3112bb3e0620fbce4f37bdd4fe06e3bdbaa0d5)) +* **api:** api update ([#196](https://github.com/runloopai/api-client-python/issues/196)) ([f367ac3](https://github.com/runloopai/api-client-python/commit/f367ac3014e94f4be43480fbb8404a8c95b853fe)) +* **api:** api update ([#197](https://github.com/runloopai/api-client-python/issues/197)) ([f5d88d9](https://github.com/runloopai/api-client-python/commit/f5d88d970de6e2820449eedbddc424f387a147ff)) +* **api:** api update ([#198](https://github.com/runloopai/api-client-python/issues/198)) ([6a8c688](https://github.com/runloopai/api-client-python/commit/6a8c688473c715c6bf82a81084a414ea844bac01)) +* **api:** api update ([#199](https://github.com/runloopai/api-client-python/issues/199)) ([e36adf9](https://github.com/runloopai/api-client-python/commit/e36adf900d0c7ee4e25ea1d806c2da2f17cc48eb)) +* **api:** api update ([#200](https://github.com/runloopai/api-client-python/issues/200)) ([2b51e56](https://github.com/runloopai/api-client-python/commit/2b51e5641684c23ddaaf23131b3fe8eba0877925)) + ## 0.2.0 (2024-10-10) Full Changelog: [v0.1.0-alpha.23...v0.2.0](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.23...v0.2.0) diff --git a/api.md b/api.md index f9ca5e509..7185c77d4 100644 --- a/api.md +++ b/api.md @@ -1,15 +1,11 @@ # Shared Types ```python -from runloop_api_client.types import FunctionInvocationExecutionDetailView, ProjectLogsView -``` - -# Account - -Types: - -```python -from runloop_api_client.types import ResourceSize +from runloop_api_client.types import ( + FunctionInvocationExecutionDetailView, + LaunchParameters, + ProjectLogsView, +) ``` # Blueprints @@ -52,9 +48,10 @@ from runloop_api_client.types import ( DevboxAsyncExecutionDetailView, DevboxExecutionDetailView, DevboxListView, + DevboxSnapshotListView, + DevboxSnapshotView, DevboxView, DevboxCreateSSHKeyResponse, - DevboxDiskSnapshotsResponse, DevboxReadFileContentsResponse, DevboxUploadFileResponse, ) @@ -66,12 +63,13 @@ Methods: - client.devboxes.retrieve(id) -> DevboxView - client.devboxes.list(\*\*params) -> DevboxListView - client.devboxes.create_ssh_key(id) -> DevboxCreateSSHKeyResponse -- client.devboxes.disk_snapshots(\*\*params) -> DevboxDiskSnapshotsResponse +- client.devboxes.disk_snapshots(\*\*params) -> DevboxSnapshotListView - client.devboxes.download_file(id, \*\*params) -> BinaryAPIResponse - client.devboxes.execute_async(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_sync(id, \*\*params) -> DevboxExecutionDetailView - client.devboxes.read_file_contents(id, \*\*params) -> str - client.devboxes.shutdown(id) -> DevboxView +- client.devboxes.snapshot_disk(id, \*\*params) -> None - client.devboxes.upload_file(id, \*\*params) -> object - client.devboxes.write_file(id, \*\*params) -> DevboxExecutionDetailView diff --git a/pyproject.toml b/pyproject.toml index 4077fc8eb..9b0c61d68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runloop_api_client" -version = "0.2.0" +version = "0.2.1" description = "The official Python library for the runloop API" dynamic = ["readme"] license = "MIT" diff --git a/src/runloop_api_client/_version.py b/src/runloop_api_client/_version.py index 7e03c3115..b4c93d59f 100644 --- a/src/runloop_api_client/_version.py +++ b/src/runloop_api_client/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "runloop_api_client" -__version__ = "0.2.0" # x-release-please-version +__version__ = "0.2.1" # x-release-please-version diff --git a/src/runloop_api_client/resources/blueprints.py b/src/runloop_api_client/resources/blueprints.py index f4405b773..8acbd7631 100644 --- a/src/runloop_api_client/resources/blueprints.py +++ b/src/runloop_api_client/resources/blueprints.py @@ -26,6 +26,7 @@ from ..types.blueprint_preview_view import BlueprintPreviewView from ..types.code_mount_parameters_param import CodeMountParametersParam from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView +from ..types.shared_params.launch_parameters import LaunchParameters __all__ = ["BlueprintsResource", "AsyncBlueprintsResource"] @@ -57,7 +58,7 @@ def create( code_mounts: Iterable[CodeMountParametersParam] | NotGiven = NOT_GIVEN, dockerfile: str | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: blueprint_create_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, system_setup_commands: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -237,7 +238,7 @@ def preview( code_mounts: Iterable[CodeMountParametersParam] | NotGiven = NOT_GIVEN, dockerfile: str | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: blueprint_preview_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, system_setup_commands: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -319,7 +320,7 @@ async def create( code_mounts: Iterable[CodeMountParametersParam] | NotGiven = NOT_GIVEN, dockerfile: str | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: blueprint_create_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, system_setup_commands: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -499,7 +500,7 @@ async def preview( code_mounts: Iterable[CodeMountParametersParam] | NotGiven = NOT_GIVEN, dockerfile: str | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: blueprint_preview_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, system_setup_commands: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index df85bf094..4c35bda9e 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -22,10 +22,11 @@ devbox_execute_sync_params, devbox_download_file_params, devbox_execute_async_params, + devbox_snapshot_disk_params, devbox_disk_snapshots_params, devbox_read_file_contents_params, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes from ..._utils import ( extract_files, maybe_transform, @@ -59,10 +60,11 @@ from ..._base_client import make_request_options from ...types.devbox_view import DevboxView from ...types.devbox_list_view import DevboxListView +from ...types.devbox_snapshot_list_view import DevboxSnapshotListView from ...types.code_mount_parameters_param import CodeMountParametersParam from ...types.devbox_execution_detail_view import DevboxExecutionDetailView from ...types.devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse -from ...types.devbox_disk_snapshots_response import DevboxDiskSnapshotsResponse +from ...types.shared_params.launch_parameters import LaunchParameters from ...types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView __all__ = ["DevboxesResource", "AsyncDevboxesResource"] @@ -105,7 +107,7 @@ def create( entrypoint: str | NotGiven = NOT_GIVEN, environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: devbox_create_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, prebuilt: str | NotGiven = NOT_GIVEN, @@ -317,7 +319,7 @@ def disk_snapshots( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DevboxDiskSnapshotsResponse: + ) -> DevboxSnapshotListView: """ List all snapshots of a devbox by id. @@ -349,7 +351,7 @@ def disk_snapshots( devbox_disk_snapshots_params.DevboxDiskSnapshotsParams, ), ), - cast_to=DevboxDiskSnapshotsResponse, + cast_to=DevboxSnapshotListView, ) def download_file( @@ -556,6 +558,53 @@ def shutdown( cast_to=DevboxView, ) + def snapshot_disk( + self, + id: str, + *, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create a filesystem snapshot of a devbox with the specified name and metadata. + + Args: + metadata: (Optional) Metadata used to describe the snapshot + + name: (Optional) A user specified name to give the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/v1/devboxes/{id}/snapshot_disk", + body=maybe_transform( + { + "metadata": metadata, + "name": name, + }, + devbox_snapshot_disk_params.DevboxSnapshotDiskParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + def upload_file( self, id: str, @@ -688,7 +737,7 @@ async def create( entrypoint: str | NotGiven = NOT_GIVEN, environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN, file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN, - launch_parameters: devbox_create_params.LaunchParameters | NotGiven = NOT_GIVEN, + launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN, metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, prebuilt: str | NotGiven = NOT_GIVEN, @@ -900,7 +949,7 @@ async def disk_snapshots( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DevboxDiskSnapshotsResponse: + ) -> DevboxSnapshotListView: """ List all snapshots of a devbox by id. @@ -932,7 +981,7 @@ async def disk_snapshots( devbox_disk_snapshots_params.DevboxDiskSnapshotsParams, ), ), - cast_to=DevboxDiskSnapshotsResponse, + cast_to=DevboxSnapshotListView, ) async def download_file( @@ -1139,6 +1188,53 @@ async def shutdown( cast_to=DevboxView, ) + async def snapshot_disk( + self, + id: str, + *, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create a filesystem snapshot of a devbox with the specified name and metadata. + + Args: + metadata: (Optional) Metadata used to describe the snapshot + + name: (Optional) A user specified name to give the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/v1/devboxes/{id}/snapshot_disk", + body=await async_maybe_transform( + { + "metadata": metadata, + "name": name, + }, + devbox_snapshot_disk_params.DevboxSnapshotDiskParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + async def upload_file( self, id: str, @@ -1269,6 +1365,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.shutdown = to_raw_response_wrapper( devboxes.shutdown, ) + self.snapshot_disk = to_raw_response_wrapper( + devboxes.snapshot_disk, + ) self.upload_file = to_raw_response_wrapper( devboxes.upload_file, ) @@ -1320,6 +1419,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.shutdown = async_to_raw_response_wrapper( devboxes.shutdown, ) + self.snapshot_disk = async_to_raw_response_wrapper( + devboxes.snapshot_disk, + ) self.upload_file = async_to_raw_response_wrapper( devboxes.upload_file, ) @@ -1371,6 +1473,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.shutdown = to_streamed_response_wrapper( devboxes.shutdown, ) + self.snapshot_disk = to_streamed_response_wrapper( + devboxes.snapshot_disk, + ) self.upload_file = to_streamed_response_wrapper( devboxes.upload_file, ) @@ -1422,6 +1527,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.shutdown = async_to_streamed_response_wrapper( devboxes.shutdown, ) + self.snapshot_disk = async_to_streamed_response_wrapper( + devboxes.snapshot_disk, + ) self.upload_file = async_to_streamed_response_wrapper( devboxes.upload_file, ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index 1b6c191cd..a5fe07214 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -4,10 +4,10 @@ from .shared import ( ProjectLogsView as ProjectLogsView, + LaunchParameters as LaunchParameters, FunctionInvocationExecutionDetailView as FunctionInvocationExecutionDetailView, ) from .devbox_view import DevboxView as DevboxView -from .resource_size import ResourceSize as ResourceSize from .blueprint_view import BlueprintView as BlueprintView from .devbox_list_view import DevboxListView as DevboxListView from .project_list_view import ProjectListView as ProjectListView @@ -16,25 +16,27 @@ from .blueprint_build_log import BlueprintBuildLog as BlueprintBuildLog from .blueprint_list_view import BlueprintListView as BlueprintListView from .devbox_create_params import DevboxCreateParams as DevboxCreateParams +from .devbox_snapshot_view import DevboxSnapshotView as DevboxSnapshotView from .blueprint_list_params import BlueprintListParams as BlueprintListParams from .code_mount_parameters import CodeMountParameters as CodeMountParameters from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView from .blueprint_create_params import BlueprintCreateParams as BlueprintCreateParams from .blueprint_preview_params import BlueprintPreviewParams as BlueprintPreviewParams from .devbox_write_file_params import DevboxWriteFileParams as DevboxWriteFileParams +from .devbox_snapshot_list_view import DevboxSnapshotListView as DevboxSnapshotListView from .devbox_upload_file_params import DevboxUploadFileParams as DevboxUploadFileParams from .blueprint_build_parameters import BlueprintBuildParameters as BlueprintBuildParameters from .devbox_execute_sync_params import DevboxExecuteSyncParams as DevboxExecuteSyncParams from .code_mount_parameters_param import CodeMountParametersParam as CodeMountParametersParam from .devbox_download_file_params import DevboxDownloadFileParams as DevboxDownloadFileParams from .devbox_execute_async_params import DevboxExecuteAsyncParams as DevboxExecuteAsyncParams +from .devbox_snapshot_disk_params import DevboxSnapshotDiskParams as DevboxSnapshotDiskParams from .function_invoke_sync_params import FunctionInvokeSyncParams as FunctionInvokeSyncParams from .devbox_disk_snapshots_params import DevboxDiskSnapshotsParams as DevboxDiskSnapshotsParams from .devbox_execution_detail_view import DevboxExecutionDetailView as DevboxExecutionDetailView from .function_invoke_async_params import FunctionInvokeAsyncParams as FunctionInvokeAsyncParams from .blueprint_build_logs_list_view import BlueprintBuildLogsListView as BlueprintBuildLogsListView from .devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse as DevboxCreateSSHKeyResponse -from .devbox_disk_snapshots_response import DevboxDiskSnapshotsResponse as DevboxDiskSnapshotsResponse from .devbox_read_file_contents_params import DevboxReadFileContentsParams as DevboxReadFileContentsParams from .devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView as DevboxAsyncExecutionDetailView from .devbox_read_file_contents_response import DevboxReadFileContentsResponse as DevboxReadFileContentsResponse diff --git a/src/runloop_api_client/types/blueprint_build_parameters.py b/src/runloop_api_client/types/blueprint_build_parameters.py index 57d16c93c..cbd1f4fab 100644 --- a/src/runloop_api_client/types/blueprint_build_parameters.py +++ b/src/runloop_api_client/types/blueprint_build_parameters.py @@ -3,24 +3,10 @@ from typing import Dict, List, Optional from .._models import BaseModel -from .resource_size import ResourceSize from .code_mount_parameters import CodeMountParameters +from .shared.launch_parameters import LaunchParameters -__all__ = ["BlueprintBuildParameters", "LaunchParameters"] - - -class LaunchParameters(BaseModel): - keep_alive_time_seconds: Optional[int] = None - """Time in seconds after which Devbox will automatically shutdown. - - Default is 1 hour. - """ - - launch_commands: Optional[List[str]] = None - """Set of commands to be run at launch time, before the entrypoint process is run.""" - - resource_size_request: Optional[ResourceSize] = None - """Manual resource configuration for Devbox. If not set, defaults will be used.""" +__all__ = ["BlueprintBuildParameters"] class BlueprintBuildParameters(BaseModel): diff --git a/src/runloop_api_client/types/blueprint_create_params.py b/src/runloop_api_client/types/blueprint_create_params.py index 742befdbb..f5468a881 100644 --- a/src/runloop_api_client/types/blueprint_create_params.py +++ b/src/runloop_api_client/types/blueprint_create_params.py @@ -5,10 +5,10 @@ from typing import Dict, List, Iterable from typing_extensions import Required, TypedDict -from .resource_size import ResourceSize from .code_mount_parameters_param import CodeMountParametersParam +from .shared_params.launch_parameters import LaunchParameters -__all__ = ["BlueprintCreateParams", "LaunchParameters"] +__all__ = ["BlueprintCreateParams"] class BlueprintCreateParams(TypedDict, total=False): @@ -29,17 +29,3 @@ class BlueprintCreateParams(TypedDict, total=False): system_setup_commands: List[str] """A list of commands to run to set up your system.""" - - -class LaunchParameters(TypedDict, total=False): - keep_alive_time_seconds: int - """Time in seconds after which Devbox will automatically shutdown. - - Default is 1 hour. - """ - - launch_commands: List[str] - """Set of commands to be run at launch time, before the entrypoint process is run.""" - - resource_size_request: ResourceSize - """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/blueprint_preview_params.py b/src/runloop_api_client/types/blueprint_preview_params.py index eba4d0b20..5093e1549 100644 --- a/src/runloop_api_client/types/blueprint_preview_params.py +++ b/src/runloop_api_client/types/blueprint_preview_params.py @@ -5,10 +5,10 @@ from typing import Dict, List, Iterable from typing_extensions import Required, TypedDict -from .resource_size import ResourceSize from .code_mount_parameters_param import CodeMountParametersParam +from .shared_params.launch_parameters import LaunchParameters -__all__ = ["BlueprintPreviewParams", "LaunchParameters"] +__all__ = ["BlueprintPreviewParams"] class BlueprintPreviewParams(TypedDict, total=False): @@ -29,17 +29,3 @@ class BlueprintPreviewParams(TypedDict, total=False): system_setup_commands: List[str] """A list of commands to run to set up your system.""" - - -class LaunchParameters(TypedDict, total=False): - keep_alive_time_seconds: int - """Time in seconds after which Devbox will automatically shutdown. - - Default is 1 hour. - """ - - launch_commands: List[str] - """Set of commands to be run at launch time, before the entrypoint process is run.""" - - resource_size_request: ResourceSize - """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/devbox_create_params.py b/src/runloop_api_client/types/devbox_create_params.py index 5f8455746..092476a18 100644 --- a/src/runloop_api_client/types/devbox_create_params.py +++ b/src/runloop_api_client/types/devbox_create_params.py @@ -5,10 +5,10 @@ from typing import Dict, List, Iterable from typing_extensions import TypedDict -from .resource_size import ResourceSize from .code_mount_parameters_param import CodeMountParametersParam +from .shared_params.launch_parameters import LaunchParameters -__all__ = ["DevboxCreateParams", "LaunchParameters"] +__all__ = ["DevboxCreateParams"] class DevboxCreateParams(TypedDict, total=False): @@ -62,17 +62,3 @@ class DevboxCreateParams(TypedDict, total=False): snapshot_id: str """Snapshot ID to use for the Devbox.""" - - -class LaunchParameters(TypedDict, total=False): - keep_alive_time_seconds: int - """Time in seconds after which Devbox will automatically shutdown. - - Default is 1 hour. - """ - - launch_commands: List[str] - """Set of commands to be run at launch time, before the entrypoint process is run.""" - - resource_size_request: ResourceSize - """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/devbox_snapshot_disk_params.py b/src/runloop_api_client/types/devbox_snapshot_disk_params.py new file mode 100644 index 000000000..ed30fa14d --- /dev/null +++ b/src/runloop_api_client/types/devbox_snapshot_disk_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import TypedDict + +__all__ = ["DevboxSnapshotDiskParams"] + + +class DevboxSnapshotDiskParams(TypedDict, total=False): + metadata: Dict[str, str] + """(Optional) Metadata used to describe the snapshot""" + + name: str + """(Optional) A user specified name to give the snapshot""" diff --git a/src/runloop_api_client/types/devbox_snapshot_list_view.py b/src/runloop_api_client/types/devbox_snapshot_list_view.py new file mode 100644 index 000000000..6bb1eb530 --- /dev/null +++ b/src/runloop_api_client/types/devbox_snapshot_list_view.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .devbox_snapshot_view import DevboxSnapshotView + +__all__ = ["DevboxSnapshotListView"] + + +class DevboxSnapshotListView(BaseModel): + has_more: bool + + snapshots: List[DevboxSnapshotView] + """List of snapshots matching filter.""" + + total_count: int diff --git a/src/runloop_api_client/types/devbox_snapshot_view.py b/src/runloop_api_client/types/devbox_snapshot_view.py new file mode 100644 index 000000000..8e98726ee --- /dev/null +++ b/src/runloop_api_client/types/devbox_snapshot_view.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["DevboxSnapshotView"] + + +class DevboxSnapshotView(BaseModel): + id: str + """The unique identifier of the snapshot.""" + + metadata: Dict[str, str] + """metadata associated with the snapshot.""" + + source_devbox_id: str = FieldInfo(alias="sourceDevboxId") + """The source devbox identifier.""" + + name: Optional[str] = None + """(Optional) The custom name of the snapshot.""" diff --git a/src/runloop_api_client/types/devbox_view.py b/src/runloop_api_client/types/devbox_view.py index ce50abebf..4831b5425 100644 --- a/src/runloop_api_client/types/devbox_view.py +++ b/src/runloop_api_client/types/devbox_view.py @@ -1,26 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal from .._models import BaseModel -from .resource_size import ResourceSize +from .shared.launch_parameters import LaunchParameters -__all__ = ["DevboxView", "LaunchParameters"] - - -class LaunchParameters(BaseModel): - keep_alive_time_seconds: Optional[int] = None - """Time in seconds after which Devbox will automatically shutdown. - - Default is 1 hour. - """ - - launch_commands: Optional[List[str]] = None - """Set of commands to be run at launch time, before the entrypoint process is run.""" - - resource_size_request: Optional[ResourceSize] = None - """Manual resource configuration for Devbox. If not set, defaults will be used.""" +__all__ = ["DevboxView"] class DevboxView(BaseModel): diff --git a/src/runloop_api_client/types/shared/__init__.py b/src/runloop_api_client/types/shared/__init__.py index e7ddc6d87..0c30deb6b 100644 --- a/src/runloop_api_client/types/shared/__init__.py +++ b/src/runloop_api_client/types/shared/__init__.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .launch_parameters import LaunchParameters as LaunchParameters from .project_logs_view import ProjectLogsView as ProjectLogsView from .function_invocation_execution_detail_view import ( FunctionInvocationExecutionDetailView as FunctionInvocationExecutionDetailView, diff --git a/src/runloop_api_client/types/shared/lauch_parameters.py b/src/runloop_api_client/types/shared/lauch_parameters.py new file mode 100644 index 000000000..bc0ae8f25 --- /dev/null +++ b/src/runloop_api_client/types/shared/lauch_parameters.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from ..resource_size import ResourceSize + +__all__ = ["LauchParameters"] + + +class LauchParameters(BaseModel): + keep_alive_time_seconds: Optional[int] = None + """Time in seconds after which Devbox will automatically shutdown. + + Default is 1 hour. + """ + + launch_commands: Optional[List[str]] = None + """Set of commands to be run at launch time, before the entrypoint process is run.""" + + resource_size_request: Optional[ResourceSize] = None + """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/shared/launch_parameters.py b/src/runloop_api_client/types/shared/launch_parameters.py new file mode 100644 index 000000000..438162797 --- /dev/null +++ b/src/runloop_api_client/types/shared/launch_parameters.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["LaunchParameters"] + + +class LaunchParameters(BaseModel): + keep_alive_time_seconds: Optional[int] = None + """Time in seconds after which Devbox will automatically shutdown. + + Default is 1 hour. + """ + + launch_commands: Optional[List[str]] = None + """Set of commands to be run at launch time, before the entrypoint process is run.""" + + resource_size_request: Optional[Literal["SMALL", "MEDIUM", "LARGE", "X_LARGE", "CUSTOM_SIZE"]] = None + """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/shared/resource_size.py b/src/runloop_api_client/types/shared/resource_size.py new file mode 100644 index 000000000..956955c87 --- /dev/null +++ b/src/runloop_api_client/types/shared/resource_size.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResourceSize"] + +ResourceSize: TypeAlias = Literal["SMALL", "MEDIUM", "LARGE", "X_LARGE", "CUSTOM_SIZE"] diff --git a/src/runloop_api_client/types/shared_params/__init__.py b/src/runloop_api_client/types/shared_params/__init__.py new file mode 100644 index 000000000..4e215e900 --- /dev/null +++ b/src/runloop_api_client/types/shared_params/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .launch_parameters import LaunchParameters as LaunchParameters diff --git a/src/runloop_api_client/types/shared_params/lauch_parameters.py b/src/runloop_api_client/types/shared_params/lauch_parameters.py new file mode 100644 index 000000000..371f1b652 --- /dev/null +++ b/src/runloop_api_client/types/shared_params/lauch_parameters.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +from .resource_size import ResourceSize +from ..resource_size import ResourceSize + +__all__ = ["LauchParameters"] + + +class LauchParameters(TypedDict, total=False): + keep_alive_time_seconds: int + """Time in seconds after which Devbox will automatically shutdown. + + Default is 1 hour. + """ + + launch_commands: List[str] + """Set of commands to be run at launch time, before the entrypoint process is run.""" + + resource_size_request: ResourceSize + """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/src/runloop_api_client/types/shared_params/launch_parameters.py b/src/runloop_api_client/types/shared_params/launch_parameters.py new file mode 100644 index 000000000..19995fdef --- /dev/null +++ b/src/runloop_api_client/types/shared_params/launch_parameters.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, TypedDict + +__all__ = ["LaunchParameters"] + + +class LaunchParameters(TypedDict, total=False): + keep_alive_time_seconds: int + """Time in seconds after which Devbox will automatically shutdown. + + Default is 1 hour. + """ + + launch_commands: List[str] + """Set of commands to be run at launch time, before the entrypoint process is run.""" + + resource_size_request: Literal["SMALL", "MEDIUM", "LARGE", "X_LARGE", "CUSTOM_SIZE"] + """Manual resource configuration for Devbox. If not set, defaults will be used.""" diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index 2989ccb88..b938328f1 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -14,9 +14,9 @@ from runloop_api_client.types import ( DevboxView, DevboxListView, + DevboxSnapshotListView, DevboxExecutionDetailView, DevboxCreateSSHKeyResponse, - DevboxDiskSnapshotsResponse, DevboxAsyncExecutionDetailView, ) from runloop_api_client._response import ( @@ -211,7 +211,7 @@ def test_path_params_create_ssh_key(self, client: Runloop) -> None: @parametrize def test_method_disk_snapshots(self, client: Runloop) -> None: devbox = client.devboxes.disk_snapshots() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize def test_method_disk_snapshots_with_all_params(self, client: Runloop) -> None: @@ -219,7 +219,7 @@ def test_method_disk_snapshots_with_all_params(self, client: Runloop) -> None: limit=0, starting_after="starting_after", ) - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize def test_raw_response_disk_snapshots(self, client: Runloop) -> None: @@ -228,7 +228,7 @@ def test_raw_response_disk_snapshots(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize def test_streaming_response_disk_snapshots(self, client: Runloop) -> None: @@ -237,7 +237,7 @@ def test_streaming_response_disk_snapshots(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True @@ -481,6 +481,53 @@ def test_path_params_shutdown(self, client: Runloop) -> None: "", ) + @parametrize + def test_method_snapshot_disk(self, client: Runloop) -> None: + devbox = client.devboxes.snapshot_disk( + id="id", + ) + assert devbox is None + + @parametrize + def test_method_snapshot_disk_with_all_params(self, client: Runloop) -> None: + devbox = client.devboxes.snapshot_disk( + id="id", + metadata={"foo": "string"}, + name="name", + ) + assert devbox is None + + @parametrize + def test_raw_response_snapshot_disk(self, client: Runloop) -> None: + response = client.devboxes.with_raw_response.snapshot_disk( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = response.parse() + assert devbox is None + + @parametrize + def test_streaming_response_snapshot_disk(self, client: Runloop) -> None: + with client.devboxes.with_streaming_response.snapshot_disk( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = response.parse() + assert devbox is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_snapshot_disk(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.with_raw_response.snapshot_disk( + id="", + ) + @parametrize def test_method_upload_file(self, client: Runloop) -> None: devbox = client.devboxes.upload_file( @@ -757,7 +804,7 @@ async def test_path_params_create_ssh_key(self, async_client: AsyncRunloop) -> N @parametrize async def test_method_disk_snapshots(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.disk_snapshots() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize async def test_method_disk_snapshots_with_all_params(self, async_client: AsyncRunloop) -> None: @@ -765,7 +812,7 @@ async def test_method_disk_snapshots_with_all_params(self, async_client: AsyncRu limit=0, starting_after="starting_after", ) - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize async def test_raw_response_disk_snapshots(self, async_client: AsyncRunloop) -> None: @@ -774,7 +821,7 @@ async def test_raw_response_disk_snapshots(self, async_client: AsyncRunloop) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) @parametrize async def test_streaming_response_disk_snapshots(self, async_client: AsyncRunloop) -> None: @@ -783,7 +830,7 @@ async def test_streaming_response_disk_snapshots(self, async_client: AsyncRunloo assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxDiskSnapshotsResponse, devbox, path=["response"]) + assert_matches_type(DevboxSnapshotListView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1027,6 +1074,53 @@ async def test_path_params_shutdown(self, async_client: AsyncRunloop) -> None: "", ) + @parametrize + async def test_method_snapshot_disk(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.snapshot_disk( + id="id", + ) + assert devbox is None + + @parametrize + async def test_method_snapshot_disk_with_all_params(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.snapshot_disk( + id="id", + metadata={"foo": "string"}, + name="name", + ) + assert devbox is None + + @parametrize + async def test_raw_response_snapshot_disk(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.with_raw_response.snapshot_disk( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = await response.parse() + assert devbox is None + + @parametrize + async def test_streaming_response_snapshot_disk(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.with_streaming_response.snapshot_disk( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = await response.parse() + assert devbox is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_snapshot_disk(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.with_raw_response.snapshot_disk( + id="", + ) + @parametrize async def test_method_upload_file(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.upload_file(