diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 28e831b..2ed3b71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.3" + ".": "0.0.4" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 26f199e..50b64cc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/dedalus-labs%2Fdedalus-7a281169c5f380aa29376e393f8c5f87d35998fecc9e1210835f1165c0bc467f.yml -openapi_spec_hash: da9a43b37a46e0d22a823085861cdd82 -config_hash: 7fcee0473099fe6d9a119f37c80e53d7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/dedalus-labs%2Fdedalus-6a258bad8212a32bd01b1908ab115e08736d156d6907697a7e556b1809383790.yml +openapi_spec_hash: d80976534189646de029c562bb3ca9a1 +config_hash: 795e855c41188604a3e270623e39c126 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a02c65..9d924d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.0.4 (2026-04-01) + +Full Changelog: [v0.0.3...v0.0.4](https://github.com/dedalus-labs/dedalus-python/compare/v0.0.3...v0.0.4) + +### Features + +* **internal:** implement indices array format for query and form serialization ([964fbdf](https://github.com/dedalus-labs/dedalus-python/commit/964fbdfd66a57ce61c8db07cca40032c877a20ed)) + + +### Chores + +* **api:** rename workspaces to machines ([ebbdaee](https://github.com/dedalus-labs/dedalus-python/commit/ebbdaeefd99fb507499f2d9ec5c68f258ccc900e)) +* **tests:** bump steady to v0.20.1 ([fe9a91b](https://github.com/dedalus-labs/dedalus-python/commit/fe9a91b905ce79bd75487c4d1ad7b7e027d1c99e)) +* **tests:** bump steady to v0.20.2 ([e4097a4](https://github.com/dedalus-labs/dedalus-python/commit/e4097a4700e2ccc894504a796e5fa8511d36eacb)) + ## 0.0.3 (2026-03-25) Full Changelog: [v0.0.2...v0.0.3](https://github.com/dedalus-labs/dedalus-python/compare/v0.0.2...v0.0.3) diff --git a/README.md b/README.md index da701dd..2ee8b86 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,12 @@ client = Dedalus( api_key=os.environ.get("DEDALUS_API_KEY"), # This is the default and can be omitted ) -workspace = client.workspaces.create( +machine = client.machines.create( memory_mib=2048, storage_gib=10, vcpu=1, ) -print(workspace.workspace_id) +print(machine.machine_id) ``` While you can provide a `x_api_key` keyword argument, @@ -69,12 +69,12 @@ client = AsyncDedalus( async def main() -> None: - workspace = await client.workspaces.create( + machine = await client.machines.create( memory_mib=2048, storage_gib=10, vcpu=1, ) - print(workspace.workspace_id) + print(machine.machine_id) asyncio.run(main()) @@ -107,12 +107,12 @@ async def main() -> None: api_key=os.environ.get("DEDALUS_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: - workspace = await client.workspaces.create( + machine = await client.machines.create( memory_mib=2048, storage_gib=10, vcpu=1, ) - print(workspace.workspace_id) + print(machine.machine_id) asyncio.run(main()) @@ -127,11 +127,11 @@ from dedalus_sdk import Dedalus client = Dedalus() -stream = client.workspaces.watch( - workspace_id="workspace_id", +stream = client.machines.watch( + machine_id="machine_id", ) -for workspace in stream: - print(workspace.workspace_id) +for machine in stream: + print(machine.machine_id) ``` The async client uses the exact same interface. @@ -141,11 +141,11 @@ from dedalus_sdk import AsyncDedalus client = AsyncDedalus() -stream = await client.workspaces.watch( - workspace_id="workspace_id", +stream = await client.machines.watch( + machine_id="machine_id", ) -async for workspace in stream: - print(workspace.workspace_id) +async for machine in stream: + print(machine.machine_id) ``` ## Using types @@ -168,12 +168,12 @@ from dedalus_sdk import Dedalus client = Dedalus() -all_workspaces = [] +all_machines = [] # Automatically fetches more pages as needed. -for workspace in client.workspaces.list(): - # Do something with workspace here - all_workspaces.append(workspace) -print(all_workspaces) +for machine in client.machines.list(): + # Do something with machine here + all_machines.append(machine) +print(all_machines) ``` Or, asynchronously: @@ -186,11 +186,11 @@ client = AsyncDedalus() async def main() -> None: - all_workspaces = [] + all_machines = [] # Iterate through items across all pages, issuing requests as needed. - async for workspace in client.workspaces.list(): - all_workspaces.append(workspace) - print(all_workspaces) + async for machine in client.machines.list(): + all_machines.append(machine) + print(all_machines) asyncio.run(main()) @@ -199,7 +199,7 @@ asyncio.run(main()) Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: ```python -first_page = await client.workspaces.list() +first_page = await client.machines.list() if first_page.has_next_page(): print(f"will fetch next page using these details: {first_page.next_page_info()}") next_page = await first_page.get_next_page() @@ -211,11 +211,11 @@ if first_page.has_next_page(): Or just work directly with the returned data: ```python -first_page = await client.workspaces.list() +first_page = await client.machines.list() print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..." -for workspace in first_page.items: - print(workspace.workspace_id) +for machine in first_page.items: + print(machine.machine_id) # Remove `await` for non-async usage. ``` @@ -236,7 +236,7 @@ from dedalus_sdk import Dedalus client = Dedalus() try: - client.workspaces.create( + client.machines.create( memory_mib=2048, storage_gib=10, vcpu=1, @@ -283,7 +283,7 @@ client = Dedalus( ) # Or, configure per-request: -client.with_options(max_retries=5).workspaces.create( +client.with_options(max_retries=5).machines.create( memory_mib=2048, storage_gib=10, vcpu=1, @@ -310,7 +310,7 @@ client = Dedalus( ) # Override per-request: -client.with_options(timeout=5.0).workspaces.create( +client.with_options(timeout=5.0).machines.create( memory_mib=2048, storage_gib=10, vcpu=1, @@ -355,15 +355,15 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to from dedalus_sdk import Dedalus client = Dedalus() -response = client.workspaces.with_raw_response.create( +response = client.machines.with_raw_response.create( memory_mib=2048, storage_gib=10, vcpu=1, ) print(response.headers.get('X-My-Header')) -workspace = response.parse() # get the object that `workspaces.create()` would have returned -print(workspace.workspace_id) +machine = response.parse() # get the object that `machines.create()` would have returned +print(machine.machine_id) ``` These methods return an [`APIResponse`](https://github.com/dedalus-labs/dedalus-python/tree/main/src/dedalus_sdk/_response.py) object. @@ -377,7 +377,7 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.workspaces.with_streaming_response.create( +with client.machines.with_streaming_response.create( memory_mib=2048, storage_gib=10, vcpu=1, diff --git a/api.md b/api.md index 14c717c..21d79de 100644 --- a/api.md +++ b/api.md @@ -1,55 +1,62 @@ -# Workspaces +# Machines Types: ```python -from dedalus_sdk.types import CreateParams, LifecycleStatus, UpdateParams, Workspace, WorkspaceList +from dedalus_sdk.types import ( + CreateParams, + LifecycleStatus, + Machine, + MachineList, + MachineListItem, + UpdateParams, +) ``` Methods: -- client.workspaces.create(\*\*params) -> Workspace -- client.workspaces.retrieve(workspace_id) -> Workspace -- client.workspaces.update(workspace_id, \*\*params) -> Workspace -- client.workspaces.list(\*\*params) -> SyncCursorPage[Item] -- client.workspaces.delete(workspace_id) -> Workspace -- client.workspaces.watch(workspace_id) -> Workspace +- client.machines.create(\*\*params) -> Machine +- client.machines.retrieve(\*, machine_id) -> Machine +- client.machines.update(\*, machine_id, \*\*params) -> Machine +- client.machines.list(\*\*params) -> SyncCursorPage[MachineListItem] +- client.machines.delete(\*, machine_id) -> Machine +- client.machines.watch(\*, machine_id) -> Machine ## Artifacts Types: ```python -from dedalus_sdk.types.workspaces import Artifact, ArtifactList +from dedalus_sdk.types.machines import Artifact, ArtifactList ``` Methods: -- client.workspaces.artifacts.retrieve(artifact_id, \*, workspace_id) -> Artifact -- client.workspaces.artifacts.list(workspace_id, \*\*params) -> SyncCursorPage[Artifact] -- client.workspaces.artifacts.delete(artifact_id, \*, workspace_id) -> Artifact +- client.machines.artifacts.retrieve(\*, machine_id, artifact_id) -> Artifact +- client.machines.artifacts.list(\*, machine_id, \*\*params) -> SyncCursorPage[Artifact] +- client.machines.artifacts.delete(\*, machine_id, artifact_id) -> Artifact ## Previews Types: ```python -from dedalus_sdk.types.workspaces import Preview, PreviewCreateParams, PreviewList +from dedalus_sdk.types.machines import Preview, PreviewCreateParams, PreviewList ``` Methods: -- client.workspaces.previews.create(workspace_id, \*\*params) -> Preview -- client.workspaces.previews.retrieve(preview_id, \*, workspace_id) -> Preview -- client.workspaces.previews.list(workspace_id, \*\*params) -> SyncCursorPage[Preview] -- client.workspaces.previews.delete(preview_id, \*, workspace_id) -> Preview +- client.machines.previews.create(\*, machine_id, \*\*params) -> Preview +- client.machines.previews.retrieve(\*, machine_id, preview_id) -> Preview +- client.machines.previews.list(\*, machine_id, \*\*params) -> SyncCursorPage[Preview] +- client.machines.previews.delete(\*, machine_id, preview_id) -> Preview ## SSH Types: ```python -from dedalus_sdk.types.workspaces import ( +from dedalus_sdk.types.machines import ( SSHConnection, SSHHostTrust, SSHSession, @@ -60,17 +67,17 @@ from dedalus_sdk.types.workspaces import ( Methods: -- client.workspaces.ssh.create(workspace_id, \*\*params) -> SSHSession -- client.workspaces.ssh.retrieve(session_id, \*, workspace_id) -> SSHSession -- client.workspaces.ssh.list(workspace_id, \*\*params) -> SyncCursorPage[SSHSession] -- client.workspaces.ssh.delete(session_id, \*, workspace_id) -> SSHSession +- client.machines.ssh.create(\*, machine_id, \*\*params) -> SSHSession +- client.machines.ssh.retrieve(\*, machine_id, session_id) -> SSHSession +- client.machines.ssh.list(\*, machine_id, \*\*params) -> SyncCursorPage[SSHSession] +- client.machines.ssh.delete(\*, machine_id, session_id) -> SSHSession ## Executions Types: ```python -from dedalus_sdk.types.workspaces import ( +from dedalus_sdk.types.machines import ( ArtifactRef, Execution, ExecutionCreateParams, @@ -83,19 +90,19 @@ from dedalus_sdk.types.workspaces import ( Methods: -- client.workspaces.executions.create(workspace_id, \*\*params) -> Execution -- client.workspaces.executions.retrieve(execution_id, \*, workspace_id) -> Execution -- client.workspaces.executions.list(workspace_id, \*\*params) -> SyncCursorPage[Execution] -- client.workspaces.executions.delete(execution_id, \*, workspace_id) -> Execution -- client.workspaces.executions.events(execution_id, \*, workspace_id, \*\*params) -> SyncCursorPage[ExecutionEvent] -- client.workspaces.executions.output(execution_id, \*, workspace_id) -> ExecutionOutput +- client.machines.executions.create(\*, machine_id, \*\*params) -> Execution +- client.machines.executions.retrieve(\*, machine_id, execution_id) -> Execution +- client.machines.executions.list(\*, machine_id, \*\*params) -> SyncCursorPage[Execution] +- client.machines.executions.delete(\*, machine_id, execution_id) -> Execution +- client.machines.executions.events(\*, machine_id, execution_id, \*\*params) -> SyncCursorPage[ExecutionEvent] +- client.machines.executions.output(\*, machine_id, execution_id) -> ExecutionOutput ## Terminals Types: ```python -from dedalus_sdk.types.workspaces import ( +from dedalus_sdk.types.machines import ( Terminal, TerminalClientEvent, TerminalClosedEvent, @@ -111,7 +118,7 @@ from dedalus_sdk.types.workspaces import ( Methods: -- client.workspaces.terminals.create(workspace_id, \*\*params) -> Terminal -- client.workspaces.terminals.retrieve(terminal_id, \*, workspace_id) -> Terminal -- client.workspaces.terminals.list(workspace_id, \*\*params) -> SyncCursorPage[Terminal] -- client.workspaces.terminals.delete(terminal_id, \*, workspace_id) -> Terminal +- client.machines.terminals.create(\*, machine_id, \*\*params) -> Terminal +- client.machines.terminals.retrieve(\*, machine_id, terminal_id) -> Terminal +- client.machines.terminals.list(\*, machine_id, \*\*params) -> SyncCursorPage[Terminal] +- client.machines.terminals.delete(\*, machine_id, terminal_id) -> Terminal diff --git a/pyproject.toml b/pyproject.toml index 190cfd6..9186892 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "dedalus-sdk" -version = "0.0.3" +version = "0.0.4" description = "The official Python library for the Dedalus API" dynamic = ["readme"] license = "MIT" diff --git a/scripts/mock b/scripts/mock index 09eb49f..7c58865 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.7 -- steady --version + npm exec --package=@stdy/cli@0.20.2 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index d13602a..4f1b756 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 diff --git a/src/dedalus_sdk/_client.py b/src/dedalus_sdk/_client.py index 7eea679..892f5a5 100644 --- a/src/dedalus_sdk/_client.py +++ b/src/dedalus_sdk/_client.py @@ -33,8 +33,8 @@ ) if TYPE_CHECKING: - from .resources import workspaces - from .resources.workspaces.workspaces import WorkspacesResource, AsyncWorkspacesResource + from .resources import machines + from .resources.machines.machines import MachinesResource, AsyncMachinesResource __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Dedalus", "AsyncDedalus", "Client", "AsyncClient"] @@ -121,10 +121,10 @@ def __init__( self._default_stream_cls = Stream @cached_property - def workspaces(self) -> WorkspacesResource: - from .resources.workspaces import WorkspacesResource + def machines(self) -> MachinesResource: + from .resources.machines import MachinesResource - return WorkspacesResource(self) + return MachinesResource(self) @cached_property def with_raw_response(self) -> DedalusWithRawResponse: @@ -137,7 +137,7 @@ def with_streaming_response(self) -> DedalusWithStreamedResponse: @property @override def qs(self) -> Querystring: - return Querystring(array_format="comma") + return Querystring(array_format="repeat") @override def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @@ -355,10 +355,10 @@ def __init__( self._default_stream_cls = AsyncStream @cached_property - def workspaces(self) -> AsyncWorkspacesResource: - from .resources.workspaces import AsyncWorkspacesResource + def machines(self) -> AsyncMachinesResource: + from .resources.machines import AsyncMachinesResource - return AsyncWorkspacesResource(self) + return AsyncMachinesResource(self) @cached_property def with_raw_response(self) -> AsyncDedalusWithRawResponse: @@ -371,7 +371,7 @@ def with_streaming_response(self) -> AsyncDedalusWithStreamedResponse: @property @override def qs(self) -> Querystring: - return Querystring(array_format="comma") + return Querystring(array_format="repeat") @override def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @@ -514,10 +514,10 @@ def __init__(self, client: Dedalus) -> None: self._client = client @cached_property - def workspaces(self) -> workspaces.WorkspacesResourceWithRawResponse: - from .resources.workspaces import WorkspacesResourceWithRawResponse + def machines(self) -> machines.MachinesResourceWithRawResponse: + from .resources.machines import MachinesResourceWithRawResponse - return WorkspacesResourceWithRawResponse(self._client.workspaces) + return MachinesResourceWithRawResponse(self._client.machines) class AsyncDedalusWithRawResponse: @@ -527,10 +527,10 @@ def __init__(self, client: AsyncDedalus) -> None: self._client = client @cached_property - def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithRawResponse: - from .resources.workspaces import AsyncWorkspacesResourceWithRawResponse + def machines(self) -> machines.AsyncMachinesResourceWithRawResponse: + from .resources.machines import AsyncMachinesResourceWithRawResponse - return AsyncWorkspacesResourceWithRawResponse(self._client.workspaces) + return AsyncMachinesResourceWithRawResponse(self._client.machines) class DedalusWithStreamedResponse: @@ -540,10 +540,10 @@ def __init__(self, client: Dedalus) -> None: self._client = client @cached_property - def workspaces(self) -> workspaces.WorkspacesResourceWithStreamingResponse: - from .resources.workspaces import WorkspacesResourceWithStreamingResponse + def machines(self) -> machines.MachinesResourceWithStreamingResponse: + from .resources.machines import MachinesResourceWithStreamingResponse - return WorkspacesResourceWithStreamingResponse(self._client.workspaces) + return MachinesResourceWithStreamingResponse(self._client.machines) class AsyncDedalusWithStreamedResponse: @@ -553,10 +553,10 @@ def __init__(self, client: AsyncDedalus) -> None: self._client = client @cached_property - def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithStreamingResponse: - from .resources.workspaces import AsyncWorkspacesResourceWithStreamingResponse + def machines(self) -> machines.AsyncMachinesResourceWithStreamingResponse: + from .resources.machines import AsyncMachinesResourceWithStreamingResponse - return AsyncWorkspacesResourceWithStreamingResponse(self._client.workspaces) + return AsyncMachinesResourceWithStreamingResponse(self._client.machines) Client = Dedalus diff --git a/src/dedalus_sdk/_qs.py b/src/dedalus_sdk/_qs.py index ada6fd3..de8c99b 100644 --- a/src/dedalus_sdk/_qs.py +++ b/src/dedalus_sdk/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" diff --git a/src/dedalus_sdk/_version.py b/src/dedalus_sdk/_version.py index 8fd0082..8004aa5 100644 --- a/src/dedalus_sdk/_version.py +++ b/src/dedalus_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "dedalus_sdk" -__version__ = "0.0.3" # x-release-please-version +__version__ = "0.0.4" # x-release-please-version diff --git a/src/dedalus_sdk/resources/__init__.py b/src/dedalus_sdk/resources/__init__.py index b897851..2967015 100644 --- a/src/dedalus_sdk/resources/__init__.py +++ b/src/dedalus_sdk/resources/__init__.py @@ -1,19 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .workspaces import ( - WorkspacesResource, - AsyncWorkspacesResource, - WorkspacesResourceWithRawResponse, - AsyncWorkspacesResourceWithRawResponse, - WorkspacesResourceWithStreamingResponse, - AsyncWorkspacesResourceWithStreamingResponse, +from .machines import ( + MachinesResource, + AsyncMachinesResource, + MachinesResourceWithRawResponse, + AsyncMachinesResourceWithRawResponse, + MachinesResourceWithStreamingResponse, + AsyncMachinesResourceWithStreamingResponse, ) __all__ = [ - "WorkspacesResource", - "AsyncWorkspacesResource", - "WorkspacesResourceWithRawResponse", - "AsyncWorkspacesResourceWithRawResponse", - "WorkspacesResourceWithStreamingResponse", - "AsyncWorkspacesResourceWithStreamingResponse", + "MachinesResource", + "AsyncMachinesResource", + "MachinesResourceWithRawResponse", + "AsyncMachinesResourceWithRawResponse", + "MachinesResourceWithStreamingResponse", + "AsyncMachinesResourceWithStreamingResponse", ] diff --git a/src/dedalus_sdk/resources/workspaces/__init__.py b/src/dedalus_sdk/resources/machines/__init__.py similarity index 83% rename from src/dedalus_sdk/resources/workspaces/__init__.py rename to src/dedalus_sdk/resources/machines/__init__.py index c9822e7..75f56d8 100644 --- a/src/dedalus_sdk/resources/workspaces/__init__.py +++ b/src/dedalus_sdk/resources/machines/__init__.py @@ -8,6 +8,14 @@ SSHResourceWithStreamingResponse, AsyncSSHResourceWithStreamingResponse, ) +from .machines import ( + MachinesResource, + AsyncMachinesResource, + MachinesResourceWithRawResponse, + AsyncMachinesResourceWithRawResponse, + MachinesResourceWithStreamingResponse, + AsyncMachinesResourceWithStreamingResponse, +) from .previews import ( PreviewsResource, AsyncPreviewsResource, @@ -40,14 +48,6 @@ ExecutionsResourceWithStreamingResponse, AsyncExecutionsResourceWithStreamingResponse, ) -from .workspaces import ( - WorkspacesResource, - AsyncWorkspacesResource, - WorkspacesResourceWithRawResponse, - AsyncWorkspacesResourceWithRawResponse, - WorkspacesResourceWithStreamingResponse, - AsyncWorkspacesResourceWithStreamingResponse, -) __all__ = [ "ArtifactsResource", @@ -80,10 +80,10 @@ "AsyncTerminalsResourceWithRawResponse", "TerminalsResourceWithStreamingResponse", "AsyncTerminalsResourceWithStreamingResponse", - "WorkspacesResource", - "AsyncWorkspacesResource", - "WorkspacesResourceWithRawResponse", - "AsyncWorkspacesResourceWithRawResponse", - "WorkspacesResourceWithStreamingResponse", - "AsyncWorkspacesResourceWithStreamingResponse", + "MachinesResource", + "AsyncMachinesResource", + "MachinesResourceWithRawResponse", + "AsyncMachinesResourceWithRawResponse", + "MachinesResourceWithStreamingResponse", + "AsyncMachinesResourceWithStreamingResponse", ] diff --git a/src/dedalus_sdk/resources/workspaces/artifacts.py b/src/dedalus_sdk/resources/machines/artifacts.py similarity index 86% rename from src/dedalus_sdk/resources/workspaces/artifacts.py rename to src/dedalus_sdk/resources/machines/artifacts.py index 068e0dc..8856407 100644 --- a/src/dedalus_sdk/resources/workspaces/artifacts.py +++ b/src/dedalus_sdk/resources/machines/artifacts.py @@ -16,8 +16,8 @@ ) from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.workspaces import artifact_list_params -from ...types.workspaces.artifact import Artifact +from ...types.machines import artifact_list_params +from ...types.machines.artifact import Artifact __all__ = ["ArtifactsResource", "AsyncArtifactsResource"] @@ -44,9 +44,9 @@ def with_streaming_response(self) -> ArtifactsResourceWithStreamingResponse: def retrieve( self, - artifact_id: str, *, - workspace_id: str, + machine_id: str, + artifact_id: str, # 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, @@ -66,15 +66,13 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not artifact_id: raise ValueError(f"Expected a non-empty value for `artifact_id` but received {artifact_id!r}") return self._get( path_template( - "/v1/workspaces/{workspace_id}/artifacts/{artifact_id}", - workspace_id=workspace_id, - artifact_id=artifact_id, + "/v1/machines/{machine_id}/artifacts/{artifact_id}", machine_id=machine_id, artifact_id=artifact_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -84,8 +82,8 @@ def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -107,10 +105,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/artifacts", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/artifacts", machine_id=machine_id), page=SyncCursorPage[Artifact], options=make_request_options( extra_headers=extra_headers, @@ -130,9 +128,9 @@ def list( def delete( self, - artifact_id: str, *, - workspace_id: str, + machine_id: str, + artifact_id: str, # 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, @@ -155,15 +153,13 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not artifact_id: raise ValueError(f"Expected a non-empty value for `artifact_id` but received {artifact_id!r}") return self._delete( path_template( - "/v1/workspaces/{workspace_id}/artifacts/{artifact_id}", - workspace_id=workspace_id, - artifact_id=artifact_id, + "/v1/machines/{machine_id}/artifacts/{artifact_id}", machine_id=machine_id, artifact_id=artifact_id ), options=make_request_options( extra_headers=extra_headers, @@ -198,9 +194,9 @@ def with_streaming_response(self) -> AsyncArtifactsResourceWithStreamingResponse async def retrieve( self, - artifact_id: str, *, - workspace_id: str, + machine_id: str, + artifact_id: str, # 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, @@ -220,15 +216,13 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not artifact_id: raise ValueError(f"Expected a non-empty value for `artifact_id` but received {artifact_id!r}") return await self._get( path_template( - "/v1/workspaces/{workspace_id}/artifacts/{artifact_id}", - workspace_id=workspace_id, - artifact_id=artifact_id, + "/v1/machines/{machine_id}/artifacts/{artifact_id}", machine_id=machine_id, artifact_id=artifact_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -238,8 +232,8 @@ async def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -261,10 +255,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/artifacts", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/artifacts", machine_id=machine_id), page=AsyncCursorPage[Artifact], options=make_request_options( extra_headers=extra_headers, @@ -284,9 +278,9 @@ def list( async def delete( self, - artifact_id: str, *, - workspace_id: str, + machine_id: str, + artifact_id: str, # 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, @@ -309,15 +303,13 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not artifact_id: raise ValueError(f"Expected a non-empty value for `artifact_id` but received {artifact_id!r}") return await self._delete( path_template( - "/v1/workspaces/{workspace_id}/artifacts/{artifact_id}", - workspace_id=workspace_id, - artifact_id=artifact_id, + "/v1/machines/{machine_id}/artifacts/{artifact_id}", machine_id=machine_id, artifact_id=artifact_id ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/dedalus_sdk/resources/workspaces/executions.py b/src/dedalus_sdk/resources/machines/executions.py similarity index 86% rename from src/dedalus_sdk/resources/workspaces/executions.py rename to src/dedalus_sdk/resources/machines/executions.py index c53caac..bd2a80e 100644 --- a/src/dedalus_sdk/resources/workspaces/executions.py +++ b/src/dedalus_sdk/resources/machines/executions.py @@ -18,10 +18,10 @@ ) from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.workspaces import execution_list_params, execution_create_params, execution_events_params -from ...types.workspaces.execution import Execution -from ...types.workspaces.execution_event import ExecutionEvent -from ...types.workspaces.execution_output import ExecutionOutput +from ...types.machines import execution_list_params, execution_create_params, execution_events_params +from ...types.machines.execution import Execution +from ...types.machines.execution_event import ExecutionEvent +from ...types.machines.execution_output import ExecutionOutput __all__ = ["ExecutionsResource", "AsyncExecutionsResource"] @@ -48,8 +48,8 @@ def with_streaming_response(self) -> ExecutionsResourceWithStreamingResponse: def create( self, - workspace_id: str, *, + machine_id: str, command: Optional[SequenceNotStr[str]], cwd: str | Omit = omit, env: Dict[str, str] | Omit = omit, @@ -77,10 +77,10 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._post( - path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/executions", machine_id=machine_id), body=maybe_transform( { "command": command, @@ -103,9 +103,9 @@ def create( def retrieve( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -125,15 +125,13 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._get( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}", - workspace_id=workspace_id, - execution_id=execution_id, + "/v1/machines/{machine_id}/executions/{execution_id}", machine_id=machine_id, execution_id=execution_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -143,8 +141,8 @@ def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -166,10 +164,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/executions", machine_id=machine_id), page=SyncCursorPage[Execution], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +187,9 @@ def list( def delete( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -214,15 +212,13 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._delete( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}", - workspace_id=workspace_id, - execution_id=execution_id, + "/v1/machines/{machine_id}/executions/{execution_id}", machine_id=machine_id, execution_id=execution_id ), options=make_request_options( extra_headers=extra_headers, @@ -236,9 +232,9 @@ def delete( def events( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -260,14 +256,14 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._get_api_list( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}/events", - workspace_id=workspace_id, + "/v1/machines/{machine_id}/executions/{execution_id}/events", + machine_id=machine_id, execution_id=execution_id, ), page=SyncCursorPage[ExecutionEvent], @@ -289,9 +285,9 @@ def events( def output( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -311,14 +307,14 @@ def output( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._get( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}/output", - workspace_id=workspace_id, + "/v1/machines/{machine_id}/executions/{execution_id}/output", + machine_id=machine_id, execution_id=execution_id, ), options=make_request_options( @@ -350,8 +346,8 @@ def with_streaming_response(self) -> AsyncExecutionsResourceWithStreamingRespons async def create( self, - workspace_id: str, *, + machine_id: str, command: Optional[SequenceNotStr[str]], cwd: str | Omit = omit, env: Dict[str, str] | Omit = omit, @@ -379,10 +375,10 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return await self._post( - path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/executions", machine_id=machine_id), body=await async_maybe_transform( { "command": command, @@ -405,9 +401,9 @@ async def create( async def retrieve( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -427,15 +423,13 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return await self._get( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}", - workspace_id=workspace_id, - execution_id=execution_id, + "/v1/machines/{machine_id}/executions/{execution_id}", machine_id=machine_id, execution_id=execution_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -445,8 +439,8 @@ async def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -468,10 +462,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/executions", machine_id=machine_id), page=AsyncCursorPage[Execution], options=make_request_options( extra_headers=extra_headers, @@ -491,9 +485,9 @@ def list( async def delete( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -516,15 +510,13 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return await self._delete( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}", - workspace_id=workspace_id, - execution_id=execution_id, + "/v1/machines/{machine_id}/executions/{execution_id}", machine_id=machine_id, execution_id=execution_id ), options=make_request_options( extra_headers=extra_headers, @@ -538,9 +530,9 @@ async def delete( def events( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -562,14 +554,14 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._get_api_list( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}/events", - workspace_id=workspace_id, + "/v1/machines/{machine_id}/executions/{execution_id}/events", + machine_id=machine_id, execution_id=execution_id, ), page=AsyncCursorPage[ExecutionEvent], @@ -591,9 +583,9 @@ def events( async def output( self, - execution_id: str, *, - workspace_id: str, + machine_id: str, + execution_id: str, # 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, @@ -613,14 +605,14 @@ async def output( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not execution_id: raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return await self._get( path_template( - "/v1/workspaces/{workspace_id}/executions/{execution_id}/output", - workspace_id=workspace_id, + "/v1/machines/{machine_id}/executions/{execution_id}/output", + machine_id=machine_id, execution_id=execution_id, ), options=make_request_options( diff --git a/src/dedalus_sdk/resources/workspaces/workspaces.py b/src/dedalus_sdk/resources/machines/machines.py similarity index 76% rename from src/dedalus_sdk/resources/workspaces/workspaces.py rename to src/dedalus_sdk/resources/machines/machines.py index 18d290a..d70fa20 100644 --- a/src/dedalus_sdk/resources/workspaces/workspaces.py +++ b/src/dedalus_sdk/resources/machines/machines.py @@ -12,7 +12,7 @@ SSHResourceWithStreamingResponse, AsyncSSHResourceWithStreamingResponse, ) -from ...types import workspace_list_params, workspace_create_params, workspace_update_params +from ...types import machine_list_params, machine_create_params, machine_update_params from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import path_template, maybe_transform, strip_not_given, async_maybe_transform from .previews import ( @@ -58,13 +58,13 @@ from ..._streaming import Stream, AsyncStream from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.workspace import Workspace -from ...types.workspace_list import Item +from ...types.machine import Machine +from ...types.machine_list_item import MachineListItem -__all__ = ["WorkspacesResource", "AsyncWorkspacesResource"] +__all__ = ["MachinesResource", "AsyncMachinesResource"] -class WorkspacesResource(SyncAPIResource): +class MachinesResource(SyncAPIResource): @cached_property def artifacts(self) -> ArtifactsResource: return ArtifactsResource(self._client) @@ -86,23 +86,23 @@ def terminals(self) -> TerminalsResource: return TerminalsResource(self._client) @cached_property - def with_raw_response(self) -> WorkspacesResourceWithRawResponse: + def with_raw_response(self) -> MachinesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/dedalus-labs/dedalus-python#accessing-raw-response-data-eg-headers """ - return WorkspacesResourceWithRawResponse(self) + return MachinesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WorkspacesResourceWithStreamingResponse: + def with_streaming_response(self) -> MachinesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/dedalus-labs/dedalus-python#with_streaming_response """ - return WorkspacesResourceWithStreamingResponse(self) + return MachinesResourceWithStreamingResponse(self) def create( self, @@ -117,9 +117,9 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Create workspace + Create machine Args: memory_mib: Memory in MiB. @@ -139,14 +139,14 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ return self._post( - "/v1/workspaces", + "/v1/machines", body=maybe_transform( { "memory_mib": memory_mib, "storage_gib": storage_gib, "vcpu": vcpu, }, - workspace_create_params.WorkspaceCreateParams, + machine_create_params.MachineCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -155,22 +155,22 @@ def create( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) def retrieve( self, - workspace_id: str, *, + machine_id: str, # 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, - ) -> Workspace: + ) -> Machine: """ - Get workspace + Get machine Args: extra_headers: Send extra headers @@ -181,20 +181,20 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Workspace, + cast_to=Machine, ) def update( self, - workspace_id: str, *, + machine_id: str, if_match: str, memory_mib: int | Omit = omit, storage_gib: int | Omit = omit, @@ -206,9 +206,9 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Update workspace + Update machine Args: memory_mib: Memory in MiB. @@ -227,18 +227,18 @@ def update( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"If-Match": if_match, **(extra_headers or {})} return self._patch( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), body=maybe_transform( { "memory_mib": memory_mib, "storage_gib": storage_gib, "vcpu": vcpu, }, - workspace_update_params.WorkspaceUpdateParams, + machine_update_params.MachineUpdateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -247,7 +247,7 @@ def update( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) def list( @@ -261,9 +261,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncCursorPage[Item]: + ) -> SyncCursorPage[MachineListItem]: """ - List workspaces + List machines Args: extra_headers: Send extra headers @@ -275,8 +275,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/v1/workspaces", - page=SyncCursorPage[Item], + "/v1/machines", + page=SyncCursorPage[MachineListItem], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -287,16 +287,16 @@ def list( "cursor": cursor, "limit": limit, }, - workspace_list_params.WorkspaceListParams, + machine_list_params.MachineListParams, ), ), - model=Item, + model=MachineListItem, ) def delete( self, - workspace_id: str, *, + machine_id: str, if_match: str, # 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. @@ -305,9 +305,9 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Destroy workspace + Destroy machine Args: extra_headers: Send extra headers @@ -320,11 +320,11 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"If-Match": if_match, **(extra_headers or {})} return self._delete( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -332,13 +332,13 @@ def delete( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) def watch( self, - workspace_id: str, *, + machine_id: str, last_event_id: str | Omit = omit, # 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. @@ -346,12 +346,12 @@ def watch( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[Workspace]: - """Streams workspace lifecycle updates over Server-Sent Events. + ) -> Stream[Machine]: + """Streams machine lifecycle updates over Server-Sent Events. Each `status` event - contains a full `LifecycleResponse` payload. The stream closes after the - workspace reaches its current desired state. + contains a full `LifecycleResponse` payload. The stream closes after the machine + reaches its current desired state. Args: extra_headers: Send extra headers @@ -362,22 +362,22 @@ def watch( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} extra_headers = {**strip_not_given({"Last-Event-ID": last_event_id}), **(extra_headers or {})} return self._get( - path_template("/v1/workspaces/{workspace_id}/status/stream", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/status/stream", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Workspace, + cast_to=Machine, stream=True, - stream_cls=Stream[Workspace], + stream_cls=Stream[Machine], ) -class AsyncWorkspacesResource(AsyncAPIResource): +class AsyncMachinesResource(AsyncAPIResource): @cached_property def artifacts(self) -> AsyncArtifactsResource: return AsyncArtifactsResource(self._client) @@ -399,23 +399,23 @@ def terminals(self) -> AsyncTerminalsResource: return AsyncTerminalsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncWorkspacesResourceWithRawResponse: + def with_raw_response(self) -> AsyncMachinesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/dedalus-labs/dedalus-python#accessing-raw-response-data-eg-headers """ - return AsyncWorkspacesResourceWithRawResponse(self) + return AsyncMachinesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWorkspacesResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncMachinesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/dedalus-labs/dedalus-python#with_streaming_response """ - return AsyncWorkspacesResourceWithStreamingResponse(self) + return AsyncMachinesResourceWithStreamingResponse(self) async def create( self, @@ -430,9 +430,9 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Create workspace + Create machine Args: memory_mib: Memory in MiB. @@ -452,14 +452,14 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ return await self._post( - "/v1/workspaces", + "/v1/machines", body=await async_maybe_transform( { "memory_mib": memory_mib, "storage_gib": storage_gib, "vcpu": vcpu, }, - workspace_create_params.WorkspaceCreateParams, + machine_create_params.MachineCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -468,22 +468,22 @@ async def create( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) async def retrieve( self, - workspace_id: str, *, + machine_id: str, # 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, - ) -> Workspace: + ) -> Machine: """ - Get workspace + Get machine Args: extra_headers: Send extra headers @@ -494,20 +494,20 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return await self._get( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Workspace, + cast_to=Machine, ) async def update( self, - workspace_id: str, *, + machine_id: str, if_match: str, memory_mib: int | Omit = omit, storage_gib: int | Omit = omit, @@ -519,9 +519,9 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Update workspace + Update machine Args: memory_mib: Memory in MiB. @@ -540,18 +540,18 @@ async def update( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"If-Match": if_match, **(extra_headers or {})} return await self._patch( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), body=await async_maybe_transform( { "memory_mib": memory_mib, "storage_gib": storage_gib, "vcpu": vcpu, }, - workspace_update_params.WorkspaceUpdateParams, + machine_update_params.MachineUpdateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -560,7 +560,7 @@ async def update( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) def list( @@ -574,9 +574,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Item, AsyncCursorPage[Item]]: + ) -> AsyncPaginator[MachineListItem, AsyncCursorPage[MachineListItem]]: """ - List workspaces + List machines Args: extra_headers: Send extra headers @@ -588,8 +588,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/v1/workspaces", - page=AsyncCursorPage[Item], + "/v1/machines", + page=AsyncCursorPage[MachineListItem], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -600,16 +600,16 @@ def list( "cursor": cursor, "limit": limit, }, - workspace_list_params.WorkspaceListParams, + machine_list_params.MachineListParams, ), ), - model=Item, + model=MachineListItem, ) async def delete( self, - workspace_id: str, *, + machine_id: str, if_match: str, # 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. @@ -618,9 +618,9 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Workspace: + ) -> Machine: """ - Destroy workspace + Destroy machine Args: extra_headers: Send extra headers @@ -633,11 +633,11 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"If-Match": if_match, **(extra_headers or {})} return await self._delete( - path_template("/v1/workspaces/{workspace_id}", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -645,13 +645,13 @@ async def delete( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Workspace, + cast_to=Machine, ) async def watch( self, - workspace_id: str, *, + machine_id: str, last_event_id: str | Omit = omit, # 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. @@ -659,12 +659,12 @@ async def watch( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[Workspace]: - """Streams workspace lifecycle updates over Server-Sent Events. + ) -> AsyncStream[Machine]: + """Streams machine lifecycle updates over Server-Sent Events. Each `status` event - contains a full `LifecycleResponse` payload. The stream closes after the - workspace reaches its current desired state. + contains a full `LifecycleResponse` payload. The stream closes after the machine + reaches its current desired state. Args: extra_headers: Send extra headers @@ -675,192 +675,192 @@ async def watch( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} extra_headers = {**strip_not_given({"Last-Event-ID": last_event_id}), **(extra_headers or {})} return await self._get( - path_template("/v1/workspaces/{workspace_id}/status/stream", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/status/stream", machine_id=machine_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Workspace, + cast_to=Machine, stream=True, - stream_cls=AsyncStream[Workspace], + stream_cls=AsyncStream[Machine], ) -class WorkspacesResourceWithRawResponse: - def __init__(self, workspaces: WorkspacesResource) -> None: - self._workspaces = workspaces +class MachinesResourceWithRawResponse: + def __init__(self, machines: MachinesResource) -> None: + self._machines = machines self.create = to_raw_response_wrapper( - workspaces.create, + machines.create, ) self.retrieve = to_raw_response_wrapper( - workspaces.retrieve, + machines.retrieve, ) self.update = to_raw_response_wrapper( - workspaces.update, + machines.update, ) self.list = to_raw_response_wrapper( - workspaces.list, + machines.list, ) self.delete = to_raw_response_wrapper( - workspaces.delete, + machines.delete, ) self.watch = to_raw_response_wrapper( - workspaces.watch, + machines.watch, ) @cached_property def artifacts(self) -> ArtifactsResourceWithRawResponse: - return ArtifactsResourceWithRawResponse(self._workspaces.artifacts) + return ArtifactsResourceWithRawResponse(self._machines.artifacts) @cached_property def previews(self) -> PreviewsResourceWithRawResponse: - return PreviewsResourceWithRawResponse(self._workspaces.previews) + return PreviewsResourceWithRawResponse(self._machines.previews) @cached_property def ssh(self) -> SSHResourceWithRawResponse: - return SSHResourceWithRawResponse(self._workspaces.ssh) + return SSHResourceWithRawResponse(self._machines.ssh) @cached_property def executions(self) -> ExecutionsResourceWithRawResponse: - return ExecutionsResourceWithRawResponse(self._workspaces.executions) + return ExecutionsResourceWithRawResponse(self._machines.executions) @cached_property def terminals(self) -> TerminalsResourceWithRawResponse: - return TerminalsResourceWithRawResponse(self._workspaces.terminals) + return TerminalsResourceWithRawResponse(self._machines.terminals) -class AsyncWorkspacesResourceWithRawResponse: - def __init__(self, workspaces: AsyncWorkspacesResource) -> None: - self._workspaces = workspaces +class AsyncMachinesResourceWithRawResponse: + def __init__(self, machines: AsyncMachinesResource) -> None: + self._machines = machines self.create = async_to_raw_response_wrapper( - workspaces.create, + machines.create, ) self.retrieve = async_to_raw_response_wrapper( - workspaces.retrieve, + machines.retrieve, ) self.update = async_to_raw_response_wrapper( - workspaces.update, + machines.update, ) self.list = async_to_raw_response_wrapper( - workspaces.list, + machines.list, ) self.delete = async_to_raw_response_wrapper( - workspaces.delete, + machines.delete, ) self.watch = async_to_raw_response_wrapper( - workspaces.watch, + machines.watch, ) @cached_property def artifacts(self) -> AsyncArtifactsResourceWithRawResponse: - return AsyncArtifactsResourceWithRawResponse(self._workspaces.artifacts) + return AsyncArtifactsResourceWithRawResponse(self._machines.artifacts) @cached_property def previews(self) -> AsyncPreviewsResourceWithRawResponse: - return AsyncPreviewsResourceWithRawResponse(self._workspaces.previews) + return AsyncPreviewsResourceWithRawResponse(self._machines.previews) @cached_property def ssh(self) -> AsyncSSHResourceWithRawResponse: - return AsyncSSHResourceWithRawResponse(self._workspaces.ssh) + return AsyncSSHResourceWithRawResponse(self._machines.ssh) @cached_property def executions(self) -> AsyncExecutionsResourceWithRawResponse: - return AsyncExecutionsResourceWithRawResponse(self._workspaces.executions) + return AsyncExecutionsResourceWithRawResponse(self._machines.executions) @cached_property def terminals(self) -> AsyncTerminalsResourceWithRawResponse: - return AsyncTerminalsResourceWithRawResponse(self._workspaces.terminals) + return AsyncTerminalsResourceWithRawResponse(self._machines.terminals) -class WorkspacesResourceWithStreamingResponse: - def __init__(self, workspaces: WorkspacesResource) -> None: - self._workspaces = workspaces +class MachinesResourceWithStreamingResponse: + def __init__(self, machines: MachinesResource) -> None: + self._machines = machines self.create = to_streamed_response_wrapper( - workspaces.create, + machines.create, ) self.retrieve = to_streamed_response_wrapper( - workspaces.retrieve, + machines.retrieve, ) self.update = to_streamed_response_wrapper( - workspaces.update, + machines.update, ) self.list = to_streamed_response_wrapper( - workspaces.list, + machines.list, ) self.delete = to_streamed_response_wrapper( - workspaces.delete, + machines.delete, ) self.watch = to_streamed_response_wrapper( - workspaces.watch, + machines.watch, ) @cached_property def artifacts(self) -> ArtifactsResourceWithStreamingResponse: - return ArtifactsResourceWithStreamingResponse(self._workspaces.artifacts) + return ArtifactsResourceWithStreamingResponse(self._machines.artifacts) @cached_property def previews(self) -> PreviewsResourceWithStreamingResponse: - return PreviewsResourceWithStreamingResponse(self._workspaces.previews) + return PreviewsResourceWithStreamingResponse(self._machines.previews) @cached_property def ssh(self) -> SSHResourceWithStreamingResponse: - return SSHResourceWithStreamingResponse(self._workspaces.ssh) + return SSHResourceWithStreamingResponse(self._machines.ssh) @cached_property def executions(self) -> ExecutionsResourceWithStreamingResponse: - return ExecutionsResourceWithStreamingResponse(self._workspaces.executions) + return ExecutionsResourceWithStreamingResponse(self._machines.executions) @cached_property def terminals(self) -> TerminalsResourceWithStreamingResponse: - return TerminalsResourceWithStreamingResponse(self._workspaces.terminals) + return TerminalsResourceWithStreamingResponse(self._machines.terminals) -class AsyncWorkspacesResourceWithStreamingResponse: - def __init__(self, workspaces: AsyncWorkspacesResource) -> None: - self._workspaces = workspaces +class AsyncMachinesResourceWithStreamingResponse: + def __init__(self, machines: AsyncMachinesResource) -> None: + self._machines = machines self.create = async_to_streamed_response_wrapper( - workspaces.create, + machines.create, ) self.retrieve = async_to_streamed_response_wrapper( - workspaces.retrieve, + machines.retrieve, ) self.update = async_to_streamed_response_wrapper( - workspaces.update, + machines.update, ) self.list = async_to_streamed_response_wrapper( - workspaces.list, + machines.list, ) self.delete = async_to_streamed_response_wrapper( - workspaces.delete, + machines.delete, ) self.watch = async_to_streamed_response_wrapper( - workspaces.watch, + machines.watch, ) @cached_property def artifacts(self) -> AsyncArtifactsResourceWithStreamingResponse: - return AsyncArtifactsResourceWithStreamingResponse(self._workspaces.artifacts) + return AsyncArtifactsResourceWithStreamingResponse(self._machines.artifacts) @cached_property def previews(self) -> AsyncPreviewsResourceWithStreamingResponse: - return AsyncPreviewsResourceWithStreamingResponse(self._workspaces.previews) + return AsyncPreviewsResourceWithStreamingResponse(self._machines.previews) @cached_property def ssh(self) -> AsyncSSHResourceWithStreamingResponse: - return AsyncSSHResourceWithStreamingResponse(self._workspaces.ssh) + return AsyncSSHResourceWithStreamingResponse(self._machines.ssh) @cached_property def executions(self) -> AsyncExecutionsResourceWithStreamingResponse: - return AsyncExecutionsResourceWithStreamingResponse(self._workspaces.executions) + return AsyncExecutionsResourceWithStreamingResponse(self._machines.executions) @cached_property def terminals(self) -> AsyncTerminalsResourceWithStreamingResponse: - return AsyncTerminalsResourceWithStreamingResponse(self._workspaces.terminals) + return AsyncTerminalsResourceWithStreamingResponse(self._machines.terminals) diff --git a/src/dedalus_sdk/resources/workspaces/previews.py b/src/dedalus_sdk/resources/machines/previews.py similarity index 87% rename from src/dedalus_sdk/resources/workspaces/previews.py rename to src/dedalus_sdk/resources/machines/previews.py index 54377cb..074ef9b 100644 --- a/src/dedalus_sdk/resources/workspaces/previews.py +++ b/src/dedalus_sdk/resources/machines/previews.py @@ -18,8 +18,8 @@ ) from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.workspaces import preview_list_params, preview_create_params -from ...types.workspaces.preview import Preview +from ...types.machines import preview_list_params, preview_create_params +from ...types.machines.preview import Preview __all__ = ["PreviewsResource", "AsyncPreviewsResource"] @@ -46,10 +46,11 @@ def with_streaming_response(self) -> PreviewsResourceWithStreamingResponse: def create( self, - workspace_id: str, *, + machine_id: str, port: int, protocol: Literal["http", "https"] | Omit = omit, + visibility: Literal["public", "private", "org"] | Omit = omit, # 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, @@ -72,14 +73,15 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._post( - path_template("/v1/workspaces/{workspace_id}/previews", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/previews", machine_id=machine_id), body=maybe_transform( { "port": port, "protocol": protocol, + "visibility": visibility, }, preview_create_params.PreviewCreateParams, ), @@ -95,9 +97,9 @@ def create( def retrieve( self, - preview_id: str, *, - workspace_id: str, + machine_id: str, + preview_id: str, # 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, @@ -117,13 +119,13 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not preview_id: raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") return self._get( path_template( - "/v1/workspaces/{workspace_id}/previews/{preview_id}", workspace_id=workspace_id, preview_id=preview_id + "/v1/machines/{machine_id}/previews/{preview_id}", machine_id=machine_id, preview_id=preview_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -133,8 +135,8 @@ def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -156,10 +158,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/previews", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/previews", machine_id=machine_id), page=SyncCursorPage[Preview], options=make_request_options( extra_headers=extra_headers, @@ -179,9 +181,9 @@ def list( def delete( self, - preview_id: str, *, - workspace_id: str, + machine_id: str, + preview_id: str, # 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, @@ -204,13 +206,13 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not preview_id: raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") return self._delete( path_template( - "/v1/workspaces/{workspace_id}/previews/{preview_id}", workspace_id=workspace_id, preview_id=preview_id + "/v1/machines/{machine_id}/previews/{preview_id}", machine_id=machine_id, preview_id=preview_id ), options=make_request_options( extra_headers=extra_headers, @@ -245,10 +247,11 @@ def with_streaming_response(self) -> AsyncPreviewsResourceWithStreamingResponse: async def create( self, - workspace_id: str, *, + machine_id: str, port: int, protocol: Literal["http", "https"] | Omit = omit, + visibility: Literal["public", "private", "org"] | Omit = omit, # 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, @@ -271,14 +274,15 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return await self._post( - path_template("/v1/workspaces/{workspace_id}/previews", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/previews", machine_id=machine_id), body=await async_maybe_transform( { "port": port, "protocol": protocol, + "visibility": visibility, }, preview_create_params.PreviewCreateParams, ), @@ -294,9 +298,9 @@ async def create( async def retrieve( self, - preview_id: str, *, - workspace_id: str, + machine_id: str, + preview_id: str, # 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, @@ -316,13 +320,13 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not preview_id: raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") return await self._get( path_template( - "/v1/workspaces/{workspace_id}/previews/{preview_id}", workspace_id=workspace_id, preview_id=preview_id + "/v1/machines/{machine_id}/previews/{preview_id}", machine_id=machine_id, preview_id=preview_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -332,8 +336,8 @@ async def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -355,10 +359,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/previews", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/previews", machine_id=machine_id), page=AsyncCursorPage[Preview], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +382,9 @@ def list( async def delete( self, - preview_id: str, *, - workspace_id: str, + machine_id: str, + preview_id: str, # 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, @@ -403,13 +407,13 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not preview_id: raise ValueError(f"Expected a non-empty value for `preview_id` but received {preview_id!r}") return await self._delete( path_template( - "/v1/workspaces/{workspace_id}/previews/{preview_id}", workspace_id=workspace_id, preview_id=preview_id + "/v1/machines/{machine_id}/previews/{preview_id}", machine_id=machine_id, preview_id=preview_id ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/dedalus_sdk/resources/workspaces/ssh.py b/src/dedalus_sdk/resources/machines/ssh.py similarity index 86% rename from src/dedalus_sdk/resources/workspaces/ssh.py rename to src/dedalus_sdk/resources/machines/ssh.py index e4c11f6..041e445 100644 --- a/src/dedalus_sdk/resources/workspaces/ssh.py +++ b/src/dedalus_sdk/resources/machines/ssh.py @@ -16,8 +16,8 @@ ) from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.workspaces import ssh_list_params, ssh_create_params -from ...types.workspaces.ssh_session import SSHSession +from ...types.machines import ssh_list_params, ssh_create_params +from ...types.machines.ssh_session import SSHSession __all__ = ["SSHResource", "AsyncSSHResource"] @@ -44,8 +44,8 @@ def with_streaming_response(self) -> SSHResourceWithStreamingResponse: def create( self, - workspace_id: str, *, + machine_id: str, public_key: str, # 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. @@ -69,10 +69,10 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._post( - path_template("/v1/workspaces/{workspace_id}/ssh", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/ssh", machine_id=machine_id), body=maybe_transform({"public_key": public_key}, ssh_create_params.SSHCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -86,9 +86,9 @@ def create( def retrieve( self, - session_id: str, *, - workspace_id: str, + machine_id: str, + session_id: str, # 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, @@ -108,14 +108,12 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not session_id: raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") return self._get( - path_template( - "/v1/workspaces/{workspace_id}/ssh/{session_id}", workspace_id=workspace_id, session_id=session_id - ), + path_template("/v1/machines/{machine_id}/ssh/{session_id}", machine_id=machine_id, session_id=session_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,8 +122,8 @@ def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -147,10 +145,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/ssh", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/ssh", machine_id=machine_id), page=SyncCursorPage[SSHSession], options=make_request_options( extra_headers=extra_headers, @@ -170,9 +168,9 @@ def list( def delete( self, - session_id: str, *, - workspace_id: str, + machine_id: str, + session_id: str, # 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, @@ -195,14 +193,12 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not session_id: raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") return self._delete( - path_template( - "/v1/workspaces/{workspace_id}/ssh/{session_id}", workspace_id=workspace_id, session_id=session_id - ), + path_template("/v1/machines/{machine_id}/ssh/{session_id}", machine_id=machine_id, session_id=session_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -236,8 +232,8 @@ def with_streaming_response(self) -> AsyncSSHResourceWithStreamingResponse: async def create( self, - workspace_id: str, *, + machine_id: str, public_key: str, # 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. @@ -261,10 +257,10 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return await self._post( - path_template("/v1/workspaces/{workspace_id}/ssh", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/ssh", machine_id=machine_id), body=await async_maybe_transform({"public_key": public_key}, ssh_create_params.SSHCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -278,9 +274,9 @@ async def create( async def retrieve( self, - session_id: str, *, - workspace_id: str, + machine_id: str, + session_id: str, # 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, @@ -300,14 +296,12 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not session_id: raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") return await self._get( - path_template( - "/v1/workspaces/{workspace_id}/ssh/{session_id}", workspace_id=workspace_id, session_id=session_id - ), + path_template("/v1/machines/{machine_id}/ssh/{session_id}", machine_id=machine_id, session_id=session_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -316,8 +310,8 @@ async def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -339,10 +333,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/ssh", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/ssh", machine_id=machine_id), page=AsyncCursorPage[SSHSession], options=make_request_options( extra_headers=extra_headers, @@ -362,9 +356,9 @@ def list( async def delete( self, - session_id: str, *, - workspace_id: str, + machine_id: str, + session_id: str, # 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, @@ -387,14 +381,12 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not session_id: raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") return await self._delete( - path_template( - "/v1/workspaces/{workspace_id}/ssh/{session_id}", workspace_id=workspace_id, session_id=session_id - ), + path_template("/v1/machines/{machine_id}/ssh/{session_id}", machine_id=machine_id, session_id=session_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/dedalus_sdk/resources/workspaces/terminals.py b/src/dedalus_sdk/resources/machines/terminals.py similarity index 89% rename from src/dedalus_sdk/resources/workspaces/terminals.py rename to src/dedalus_sdk/resources/machines/terminals.py index 0c6096b..8084584 100644 --- a/src/dedalus_sdk/resources/workspaces/terminals.py +++ b/src/dedalus_sdk/resources/machines/terminals.py @@ -25,12 +25,12 @@ from ...pagination import SyncCursorPage, AsyncCursorPage from ..._exceptions import DedalusError from ..._base_client import AsyncPaginator, _merge_mappings, make_request_options -from ...types.workspaces import terminal_list_params, terminal_create_params -from ...types.workspaces.terminal import Terminal +from ...types.machines import terminal_list_params, terminal_create_params +from ...types.machines.terminal import Terminal from ...types.websocket_connection_options import WebSocketConnectionOptions -from ...types.workspaces.terminal_client_event import TerminalClientEvent -from ...types.workspaces.terminal_server_event import TerminalServerEvent -from ...types.workspaces.terminal_client_event_param import TerminalClientEventParam +from ...types.machines.terminal_client_event import TerminalClientEvent +from ...types.machines.terminal_server_event import TerminalServerEvent +from ...types.machines.terminal_client_event_param import TerminalClientEventParam if TYPE_CHECKING: from websockets.sync.client import ClientConnection as WebSocketConnection @@ -65,8 +65,8 @@ def with_streaming_response(self) -> TerminalsResourceWithStreamingResponse: def create( self, - workspace_id: str, *, + machine_id: str, height: int, width: int, cwd: str | Omit = omit, @@ -94,10 +94,10 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._post( - path_template("/v1/workspaces/{workspace_id}/terminals", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/terminals", machine_id=machine_id), body=maybe_transform( { "height": height, @@ -120,9 +120,9 @@ def create( def retrieve( self, - terminal_id: str, *, - workspace_id: str, + machine_id: str, + terminal_id: str, # 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, @@ -142,15 +142,13 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not terminal_id: raise ValueError(f"Expected a non-empty value for `terminal_id` but received {terminal_id!r}") return self._get( path_template( - "/v1/workspaces/{workspace_id}/terminals/{terminal_id}", - workspace_id=workspace_id, - terminal_id=terminal_id, + "/v1/machines/{machine_id}/terminals/{terminal_id}", machine_id=machine_id, terminal_id=terminal_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -160,8 +158,8 @@ def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -183,10 +181,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/terminals", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/terminals", machine_id=machine_id), page=SyncCursorPage[Terminal], options=make_request_options( extra_headers=extra_headers, @@ -206,9 +204,9 @@ def list( def delete( self, - terminal_id: str, *, - workspace_id: str, + machine_id: str, + terminal_id: str, # 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, @@ -231,15 +229,13 @@ def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not terminal_id: raise ValueError(f"Expected a non-empty value for `terminal_id` but received {terminal_id!r}") return self._delete( path_template( - "/v1/workspaces/{workspace_id}/terminals/{terminal_id}", - workspace_id=workspace_id, - terminal_id=terminal_id, + "/v1/machines/{machine_id}/terminals/{terminal_id}", machine_id=machine_id, terminal_id=terminal_id ), options=make_request_options( extra_headers=extra_headers, @@ -287,8 +283,8 @@ def with_streaming_response(self) -> AsyncTerminalsResourceWithStreamingResponse async def create( self, - workspace_id: str, *, + machine_id: str, height: int, width: int, cwd: str | Omit = omit, @@ -316,10 +312,10 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return await self._post( - path_template("/v1/workspaces/{workspace_id}/terminals", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/terminals", machine_id=machine_id), body=await async_maybe_transform( { "height": height, @@ -342,9 +338,9 @@ async def create( async def retrieve( self, - terminal_id: str, *, - workspace_id: str, + machine_id: str, + terminal_id: str, # 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, @@ -364,15 +360,13 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not terminal_id: raise ValueError(f"Expected a non-empty value for `terminal_id` but received {terminal_id!r}") return await self._get( path_template( - "/v1/workspaces/{workspace_id}/terminals/{terminal_id}", - workspace_id=workspace_id, - terminal_id=terminal_id, + "/v1/machines/{machine_id}/terminals/{terminal_id}", machine_id=machine_id, terminal_id=terminal_id ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -382,8 +376,8 @@ async def retrieve( def list( self, - workspace_id: str, *, + machine_id: str, cursor: str | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -405,10 +399,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") return self._get_api_list( - path_template("/v1/workspaces/{workspace_id}/terminals", workspace_id=workspace_id), + path_template("/v1/machines/{machine_id}/terminals", machine_id=machine_id), page=AsyncCursorPage[Terminal], options=make_request_options( extra_headers=extra_headers, @@ -428,9 +422,9 @@ def list( async def delete( self, - terminal_id: str, *, - workspace_id: str, + machine_id: str, + terminal_id: str, # 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, @@ -453,15 +447,13 @@ async def delete( idempotency_key: Specify a custom idempotency key for this request """ - if not workspace_id: - raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") + if not machine_id: + raise ValueError(f"Expected a non-empty value for `machine_id` but received {machine_id!r}") if not terminal_id: raise ValueError(f"Expected a non-empty value for `terminal_id` but received {terminal_id!r}") return await self._delete( path_template( - "/v1/workspaces/{workspace_id}/terminals/{terminal_id}", - workspace_id=workspace_id, - terminal_id=terminal_id, + "/v1/machines/{machine_id}/terminals/{terminal_id}", machine_id=machine_id, terminal_id=terminal_id ), options=make_request_options( extra_headers=extra_headers, @@ -624,7 +616,7 @@ def parse_event(self, data: str | bytes) -> TerminalServerEvent: class AsyncTerminalsResourceConnectionManager: """ - Context manager over a `AsyncTerminalsResourceConnection` that is returned by `workspaces.terminals.connect()` + Context manager over a `AsyncTerminalsResourceConnection` that is returned by `machines.terminals.connect()` This context manager ensures that the connection will be closed when it exits. @@ -636,7 +628,7 @@ class AsyncTerminalsResourceConnectionManager: **Warning**: You must remember to close the connection with `.close()`. ```py - connection = await client.workspaces.terminals.connect(...).enter() + connection = await client.machines.terminals.connect(...).enter() # ... await connection.close() ``` @@ -664,7 +656,7 @@ async def __aenter__(self) -> AsyncTerminalsResourceConnection: **Warning**: You must remember to close the connection with `.close()`. ```py - connection = await client.workspaces.terminals.connect(...).enter() + connection = await client.machines.terminals.connect(...).enter() # ... await connection.close() ``` @@ -710,9 +702,7 @@ def _prepare_url(self) -> httpx.URL: ws_scheme = "ws" if scheme == "http" else "wss" base_url = self.__client._base_url.copy_with(scheme=ws_scheme) - merge_raw_path = ( - base_url.raw_path.rstrip(b"/") + b"/v1/workspaces/{workspace_id}/terminals/{terminal_id}/stream" - ) + merge_raw_path = base_url.raw_path.rstrip(b"/") + b"/v1/machines/{machine_id}/terminals/{terminal_id}/stream" return base_url.copy_with(raw_path=merge_raw_path) async def __aexit__( @@ -787,7 +777,7 @@ def parse_event(self, data: str | bytes) -> TerminalServerEvent: class TerminalsResourceConnectionManager: """ - Context manager over a `TerminalsResourceConnection` that is returned by `workspaces.terminals.connect()` + Context manager over a `TerminalsResourceConnection` that is returned by `machines.terminals.connect()` This context manager ensures that the connection will be closed when it exits. @@ -799,7 +789,7 @@ class TerminalsResourceConnectionManager: **Warning**: You must remember to close the connection with `.close()`. ```py - connection = client.workspaces.terminals.connect(...).enter() + connection = client.machines.terminals.connect(...).enter() # ... connection.close() ``` @@ -827,7 +817,7 @@ def __enter__(self) -> TerminalsResourceConnection: **Warning**: You must remember to close the connection with `.close()`. ```py - connection = client.workspaces.terminals.connect(...).enter() + connection = client.machines.terminals.connect(...).enter() # ... connection.close() ``` @@ -873,9 +863,7 @@ def _prepare_url(self) -> httpx.URL: ws_scheme = "ws" if scheme == "http" else "wss" base_url = self.__client._base_url.copy_with(scheme=ws_scheme) - merge_raw_path = ( - base_url.raw_path.rstrip(b"/") + b"/v1/workspaces/{workspace_id}/terminals/{terminal_id}/stream" - ) + merge_raw_path = base_url.raw_path.rstrip(b"/") + b"/v1/machines/{machine_id}/terminals/{terminal_id}/stream" return base_url.copy_with(raw_path=merge_raw_path) def __exit__( diff --git a/src/dedalus_sdk/types/__init__.py b/src/dedalus_sdk/types/__init__.py index 2fcb234..669e1bd 100644 --- a/src/dedalus_sdk/types/__init__.py +++ b/src/dedalus_sdk/types/__init__.py @@ -2,10 +2,11 @@ from __future__ import annotations -from .workspace import Workspace as Workspace -from .workspace_list import WorkspaceList as WorkspaceList +from .machine import Machine as Machine +from .machine_list import MachineList as MachineList from .lifecycle_status import LifecycleStatus as LifecycleStatus -from .workspace_list_params import WorkspaceListParams as WorkspaceListParams -from .workspace_create_params import WorkspaceCreateParams as WorkspaceCreateParams -from .workspace_update_params import WorkspaceUpdateParams as WorkspaceUpdateParams +from .machine_list_item import MachineListItem as MachineListItem +from .machine_list_params import MachineListParams as MachineListParams +from .machine_create_params import MachineCreateParams as MachineCreateParams +from .machine_update_params import MachineUpdateParams as MachineUpdateParams from .websocket_connection_options import WebSocketConnectionOptions as WebSocketConnectionOptions diff --git a/src/dedalus_sdk/types/workspace.py b/src/dedalus_sdk/types/machine.py similarity index 84% rename from src/dedalus_sdk/types/workspace.py rename to src/dedalus_sdk/types/machine.py index 435cae4..26ee71b 100644 --- a/src/dedalus_sdk/types/workspace.py +++ b/src/dedalus_sdk/types/machine.py @@ -5,12 +5,14 @@ from .._models import BaseModel from .lifecycle_status import LifecycleStatus -__all__ = ["Workspace"] +__all__ = ["Machine"] -class Workspace(BaseModel): +class Machine(BaseModel): desired_state: Literal["running", "sleeping", "destroyed"] + machine_id: str + memory_mib: int """Memory in MiB.""" @@ -20,5 +22,3 @@ class Workspace(BaseModel): vcpu: float """CPU in vCPUs.""" - - workspace_id: str diff --git a/src/dedalus_sdk/types/workspace_create_params.py b/src/dedalus_sdk/types/machine_create_params.py similarity index 79% rename from src/dedalus_sdk/types/workspace_create_params.py rename to src/dedalus_sdk/types/machine_create_params.py index 641c5b5..ca95704 100644 --- a/src/dedalus_sdk/types/workspace_create_params.py +++ b/src/dedalus_sdk/types/machine_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["WorkspaceCreateParams"] +__all__ = ["MachineCreateParams"] -class WorkspaceCreateParams(TypedDict, total=False): +class MachineCreateParams(TypedDict, total=False): memory_mib: Required[int] """Memory in MiB.""" diff --git a/src/dedalus_sdk/types/machine_list.py b/src/dedalus_sdk/types/machine_list.py new file mode 100644 index 0000000..d809935 --- /dev/null +++ b/src/dedalus_sdk/types/machine_list.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel +from .machine_list_item import MachineListItem + +__all__ = ["MachineList"] + + +class MachineList(BaseModel): + items: Optional[List[MachineListItem]] = None + + next_cursor: Optional[str] = None diff --git a/src/dedalus_sdk/types/workspace_list.py b/src/dedalus_sdk/types/machine_list_item.py similarity index 67% rename from src/dedalus_sdk/types/workspace_list.py rename to src/dedalus_sdk/types/machine_list_item.py index a09302d..a2f236f 100644 --- a/src/dedalus_sdk/types/workspace_list.py +++ b/src/dedalus_sdk/types/machine_list_item.py @@ -1,20 +1,21 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel from .lifecycle_status import LifecycleStatus -__all__ = ["WorkspaceList", "Item"] +__all__ = ["MachineListItem"] -class Item(BaseModel): +class MachineListItem(BaseModel): created_at: datetime desired_state: Literal["running", "sleeping", "destroyed"] + machine_id: str + memory_mib: int """Memory in MiB.""" @@ -24,11 +25,3 @@ class Item(BaseModel): vcpu: float """CPU in vCPUs.""" - - workspace_id: str - - -class WorkspaceList(BaseModel): - items: Optional[List[Item]] = None - - next_cursor: Optional[str] = None diff --git a/src/dedalus_sdk/types/machine_list_params.py b/src/dedalus_sdk/types/machine_list_params.py new file mode 100644 index 0000000..2676797 --- /dev/null +++ b/src/dedalus_sdk/types/machine_list_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["MachineListParams"] + + +class MachineListParams(TypedDict, total=False): + cursor: str + + limit: int diff --git a/src/dedalus_sdk/types/workspace_update_params.py b/src/dedalus_sdk/types/machine_update_params.py similarity index 78% rename from src/dedalus_sdk/types/workspace_update_params.py rename to src/dedalus_sdk/types/machine_update_params.py index dfeab87..a7d36d7 100644 --- a/src/dedalus_sdk/types/workspace_update_params.py +++ b/src/dedalus_sdk/types/machine_update_params.py @@ -6,10 +6,12 @@ from .._utils import PropertyInfo -__all__ = ["WorkspaceUpdateParams"] +__all__ = ["MachineUpdateParams"] -class WorkspaceUpdateParams(TypedDict, total=False): +class MachineUpdateParams(TypedDict, total=False): + machine_id: Required[str] + if_match: Required[Annotated[str, PropertyInfo(alias="If-Match")]] memory_mib: int diff --git a/src/dedalus_sdk/types/workspaces/__init__.py b/src/dedalus_sdk/types/machines/__init__.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/__init__.py rename to src/dedalus_sdk/types/machines/__init__.py diff --git a/src/dedalus_sdk/types/workspaces/artifact.py b/src/dedalus_sdk/types/machines/artifact.py similarity index 95% rename from src/dedalus_sdk/types/workspaces/artifact.py rename to src/dedalus_sdk/types/machines/artifact.py index 3760173..2a75d0d 100644 --- a/src/dedalus_sdk/types/workspaces/artifact.py +++ b/src/dedalus_sdk/types/machines/artifact.py @@ -13,12 +13,12 @@ class Artifact(BaseModel): created_at: datetime + machine_id: str + name: str size_bytes: int - workspace_id: str - download_url: Optional[str] = None execution_id: Optional[str] = None diff --git a/src/dedalus_sdk/types/workspaces/artifact_list.py b/src/dedalus_sdk/types/machines/artifact_list.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/artifact_list.py rename to src/dedalus_sdk/types/machines/artifact_list.py diff --git a/src/dedalus_sdk/types/workspaces/artifact_list_params.py b/src/dedalus_sdk/types/machines/artifact_list_params.py similarity index 74% rename from src/dedalus_sdk/types/workspaces/artifact_list_params.py rename to src/dedalus_sdk/types/machines/artifact_list_params.py index 514c0f6..61f41a1 100644 --- a/src/dedalus_sdk/types/workspaces/artifact_list_params.py +++ b/src/dedalus_sdk/types/machines/artifact_list_params.py @@ -2,12 +2,14 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["ArtifactListParams"] class ArtifactListParams(TypedDict, total=False): + machine_id: Required[str] + cursor: str limit: int diff --git a/src/dedalus_sdk/types/workspaces/artifact_ref.py b/src/dedalus_sdk/types/machines/artifact_ref.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/artifact_ref.py rename to src/dedalus_sdk/types/machines/artifact_ref.py diff --git a/src/dedalus_sdk/types/workspaces/execution.py b/src/dedalus_sdk/types/machines/execution.py similarity index 98% rename from src/dedalus_sdk/types/workspaces/execution.py rename to src/dedalus_sdk/types/machines/execution.py index d248c02..087d684 100644 --- a/src/dedalus_sdk/types/workspaces/execution.py +++ b/src/dedalus_sdk/types/machines/execution.py @@ -17,9 +17,9 @@ class Execution(BaseModel): execution_id: str - status: Literal["wake_in_progress", "queued", "running", "succeeded", "failed", "cancelled", "expired"] + machine_id: str - workspace_id: str + status: Literal["wake_in_progress", "queued", "running", "succeeded", "failed", "cancelled", "expired"] artifacts: Optional[List[ArtifactRef]] = None diff --git a/src/dedalus_sdk/types/workspaces/execution_create_params.py b/src/dedalus_sdk/types/machines/execution_create_params.py similarity index 93% rename from src/dedalus_sdk/types/workspaces/execution_create_params.py rename to src/dedalus_sdk/types/machines/execution_create_params.py index a95100a..293f839 100644 --- a/src/dedalus_sdk/types/workspaces/execution_create_params.py +++ b/src/dedalus_sdk/types/machines/execution_create_params.py @@ -11,6 +11,8 @@ class ExecutionCreateParams(TypedDict, total=False): + machine_id: Required[str] + command: Required[Optional[SequenceNotStr[str]]] cwd: str diff --git a/src/dedalus_sdk/types/workspaces/execution_event.py b/src/dedalus_sdk/types/machines/execution_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/execution_event.py rename to src/dedalus_sdk/types/machines/execution_event.py diff --git a/src/dedalus_sdk/types/workspaces/execution_events.py b/src/dedalus_sdk/types/machines/execution_events.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/execution_events.py rename to src/dedalus_sdk/types/machines/execution_events.py diff --git a/src/dedalus_sdk/types/workspaces/execution_events_params.py b/src/dedalus_sdk/types/machines/execution_events_params.py similarity index 82% rename from src/dedalus_sdk/types/workspaces/execution_events_params.py rename to src/dedalus_sdk/types/machines/execution_events_params.py index 7dcee5c..f2ec158 100644 --- a/src/dedalus_sdk/types/workspaces/execution_events_params.py +++ b/src/dedalus_sdk/types/machines/execution_events_params.py @@ -8,7 +8,9 @@ class ExecutionEventsParams(TypedDict, total=False): - workspace_id: Required[str] + machine_id: Required[str] + + execution_id: Required[str] cursor: str diff --git a/src/dedalus_sdk/types/workspaces/execution_list.py b/src/dedalus_sdk/types/machines/execution_list.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/execution_list.py rename to src/dedalus_sdk/types/machines/execution_list.py diff --git a/src/dedalus_sdk/types/workspaces/execution_list_params.py b/src/dedalus_sdk/types/machines/execution_list_params.py similarity index 75% rename from src/dedalus_sdk/types/workspaces/execution_list_params.py rename to src/dedalus_sdk/types/machines/execution_list_params.py index 6c48dfe..9bbbd28 100644 --- a/src/dedalus_sdk/types/workspaces/execution_list_params.py +++ b/src/dedalus_sdk/types/machines/execution_list_params.py @@ -2,12 +2,14 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["ExecutionListParams"] class ExecutionListParams(TypedDict, total=False): + machine_id: Required[str] + cursor: str limit: int diff --git a/src/dedalus_sdk/types/workspaces/execution_output.py b/src/dedalus_sdk/types/machines/execution_output.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/execution_output.py rename to src/dedalus_sdk/types/machines/execution_output.py diff --git a/src/dedalus_sdk/types/workspaces/preview.py b/src/dedalus_sdk/types/machines/preview.py similarity index 90% rename from src/dedalus_sdk/types/workspaces/preview.py rename to src/dedalus_sdk/types/machines/preview.py index 82b0c14..760ac82 100644 --- a/src/dedalus_sdk/types/workspaces/preview.py +++ b/src/dedalus_sdk/types/machines/preview.py @@ -12,13 +12,15 @@ class Preview(BaseModel): created_at: datetime + machine_id: str + port: int preview_id: str status: Literal["wake_in_progress", "ready", "closed", "expired", "failed"] - workspace_id: str + visibility: Literal["public", "private", "org"] error_code: Optional[str] = None diff --git a/src/dedalus_sdk/types/workspaces/preview_create_params.py b/src/dedalus_sdk/types/machines/preview_create_params.py similarity index 79% rename from src/dedalus_sdk/types/workspaces/preview_create_params.py rename to src/dedalus_sdk/types/machines/preview_create_params.py index d2bb119..9e9f9e8 100644 --- a/src/dedalus_sdk/types/workspaces/preview_create_params.py +++ b/src/dedalus_sdk/types/machines/preview_create_params.py @@ -8,6 +8,10 @@ class PreviewCreateParams(TypedDict, total=False): + machine_id: Required[str] + port: Required[int] protocol: Literal["http", "https"] + + visibility: Literal["public", "private", "org"] diff --git a/src/dedalus_sdk/types/workspaces/preview_list.py b/src/dedalus_sdk/types/machines/preview_list.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/preview_list.py rename to src/dedalus_sdk/types/machines/preview_list.py diff --git a/src/dedalus_sdk/types/workspaces/preview_list_params.py b/src/dedalus_sdk/types/machines/preview_list_params.py similarity index 74% rename from src/dedalus_sdk/types/workspaces/preview_list_params.py rename to src/dedalus_sdk/types/machines/preview_list_params.py index 539eb03..e1050f0 100644 --- a/src/dedalus_sdk/types/workspaces/preview_list_params.py +++ b/src/dedalus_sdk/types/machines/preview_list_params.py @@ -2,12 +2,14 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["PreviewListParams"] class PreviewListParams(TypedDict, total=False): + machine_id: Required[str] + cursor: str limit: int diff --git a/src/dedalus_sdk/types/workspaces/ssh_connection.py b/src/dedalus_sdk/types/machines/ssh_connection.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/ssh_connection.py rename to src/dedalus_sdk/types/machines/ssh_connection.py diff --git a/src/dedalus_sdk/types/workspaces/ssh_create_params.py b/src/dedalus_sdk/types/machines/ssh_create_params.py similarity index 90% rename from src/dedalus_sdk/types/workspaces/ssh_create_params.py rename to src/dedalus_sdk/types/machines/ssh_create_params.py index d4b48c3..8d1a164 100644 --- a/src/dedalus_sdk/types/workspaces/ssh_create_params.py +++ b/src/dedalus_sdk/types/machines/ssh_create_params.py @@ -8,4 +8,6 @@ class SSHCreateParams(TypedDict, total=False): + machine_id: Required[str] + public_key: Required[str] diff --git a/src/dedalus_sdk/types/workspaces/ssh_host_trust.py b/src/dedalus_sdk/types/machines/ssh_host_trust.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/ssh_host_trust.py rename to src/dedalus_sdk/types/machines/ssh_host_trust.py diff --git a/src/dedalus_sdk/types/workspaces/ssh_list_params.py b/src/dedalus_sdk/types/machines/ssh_list_params.py similarity index 74% rename from src/dedalus_sdk/types/workspaces/ssh_list_params.py rename to src/dedalus_sdk/types/machines/ssh_list_params.py index 12be8b6..81a285e 100644 --- a/src/dedalus_sdk/types/workspaces/ssh_list_params.py +++ b/src/dedalus_sdk/types/machines/ssh_list_params.py @@ -2,12 +2,14 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["SSHListParams"] class SSHListParams(TypedDict, total=False): + machine_id: Required[str] + cursor: str limit: int diff --git a/src/dedalus_sdk/types/workspaces/ssh_session.py b/src/dedalus_sdk/types/machines/ssh_session.py similarity index 96% rename from src/dedalus_sdk/types/workspaces/ssh_session.py rename to src/dedalus_sdk/types/machines/ssh_session.py index 3056a1a..d746518 100644 --- a/src/dedalus_sdk/types/workspaces/ssh_session.py +++ b/src/dedalus_sdk/types/machines/ssh_session.py @@ -13,12 +13,12 @@ class SSHSession(BaseModel): created_at: datetime + machine_id: str + session_id: str status: Literal["wake_in_progress", "ready", "closed", "expired", "failed"] - workspace_id: str - connection: Optional[SSHConnection] = None error_code: Optional[str] = None diff --git a/src/dedalus_sdk/types/workspaces/ssh_session_list.py b/src/dedalus_sdk/types/machines/ssh_session_list.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/ssh_session_list.py rename to src/dedalus_sdk/types/machines/ssh_session_list.py diff --git a/src/dedalus_sdk/types/workspaces/terminal.py b/src/dedalus_sdk/types/machines/terminal.py similarity index 97% rename from src/dedalus_sdk/types/workspaces/terminal.py rename to src/dedalus_sdk/types/machines/terminal.py index dfce5c9..2897d3e 100644 --- a/src/dedalus_sdk/types/workspaces/terminal.py +++ b/src/dedalus_sdk/types/machines/terminal.py @@ -14,14 +14,14 @@ class Terminal(BaseModel): height: int + machine_id: str + status: Literal["wake_in_progress", "ready", "closed", "expired", "failed"] terminal_id: str width: int - workspace_id: str - error_code: Optional[str] = None error_message: Optional[str] = None diff --git a/src/dedalus_sdk/types/workspaces/terminal_client_event.py b/src/dedalus_sdk/types/machines/terminal_client_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_client_event.py rename to src/dedalus_sdk/types/machines/terminal_client_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_client_event_param.py b/src/dedalus_sdk/types/machines/terminal_client_event_param.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_client_event_param.py rename to src/dedalus_sdk/types/machines/terminal_client_event_param.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_closed_event.py b/src/dedalus_sdk/types/machines/terminal_closed_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_closed_event.py rename to src/dedalus_sdk/types/machines/terminal_closed_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_create_params.py b/src/dedalus_sdk/types/machines/terminal_create_params.py similarity index 92% rename from src/dedalus_sdk/types/workspaces/terminal_create_params.py rename to src/dedalus_sdk/types/machines/terminal_create_params.py index 23c4a2e..53b2a38 100644 --- a/src/dedalus_sdk/types/workspaces/terminal_create_params.py +++ b/src/dedalus_sdk/types/machines/terminal_create_params.py @@ -9,6 +9,8 @@ class TerminalCreateParams(TypedDict, total=False): + machine_id: Required[str] + height: Required[int] width: Required[int] diff --git a/src/dedalus_sdk/types/workspaces/terminal_error_event.py b/src/dedalus_sdk/types/machines/terminal_error_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_error_event.py rename to src/dedalus_sdk/types/machines/terminal_error_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_input_event.py b/src/dedalus_sdk/types/machines/terminal_input_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_input_event.py rename to src/dedalus_sdk/types/machines/terminal_input_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_input_event_param.py b/src/dedalus_sdk/types/machines/terminal_input_event_param.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_input_event_param.py rename to src/dedalus_sdk/types/machines/terminal_input_event_param.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_list.py b/src/dedalus_sdk/types/machines/terminal_list.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_list.py rename to src/dedalus_sdk/types/machines/terminal_list.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_list_params.py b/src/dedalus_sdk/types/machines/terminal_list_params.py similarity index 74% rename from src/dedalus_sdk/types/workspaces/terminal_list_params.py rename to src/dedalus_sdk/types/machines/terminal_list_params.py index 51deecb..cd723d6 100644 --- a/src/dedalus_sdk/types/workspaces/terminal_list_params.py +++ b/src/dedalus_sdk/types/machines/terminal_list_params.py @@ -2,12 +2,14 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict __all__ = ["TerminalListParams"] class TerminalListParams(TypedDict, total=False): + machine_id: Required[str] + cursor: str limit: int diff --git a/src/dedalus_sdk/types/workspaces/terminal_output_event.py b/src/dedalus_sdk/types/machines/terminal_output_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_output_event.py rename to src/dedalus_sdk/types/machines/terminal_output_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_resize_event.py b/src/dedalus_sdk/types/machines/terminal_resize_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_resize_event.py rename to src/dedalus_sdk/types/machines/terminal_resize_event.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_resize_event_param.py b/src/dedalus_sdk/types/machines/terminal_resize_event_param.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_resize_event_param.py rename to src/dedalus_sdk/types/machines/terminal_resize_event_param.py diff --git a/src/dedalus_sdk/types/workspaces/terminal_server_event.py b/src/dedalus_sdk/types/machines/terminal_server_event.py similarity index 100% rename from src/dedalus_sdk/types/workspaces/terminal_server_event.py rename to src/dedalus_sdk/types/machines/terminal_server_event.py diff --git a/src/dedalus_sdk/types/workspace_list_params.py b/src/dedalus_sdk/types/workspace_list_params.py deleted file mode 100644 index f3e43d5..0000000 --- a/src/dedalus_sdk/types/workspace_list_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["WorkspaceListParams"] - - -class WorkspaceListParams(TypedDict, total=False): - cursor: str - - limit: int diff --git a/tests/api_resources/workspaces/__init__.py b/tests/api_resources/machines/__init__.py similarity index 100% rename from tests/api_resources/workspaces/__init__.py rename to tests/api_resources/machines/__init__.py diff --git a/tests/api_resources/workspaces/test_artifacts.py b/tests/api_resources/machines/test_artifacts.py similarity index 71% rename from tests/api_resources/workspaces/test_artifacts.py rename to tests/api_resources/machines/test_artifacts.py index e01a1ae..d57de2f 100644 --- a/tests/api_resources/workspaces/test_artifacts.py +++ b/tests/api_resources/machines/test_artifacts.py @@ -10,7 +10,7 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspaces import Artifact +from dedalus_sdk.types.machines import Artifact base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,17 +20,17 @@ class TestArtifacts: @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - artifact = client.workspaces.artifacts.retrieve( + artifact = client.machines.artifacts.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert_matches_type(Artifact, artifact, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.artifacts.with_raw_response.retrieve( + response = client.machines.artifacts.with_raw_response.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -40,9 +40,9 @@ def test_raw_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.artifacts.with_streaming_response.retrieve( + with client.machines.artifacts.with_streaming_response.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -54,29 +54,29 @@ def test_streaming_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.artifacts.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.artifacts.with_raw_response.retrieve( + machine_id="", artifact_id="artifact_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `artifact_id` but received ''"): - client.workspaces.artifacts.with_raw_response.retrieve( + client.machines.artifacts.with_raw_response.retrieve( + machine_id="machine_id", artifact_id="", - workspace_id="workspace_id", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - artifact = client.workspaces.artifacts.list( - workspace_id="workspace_id", + artifact = client.machines.artifacts.list( + machine_id="machine_id", ) assert_matches_type(SyncCursorPage[Artifact], artifact, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - artifact = client.workspaces.artifacts.list( - workspace_id="workspace_id", + artifact = client.machines.artifacts.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -84,8 +84,8 @@ def test_method_list_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.artifacts.with_raw_response.list( - workspace_id="workspace_id", + response = client.machines.artifacts.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -95,8 +95,8 @@ def test_raw_response_list(self, client: Dedalus) -> None: @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.artifacts.with_streaming_response.list( - workspace_id="workspace_id", + with client.machines.artifacts.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,24 +108,24 @@ def test_streaming_response_list(self, client: Dedalus) -> None: @parametrize def test_path_params_list(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.artifacts.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.artifacts.with_raw_response.list( + machine_id="", ) @parametrize def test_method_delete(self, client: Dedalus) -> None: - artifact = client.workspaces.artifacts.delete( + artifact = client.machines.artifacts.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert_matches_type(Artifact, artifact, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.artifacts.with_raw_response.delete( + response = client.machines.artifacts.with_raw_response.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -135,9 +135,9 @@ def test_raw_response_delete(self, client: Dedalus) -> None: @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.artifacts.with_streaming_response.delete( + with client.machines.artifacts.with_streaming_response.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,16 +149,16 @@ def test_streaming_response_delete(self, client: Dedalus) -> None: @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.artifacts.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.artifacts.with_raw_response.delete( + machine_id="", artifact_id="artifact_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `artifact_id` but received ''"): - client.workspaces.artifacts.with_raw_response.delete( + client.machines.artifacts.with_raw_response.delete( + machine_id="machine_id", artifact_id="", - workspace_id="workspace_id", ) @@ -169,17 +169,17 @@ class TestAsyncArtifacts: @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - artifact = await async_client.workspaces.artifacts.retrieve( + artifact = await async_client.machines.artifacts.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert_matches_type(Artifact, artifact, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.artifacts.with_raw_response.retrieve( + response = await async_client.machines.artifacts.with_raw_response.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -189,9 +189,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.artifacts.with_streaming_response.retrieve( + async with async_client.machines.artifacts.with_streaming_response.retrieve( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -203,29 +203,29 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.artifacts.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.artifacts.with_raw_response.retrieve( + machine_id="", artifact_id="artifact_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `artifact_id` but received ''"): - await async_client.workspaces.artifacts.with_raw_response.retrieve( + await async_client.machines.artifacts.with_raw_response.retrieve( + machine_id="machine_id", artifact_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - artifact = await async_client.workspaces.artifacts.list( - workspace_id="workspace_id", + artifact = await async_client.machines.artifacts.list( + machine_id="machine_id", ) assert_matches_type(AsyncCursorPage[Artifact], artifact, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - artifact = await async_client.workspaces.artifacts.list( - workspace_id="workspace_id", + artifact = await async_client.machines.artifacts.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -233,8 +233,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.artifacts.with_raw_response.list( - workspace_id="workspace_id", + response = await async_client.machines.artifacts.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -244,8 +244,8 @@ async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.artifacts.with_streaming_response.list( - workspace_id="workspace_id", + async with async_client.machines.artifacts.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -257,24 +257,24 @@ async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None @parametrize async def test_path_params_list(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.artifacts.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.artifacts.with_raw_response.list( + machine_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - artifact = await async_client.workspaces.artifacts.delete( + artifact = await async_client.machines.artifacts.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert_matches_type(Artifact, artifact, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.artifacts.with_raw_response.delete( + response = await async_client.machines.artifacts.with_raw_response.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -284,9 +284,9 @@ async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.artifacts.with_streaming_response.delete( + async with async_client.machines.artifacts.with_streaming_response.delete( + machine_id="machine_id", artifact_id="artifact_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -298,14 +298,14 @@ async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.artifacts.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.artifacts.with_raw_response.delete( + machine_id="", artifact_id="artifact_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `artifact_id` but received ''"): - await async_client.workspaces.artifacts.with_raw_response.delete( + await async_client.machines.artifacts.with_raw_response.delete( + machine_id="machine_id", artifact_id="", - workspace_id="workspace_id", ) diff --git a/tests/api_resources/workspaces/test_executions.py b/tests/api_resources/machines/test_executions.py similarity index 71% rename from tests/api_resources/workspaces/test_executions.py rename to tests/api_resources/machines/test_executions.py index 15777c1..37fb085 100644 --- a/tests/api_resources/workspaces/test_executions.py +++ b/tests/api_resources/machines/test_executions.py @@ -10,7 +10,7 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspaces import ( +from dedalus_sdk.types.machines import ( Execution, ExecutionEvent, ExecutionOutput, @@ -24,16 +24,16 @@ class TestExecutions: @parametrize def test_method_create(self, client: Dedalus) -> None: - execution = client.workspaces.executions.create( - workspace_id="workspace_id", + execution = client.machines.executions.create( + machine_id="machine_id", command=["string"], ) assert_matches_type(Execution, execution, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Dedalus) -> None: - execution = client.workspaces.executions.create( - workspace_id="workspace_id", + execution = client.machines.executions.create( + machine_id="machine_id", command=["string"], cwd="cwd", env={"foo": "string"}, @@ -44,8 +44,8 @@ def test_method_create_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_create(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.create( - workspace_id="workspace_id", + response = client.machines.executions.with_raw_response.create( + machine_id="machine_id", command=["string"], ) @@ -56,8 +56,8 @@ def test_raw_response_create(self, client: Dedalus) -> None: @parametrize def test_streaming_response_create(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.create( - workspace_id="workspace_id", + with client.machines.executions.with_streaming_response.create( + machine_id="machine_id", command=["string"], ) as response: assert not response.is_closed @@ -70,25 +70,25 @@ def test_streaming_response_create(self, client: Dedalus) -> None: @parametrize def test_path_params_create(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.create( + machine_id="", command=["string"], ) @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - execution = client.workspaces.executions.retrieve( + execution = client.machines.executions.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(Execution, execution, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.retrieve( + response = client.machines.executions.with_raw_response.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -98,9 +98,9 @@ def test_raw_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.retrieve( + with client.machines.executions.with_streaming_response.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,29 +112,29 @@ def test_streaming_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.retrieve( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.workspaces.executions.with_raw_response.retrieve( + client.machines.executions.with_raw_response.retrieve( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - execution = client.workspaces.executions.list( - workspace_id="workspace_id", + execution = client.machines.executions.list( + machine_id="machine_id", ) assert_matches_type(SyncCursorPage[Execution], execution, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - execution = client.workspaces.executions.list( - workspace_id="workspace_id", + execution = client.machines.executions.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -142,8 +142,8 @@ def test_method_list_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.list( - workspace_id="workspace_id", + response = client.machines.executions.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -153,8 +153,8 @@ def test_raw_response_list(self, client: Dedalus) -> None: @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.list( - workspace_id="workspace_id", + with client.machines.executions.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,24 +166,24 @@ def test_streaming_response_list(self, client: Dedalus) -> None: @parametrize def test_path_params_list(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.list( + machine_id="", ) @parametrize def test_method_delete(self, client: Dedalus) -> None: - execution = client.workspaces.executions.delete( + execution = client.machines.executions.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(Execution, execution, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.delete( + response = client.machines.executions.with_raw_response.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -193,9 +193,9 @@ def test_raw_response_delete(self, client: Dedalus) -> None: @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.delete( + with client.machines.executions.with_streaming_response.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -207,31 +207,31 @@ def test_streaming_response_delete(self, client: Dedalus) -> None: @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.delete( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.workspaces.executions.with_raw_response.delete( + client.machines.executions.with_raw_response.delete( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize def test_method_events(self, client: Dedalus) -> None: - execution = client.workspaces.executions.events( + execution = client.machines.executions.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(SyncCursorPage[ExecutionEvent], execution, path=["response"]) @parametrize def test_method_events_with_all_params(self, client: Dedalus) -> None: - execution = client.workspaces.executions.events( + execution = client.machines.executions.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", cursor="cursor", limit=0, ) @@ -239,9 +239,9 @@ def test_method_events_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_events(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.events( + response = client.machines.executions.with_raw_response.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -251,9 +251,9 @@ def test_raw_response_events(self, client: Dedalus) -> None: @parametrize def test_streaming_response_events(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.events( + with client.machines.executions.with_streaming_response.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -265,31 +265,31 @@ def test_streaming_response_events(self, client: Dedalus) -> None: @parametrize def test_path_params_events(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.events( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.events( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.workspaces.executions.with_raw_response.events( + client.machines.executions.with_raw_response.events( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize def test_method_output(self, client: Dedalus) -> None: - execution = client.workspaces.executions.output( + execution = client.machines.executions.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(ExecutionOutput, execution, path=["response"]) @parametrize def test_raw_response_output(self, client: Dedalus) -> None: - response = client.workspaces.executions.with_raw_response.output( + response = client.machines.executions.with_raw_response.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -299,9 +299,9 @@ def test_raw_response_output(self, client: Dedalus) -> None: @parametrize def test_streaming_response_output(self, client: Dedalus) -> None: - with client.workspaces.executions.with_streaming_response.output( + with client.machines.executions.with_streaming_response.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -313,16 +313,16 @@ def test_streaming_response_output(self, client: Dedalus) -> None: @parametrize def test_path_params_output(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.executions.with_raw_response.output( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.executions.with_raw_response.output( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.workspaces.executions.with_raw_response.output( + client.machines.executions.with_raw_response.output( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @@ -333,16 +333,16 @@ class TestAsyncExecutions: @parametrize async def test_method_create(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.create( - workspace_id="workspace_id", + execution = await async_client.machines.executions.create( + machine_id="machine_id", command=["string"], ) assert_matches_type(Execution, execution, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.create( - workspace_id="workspace_id", + execution = await async_client.machines.executions.create( + machine_id="machine_id", command=["string"], cwd="cwd", env={"foo": "string"}, @@ -353,8 +353,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncDedalus) - @parametrize async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.create( - workspace_id="workspace_id", + response = await async_client.machines.executions.with_raw_response.create( + machine_id="machine_id", command=["string"], ) @@ -365,8 +365,8 @@ async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.create( - workspace_id="workspace_id", + async with async_client.machines.executions.with_streaming_response.create( + machine_id="machine_id", command=["string"], ) as response: assert not response.is_closed @@ -379,25 +379,25 @@ async def test_streaming_response_create(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_create(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.create( + machine_id="", command=["string"], ) @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.retrieve( + execution = await async_client.machines.executions.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(Execution, execution, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.retrieve( + response = await async_client.machines.executions.with_raw_response.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -407,9 +407,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.retrieve( + async with async_client.machines.executions.with_streaming_response.retrieve( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -421,29 +421,29 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.retrieve( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.retrieve( + await async_client.machines.executions.with_raw_response.retrieve( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.list( - workspace_id="workspace_id", + execution = await async_client.machines.executions.list( + machine_id="machine_id", ) assert_matches_type(AsyncCursorPage[Execution], execution, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.list( - workspace_id="workspace_id", + execution = await async_client.machines.executions.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -451,8 +451,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.list( - workspace_id="workspace_id", + response = await async_client.machines.executions.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -462,8 +462,8 @@ async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.list( - workspace_id="workspace_id", + async with async_client.machines.executions.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -475,24 +475,24 @@ async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None @parametrize async def test_path_params_list(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.list( + machine_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.delete( + execution = await async_client.machines.executions.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(Execution, execution, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.delete( + response = await async_client.machines.executions.with_raw_response.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -502,9 +502,9 @@ async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.delete( + async with async_client.machines.executions.with_streaming_response.delete( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -516,31 +516,31 @@ async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.delete( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.delete( + await async_client.machines.executions.with_raw_response.delete( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_events(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.events( + execution = await async_client.machines.executions.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(AsyncCursorPage[ExecutionEvent], execution, path=["response"]) @parametrize async def test_method_events_with_all_params(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.events( + execution = await async_client.machines.executions.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", cursor="cursor", limit=0, ) @@ -548,9 +548,9 @@ async def test_method_events_with_all_params(self, async_client: AsyncDedalus) - @parametrize async def test_raw_response_events(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.events( + response = await async_client.machines.executions.with_raw_response.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -560,9 +560,9 @@ async def test_raw_response_events(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_events(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.events( + async with async_client.machines.executions.with_streaming_response.events( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -574,31 +574,31 @@ async def test_streaming_response_events(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_events(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.events( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.events( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.events( + await async_client.machines.executions.with_raw_response.events( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_output(self, async_client: AsyncDedalus) -> None: - execution = await async_client.workspaces.executions.output( + execution = await async_client.machines.executions.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert_matches_type(ExecutionOutput, execution, path=["response"]) @parametrize async def test_raw_response_output(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.executions.with_raw_response.output( + response = await async_client.machines.executions.with_raw_response.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -608,9 +608,9 @@ async def test_raw_response_output(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_output(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.executions.with_streaming_response.output( + async with async_client.machines.executions.with_streaming_response.output( + machine_id="machine_id", execution_id="execution_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -622,14 +622,14 @@ async def test_streaming_response_output(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_output(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.output( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.executions.with_raw_response.output( + machine_id="", execution_id="execution_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.workspaces.executions.with_raw_response.output( + await async_client.machines.executions.with_raw_response.output( + machine_id="machine_id", execution_id="", - workspace_id="workspace_id", ) diff --git a/tests/api_resources/workspaces/test_previews.py b/tests/api_resources/machines/test_previews.py similarity index 70% rename from tests/api_resources/workspaces/test_previews.py rename to tests/api_resources/machines/test_previews.py index bc1e519..d804571 100644 --- a/tests/api_resources/workspaces/test_previews.py +++ b/tests/api_resources/machines/test_previews.py @@ -10,7 +10,7 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspaces import Preview +from dedalus_sdk.types.machines import Preview base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,25 +20,26 @@ class TestPreviews: @parametrize def test_method_create(self, client: Dedalus) -> None: - preview = client.workspaces.previews.create( - workspace_id="workspace_id", + preview = client.machines.previews.create( + machine_id="machine_id", port=0, ) assert_matches_type(Preview, preview, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Dedalus) -> None: - preview = client.workspaces.previews.create( - workspace_id="workspace_id", + preview = client.machines.previews.create( + machine_id="machine_id", port=0, protocol="http", + visibility="public", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize def test_raw_response_create(self, client: Dedalus) -> None: - response = client.workspaces.previews.with_raw_response.create( - workspace_id="workspace_id", + response = client.machines.previews.with_raw_response.create( + machine_id="machine_id", port=0, ) @@ -49,8 +50,8 @@ def test_raw_response_create(self, client: Dedalus) -> None: @parametrize def test_streaming_response_create(self, client: Dedalus) -> None: - with client.workspaces.previews.with_streaming_response.create( - workspace_id="workspace_id", + with client.machines.previews.with_streaming_response.create( + machine_id="machine_id", port=0, ) as response: assert not response.is_closed @@ -63,25 +64,25 @@ def test_streaming_response_create(self, client: Dedalus) -> None: @parametrize def test_path_params_create(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.previews.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.previews.with_raw_response.create( + machine_id="", port=0, ) @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - preview = client.workspaces.previews.retrieve( + preview = client.machines.previews.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.previews.with_raw_response.retrieve( + response = client.machines.previews.with_raw_response.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -91,9 +92,9 @@ def test_raw_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.previews.with_streaming_response.retrieve( + with client.machines.previews.with_streaming_response.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -105,29 +106,29 @@ def test_streaming_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.previews.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.previews.with_raw_response.retrieve( + machine_id="", preview_id="preview_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - client.workspaces.previews.with_raw_response.retrieve( + client.machines.previews.with_raw_response.retrieve( + machine_id="machine_id", preview_id="", - workspace_id="workspace_id", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - preview = client.workspaces.previews.list( - workspace_id="workspace_id", + preview = client.machines.previews.list( + machine_id="machine_id", ) assert_matches_type(SyncCursorPage[Preview], preview, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - preview = client.workspaces.previews.list( - workspace_id="workspace_id", + preview = client.machines.previews.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -135,8 +136,8 @@ def test_method_list_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.previews.with_raw_response.list( - workspace_id="workspace_id", + response = client.machines.previews.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -146,8 +147,8 @@ def test_raw_response_list(self, client: Dedalus) -> None: @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.previews.with_streaming_response.list( - workspace_id="workspace_id", + with client.machines.previews.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -159,24 +160,24 @@ def test_streaming_response_list(self, client: Dedalus) -> None: @parametrize def test_path_params_list(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.previews.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.previews.with_raw_response.list( + machine_id="", ) @parametrize def test_method_delete(self, client: Dedalus) -> None: - preview = client.workspaces.previews.delete( + preview = client.machines.previews.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.previews.with_raw_response.delete( + response = client.machines.previews.with_raw_response.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -186,9 +187,9 @@ def test_raw_response_delete(self, client: Dedalus) -> None: @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.previews.with_streaming_response.delete( + with client.machines.previews.with_streaming_response.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -200,16 +201,16 @@ def test_streaming_response_delete(self, client: Dedalus) -> None: @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.previews.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.previews.with_raw_response.delete( + machine_id="", preview_id="preview_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - client.workspaces.previews.with_raw_response.delete( + client.machines.previews.with_raw_response.delete( + machine_id="machine_id", preview_id="", - workspace_id="workspace_id", ) @@ -220,25 +221,26 @@ class TestAsyncPreviews: @parametrize async def test_method_create(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.create( - workspace_id="workspace_id", + preview = await async_client.machines.previews.create( + machine_id="machine_id", port=0, ) assert_matches_type(Preview, preview, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.create( - workspace_id="workspace_id", + preview = await async_client.machines.previews.create( + machine_id="machine_id", port=0, protocol="http", + visibility="public", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.previews.with_raw_response.create( - workspace_id="workspace_id", + response = await async_client.machines.previews.with_raw_response.create( + machine_id="machine_id", port=0, ) @@ -249,8 +251,8 @@ async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.previews.with_streaming_response.create( - workspace_id="workspace_id", + async with async_client.machines.previews.with_streaming_response.create( + machine_id="machine_id", port=0, ) as response: assert not response.is_closed @@ -263,25 +265,25 @@ async def test_streaming_response_create(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_create(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.previews.with_raw_response.create( + machine_id="", port=0, ) @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.retrieve( + preview = await async_client.machines.previews.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.previews.with_raw_response.retrieve( + response = await async_client.machines.previews.with_raw_response.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -291,9 +293,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.previews.with_streaming_response.retrieve( + async with async_client.machines.previews.with_streaming_response.retrieve( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -305,29 +307,29 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.previews.with_raw_response.retrieve( + machine_id="", preview_id="preview_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.retrieve( + await async_client.machines.previews.with_raw_response.retrieve( + machine_id="machine_id", preview_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.list( - workspace_id="workspace_id", + preview = await async_client.machines.previews.list( + machine_id="machine_id", ) assert_matches_type(AsyncCursorPage[Preview], preview, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.list( - workspace_id="workspace_id", + preview = await async_client.machines.previews.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -335,8 +337,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.previews.with_raw_response.list( - workspace_id="workspace_id", + response = await async_client.machines.previews.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -346,8 +348,8 @@ async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.previews.with_streaming_response.list( - workspace_id="workspace_id", + async with async_client.machines.previews.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,24 +361,24 @@ async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None @parametrize async def test_path_params_list(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.previews.with_raw_response.list( + machine_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - preview = await async_client.workspaces.previews.delete( + preview = await async_client.machines.previews.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert_matches_type(Preview, preview, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.previews.with_raw_response.delete( + response = await async_client.machines.previews.with_raw_response.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -386,9 +388,9 @@ async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.previews.with_streaming_response.delete( + async with async_client.machines.previews.with_streaming_response.delete( + machine_id="machine_id", preview_id="preview_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -400,14 +402,14 @@ async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.previews.with_raw_response.delete( + machine_id="", preview_id="preview_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - await async_client.workspaces.previews.with_raw_response.delete( + await async_client.machines.previews.with_raw_response.delete( + machine_id="machine_id", preview_id="", - workspace_id="workspace_id", ) diff --git a/tests/api_resources/workspaces/test_ssh.py b/tests/api_resources/machines/test_ssh.py similarity index 72% rename from tests/api_resources/workspaces/test_ssh.py rename to tests/api_resources/machines/test_ssh.py index 535709d..ecba31f 100644 --- a/tests/api_resources/workspaces/test_ssh.py +++ b/tests/api_resources/machines/test_ssh.py @@ -10,7 +10,7 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspaces import SSHSession +from dedalus_sdk.types.machines import SSHSession base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,16 +20,16 @@ class TestSSH: @parametrize def test_method_create(self, client: Dedalus) -> None: - ssh = client.workspaces.ssh.create( - workspace_id="workspace_id", + ssh = client.machines.ssh.create( + machine_id="machine_id", public_key="public_key", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize def test_raw_response_create(self, client: Dedalus) -> None: - response = client.workspaces.ssh.with_raw_response.create( - workspace_id="workspace_id", + response = client.machines.ssh.with_raw_response.create( + machine_id="machine_id", public_key="public_key", ) @@ -40,8 +40,8 @@ def test_raw_response_create(self, client: Dedalus) -> None: @parametrize def test_streaming_response_create(self, client: Dedalus) -> None: - with client.workspaces.ssh.with_streaming_response.create( - workspace_id="workspace_id", + with client.machines.ssh.with_streaming_response.create( + machine_id="machine_id", public_key="public_key", ) as response: assert not response.is_closed @@ -54,25 +54,25 @@ def test_streaming_response_create(self, client: Dedalus) -> None: @parametrize def test_path_params_create(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.ssh.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.ssh.with_raw_response.create( + machine_id="", public_key="public_key", ) @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - ssh = client.workspaces.ssh.retrieve( + ssh = client.machines.ssh.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.ssh.with_raw_response.retrieve( + response = client.machines.ssh.with_raw_response.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -82,9 +82,9 @@ def test_raw_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.ssh.with_streaming_response.retrieve( + with client.machines.ssh.with_streaming_response.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -96,29 +96,29 @@ def test_streaming_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.ssh.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.ssh.with_raw_response.retrieve( + machine_id="", session_id="session_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.workspaces.ssh.with_raw_response.retrieve( + client.machines.ssh.with_raw_response.retrieve( + machine_id="machine_id", session_id="", - workspace_id="workspace_id", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - ssh = client.workspaces.ssh.list( - workspace_id="workspace_id", + ssh = client.machines.ssh.list( + machine_id="machine_id", ) assert_matches_type(SyncCursorPage[SSHSession], ssh, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - ssh = client.workspaces.ssh.list( - workspace_id="workspace_id", + ssh = client.machines.ssh.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -126,8 +126,8 @@ def test_method_list_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.ssh.with_raw_response.list( - workspace_id="workspace_id", + response = client.machines.ssh.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -137,8 +137,8 @@ def test_raw_response_list(self, client: Dedalus) -> None: @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.ssh.with_streaming_response.list( - workspace_id="workspace_id", + with client.machines.ssh.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,24 +150,24 @@ def test_streaming_response_list(self, client: Dedalus) -> None: @parametrize def test_path_params_list(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.ssh.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.ssh.with_raw_response.list( + machine_id="", ) @parametrize def test_method_delete(self, client: Dedalus) -> None: - ssh = client.workspaces.ssh.delete( + ssh = client.machines.ssh.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.ssh.with_raw_response.delete( + response = client.machines.ssh.with_raw_response.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -177,9 +177,9 @@ def test_raw_response_delete(self, client: Dedalus) -> None: @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.ssh.with_streaming_response.delete( + with client.machines.ssh.with_streaming_response.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -191,16 +191,16 @@ def test_streaming_response_delete(self, client: Dedalus) -> None: @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.ssh.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.ssh.with_raw_response.delete( + machine_id="", session_id="session_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.workspaces.ssh.with_raw_response.delete( + client.machines.ssh.with_raw_response.delete( + machine_id="machine_id", session_id="", - workspace_id="workspace_id", ) @@ -211,16 +211,16 @@ class TestAsyncSSH: @parametrize async def test_method_create(self, async_client: AsyncDedalus) -> None: - ssh = await async_client.workspaces.ssh.create( - workspace_id="workspace_id", + ssh = await async_client.machines.ssh.create( + machine_id="machine_id", public_key="public_key", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.ssh.with_raw_response.create( - workspace_id="workspace_id", + response = await async_client.machines.ssh.with_raw_response.create( + machine_id="machine_id", public_key="public_key", ) @@ -231,8 +231,8 @@ async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.ssh.with_streaming_response.create( - workspace_id="workspace_id", + async with async_client.machines.ssh.with_streaming_response.create( + machine_id="machine_id", public_key="public_key", ) as response: assert not response.is_closed @@ -245,25 +245,25 @@ async def test_streaming_response_create(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_create(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.ssh.with_raw_response.create( + machine_id="", public_key="public_key", ) @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - ssh = await async_client.workspaces.ssh.retrieve( + ssh = await async_client.machines.ssh.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.ssh.with_raw_response.retrieve( + response = await async_client.machines.ssh.with_raw_response.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -273,9 +273,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.ssh.with_streaming_response.retrieve( + async with async_client.machines.ssh.with_streaming_response.retrieve( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -287,29 +287,29 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.ssh.with_raw_response.retrieve( + machine_id="", session_id="session_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.retrieve( + await async_client.machines.ssh.with_raw_response.retrieve( + machine_id="machine_id", session_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - ssh = await async_client.workspaces.ssh.list( - workspace_id="workspace_id", + ssh = await async_client.machines.ssh.list( + machine_id="machine_id", ) assert_matches_type(AsyncCursorPage[SSHSession], ssh, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - ssh = await async_client.workspaces.ssh.list( - workspace_id="workspace_id", + ssh = await async_client.machines.ssh.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -317,8 +317,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.ssh.with_raw_response.list( - workspace_id="workspace_id", + response = await async_client.machines.ssh.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -328,8 +328,8 @@ async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.ssh.with_streaming_response.list( - workspace_id="workspace_id", + async with async_client.machines.ssh.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -341,24 +341,24 @@ async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None @parametrize async def test_path_params_list(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.ssh.with_raw_response.list( + machine_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - ssh = await async_client.workspaces.ssh.delete( + ssh = await async_client.machines.ssh.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert_matches_type(SSHSession, ssh, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.ssh.with_raw_response.delete( + response = await async_client.machines.ssh.with_raw_response.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -368,9 +368,9 @@ async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.ssh.with_streaming_response.delete( + async with async_client.machines.ssh.with_streaming_response.delete( + machine_id="machine_id", session_id="session_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -382,14 +382,14 @@ async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.ssh.with_raw_response.delete( + machine_id="", session_id="session_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.workspaces.ssh.with_raw_response.delete( + await async_client.machines.ssh.with_raw_response.delete( + machine_id="machine_id", session_id="", - workspace_id="workspace_id", ) diff --git a/tests/api_resources/workspaces/test_terminals.py b/tests/api_resources/machines/test_terminals.py similarity index 71% rename from tests/api_resources/workspaces/test_terminals.py rename to tests/api_resources/machines/test_terminals.py index e84e52d..47e3aaa 100644 --- a/tests/api_resources/workspaces/test_terminals.py +++ b/tests/api_resources/machines/test_terminals.py @@ -10,7 +10,7 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspaces import Terminal +from dedalus_sdk.types.machines import Terminal base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,8 +20,8 @@ class TestTerminals: @parametrize def test_method_create(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.create( - workspace_id="workspace_id", + terminal = client.machines.terminals.create( + machine_id="machine_id", height=0, width=0, ) @@ -29,8 +29,8 @@ def test_method_create(self, client: Dedalus) -> None: @parametrize def test_method_create_with_all_params(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.create( - workspace_id="workspace_id", + terminal = client.machines.terminals.create( + machine_id="machine_id", height=0, width=0, cwd="cwd", @@ -41,8 +41,8 @@ def test_method_create_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_create(self, client: Dedalus) -> None: - response = client.workspaces.terminals.with_raw_response.create( - workspace_id="workspace_id", + response = client.machines.terminals.with_raw_response.create( + machine_id="machine_id", height=0, width=0, ) @@ -54,8 +54,8 @@ def test_raw_response_create(self, client: Dedalus) -> None: @parametrize def test_streaming_response_create(self, client: Dedalus) -> None: - with client.workspaces.terminals.with_streaming_response.create( - workspace_id="workspace_id", + with client.machines.terminals.with_streaming_response.create( + machine_id="machine_id", height=0, width=0, ) as response: @@ -69,26 +69,26 @@ def test_streaming_response_create(self, client: Dedalus) -> None: @parametrize def test_path_params_create(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.terminals.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.terminals.with_raw_response.create( + machine_id="", height=0, width=0, ) @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.retrieve( + terminal = client.machines.terminals.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert_matches_type(Terminal, terminal, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.terminals.with_raw_response.retrieve( + response = client.machines.terminals.with_raw_response.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -98,9 +98,9 @@ def test_raw_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.terminals.with_streaming_response.retrieve( + with client.machines.terminals.with_streaming_response.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,29 +112,29 @@ def test_streaming_response_retrieve(self, client: Dedalus) -> None: @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.terminals.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.terminals.with_raw_response.retrieve( + machine_id="", terminal_id="terminal_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `terminal_id` but received ''"): - client.workspaces.terminals.with_raw_response.retrieve( + client.machines.terminals.with_raw_response.retrieve( + machine_id="machine_id", terminal_id="", - workspace_id="workspace_id", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.list( - workspace_id="workspace_id", + terminal = client.machines.terminals.list( + machine_id="machine_id", ) assert_matches_type(SyncCursorPage[Terminal], terminal, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.list( - workspace_id="workspace_id", + terminal = client.machines.terminals.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -142,8 +142,8 @@ def test_method_list_with_all_params(self, client: Dedalus) -> None: @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.terminals.with_raw_response.list( - workspace_id="workspace_id", + response = client.machines.terminals.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -153,8 +153,8 @@ def test_raw_response_list(self, client: Dedalus) -> None: @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.terminals.with_streaming_response.list( - workspace_id="workspace_id", + with client.machines.terminals.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,24 +166,24 @@ def test_streaming_response_list(self, client: Dedalus) -> None: @parametrize def test_path_params_list(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.terminals.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.terminals.with_raw_response.list( + machine_id="", ) @parametrize def test_method_delete(self, client: Dedalus) -> None: - terminal = client.workspaces.terminals.delete( + terminal = client.machines.terminals.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert_matches_type(Terminal, terminal, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.terminals.with_raw_response.delete( + response = client.machines.terminals.with_raw_response.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -193,9 +193,9 @@ def test_raw_response_delete(self, client: Dedalus) -> None: @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.terminals.with_streaming_response.delete( + with client.machines.terminals.with_streaming_response.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -207,16 +207,16 @@ def test_streaming_response_delete(self, client: Dedalus) -> None: @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.terminals.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.terminals.with_raw_response.delete( + machine_id="", terminal_id="terminal_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `terminal_id` but received ''"): - client.workspaces.terminals.with_raw_response.delete( + client.machines.terminals.with_raw_response.delete( + machine_id="machine_id", terminal_id="", - workspace_id="workspace_id", ) @@ -227,8 +227,8 @@ class TestAsyncTerminals: @parametrize async def test_method_create(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.create( - workspace_id="workspace_id", + terminal = await async_client.machines.terminals.create( + machine_id="machine_id", height=0, width=0, ) @@ -236,8 +236,8 @@ async def test_method_create(self, async_client: AsyncDedalus) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.create( - workspace_id="workspace_id", + terminal = await async_client.machines.terminals.create( + machine_id="machine_id", height=0, width=0, cwd="cwd", @@ -248,8 +248,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncDedalus) - @parametrize async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.terminals.with_raw_response.create( - workspace_id="workspace_id", + response = await async_client.machines.terminals.with_raw_response.create( + machine_id="machine_id", height=0, width=0, ) @@ -261,8 +261,8 @@ async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.terminals.with_streaming_response.create( - workspace_id="workspace_id", + async with async_client.machines.terminals.with_streaming_response.create( + machine_id="machine_id", height=0, width=0, ) as response: @@ -276,26 +276,26 @@ async def test_streaming_response_create(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_create(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.create( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.terminals.with_raw_response.create( + machine_id="", height=0, width=0, ) @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.retrieve( + terminal = await async_client.machines.terminals.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert_matches_type(Terminal, terminal, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.terminals.with_raw_response.retrieve( + response = await async_client.machines.terminals.with_raw_response.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -305,9 +305,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.terminals.with_streaming_response.retrieve( + async with async_client.machines.terminals.with_streaming_response.retrieve( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -319,29 +319,29 @@ async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.terminals.with_raw_response.retrieve( + machine_id="", terminal_id="terminal_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `terminal_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.retrieve( + await async_client.machines.terminals.with_raw_response.retrieve( + machine_id="machine_id", terminal_id="", - workspace_id="workspace_id", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.list( - workspace_id="workspace_id", + terminal = await async_client.machines.terminals.list( + machine_id="machine_id", ) assert_matches_type(AsyncCursorPage[Terminal], terminal, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.list( - workspace_id="workspace_id", + terminal = await async_client.machines.terminals.list( + machine_id="machine_id", cursor="cursor", limit=0, ) @@ -349,8 +349,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.terminals.with_raw_response.list( - workspace_id="workspace_id", + response = await async_client.machines.terminals.with_raw_response.list( + machine_id="machine_id", ) assert response.is_closed is True @@ -360,8 +360,8 @@ async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.terminals.with_streaming_response.list( - workspace_id="workspace_id", + async with async_client.machines.terminals.with_streaming_response.list( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -373,24 +373,24 @@ async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None @parametrize async def test_path_params_list(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.list( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.terminals.with_raw_response.list( + machine_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - terminal = await async_client.workspaces.terminals.delete( + terminal = await async_client.machines.terminals.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert_matches_type(Terminal, terminal, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.terminals.with_raw_response.delete( + response = await async_client.machines.terminals.with_raw_response.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) assert response.is_closed is True @@ -400,9 +400,9 @@ async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.terminals.with_streaming_response.delete( + async with async_client.machines.terminals.with_streaming_response.delete( + machine_id="machine_id", terminal_id="terminal_id", - workspace_id="workspace_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -414,14 +414,14 @@ async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> No @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.delete( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.terminals.with_raw_response.delete( + machine_id="", terminal_id="terminal_id", - workspace_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `terminal_id` but received ''"): - await async_client.workspaces.terminals.with_raw_response.delete( + await async_client.machines.terminals.with_raw_response.delete( + machine_id="machine_id", terminal_id="", - workspace_id="workspace_id", ) diff --git a/tests/api_resources/test_workspaces.py b/tests/api_resources/test_machines.py similarity index 58% rename from tests/api_resources/test_workspaces.py rename to tests/api_resources/test_machines.py index 0420c23..6962809 100644 --- a/tests/api_resources/test_workspaces.py +++ b/tests/api_resources/test_machines.py @@ -9,28 +9,30 @@ from dedalus_sdk import Dedalus, AsyncDedalus from tests.utils import assert_matches_type -from dedalus_sdk.types import Workspace +from dedalus_sdk.types import ( + Machine, + MachineListItem, +) from dedalus_sdk.pagination import SyncCursorPage, AsyncCursorPage -from dedalus_sdk.types.workspace_list import Item base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestWorkspaces: +class TestMachines: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Dedalus) -> None: - workspace = client.workspaces.create( + machine = client.machines.create( memory_mib=0, storage_gib=0, vcpu=0, ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_raw_response_create(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.create( + response = client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, @@ -38,12 +40,12 @@ def test_raw_response_create(self, client: Dedalus) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_streaming_response_create(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.create( + with client.machines.with_streaming_response.create( memory_mib=0, storage_gib=0, vcpu=0, @@ -51,196 +53,196 @@ def test_streaming_response_create(self, client: Dedalus) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: Dedalus) -> None: - workspace = client.workspaces.retrieve( - "workspace_id", + machine = client.machines.retrieve( + machine_id="machine_id", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.retrieve( - "workspace_id", + response = client.machines.with_raw_response.retrieve( + machine_id="machine_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.retrieve( - "workspace_id", + with client.machines.with_streaming_response.retrieve( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.with_raw_response.retrieve( - "", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.with_raw_response.retrieve( + machine_id="", ) @parametrize def test_method_update(self, client: Dedalus) -> None: - workspace = client.workspaces.update( - workspace_id="workspace_id", + machine = client.machines.update( + machine_id="machine_id", if_match="If-Match", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Dedalus) -> None: - workspace = client.workspaces.update( - workspace_id="workspace_id", + machine = client.machines.update( + machine_id="machine_id", if_match="If-Match", memory_mib=0, storage_gib=0, vcpu=0, ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_raw_response_update(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.update( - workspace_id="workspace_id", + response = client.machines.with_raw_response.update( + machine_id="machine_id", if_match="If-Match", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_streaming_response_update(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.update( - workspace_id="workspace_id", + with client.machines.with_streaming_response.update( + machine_id="machine_id", if_match="If-Match", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.with_raw_response.update( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.with_raw_response.update( + machine_id="", if_match="If-Match", ) @parametrize def test_method_list(self, client: Dedalus) -> None: - workspace = client.workspaces.list() - assert_matches_type(SyncCursorPage[Item], workspace, path=["response"]) + machine = client.machines.list() + assert_matches_type(SyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Dedalus) -> None: - workspace = client.workspaces.list( + machine = client.machines.list( cursor="cursor", limit=0, ) - assert_matches_type(SyncCursorPage[Item], workspace, path=["response"]) + assert_matches_type(SyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize def test_raw_response_list(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.list() + response = client.machines.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(SyncCursorPage[Item], workspace, path=["response"]) + machine = response.parse() + assert_matches_type(SyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize def test_streaming_response_list(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.list() as response: + with client.machines.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(SyncCursorPage[Item], workspace, path=["response"]) + machine = response.parse() + assert_matches_type(SyncCursorPage[MachineListItem], machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Dedalus) -> None: - workspace = client.workspaces.delete( - workspace_id="workspace_id", + machine = client.machines.delete( + machine_id="machine_id", if_match="If-Match", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_raw_response_delete(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.delete( - workspace_id="workspace_id", + response = client.machines.with_raw_response.delete( + machine_id="machine_id", if_match="If-Match", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.delete( - workspace_id="workspace_id", + with client.machines.with_streaming_response.delete( + machine_id="machine_id", if_match="If-Match", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.with_raw_response.delete( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.with_raw_response.delete( + machine_id="", if_match="If-Match", ) @parametrize def test_method_watch(self, client: Dedalus) -> None: - workspace_stream = client.workspaces.watch( - workspace_id="workspace_id", + machine_stream = client.machines.watch( + machine_id="machine_id", ) - workspace_stream.response.close() + machine_stream.response.close() @parametrize def test_method_watch_with_all_params(self, client: Dedalus) -> None: - workspace_stream = client.workspaces.watch( - workspace_id="workspace_id", + machine_stream = client.machines.watch( + machine_id="machine_id", last_event_id="Last-Event-ID", ) - workspace_stream.response.close() + machine_stream.response.close() @parametrize def test_raw_response_watch(self, client: Dedalus) -> None: - response = client.workspaces.with_raw_response.watch( - workspace_id="workspace_id", + response = client.machines.with_raw_response.watch( + machine_id="machine_id", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -249,8 +251,8 @@ def test_raw_response_watch(self, client: Dedalus) -> None: @parametrize def test_streaming_response_watch(self, client: Dedalus) -> None: - with client.workspaces.with_streaming_response.watch( - workspace_id="workspace_id", + with client.machines.with_streaming_response.watch( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -262,29 +264,29 @@ def test_streaming_response_watch(self, client: Dedalus) -> None: @parametrize def test_path_params_watch(self, client: Dedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - client.workspaces.with_raw_response.watch( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + client.machines.with_raw_response.watch( + machine_id="", ) -class TestAsyncWorkspaces: +class TestAsyncMachines: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.create( + machine = await async_client.machines.create( memory_mib=0, storage_gib=0, vcpu=0, ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.create( + response = await async_client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, @@ -292,12 +294,12 @@ async def test_raw_response_create(self, async_client: AsyncDedalus) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.create( + async with async_client.machines.with_streaming_response.create( memory_mib=0, storage_gib=0, vcpu=0, @@ -305,196 +307,196 @@ async def test_streaming_response_create(self, async_client: AsyncDedalus) -> No assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.retrieve( - "workspace_id", + machine = await async_client.machines.retrieve( + machine_id="machine_id", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.retrieve( - "workspace_id", + response = await async_client.machines.with_raw_response.retrieve( + machine_id="machine_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.retrieve( - "workspace_id", + async with async_client.machines.with_streaming_response.retrieve( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.with_raw_response.retrieve( - "", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.with_raw_response.retrieve( + machine_id="", ) @parametrize async def test_method_update(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.update( - workspace_id="workspace_id", + machine = await async_client.machines.update( + machine_id="machine_id", if_match="If-Match", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.update( - workspace_id="workspace_id", + machine = await async_client.machines.update( + machine_id="machine_id", if_match="If-Match", memory_mib=0, storage_gib=0, vcpu=0, ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.update( - workspace_id="workspace_id", + response = await async_client.machines.with_raw_response.update( + machine_id="machine_id", if_match="If-Match", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.update( - workspace_id="workspace_id", + async with async_client.machines.with_streaming_response.update( + machine_id="machine_id", if_match="If-Match", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.with_raw_response.update( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.with_raw_response.update( + machine_id="", if_match="If-Match", ) @parametrize async def test_method_list(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.list() - assert_matches_type(AsyncCursorPage[Item], workspace, path=["response"]) + machine = await async_client.machines.list() + assert_matches_type(AsyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.list( + machine = await async_client.machines.list( cursor="cursor", limit=0, ) - assert_matches_type(AsyncCursorPage[Item], workspace, path=["response"]) + assert_matches_type(AsyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.list() + response = await async_client.machines.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(AsyncCursorPage[Item], workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(AsyncCursorPage[MachineListItem], machine, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.list() as response: + async with async_client.machines.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(AsyncCursorPage[Item], workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(AsyncCursorPage[MachineListItem], machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncDedalus) -> None: - workspace = await async_client.workspaces.delete( - workspace_id="workspace_id", + machine = await async_client.machines.delete( + machine_id="machine_id", if_match="If-Match", ) - assert_matches_type(Workspace, workspace, path=["response"]) + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.delete( - workspace_id="workspace_id", + response = await async_client.machines.with_raw_response.delete( + machine_id="machine_id", if_match="If-Match", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.delete( - workspace_id="workspace_id", + async with async_client.machines.with_streaming_response.delete( + machine_id="machine_id", if_match="If-Match", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - workspace = await response.parse() - assert_matches_type(Workspace, workspace, path=["response"]) + machine = await response.parse() + assert_matches_type(Machine, machine, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.with_raw_response.delete( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.with_raw_response.delete( + machine_id="", if_match="If-Match", ) @parametrize async def test_method_watch(self, async_client: AsyncDedalus) -> None: - workspace_stream = await async_client.workspaces.watch( - workspace_id="workspace_id", + machine_stream = await async_client.machines.watch( + machine_id="machine_id", ) - await workspace_stream.response.aclose() + await machine_stream.response.aclose() @parametrize async def test_method_watch_with_all_params(self, async_client: AsyncDedalus) -> None: - workspace_stream = await async_client.workspaces.watch( - workspace_id="workspace_id", + machine_stream = await async_client.machines.watch( + machine_id="machine_id", last_event_id="Last-Event-ID", ) - await workspace_stream.response.aclose() + await machine_stream.response.aclose() @parametrize async def test_raw_response_watch(self, async_client: AsyncDedalus) -> None: - response = await async_client.workspaces.with_raw_response.watch( - workspace_id="workspace_id", + response = await async_client.machines.with_raw_response.watch( + machine_id="machine_id", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -503,8 +505,8 @@ async def test_raw_response_watch(self, async_client: AsyncDedalus) -> None: @parametrize async def test_streaming_response_watch(self, async_client: AsyncDedalus) -> None: - async with async_client.workspaces.with_streaming_response.watch( - workspace_id="workspace_id", + async with async_client.machines.with_streaming_response.watch( + machine_id="machine_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -516,7 +518,7 @@ async def test_streaming_response_watch(self, async_client: AsyncDedalus) -> Non @parametrize async def test_path_params_watch(self, async_client: AsyncDedalus) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `workspace_id` but received ''"): - await async_client.workspaces.with_raw_response.watch( - workspace_id="", + with pytest.raises(ValueError, match=r"Expected a non-empty value for `machine_id` but received ''"): + await async_client.machines.with_raw_response.watch( + machine_id="", ) diff --git a/tests/test_client.py b/tests/test_client.py index a08e370..da636f5 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -901,20 +901,20 @@ def test_parse_retry_after_header( @mock.patch("dedalus_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Dedalus) -> None: - respx_mock.post("/v1/workspaces").mock(side_effect=httpx.TimeoutException("Test timeout error")) + respx_mock.post("/v1/machines").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - client.workspaces.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__enter__() + client.machines.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__enter__() assert _get_open_connections(client) == 0 @mock.patch("dedalus_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Dedalus) -> None: - respx_mock.post("/v1/workspaces").mock(return_value=httpx.Response(500)) + respx_mock.post("/v1/machines").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - client.workspaces.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__enter__() + client.machines.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__enter__() assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -941,9 +941,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = client.workspaces.with_raw_response.create(memory_mib=0, storage_gib=0, vcpu=0) + response = client.machines.with_raw_response.create(memory_mib=0, storage_gib=0, vcpu=0) assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -965,9 +965,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = client.workspaces.with_raw_response.create( + response = client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, extra_headers={"x-stainless-retry-count": Omit()} ) @@ -990,9 +990,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = client.workspaces.with_raw_response.create( + response = client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, extra_headers={"x-stainless-retry-count": "42"} ) @@ -1864,24 +1864,20 @@ async def test_parse_retry_after_header( async def test_retrying_timeout_errors_doesnt_leak( self, respx_mock: MockRouter, async_client: AsyncDedalus ) -> None: - respx_mock.post("/v1/workspaces").mock(side_effect=httpx.TimeoutException("Test timeout error")) + respx_mock.post("/v1/machines").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await async_client.workspaces.with_streaming_response.create( - memory_mib=0, storage_gib=0, vcpu=0 - ).__aenter__() + await async_client.machines.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__aenter__() assert _get_open_connections(async_client) == 0 @mock.patch("dedalus_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncDedalus) -> None: - respx_mock.post("/v1/workspaces").mock(return_value=httpx.Response(500)) + respx_mock.post("/v1/machines").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await async_client.workspaces.with_streaming_response.create( - memory_mib=0, storage_gib=0, vcpu=0 - ).__aenter__() + await async_client.machines.with_streaming_response.create(memory_mib=0, storage_gib=0, vcpu=0).__aenter__() assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -1908,9 +1904,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = await client.workspaces.with_raw_response.create(memory_mib=0, storage_gib=0, vcpu=0) + response = await client.machines.with_raw_response.create(memory_mib=0, storage_gib=0, vcpu=0) assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -1932,9 +1928,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = await client.workspaces.with_raw_response.create( + response = await client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, extra_headers={"x-stainless-retry-count": Omit()} ) @@ -1957,9 +1953,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.post("/v1/workspaces").mock(side_effect=retry_handler) + respx_mock.post("/v1/machines").mock(side_effect=retry_handler) - response = await client.workspaces.with_raw_response.create( + response = await client.machines.with_raw_response.create( memory_mib=0, storage_gib=0, vcpu=0, extra_headers={"x-stainless-retry-count": "42"} )