diff --git a/Makefile b/Makefile index 3fba6531..37310cc3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ ARGS:= $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) +branch ?= main # Get git commit hash automatically GIT_COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown") @@ -12,7 +13,7 @@ sdk-sandbox: @curl -H "Authorization: token $$(gh auth token)" \ -H "Accept: application/vnd.github.v3.raw" \ -o ./definition.yml \ - https://api.github.com/repos/blaxel-ai/sandbox/contents/sandbox-api/docs/openapi.yml?ref=main + https://api.github.com/repos/blaxel-ai/sandbox/contents/sandbox-api/docs/openapi.yml?ref=$(branch) rm -rf src/blaxel/core/sandbox/client/api src/blaxel/core/sandbox/client/models .venv/bin/openapi-python-client generate \ --path=definition.yml \ @@ -30,7 +31,7 @@ sdk-controlplane: @curl -H "Authorization: token $$(gh auth token)" \ -H "Accept: application/vnd.github.v3.raw" \ -o ./definition.yml \ - https://api.github.com/repos/blaxel-ai/controlplane/contents/api/api/definitions/controlplane.yml?ref=main + https://api.github.com/repos/blaxel-ai/controlplane/contents/api/api/definitions/controlplane.yml?ref=$(branch) rm -rf src/blaxel/core/client/api src/blaxel/core/client/models .venv/bin/openapi-python-client generate \ --path=definition.yml \ diff --git a/src/blaxel/core/client/api/images/list_image_shares.py b/src/blaxel/core/client/api/images/list_image_shares.py new file mode 100644 index 00000000..c03701b5 --- /dev/null +++ b/src/blaxel/core/client/api/images/list_image_shares.py @@ -0,0 +1,169 @@ +from http import HTTPStatus +from typing import Any, Union, cast + +import httpx + +from ... import errors +from ...client import Client +from ...types import Response + + +def _get_kwargs( + resource_type: str, + image_name: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/images/{resource_type}/{image_name}/share", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, list[str]] | None: + if response.status_code == 200: + response_200 = cast(list[str], response.json()) + + return response_200 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, list[str]]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + resource_type: str, + image_name: str, + *, + client: Client, +) -> Response[Union[Any, list[str]]]: + """List image shares + + Returns the list of workspaces that a container image is currently shared with. + + Args: + resource_type (str): + image_name (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, list[str]]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + resource_type: str, + image_name: str, + *, + client: Client, +) -> Union[Any, list[str]] | None: + """List image shares + + Returns the list of workspaces that a container image is currently shared with. + + Args: + resource_type (str): + image_name (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, list[str]] + """ + + return sync_detailed( + resource_type=resource_type, + image_name=image_name, + client=client, + ).parsed + + +async def asyncio_detailed( + resource_type: str, + image_name: str, + *, + client: Client, +) -> Response[Union[Any, list[str]]]: + """List image shares + + Returns the list of workspaces that a container image is currently shared with. + + Args: + resource_type (str): + image_name (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, list[str]]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + resource_type: str, + image_name: str, + *, + client: Client, +) -> Union[Any, list[str]] | None: + """List image shares + + Returns the list of workspaces that a container image is currently shared with. + + Args: + resource_type (str): + image_name (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, list[str]] + """ + + return ( + await asyncio_detailed( + resource_type=resource_type, + image_name=image_name, + client=client, + ) + ).parsed diff --git a/src/blaxel/core/client/api/images/share_image.py b/src/blaxel/core/client/api/images/share_image.py new file mode 100644 index 00000000..c0394993 --- /dev/null +++ b/src/blaxel/core/client/api/images/share_image.py @@ -0,0 +1,203 @@ +from http import HTTPStatus +from typing import Any, Union, cast + +import httpx + +from ... import errors +from ...client import Client +from ...models.image import Image +from ...models.share_image_body import ShareImageBody +from ...types import Response + + +def _get_kwargs( + resource_type: str, + image_name: str, + *, + body: ShareImageBody, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/images/{resource_type}/{image_name}/share", + } + + if type(body) is dict: + _body = body + else: + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, Image] | None: + if response.status_code == 200: + response_200 = Image.from_dict(response.json()) + + return response_200 + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Image]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + resource_type: str, + image_name: str, + *, + client: Client, + body: ShareImageBody, +) -> Response[Union[Any, Image]]: + """Share a container image + + Shares a container image with another workspace by copying the metadata record. The underlying + storage (S3) data is not duplicated. The target workspace must belong to the same account. + + Args: + resource_type (str): + image_name (str): + body (ShareImageBody): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Image]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + resource_type: str, + image_name: str, + *, + client: Client, + body: ShareImageBody, +) -> Union[Any, Image] | None: + """Share a container image + + Shares a container image with another workspace by copying the metadata record. The underlying + storage (S3) data is not duplicated. The target workspace must belong to the same account. + + Args: + resource_type (str): + image_name (str): + body (ShareImageBody): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Image] + """ + + return sync_detailed( + resource_type=resource_type, + image_name=image_name, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + resource_type: str, + image_name: str, + *, + client: Client, + body: ShareImageBody, +) -> Response[Union[Any, Image]]: + """Share a container image + + Shares a container image with another workspace by copying the metadata record. The underlying + storage (S3) data is not duplicated. The target workspace must belong to the same account. + + Args: + resource_type (str): + image_name (str): + body (ShareImageBody): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Image]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + resource_type: str, + image_name: str, + *, + client: Client, + body: ShareImageBody, +) -> Union[Any, Image] | None: + """Share a container image + + Shares a container image with another workspace by copying the metadata record. The underlying + storage (S3) data is not duplicated. The target workspace must belong to the same account. + + Args: + resource_type (str): + image_name (str): + body (ShareImageBody): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Image] + """ + + return ( + await asyncio_detailed( + resource_type=resource_type, + image_name=image_name, + client=client, + body=body, + ) + ).parsed diff --git a/src/blaxel/core/client/api/images/unshare_image.py b/src/blaxel/core/client/api/images/unshare_image.py new file mode 100644 index 00000000..07aa73dc --- /dev/null +++ b/src/blaxel/core/client/api/images/unshare_image.py @@ -0,0 +1,187 @@ +from http import HTTPStatus +from typing import Any, Union, cast + +import httpx + +from ... import errors +from ...client import Client +from ...models.image import Image +from ...types import Response + + +def _get_kwargs( + resource_type: str, + image_name: str, + target_workspace: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/images/{resource_type}/{image_name}/share/{target_workspace}", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, Image] | None: + if response.status_code == 200: + response_200 = Image.from_dict(response.json()) + + return response_200 + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Image]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + resource_type: str, + image_name: str, + target_workspace: str, + *, + client: Client, +) -> Response[Union[Any, Image]]: + """Unshare a container image + + Revokes sharing of a container image with a target workspace. Removes the metadata copy from the + target workspace. The source image is not affected. + + Args: + resource_type (str): + image_name (str): + target_workspace (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Image]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + target_workspace=target_workspace, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + resource_type: str, + image_name: str, + target_workspace: str, + *, + client: Client, +) -> Union[Any, Image] | None: + """Unshare a container image + + Revokes sharing of a container image with a target workspace. Removes the metadata copy from the + target workspace. The source image is not affected. + + Args: + resource_type (str): + image_name (str): + target_workspace (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Image] + """ + + return sync_detailed( + resource_type=resource_type, + image_name=image_name, + target_workspace=target_workspace, + client=client, + ).parsed + + +async def asyncio_detailed( + resource_type: str, + image_name: str, + target_workspace: str, + *, + client: Client, +) -> Response[Union[Any, Image]]: + """Unshare a container image + + Revokes sharing of a container image with a target workspace. Removes the metadata copy from the + target workspace. The source image is not affected. + + Args: + resource_type (str): + image_name (str): + target_workspace (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Image]] + """ + + kwargs = _get_kwargs( + resource_type=resource_type, + image_name=image_name, + target_workspace=target_workspace, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + resource_type: str, + image_name: str, + target_workspace: str, + *, + client: Client, +) -> Union[Any, Image] | None: + """Unshare a container image + + Revokes sharing of a container image with a target workspace. Removes the metadata copy from the + target workspace. The source image is not affected. + + Args: + resource_type (str): + image_name (str): + target_workspace (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Image] + """ + + return ( + await asyncio_detailed( + resource_type=resource_type, + image_name=image_name, + target_workspace=target_workspace, + client=client, + ) + ).parsed diff --git a/src/blaxel/core/client/models/__init__.py b/src/blaxel/core/client/models/__init__.py index f7c153fc..f6c328d6 100644 --- a/src/blaxel/core/client/models/__init__.py +++ b/src/blaxel/core/client/models/__init__.py @@ -172,6 +172,8 @@ from .sandbox_network import SandboxNetwork from .sandbox_runtime import SandboxRuntime from .sandbox_spec import SandboxSpec +from .sandbox_state import SandboxState +from .share_image_body import ShareImageBody from .sso_domain import SSODomain from .sso_domain_metadata import SSODomainMetadata from .sso_domain_spec import SSODomainSpec @@ -376,6 +378,8 @@ "SandboxNetwork", "SandboxRuntime", "SandboxSpec", + "SandboxState", + "ShareImageBody", "SSODomain", "SSODomainMetadata", "SSODomainSpec", diff --git a/src/blaxel/core/client/models/agent.py b/src/blaxel/core/client/models/agent.py index b1aa662c..b0c8e09d 100644 --- a/src/blaxel/core/client/models/agent.py +++ b/src/blaxel/core/client/models/agent.py @@ -36,6 +36,7 @@ class Agent: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/agent_runtime.py b/src/blaxel/core/client/models/agent_runtime.py index e4666217..4cb72a90 100644 --- a/src/blaxel/core/client/models/agent_runtime.py +++ b/src/blaxel/core/client/models/agent_runtime.py @@ -41,6 +41,7 @@ class AgentRuntime: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + envs: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.envs, Unset): envs = [] diff --git a/src/blaxel/core/client/models/agent_spec.py b/src/blaxel/core/client/models/agent_spec.py index 7775b4fb..1fc8f3c0 100644 --- a/src/blaxel/core/client/models/agent_spec.py +++ b/src/blaxel/core/client/models/agent_spec.py @@ -48,6 +48,7 @@ class AgentSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled policies: Union[Unset, list[str]] = UNSET diff --git a/src/blaxel/core/client/models/configuration.py b/src/blaxel/core/client/models/configuration.py index ba6aaef8..d0eec18b 100644 --- a/src/blaxel/core/client/models/configuration.py +++ b/src/blaxel/core/client/models/configuration.py @@ -33,6 +33,7 @@ class Configuration: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + continents: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.continents, Unset): continents = [] diff --git a/src/blaxel/core/client/models/create_job_execution_output.py b/src/blaxel/core/client/models/create_job_execution_output.py index 7d31cab9..ab7e2203 100644 --- a/src/blaxel/core/client/models/create_job_execution_output.py +++ b/src/blaxel/core/client/models/create_job_execution_output.py @@ -37,6 +37,7 @@ class CreateJobExecutionOutput: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + execution_id = self.execution_id id = self.id diff --git a/src/blaxel/core/client/models/create_job_execution_request.py b/src/blaxel/core/client/models/create_job_execution_request.py index 7ec4f73a..110a3a1b 100644 --- a/src/blaxel/core/client/models/create_job_execution_request.py +++ b/src/blaxel/core/client/models/create_job_execution_request.py @@ -40,6 +40,7 @@ class CreateJobExecutionRequest: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + env: Union[Unset, dict[str, Any]] = UNSET if self.env and not isinstance(self.env, Unset) and not isinstance(self.env, dict): env = self.env.to_dict() diff --git a/src/blaxel/core/client/models/custom_domain.py b/src/blaxel/core/client/models/custom_domain.py index 6b17e9ab..fe1fa967 100644 --- a/src/blaxel/core/client/models/custom_domain.py +++ b/src/blaxel/core/client/models/custom_domain.py @@ -28,6 +28,7 @@ class CustomDomain: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/custom_domain_metadata.py b/src/blaxel/core/client/models/custom_domain_metadata.py index 1b354e48..ae0506f3 100644 --- a/src/blaxel/core/client/models/custom_domain_metadata.py +++ b/src/blaxel/core/client/models/custom_domain_metadata.py @@ -39,6 +39,7 @@ class CustomDomainMetadata: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + created_at = self.created_at updated_at = self.updated_at diff --git a/src/blaxel/core/client/models/custom_domain_spec.py b/src/blaxel/core/client/models/custom_domain_spec.py index 01f4ece2..03116ca3 100644 --- a/src/blaxel/core/client/models/custom_domain_spec.py +++ b/src/blaxel/core/client/models/custom_domain_spec.py @@ -37,6 +37,7 @@ class CustomDomainSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + cname_records = self.cname_records last_verified_at = self.last_verified_at diff --git a/src/blaxel/core/client/models/delete_volume_template_version_response_200.py b/src/blaxel/core/client/models/delete_volume_template_version_response_200.py index c7d99aee..5a8cf60e 100644 --- a/src/blaxel/core/client/models/delete_volume_template_version_response_200.py +++ b/src/blaxel/core/client/models/delete_volume_template_version_response_200.py @@ -25,6 +25,7 @@ class DeleteVolumeTemplateVersionResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + message = self.message template: Union[Unset, dict[str, Any]] = UNSET diff --git a/src/blaxel/core/client/models/drive.py b/src/blaxel/core/client/models/drive.py index 9367391e..aead16e7 100644 --- a/src/blaxel/core/client/models/drive.py +++ b/src/blaxel/core/client/models/drive.py @@ -37,6 +37,7 @@ class Drive: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/egress_config.py b/src/blaxel/core/client/models/egress_config.py index 256fdd21..98a2603b 100644 --- a/src/blaxel/core/client/models/egress_config.py +++ b/src/blaxel/core/client/models/egress_config.py @@ -29,6 +29,7 @@ class EgressConfig: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + gateway = self.gateway mode = self.mode diff --git a/src/blaxel/core/client/models/egress_gateway.py b/src/blaxel/core/client/models/egress_gateway.py index cf6cfb23..4cf8db08 100644 --- a/src/blaxel/core/client/models/egress_gateway.py +++ b/src/blaxel/core/client/models/egress_gateway.py @@ -34,6 +34,7 @@ class EgressGateway: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/egress_ip.py b/src/blaxel/core/client/models/egress_ip.py index 92fca87c..e8542d77 100644 --- a/src/blaxel/core/client/models/egress_ip.py +++ b/src/blaxel/core/client/models/egress_ip.py @@ -33,6 +33,7 @@ class EgressIP: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/entrypoint.py b/src/blaxel/core/client/models/entrypoint.py index f56e3db8..9188c712 100644 --- a/src/blaxel/core/client/models/entrypoint.py +++ b/src/blaxel/core/client/models/entrypoint.py @@ -32,6 +32,7 @@ class Entrypoint: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + args: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.args, Unset): args = [] diff --git a/src/blaxel/core/client/models/form.py b/src/blaxel/core/client/models/form.py index e55e8722..6486251b 100644 --- a/src/blaxel/core/client/models/form.py +++ b/src/blaxel/core/client/models/form.py @@ -30,6 +30,7 @@ class Form: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + config: Union[Unset, dict[str, Any]] = UNSET if self.config and not isinstance(self.config, Unset) and not isinstance(self.config, dict): config = self.config.to_dict() diff --git a/src/blaxel/core/client/models/function.py b/src/blaxel/core/client/models/function.py index fd2528b4..b3d16028 100644 --- a/src/blaxel/core/client/models/function.py +++ b/src/blaxel/core/client/models/function.py @@ -36,6 +36,7 @@ class Function: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/function_runtime.py b/src/blaxel/core/client/models/function_runtime.py index 3b9891e0..9e2623ab 100644 --- a/src/blaxel/core/client/models/function_runtime.py +++ b/src/blaxel/core/client/models/function_runtime.py @@ -44,6 +44,7 @@ class FunctionRuntime: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + envs: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.envs, Unset): envs = [] diff --git a/src/blaxel/core/client/models/function_spec.py b/src/blaxel/core/client/models/function_spec.py index b28bb432..21cc973d 100644 --- a/src/blaxel/core/client/models/function_spec.py +++ b/src/blaxel/core/client/models/function_spec.py @@ -44,6 +44,7 @@ class FunctionSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled integration_connections: Union[Unset, list[str]] = UNSET diff --git a/src/blaxel/core/client/models/get_drive_jwks_response_200.py b/src/blaxel/core/client/models/get_drive_jwks_response_200.py index 8e429369..261bfe78 100644 --- a/src/blaxel/core/client/models/get_drive_jwks_response_200.py +++ b/src/blaxel/core/client/models/get_drive_jwks_response_200.py @@ -23,6 +23,7 @@ class GetDriveJWKSResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + keys: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.keys, Unset): keys = [] diff --git a/src/blaxel/core/client/models/get_workspace_features_response_200.py b/src/blaxel/core/client/models/get_workspace_features_response_200.py index e2818c60..ef225b64 100644 --- a/src/blaxel/core/client/models/get_workspace_features_response_200.py +++ b/src/blaxel/core/client/models/get_workspace_features_response_200.py @@ -26,6 +26,7 @@ class GetWorkspaceFeaturesResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + features: Union[Unset, dict[str, Any]] = UNSET if ( self.features diff --git a/src/blaxel/core/client/models/image.py b/src/blaxel/core/client/models/image.py index 2132b76c..98e25bb5 100644 --- a/src/blaxel/core/client/models/image.py +++ b/src/blaxel/core/client/models/image.py @@ -24,6 +24,7 @@ class Image: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/image_metadata.py b/src/blaxel/core/client/models/image_metadata.py index 22d584b8..a33148d8 100644 --- a/src/blaxel/core/client/models/image_metadata.py +++ b/src/blaxel/core/client/models/image_metadata.py @@ -24,6 +24,8 @@ class ImageMetadata: tags). name (Union[Unset, str]): The name of the image (repository name). resource_type (Union[Unset, str]): The resource type of the image. + source_workspace (Union[Unset, str]): If this image is shared from another workspace, this field contains the + name of the source workspace. Empty for non-shared images. status (Union[Unset, Status]): Deployment status of a resource deployed on Blaxel updated_at (Union[Unset, str]): The date and time when the image was last updated. workspace (Union[Unset, str]): The workspace of the image. @@ -35,12 +37,14 @@ class ImageMetadata: last_deployed_at: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET resource_type: Union[Unset, str] = UNSET + source_workspace: Union[Unset, str] = UNSET status: Union[Unset, Status] = UNSET updated_at: Union[Unset, str] = UNSET workspace: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + created_at = self.created_at display_name = self.display_name @@ -63,6 +67,8 @@ def to_dict(self) -> dict[str, Any]: resource_type = self.resource_type + source_workspace = self.source_workspace + status: Union[Unset, str] = UNSET if not isinstance(self.status, Unset): status = self.status.value @@ -86,6 +92,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["name"] = name if resource_type is not UNSET: field_dict["resourceType"] = resource_type + if source_workspace is not UNSET: + field_dict["sourceWorkspace"] = source_workspace if status is not UNSET: field_dict["status"] = status if updated_at is not UNSET: @@ -121,6 +129,8 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: resource_type = d.pop("resourceType", d.pop("resource_type", UNSET)) + source_workspace = d.pop("sourceWorkspace", d.pop("source_workspace", UNSET)) + _status = d.pop("status", UNSET) status: Union[Unset, Status] if isinstance(_status, Unset): @@ -139,6 +149,7 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: last_deployed_at=last_deployed_at, name=name, resource_type=resource_type, + source_workspace=source_workspace, status=status, updated_at=updated_at, workspace=workspace, diff --git a/src/blaxel/core/client/models/image_spec.py b/src/blaxel/core/client/models/image_spec.py index ff47facf..34225801 100644 --- a/src/blaxel/core/client/models/image_spec.py +++ b/src/blaxel/core/client/models/image_spec.py @@ -25,6 +25,7 @@ class ImageSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + size = self.size tags: Union[Unset, list[dict[str, Any]]] = UNSET diff --git a/src/blaxel/core/client/models/integration.py b/src/blaxel/core/client/models/integration.py index b893983c..57108161 100644 --- a/src/blaxel/core/client/models/integration.py +++ b/src/blaxel/core/client/models/integration.py @@ -41,6 +41,7 @@ class Integration: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + additional_infos: Union[Unset, dict[str, Any]] = UNSET if ( self.additional_infos diff --git a/src/blaxel/core/client/models/integration_connection.py b/src/blaxel/core/client/models/integration_connection.py index ba41b5fc..0ed7f358 100644 --- a/src/blaxel/core/client/models/integration_connection.py +++ b/src/blaxel/core/client/models/integration_connection.py @@ -28,6 +28,7 @@ class IntegrationConnection: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/integration_connection_spec.py b/src/blaxel/core/client/models/integration_connection_spec.py index 2f42e019..27c6d86b 100644 --- a/src/blaxel/core/client/models/integration_connection_spec.py +++ b/src/blaxel/core/client/models/integration_connection_spec.py @@ -34,6 +34,7 @@ class IntegrationConnectionSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + config: Union[Unset, dict[str, Any]] = UNSET if self.config and not isinstance(self.config, Unset) and not isinstance(self.config, dict): config = self.config.to_dict() diff --git a/src/blaxel/core/client/models/integration_endpoint.py b/src/blaxel/core/client/models/integration_endpoint.py index d1c9fea6..ade0dae2 100644 --- a/src/blaxel/core/client/models/integration_endpoint.py +++ b/src/blaxel/core/client/models/integration_endpoint.py @@ -38,6 +38,7 @@ class IntegrationEndpoint: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + body = self.body ignore_models: Union[Unset, list[dict[str, Any]]] = UNSET diff --git a/src/blaxel/core/client/models/integration_endpoints.py b/src/blaxel/core/client/models/integration_endpoints.py index 61fb17b5..76c5b99a 100644 --- a/src/blaxel/core/client/models/integration_endpoints.py +++ b/src/blaxel/core/client/models/integration_endpoints.py @@ -17,6 +17,7 @@ class IntegrationEndpoints: additional_properties: dict[str, "IntegrationEndpoint"] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): if type(prop) is dict: @@ -35,6 +36,7 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: d = src_dict.copy() integration_endpoints = cls() + additional_properties = {} for prop_name, prop_dict in d.items(): additional_property = IntegrationEndpoint.from_dict(prop_dict) diff --git a/src/blaxel/core/client/models/job.py b/src/blaxel/core/client/models/job.py index 04aae372..50901929 100644 --- a/src/blaxel/core/client/models/job.py +++ b/src/blaxel/core/client/models/job.py @@ -36,6 +36,7 @@ class Job: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/job_execution.py b/src/blaxel/core/client/models/job_execution.py index 1710452c..4bae77c9 100644 --- a/src/blaxel/core/client/models/job_execution.py +++ b/src/blaxel/core/client/models/job_execution.py @@ -36,6 +36,7 @@ class JobExecution: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/job_execution_spec.py b/src/blaxel/core/client/models/job_execution_spec.py index c0590774..f18077f8 100644 --- a/src/blaxel/core/client/models/job_execution_spec.py +++ b/src/blaxel/core/client/models/job_execution_spec.py @@ -35,6 +35,7 @@ class JobExecutionSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + env_override: Union[Unset, dict[str, Any]] = UNSET if ( self.env_override diff --git a/src/blaxel/core/client/models/job_execution_task.py b/src/blaxel/core/client/models/job_execution_task.py index f9319086..b73e476d 100644 --- a/src/blaxel/core/client/models/job_execution_task.py +++ b/src/blaxel/core/client/models/job_execution_task.py @@ -33,6 +33,7 @@ class JobExecutionTask: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + conditions: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.conditions, Unset): conditions = [] diff --git a/src/blaxel/core/client/models/job_runtime.py b/src/blaxel/core/client/models/job_runtime.py index 9920b4e4..59fe4c6e 100644 --- a/src/blaxel/core/client/models/job_runtime.py +++ b/src/blaxel/core/client/models/job_runtime.py @@ -49,6 +49,7 @@ class JobRuntime: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + disk_percent = self.disk_percent envs: Union[Unset, list[dict[str, Any]]] = UNSET diff --git a/src/blaxel/core/client/models/job_spec.py b/src/blaxel/core/client/models/job_spec.py index 51ef6255..c7b55d42 100644 --- a/src/blaxel/core/client/models/job_spec.py +++ b/src/blaxel/core/client/models/job_spec.py @@ -46,6 +46,7 @@ class JobSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled github_runner: Union[Unset, dict[str, Any]] = UNSET diff --git a/src/blaxel/core/client/models/location_response.py b/src/blaxel/core/client/models/location_response.py index 1ba28924..a413cf84 100644 --- a/src/blaxel/core/client/models/location_response.py +++ b/src/blaxel/core/client/models/location_response.py @@ -34,6 +34,7 @@ class LocationResponse: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + continent = self.continent country = self.country diff --git a/src/blaxel/core/client/models/mcp_definition.py b/src/blaxel/core/client/models/mcp_definition.py index b46583e4..bd80c485 100644 --- a/src/blaxel/core/client/models/mcp_definition.py +++ b/src/blaxel/core/client/models/mcp_definition.py @@ -60,6 +60,7 @@ class MCPDefinition: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + created_at = self.created_at updated_at = self.updated_at diff --git a/src/blaxel/core/client/models/metadata.py b/src/blaxel/core/client/models/metadata.py index 1bf488a9..96b34e84 100644 --- a/src/blaxel/core/client/models/metadata.py +++ b/src/blaxel/core/client/models/metadata.py @@ -46,6 +46,7 @@ class Metadata: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + name = self.name created_at = self.created_at diff --git a/src/blaxel/core/client/models/model.py b/src/blaxel/core/client/models/model.py index 92b6ee53..e7689923 100644 --- a/src/blaxel/core/client/models/model.py +++ b/src/blaxel/core/client/models/model.py @@ -36,6 +36,7 @@ class Model: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/model_spec.py b/src/blaxel/core/client/models/model_spec.py index 1e053ae1..c26c2b52 100644 --- a/src/blaxel/core/client/models/model_spec.py +++ b/src/blaxel/core/client/models/model_spec.py @@ -37,6 +37,7 @@ class ModelSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled flavors: Union[Unset, list[dict[str, Any]]] = UNSET diff --git a/src/blaxel/core/client/models/o_auth.py b/src/blaxel/core/client/models/o_auth.py index 8965f520..ad63ddf8 100644 --- a/src/blaxel/core/client/models/o_auth.py +++ b/src/blaxel/core/client/models/o_auth.py @@ -26,6 +26,7 @@ class OAuth: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + scope: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.scope, Unset): scope = [] diff --git a/src/blaxel/core/client/models/pending_invitation_accept.py b/src/blaxel/core/client/models/pending_invitation_accept.py index 063b69a7..845871ad 100644 --- a/src/blaxel/core/client/models/pending_invitation_accept.py +++ b/src/blaxel/core/client/models/pending_invitation_accept.py @@ -27,6 +27,7 @@ class PendingInvitationAccept: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + email = self.email workspace: Union[Unset, dict[str, Any]] = UNSET diff --git a/src/blaxel/core/client/models/pending_invitation_render.py b/src/blaxel/core/client/models/pending_invitation_render.py index 213c640a..3534130c 100644 --- a/src/blaxel/core/client/models/pending_invitation_render.py +++ b/src/blaxel/core/client/models/pending_invitation_render.py @@ -44,6 +44,7 @@ class PendingInvitationRender: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + account: Union[Unset, dict[str, Any]] = UNSET if ( self.account diff --git a/src/blaxel/core/client/models/pending_invitation_workspace_details.py b/src/blaxel/core/client/models/pending_invitation_workspace_details.py index be4320b9..6ec1525e 100644 --- a/src/blaxel/core/client/models/pending_invitation_workspace_details.py +++ b/src/blaxel/core/client/models/pending_invitation_workspace_details.py @@ -28,6 +28,7 @@ class PendingInvitationWorkspaceDetails: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + emails: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.emails, Unset): emails = [] diff --git a/src/blaxel/core/client/models/policy.py b/src/blaxel/core/client/models/policy.py index 2cf88cf9..9b913727 100644 --- a/src/blaxel/core/client/models/policy.py +++ b/src/blaxel/core/client/models/policy.py @@ -26,6 +26,7 @@ class Policy: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/policy_spec.py b/src/blaxel/core/client/models/policy_spec.py index e343e629..19ad5059 100644 --- a/src/blaxel/core/client/models/policy_spec.py +++ b/src/blaxel/core/client/models/policy_spec.py @@ -40,6 +40,7 @@ class PolicySpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + flavors: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.flavors, Unset): flavors = [] diff --git a/src/blaxel/core/client/models/preview.py b/src/blaxel/core/client/models/preview.py index bba76417..38d1601a 100644 --- a/src/blaxel/core/client/models/preview.py +++ b/src/blaxel/core/client/models/preview.py @@ -33,6 +33,7 @@ class Preview: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/preview_spec.py b/src/blaxel/core/client/models/preview_spec.py index 2f4cbc8a..2a6d50b2 100644 --- a/src/blaxel/core/client/models/preview_spec.py +++ b/src/blaxel/core/client/models/preview_spec.py @@ -46,6 +46,7 @@ class PreviewSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + custom_domain = self.custom_domain expires = self.expires diff --git a/src/blaxel/core/client/models/preview_token.py b/src/blaxel/core/client/models/preview_token.py index accc7383..3ae85791 100644 --- a/src/blaxel/core/client/models/preview_token.py +++ b/src/blaxel/core/client/models/preview_token.py @@ -25,6 +25,7 @@ class PreviewToken: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/proxy_config.py b/src/blaxel/core/client/models/proxy_config.py index fa2a8173..6da195db 100644 --- a/src/blaxel/core/client/models/proxy_config.py +++ b/src/blaxel/core/client/models/proxy_config.py @@ -31,6 +31,7 @@ class ProxyConfig: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + bypass: Union[Unset, list[str]] = UNSET if not isinstance(self.bypass, Unset): bypass = self.bypass diff --git a/src/blaxel/core/client/models/proxy_target.py b/src/blaxel/core/client/models/proxy_target.py index 69fae5fb..2b08464a 100644 --- a/src/blaxel/core/client/models/proxy_target.py +++ b/src/blaxel/core/client/models/proxy_target.py @@ -39,6 +39,7 @@ class ProxyTarget: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + body: Union[Unset, dict[str, Any]] = UNSET if self.body and not isinstance(self.body, Unset) and not isinstance(self.body, dict): body = self.body.to_dict() diff --git a/src/blaxel/core/client/models/public_ips.py b/src/blaxel/core/client/models/public_ips.py index fa7f59a5..7dae820d 100644 --- a/src/blaxel/core/client/models/public_ips.py +++ b/src/blaxel/core/client/models/public_ips.py @@ -17,6 +17,7 @@ class PublicIps: additional_properties: dict[str, "PublicIp"] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): if type(prop) is dict: diff --git a/src/blaxel/core/client/models/region.py b/src/blaxel/core/client/models/region.py index 9a2a7eb1..9c193c56 100644 --- a/src/blaxel/core/client/models/region.py +++ b/src/blaxel/core/client/models/region.py @@ -46,6 +46,7 @@ class Region: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + agent_drive_public_url: Union[Unset, dict[str, Any]] = UNSET if ( self.agent_drive_public_url diff --git a/src/blaxel/core/client/models/sandbox.py b/src/blaxel/core/client/models/sandbox.py index 839a4db8..17a0d431 100644 --- a/src/blaxel/core/client/models/sandbox.py +++ b/src/blaxel/core/client/models/sandbox.py @@ -3,6 +3,7 @@ from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..models.sandbox_state import SandboxState from ..models.status import Status from ..types import UNSET, Unset @@ -29,6 +30,7 @@ class Sandbox: expires_in (Union[Unset, int]): Time in seconds until the sandbox is automatically deleted based on TTL and lifecycle policies. Only present for sandboxes with lifecycle configured. last_used_at (Union[Unset, str]): Last time the sandbox was used (read-only, managed by the system) + state (Union[Unset, SandboxState]): Current state of the sandbox (read-only, managed by the system) status (Union[Unset, Status]): Deployment status of a resource deployed on Blaxel """ @@ -37,10 +39,12 @@ class Sandbox: events: Union[Unset, list["CoreEvent"]] = UNSET expires_in: Union[Unset, int] = UNSET last_used_at: Union[Unset, str] = UNSET + state: Union[Unset, SandboxState] = UNSET status: Union[Unset, Status] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: @@ -67,6 +71,10 @@ def to_dict(self) -> dict[str, Any]: last_used_at = self.last_used_at + state: Union[Unset, str] = UNSET + if not isinstance(self.state, Unset): + state = self.state.value + status: Union[Unset, str] = UNSET if not isinstance(self.status, Unset): status = self.status.value @@ -85,6 +93,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["expiresIn"] = expires_in if last_used_at is not UNSET: field_dict["lastUsedAt"] = last_used_at + if state is not UNSET: + field_dict["state"] = state if status is not UNSET: field_dict["status"] = status @@ -116,6 +126,13 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: last_used_at = d.pop("lastUsedAt", d.pop("last_used_at", UNSET)) + _state = d.pop("state", UNSET) + state: Union[Unset, SandboxState] + if isinstance(_state, Unset): + state = UNSET + else: + state = SandboxState(_state) + _status = d.pop("status", UNSET) status: Union[Unset, Status] if isinstance(_status, Unset): @@ -129,6 +146,7 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: events=events, expires_in=expires_in, last_used_at=last_used_at, + state=state, status=status, ) diff --git a/src/blaxel/core/client/models/sandbox_definition.py b/src/blaxel/core/client/models/sandbox_definition.py index 4adf930d..5074b15d 100644 --- a/src/blaxel/core/client/models/sandbox_definition.py +++ b/src/blaxel/core/client/models/sandbox_definition.py @@ -53,6 +53,7 @@ class SandboxDefinition: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + categories: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.categories, Unset): categories = [] diff --git a/src/blaxel/core/client/models/sandbox_error.py b/src/blaxel/core/client/models/sandbox_error.py index aa861111..f73196d4 100644 --- a/src/blaxel/core/client/models/sandbox_error.py +++ b/src/blaxel/core/client/models/sandbox_error.py @@ -42,6 +42,7 @@ class SandboxError: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + code = self.code message = self.message diff --git a/src/blaxel/core/client/models/sandbox_lifecycle.py b/src/blaxel/core/client/models/sandbox_lifecycle.py index ea0dfbd3..45a4c2fd 100644 --- a/src/blaxel/core/client/models/sandbox_lifecycle.py +++ b/src/blaxel/core/client/models/sandbox_lifecycle.py @@ -28,6 +28,7 @@ class SandboxLifecycle: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + expiration_policies: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.expiration_policies, Unset): expiration_policies = [] diff --git a/src/blaxel/core/client/models/sandbox_network.py b/src/blaxel/core/client/models/sandbox_network.py index ad061107..19e337ef 100644 --- a/src/blaxel/core/client/models/sandbox_network.py +++ b/src/blaxel/core/client/models/sandbox_network.py @@ -37,6 +37,7 @@ class SandboxNetwork: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + allowed_domains: Union[Unset, list[str]] = UNSET if not isinstance(self.allowed_domains, Unset): allowed_domains = self.allowed_domains diff --git a/src/blaxel/core/client/models/sandbox_runtime.py b/src/blaxel/core/client/models/sandbox_runtime.py index 40ddef02..809f3a5e 100644 --- a/src/blaxel/core/client/models/sandbox_runtime.py +++ b/src/blaxel/core/client/models/sandbox_runtime.py @@ -40,6 +40,7 @@ class SandboxRuntime: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + envs: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.envs, Unset): envs = [] diff --git a/src/blaxel/core/client/models/sandbox_spec.py b/src/blaxel/core/client/models/sandbox_spec.py index 540416c3..baf93cc3 100644 --- a/src/blaxel/core/client/models/sandbox_spec.py +++ b/src/blaxel/core/client/models/sandbox_spec.py @@ -42,6 +42,7 @@ class SandboxSpec: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled lifecycle: Union[Unset, dict[str, Any]] = UNSET diff --git a/src/blaxel/core/client/models/sandbox_state.py b/src/blaxel/core/client/models/sandbox_state.py new file mode 100644 index 00000000..de7709de --- /dev/null +++ b/src/blaxel/core/client/models/sandbox_state.py @@ -0,0 +1,18 @@ +from enum import Enum + + +class SandboxState(str, Enum): + RUNNING = "RUNNING" + STANDBY = "STANDBY" + + def __str__(self) -> str: + return str(self.value) + + @classmethod + def _missing_(cls, value: object) -> "SandboxState | None": + if isinstance(value, str): + upper_value = value.upper() + for member in cls: + if member.value.upper() == upper_value: + return member + return None diff --git a/src/blaxel/core/client/models/share_image_body.py b/src/blaxel/core/client/models/share_image_body.py new file mode 100644 index 00000000..c122af1f --- /dev/null +++ b/src/blaxel/core/client/models/share_image_body.py @@ -0,0 +1,62 @@ +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ShareImageBody") + + +@_attrs_define +class ShareImageBody: + """ + Attributes: + target_workspace (str): Name of the workspace to share the image with + """ + + target_workspace: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + target_workspace = self.target_workspace + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "targetWorkspace": target_workspace, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None: + if not src_dict: + return None + d = src_dict.copy() + target_workspace = ( + d.pop("targetWorkspace") if "targetWorkspace" in d else d.pop("target_workspace") + ) + + share_image_body = cls( + target_workspace=target_workspace, + ) + + share_image_body.additional_properties = d + return share_image_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/blaxel/core/client/models/sso_domain.py b/src/blaxel/core/client/models/sso_domain.py index de9c67bb..a69f25cd 100644 --- a/src/blaxel/core/client/models/sso_domain.py +++ b/src/blaxel/core/client/models/sso_domain.py @@ -28,6 +28,7 @@ class SSODomain: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/template.py b/src/blaxel/core/client/models/template.py index 363ed0f8..56ee013b 100644 --- a/src/blaxel/core/client/models/template.py +++ b/src/blaxel/core/client/models/template.py @@ -47,6 +47,7 @@ class Template: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + default_branch = self.default_branch description = self.description diff --git a/src/blaxel/core/client/models/test_feature_flag_response_200.py b/src/blaxel/core/client/models/test_feature_flag_response_200.py index 68967aa9..ab81dc75 100644 --- a/src/blaxel/core/client/models/test_feature_flag_response_200.py +++ b/src/blaxel/core/client/models/test_feature_flag_response_200.py @@ -33,6 +33,7 @@ class TestFeatureFlagResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + enabled = self.enabled evaluated_at: Union[Unset, str] = UNSET diff --git a/src/blaxel/core/client/models/trigger.py b/src/blaxel/core/client/models/trigger.py index 9de86906..8ddd3013 100644 --- a/src/blaxel/core/client/models/trigger.py +++ b/src/blaxel/core/client/models/trigger.py @@ -31,6 +31,7 @@ class Trigger: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + configuration: Union[Unset, dict[str, Any]] = UNSET if ( self.configuration diff --git a/src/blaxel/core/client/models/trigger_configuration.py b/src/blaxel/core/client/models/trigger_configuration.py index cf320103..798d50bc 100644 --- a/src/blaxel/core/client/models/trigger_configuration.py +++ b/src/blaxel/core/client/models/trigger_configuration.py @@ -39,6 +39,7 @@ class TriggerConfiguration: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + authentication_type = self.authentication_type callback_secret = self.callback_secret diff --git a/src/blaxel/core/client/models/volume.py b/src/blaxel/core/client/models/volume.py index 61556357..9640491a 100644 --- a/src/blaxel/core/client/models/volume.py +++ b/src/blaxel/core/client/models/volume.py @@ -40,6 +40,7 @@ class Volume: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/volume_template.py b/src/blaxel/core/client/models/volume_template.py index ac1143c6..d43a9145 100644 --- a/src/blaxel/core/client/models/volume_template.py +++ b/src/blaxel/core/client/models/volume_template.py @@ -34,6 +34,7 @@ class VolumeTemplate: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/vpc.py b/src/blaxel/core/client/models/vpc.py index 1d1b279f..005a9f2e 100644 --- a/src/blaxel/core/client/models/vpc.py +++ b/src/blaxel/core/client/models/vpc.py @@ -34,6 +34,7 @@ class VPC: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + if type(self.metadata) is dict: metadata = self.metadata else: diff --git a/src/blaxel/core/client/models/workspace.py b/src/blaxel/core/client/models/workspace.py index 1cd29d03..9a62f326 100644 --- a/src/blaxel/core/client/models/workspace.py +++ b/src/blaxel/core/client/models/workspace.py @@ -57,6 +57,7 @@ class Workspace: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + created_at = self.created_at updated_at = self.updated_at diff --git a/src/blaxel/core/sandbox/default/interpreter.py b/src/blaxel/core/sandbox/default/interpreter.py index afd28746..e4a5cf3a 100644 --- a/src/blaxel/core/sandbox/default/interpreter.py +++ b/src/blaxel/core/sandbox/default/interpreter.py @@ -36,6 +36,7 @@ async def create( cls, sandbox: Sandbox | SandboxCreateConfiguration | Dict[str, Any] | None = None, safe: bool = True, + create_if_not_exist: bool = False, ) -> CodeInterpreter: """ Create a sandbox instance using the jupyter-server image. @@ -83,7 +84,9 @@ async def create( if sandbox.spec and getattr(sandbox.spec, "region", None): payload["region"] = sandbox.spec.region - base_instance = await SandboxInstance.create(payload, safe=safe) + base_instance = await SandboxInstance.create( + payload, safe=safe, create_if_not_exist=create_if_not_exist + ) return cls( sandbox=base_instance.sandbox, force_url=base_instance.config.force_url, diff --git a/src/blaxel/core/sandbox/default/sandbox.py b/src/blaxel/core/sandbox/default/sandbox.py index 69c68ab0..5a533bd2 100644 --- a/src/blaxel/core/sandbox/default/sandbox.py +++ b/src/blaxel/core/sandbox/default/sandbox.py @@ -138,6 +138,7 @@ async def create( cls, sandbox: Union[Sandbox, SandboxCreateConfiguration, Dict[str, Any], None] = None, safe: bool = False, + create_if_not_exist: bool = False, ) -> "SandboxInstance": default_name = f"sandbox-{uuid.uuid4().hex[:8]}" default_image = "blaxel/base-image:latest" @@ -263,6 +264,7 @@ async def create( response = await create_sandbox( client=client, body=sandbox, + create_if_not_exist=create_if_not_exist, ) # Check if response is an error @@ -430,7 +432,7 @@ async def create_if_not_exists( ) -> "SandboxInstance": """Create a sandbox if it doesn't exist, otherwise return existing.""" try: - return await cls.create(sandbox) + return await cls.create(sandbox, create_if_not_exist=True) except SandboxAPIError as e: # Check if it's a 409 conflict error (sandbox already exists) if e.status_code == 409 or e.code in [409, "SANDBOX_ALREADY_EXISTS"]: @@ -458,7 +460,7 @@ async def create_if_not_exists( # If the sandbox is TERMINATED, treat it as not existing if sandbox_instance.status == "TERMINATED": # Create a new sandbox - backend will handle cleanup of the terminated one - return await cls.create(sandbox) + return await cls.create(sandbox, create_if_not_exist=True) # Otherwise return the existing active sandbox return sandbox_instance diff --git a/src/blaxel/core/sandbox/sync/interpreter.py b/src/blaxel/core/sandbox/sync/interpreter.py index 6080d0d6..ff7c1d01 100644 --- a/src/blaxel/core/sandbox/sync/interpreter.py +++ b/src/blaxel/core/sandbox/sync/interpreter.py @@ -29,6 +29,7 @@ def create( cls, sandbox: Union[Sandbox, SandboxCreateConfiguration, Dict[str, Any], None] = None, safe: bool = True, + create_if_not_exist: bool = False, ) -> "SyncCodeInterpreter": """ Create a sandbox instance using the jupyter-server image. @@ -72,7 +73,9 @@ def create( if sandbox.spec and getattr(sandbox.spec, "region", None): payload["region"] = sandbox.spec.region - base_instance = SyncSandboxInstance.create(payload, safe=safe) + base_instance = SyncSandboxInstance.create( + payload, safe=safe, create_if_not_exist=create_if_not_exist + ) return cls( sandbox=base_instance.sandbox, force_url=base_instance.config.force_url, diff --git a/src/blaxel/core/sandbox/sync/sandbox.py b/src/blaxel/core/sandbox/sync/sandbox.py index e8cd9a15..7d406430 100644 --- a/src/blaxel/core/sandbox/sync/sandbox.py +++ b/src/blaxel/core/sandbox/sync/sandbox.py @@ -123,6 +123,7 @@ def create( cls, sandbox: Union[Sandbox, SandboxCreateConfiguration, Dict[str, Any], None] = None, safe: bool = False, + create_if_not_exist: bool = False, ) -> "SyncSandboxInstance": default_name = f"sandbox-{uuid.uuid4().hex[:8]}" default_image = "blaxel/base-image:latest" @@ -231,6 +232,7 @@ def create( response = create_sandbox( client=client, body=sandbox, + create_if_not_exist=create_if_not_exist, ) # Check if response is an error @@ -370,7 +372,7 @@ def create_if_not_exists( cls, sandbox: Union[Sandbox, SandboxCreateConfiguration, Dict[str, Any]] ) -> "SyncSandboxInstance": try: - return cls.create(sandbox) + return cls.create(sandbox, create_if_not_exist=True) except SandboxAPIError as e: if e.status_code == 409 or e.code in [409, "SANDBOX_ALREADY_EXISTS"]: if isinstance(sandbox, SandboxCreateConfiguration): @@ -390,7 +392,7 @@ def create_if_not_exists( raise ValueError("Sandbox name is required") sandbox_instance = cls.get(name) if sandbox_instance.status == "TERMINATED": - return cls.create(sandbox) + return cls.create(sandbox, create_if_not_exist=True) return sandbox_instance raise