diff --git a/cirro_api_client/v1/api/execution/calculate_cost.py b/cirro_api_client/v1/api/execution/calculate_cost.py new file mode 100644 index 0000000..f5baf82 --- /dev/null +++ b/cirro_api_client/v1/api/execution/calculate_cost.py @@ -0,0 +1,176 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.cost_response import CostResponse +from ...types import Response + + +def _get_kwargs( + project_id: str, + dataset_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": f"/projects/{project_id}/execution/{dataset_id}/cost", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[CostResponse]: + if response.status_code == HTTPStatus.OK: + response_200 = CostResponse.from_dict(response.json()) + + return response_200 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[CostResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + dataset_id: str, + *, + client: Client, +) -> Response[CostResponse]: + """Calculate cost + + Calculate cost of an execution run + + Args: + project_id (str): + dataset_id (str): + client (Client): instance of the API client + + 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[CostResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + dataset_id=dataset_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + project_id: str, + dataset_id: str, + *, + client: Client, +) -> Optional[CostResponse]: + """Calculate cost + + Calculate cost of an execution run + + Args: + project_id (str): + dataset_id (str): + client (Client): instance of the API client + + 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: + CostResponse + """ + + try: + return sync_detailed( + project_id=project_id, + dataset_id=dataset_id, + client=client, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + project_id: str, + dataset_id: str, + *, + client: Client, +) -> Response[CostResponse]: + """Calculate cost + + Calculate cost of an execution run + + Args: + project_id (str): + dataset_id (str): + client (Client): instance of the API client + + 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[CostResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + dataset_id=dataset_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + project_id: str, + dataset_id: str, + *, + client: Client, +) -> Optional[CostResponse]: + """Calculate cost + + Calculate cost of an execution run + + Args: + project_id (str): + dataset_id (str): + client (Client): instance of the API client + + 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: + CostResponse + """ + + try: + return ( + await asyncio_detailed( + project_id=project_id, + dataset_id=dataset_id, + client=client, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/__init__.py b/cirro_api_client/v1/api/workspaces/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cirro_api_client/v1/api/workspaces/connect_workspace.py b/cirro_api_client/v1/api/workspaces/connect_workspace.py new file mode 100644 index 0000000..fee9a4e --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/connect_workspace.py @@ -0,0 +1,176 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.workspace_connection_response import WorkspaceConnectionResponse +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "post", + "url": f"/projects/{project_id}/workspaces/{workspace_id}:connect", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[WorkspaceConnectionResponse]: + if response.status_code == HTTPStatus.ACCEPTED: + response_202 = WorkspaceConnectionResponse.from_dict(response.json()) + + return response_202 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[WorkspaceConnectionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[WorkspaceConnectionResponse]: + """Connect to workspace + + Generates a URL to connect to the given workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[WorkspaceConnectionResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Optional[WorkspaceConnectionResponse]: + """Connect to workspace + + Generates a URL to connect to the given workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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: + WorkspaceConnectionResponse + """ + + try: + return sync_detailed( + project_id=project_id, + workspace_id=workspace_id, + client=client, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[WorkspaceConnectionResponse]: + """Connect to workspace + + Generates a URL to connect to the given workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[WorkspaceConnectionResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Optional[WorkspaceConnectionResponse]: + """Connect to workspace + + Generates a URL to connect to the given workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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: + WorkspaceConnectionResponse + """ + + try: + return ( + await asyncio_detailed( + project_id=project_id, + workspace_id=workspace_id, + client=client, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/create_workspace.py b/cirro_api_client/v1/api/workspaces/create_workspace.py new file mode 100644 index 0000000..57ccc68 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/create_workspace.py @@ -0,0 +1,186 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.create_response import CreateResponse +from ...models.workspace_input import WorkspaceInput +from ...types import Response + + +def _get_kwargs( + project_id: str, + *, + body: WorkspaceInput, +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": f"/projects/{project_id}/workspaces", + } + + _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) -> Optional[CreateResponse]: + if response.status_code == HTTPStatus.CREATED: + response_201 = CreateResponse.from_dict(response.json()) + + return response_201 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[CreateResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Response[CreateResponse]: + """Create workspace + + Creates a workspace within a project + + Args: + project_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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[CreateResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + body=body, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + project_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Optional[CreateResponse]: + """Create workspace + + Creates a workspace within a project + + Args: + project_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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: + CreateResponse + """ + + try: + return sync_detailed( + project_id=project_id, + client=client, + body=body, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + project_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Response[CreateResponse]: + """Create workspace + + Creates a workspace within a project + + Args: + project_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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[CreateResponse] + """ + + kwargs = _get_kwargs( + project_id=project_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + project_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Optional[CreateResponse]: + """Create workspace + + Creates a workspace within a project + + Args: + project_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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: + CreateResponse + """ + + try: + return ( + await asyncio_detailed( + project_id=project_id, + client=client, + body=body, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/delete_workspace.py b/cirro_api_client/v1/api/workspaces/delete_workspace.py new file mode 100644 index 0000000..0d3a07d --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/delete_workspace.py @@ -0,0 +1,105 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": f"/projects/{project_id}/workspaces/{workspace_id}", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.ACCEPTED: + return None + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Delete workspace + + Deletes a workspace within a project + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Delete workspace + + Deletes a workspace within a project + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) diff --git a/cirro_api_client/v1/api/workspaces/disconnect_workspace.py b/cirro_api_client/v1/api/workspaces/disconnect_workspace.py new file mode 100644 index 0000000..a87b790 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/disconnect_workspace.py @@ -0,0 +1,120 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...types import UNSET, Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, + *, + session_id: str, +) -> Dict[str, Any]: + params: Dict[str, Any] = {} + + params["sessionId"] = session_id + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": f"/projects/{project_id}/workspaces/{workspace_id}:disconnect", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.ACCEPTED: + return None + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, + session_id: str, +) -> Response[Any]: + """Disconnect from workspace + + Closes the connection to the given workspace + + Args: + project_id (str): + workspace_id (str): + session_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + session_id=session_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, + session_id: str, +) -> Response[Any]: + """Disconnect from workspace + + Closes the connection to the given workspace + + Args: + project_id (str): + workspace_id (str): + session_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + session_id=session_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) diff --git a/cirro_api_client/v1/api/workspaces/get_workspace.py b/cirro_api_client/v1/api/workspaces/get_workspace.py new file mode 100644 index 0000000..a755235 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/get_workspace.py @@ -0,0 +1,176 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.workspace import Workspace +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": f"/projects/{project_id}/workspaces/{workspace_id}", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Workspace]: + if response.status_code == HTTPStatus.OK: + response_200 = Workspace.from_dict(response.json()) + + return response_200 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Workspace]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Workspace]: + """Get workspace + + Get details of a particular workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Workspace] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Optional[Workspace]: + """Get workspace + + Get details of a particular workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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: + Workspace + """ + + try: + return sync_detailed( + project_id=project_id, + workspace_id=workspace_id, + client=client, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Workspace]: + """Get workspace + + Get details of a particular workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Workspace] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Optional[Workspace]: + """Get workspace + + Get details of a particular workspace + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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: + Workspace + """ + + try: + return ( + await asyncio_detailed( + project_id=project_id, + workspace_id=workspace_id, + client=client, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/get_workspace_environments.py b/cirro_api_client/v1/api/workspaces/get_workspace_environments.py new file mode 100644 index 0000000..e6a4c80 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/get_workspace_environments.py @@ -0,0 +1,140 @@ +from http import HTTPStatus +from typing import Any, Dict, List, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.workspace_environment import WorkspaceEnvironment +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/workspace-environments", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[List["WorkspaceEnvironment"]]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = WorkspaceEnvironment.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[List["WorkspaceEnvironment"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Client, +) -> Response[List["WorkspaceEnvironment"]]: + """Get workspace environments + + Retrieves a list of pre-defined workspace environments available to use + + 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[List['WorkspaceEnvironment']] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Client, +) -> Optional[List["WorkspaceEnvironment"]]: + """Get workspace environments + + Retrieves a list of pre-defined workspace environments available to use + + 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: + List['WorkspaceEnvironment'] + """ + + try: + return sync_detailed( + client=client, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + *, + client: Client, +) -> Response[List["WorkspaceEnvironment"]]: + """Get workspace environments + + Retrieves a list of pre-defined workspace environments available to use + + 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[List['WorkspaceEnvironment']] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Client, +) -> Optional[List["WorkspaceEnvironment"]]: + """Get workspace environments + + Retrieves a list of pre-defined workspace environments available to use + + 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: + List['WorkspaceEnvironment'] + """ + + try: + return ( + await asyncio_detailed( + client=client, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/get_workspaces.py b/cirro_api_client/v1/api/workspaces/get_workspaces.py new file mode 100644 index 0000000..5f3958e --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/get_workspaces.py @@ -0,0 +1,168 @@ +from http import HTTPStatus +from typing import Any, Dict, List, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.workspace import Workspace +from ...types import Response + + +def _get_kwargs( + project_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": f"/projects/{project_id}/workspaces", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[List["Workspace"]]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Workspace.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[List["Workspace"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + *, + client: Client, +) -> Response[List["Workspace"]]: + """Get workspaces + + Retrieves a list of workspaces that the user has access to + + Args: + project_id (str): + client (Client): instance of the API client + + 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[List['Workspace']] + """ + + kwargs = _get_kwargs( + project_id=project_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + project_id: str, + *, + client: Client, +) -> Optional[List["Workspace"]]: + """Get workspaces + + Retrieves a list of workspaces that the user has access to + + Args: + project_id (str): + client (Client): instance of the API client + + 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: + List['Workspace'] + """ + + try: + return sync_detailed( + project_id=project_id, + client=client, + ).parsed + except errors.NotFoundException: + return None + + +async def asyncio_detailed( + project_id: str, + *, + client: Client, +) -> Response[List["Workspace"]]: + """Get workspaces + + Retrieves a list of workspaces that the user has access to + + Args: + project_id (str): + client (Client): instance of the API client + + 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[List['Workspace']] + """ + + kwargs = _get_kwargs( + project_id=project_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + project_id: str, + *, + client: Client, +) -> Optional[List["Workspace"]]: + """Get workspaces + + Retrieves a list of workspaces that the user has access to + + Args: + project_id (str): + client (Client): instance of the API client + + 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: + List['Workspace'] + """ + + try: + return ( + await asyncio_detailed( + project_id=project_id, + client=client, + ) + ).parsed + except errors.NotFoundException: + return None diff --git a/cirro_api_client/v1/api/workspaces/start_workspace.py b/cirro_api_client/v1/api/workspaces/start_workspace.py new file mode 100644 index 0000000..98b4ed3 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/start_workspace.py @@ -0,0 +1,105 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "post", + "url": f"/projects/{project_id}/workspaces/{workspace_id}:start", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.ACCEPTED: + return None + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Start workspace + + Starts a workspace instance + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Start workspace + + Starts a workspace instance + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) diff --git a/cirro_api_client/v1/api/workspaces/stop_workspace.py b/cirro_api_client/v1/api/workspaces/stop_workspace.py new file mode 100644 index 0000000..c258ba3 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/stop_workspace.py @@ -0,0 +1,105 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "post", + "url": f"/projects/{project_id}/workspaces/{workspace_id}:stop", + } + + return _kwargs + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.ACCEPTED: + return None + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Stop workspace + + Shuts down a running workspace instance + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, +) -> Response[Any]: + """Stop workspace + + Shuts down a running workspace instance + + Args: + project_id (str): + workspace_id (str): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) diff --git a/cirro_api_client/v1/api/workspaces/update_workspace.py b/cirro_api_client/v1/api/workspaces/update_workspace.py new file mode 100644 index 0000000..aa5b8c6 --- /dev/null +++ b/cirro_api_client/v1/api/workspaces/update_workspace.py @@ -0,0 +1,122 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...models.workspace_input import WorkspaceInput +from ...types import Response + + +def _get_kwargs( + project_id: str, + workspace_id: str, + *, + body: WorkspaceInput, +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": f"/projects/{project_id}/workspaces/{workspace_id}", + } + + _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) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + + errors.handle_error_response(response, client.raise_on_unexpected_status) + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Response[Any]: + """Update workspace + + Updates a workspace within a project + + Args: + project_id (str): + workspace_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + body=body, + ) + + response = client.get_httpx_client().request( + auth=client.get_auth(), + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + project_id: str, + workspace_id: str, + *, + client: Client, + body: WorkspaceInput, +) -> Response[Any]: + """Update workspace + + Updates a workspace within a project + + Args: + project_id (str): + workspace_id (str): + body (WorkspaceInput): + client (Client): instance of the API client + + 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[Any] + """ + + kwargs = _get_kwargs( + project_id=project_id, + workspace_id=workspace_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs) + + return _build_response(client=client, response=response) diff --git a/cirro_api_client/v1/models/__init__.py b/cirro_api_client/v1/models/__init__.py index 17617b0..732e284 100644 --- a/cirro_api_client/v1/models/__init__.py +++ b/cirro_api_client/v1/models/__init__.py @@ -35,6 +35,7 @@ from .compute_environment_configuration_properties import ComputeEnvironmentConfigurationProperties from .contact import Contact from .contact_input import ContactInput +from .cost_response import CostResponse from .create_notebook_instance_request import CreateNotebookInstanceRequest from .create_project_access_request import CreateProjectAccessRequest from .create_reference_request import CreateReferenceRequest @@ -59,6 +60,7 @@ from .dataset_detail_params import DatasetDetailParams from .dataset_detail_source_sample_files_map import DatasetDetailSourceSampleFilesMap from .dataset_viz import DatasetViz +from .dataset_viz_config import DatasetVizConfig from .discussion import Discussion from .discussion_input import DiscussionInput from .discussion_type import DiscussionType @@ -95,6 +97,7 @@ from .governance_scope import GovernanceScope from .governance_training_verification import GovernanceTrainingVerification from .governance_type import GovernanceType +from .group_cost import GroupCost from .import_data_request import ImportDataRequest from .invite_user_request import InviteUserRequest from .invite_user_response import InviteUserResponse @@ -106,6 +109,7 @@ from .message_type import MessageType from .metric_record import MetricRecord from .metric_record_services import MetricRecordServices +from .mounted_dataset import MountedDataset from .move_dataset_input import MoveDatasetInput from .move_dataset_response import MoveDatasetResponse from .named_item import NamedItem @@ -158,6 +162,7 @@ from .share_detail import ShareDetail from .share_input import ShareInput from .share_type import ShareType +from .sharing_type import SharingType from .sort_order import SortOrder from .status import Status from .stop_execution_response import StopExecutionResponse @@ -166,6 +171,7 @@ from .table import Table from .tag import Tag from .task import Task +from .task_cost import TaskCost from .tenant_info import TenantInfo from .update_dataset_request import UpdateDatasetRequest from .update_user_request import UpdateUserRequest @@ -177,6 +183,14 @@ from .user_settings import UserSettings from .validate_file_name_patterns_request import ValidateFileNamePatternsRequest from .validate_file_requirements_request import ValidateFileRequirementsRequest +from .version_specification import VersionSpecification +from .workspace import Workspace +from .workspace_compute_config import WorkspaceComputeConfig +from .workspace_compute_config_environment_variables import WorkspaceComputeConfigEnvironmentVariables +from .workspace_connection_response import WorkspaceConnectionResponse +from .workspace_environment import WorkspaceEnvironment +from .workspace_input import WorkspaceInput +from .workspace_session import WorkspaceSession __all__ = ( "Agent", @@ -214,6 +228,7 @@ "ComputeEnvironmentConfigurationProperties", "Contact", "ContactInput", + "CostResponse", "CreateNotebookInstanceRequest", "CreateProjectAccessRequest", "CreateReferenceRequest", @@ -238,6 +253,7 @@ "DatasetDetailParams", "DatasetDetailSourceSampleFilesMap", "DatasetViz", + "DatasetVizConfig", "Discussion", "DiscussionInput", "DiscussionType", @@ -274,6 +290,7 @@ "GovernanceScope", "GovernanceTrainingVerification", "GovernanceType", + "GroupCost", "ImportDataRequest", "InviteUserRequest", "InviteUserResponse", @@ -285,6 +302,7 @@ "MessageType", "MetricRecord", "MetricRecordServices", + "MountedDataset", "MoveDatasetInput", "MoveDatasetResponse", "NamedItem", @@ -337,6 +355,7 @@ "ShareDetail", "ShareInput", "ShareType", + "SharingType", "SortOrder", "Status", "StopExecutionResponse", @@ -345,6 +364,7 @@ "Table", "Tag", "Task", + "TaskCost", "TenantInfo", "UpdateDatasetRequest", "UpdateUserRequest", @@ -356,4 +376,12 @@ "UserSettings", "ValidateFileNamePatternsRequest", "ValidateFileRequirementsRequest", + "VersionSpecification", + "Workspace", + "WorkspaceComputeConfig", + "WorkspaceComputeConfigEnvironmentVariables", + "WorkspaceConnectionResponse", + "WorkspaceEnvironment", + "WorkspaceInput", + "WorkspaceSession", ) diff --git a/cirro_api_client/v1/models/cost_response.py b/cirro_api_client/v1/models/cost_response.py new file mode 100644 index 0000000..16eae86 --- /dev/null +++ b/cirro_api_client/v1/models/cost_response.py @@ -0,0 +1,101 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.group_cost import GroupCost + from ..models.task_cost import TaskCost + + +T = TypeVar("T", bound="CostResponse") + + +@_attrs_define +class CostResponse: + """ + Attributes: + total_cost (Union[Unset, float]): Total cost + groups (Union[Unset, List['GroupCost']]): Costs grouped by the task status + tasks (Union[Unset, List['TaskCost']]): Costs for each workflow task + is_estimate (Union[Unset, bool]): Whether this is an estimated cost + """ + + total_cost: Union[Unset, float] = UNSET + groups: Union[Unset, List["GroupCost"]] = UNSET + tasks: Union[Unset, List["TaskCost"]] = UNSET + is_estimate: Union[Unset, bool] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + total_cost = self.total_cost + + groups: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.groups, Unset): + groups = [] + for groups_item_data in self.groups: + groups_item = groups_item_data.to_dict() + groups.append(groups_item) + + tasks: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.tasks, Unset): + tasks = [] + for tasks_item_data in self.tasks: + tasks_item = tasks_item_data.to_dict() + tasks.append(tasks_item) + + is_estimate = self.is_estimate + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if total_cost is not UNSET: + field_dict["totalCost"] = total_cost + if groups is not UNSET: + field_dict["groups"] = groups + if tasks is not UNSET: + field_dict["tasks"] = tasks + if is_estimate is not UNSET: + field_dict["isEstimate"] = is_estimate + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.group_cost import GroupCost + from ..models.task_cost import TaskCost + + d = src_dict.copy() + total_cost = d.pop("totalCost", UNSET) + + groups = [] + _groups = d.pop("groups", UNSET) + for groups_item_data in _groups or []: + groups_item = GroupCost.from_dict(groups_item_data) + + groups.append(groups_item) + + tasks = [] + _tasks = d.pop("tasks", UNSET) + for tasks_item_data in _tasks or []: + tasks_item = TaskCost.from_dict(tasks_item_data) + + tasks.append(tasks_item) + + is_estimate = d.pop("isEstimate", UNSET) + + cost_response = cls( + total_cost=total_cost, + groups=groups, + tasks=tasks, + is_estimate=is_estimate, + ) + + cost_response.additional_properties = d + return cost_response + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/dashboard.py b/cirro_api_client/v1/models/dashboard.py index d929804..7224b38 100644 --- a/cirro_api_client/v1/models/dashboard.py +++ b/cirro_api_client/v1/models/dashboard.py @@ -1,10 +1,12 @@ import datetime -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from dateutil.parser import isoparse +from ..types import UNSET, Unset + if TYPE_CHECKING: from ..models.dashboard_dashboard_data import DashboardDashboardData from ..models.dashboard_info import DashboardInfo @@ -21,22 +23,22 @@ class Dashboard: name (str): description (str): process_ids (List[str]): - dashboard_data (DashboardDashboardData): - info (DashboardInfo): created_by (str): created_at (datetime.datetime): updated_at (datetime.datetime): + dashboard_data (Union[Unset, DashboardDashboardData]): + info (Union[Unset, DashboardInfo]): """ id: str name: str description: str process_ids: List[str] - dashboard_data: "DashboardDashboardData" - info: "DashboardInfo" created_by: str created_at: datetime.datetime updated_at: datetime.datetime + dashboard_data: Union[Unset, "DashboardDashboardData"] = UNSET + info: Union[Unset, "DashboardInfo"] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -48,16 +50,20 @@ def to_dict(self) -> Dict[str, Any]: process_ids = self.process_ids - dashboard_data = self.dashboard_data.to_dict() - - info = self.info.to_dict() - created_by = self.created_by created_at = self.created_at.isoformat() updated_at = self.updated_at.isoformat() + dashboard_data: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.dashboard_data, Unset): + dashboard_data = self.dashboard_data.to_dict() + + info: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.info, Unset): + info = self.info.to_dict() + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -66,13 +72,15 @@ def to_dict(self) -> Dict[str, Any]: "name": name, "description": description, "processIds": process_ids, - "dashboardData": dashboard_data, - "info": info, "createdBy": created_by, "createdAt": created_at, "updatedAt": updated_at, } ) + if dashboard_data is not UNSET: + field_dict["dashboardData"] = dashboard_data + if info is not UNSET: + field_dict["info"] = info return field_dict @@ -90,26 +98,36 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: process_ids = cast(List[str], d.pop("processIds")) - dashboard_data = DashboardDashboardData.from_dict(d.pop("dashboardData")) - - info = DashboardInfo.from_dict(d.pop("info")) - created_by = d.pop("createdBy") created_at = isoparse(d.pop("createdAt")) updated_at = isoparse(d.pop("updatedAt")) + _dashboard_data = d.pop("dashboardData", UNSET) + dashboard_data: Union[Unset, DashboardDashboardData] + if isinstance(_dashboard_data, Unset): + dashboard_data = UNSET + else: + dashboard_data = DashboardDashboardData.from_dict(_dashboard_data) + + _info = d.pop("info", UNSET) + info: Union[Unset, DashboardInfo] + if isinstance(_info, Unset): + info = UNSET + else: + info = DashboardInfo.from_dict(_info) + dashboard = cls( id=id, name=name, description=description, process_ids=process_ids, - dashboard_data=dashboard_data, - info=info, created_by=created_by, created_at=created_at, updated_at=updated_at, + dashboard_data=dashboard_data, + info=info, ) dashboard.additional_properties = d diff --git a/cirro_api_client/v1/models/dashboard_request.py b/cirro_api_client/v1/models/dashboard_request.py index 80d7523..358eb79 100644 --- a/cirro_api_client/v1/models/dashboard_request.py +++ b/cirro_api_client/v1/models/dashboard_request.py @@ -1,8 +1,10 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..types import UNSET, Unset + if TYPE_CHECKING: from ..models.dashboard_request_dashboard_data import DashboardRequestDashboardData from ..models.dashboard_request_info import DashboardRequestInfo @@ -18,15 +20,15 @@ class DashboardRequest: name (str): description (str): process_ids (List[str]): - dashboard_data (DashboardRequestDashboardData): - info (DashboardRequestInfo): + dashboard_data (Union[Unset, DashboardRequestDashboardData]): + info (Union[Unset, DashboardRequestInfo]): """ name: str description: str process_ids: List[str] - dashboard_data: "DashboardRequestDashboardData" - info: "DashboardRequestInfo" + dashboard_data: Union[Unset, "DashboardRequestDashboardData"] = UNSET + info: Union[Unset, "DashboardRequestInfo"] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -36,9 +38,13 @@ def to_dict(self) -> Dict[str, Any]: process_ids = self.process_ids - dashboard_data = self.dashboard_data.to_dict() + dashboard_data: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.dashboard_data, Unset): + dashboard_data = self.dashboard_data.to_dict() - info = self.info.to_dict() + info: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.info, Unset): + info = self.info.to_dict() field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) @@ -47,10 +53,12 @@ def to_dict(self) -> Dict[str, Any]: "name": name, "description": description, "processIds": process_ids, - "dashboardData": dashboard_data, - "info": info, } ) + if dashboard_data is not UNSET: + field_dict["dashboardData"] = dashboard_data + if info is not UNSET: + field_dict["info"] = info return field_dict @@ -66,9 +74,19 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: process_ids = cast(List[str], d.pop("processIds")) - dashboard_data = DashboardRequestDashboardData.from_dict(d.pop("dashboardData")) - - info = DashboardRequestInfo.from_dict(d.pop("info")) + _dashboard_data = d.pop("dashboardData", UNSET) + dashboard_data: Union[Unset, DashboardRequestDashboardData] + if isinstance(_dashboard_data, Unset): + dashboard_data = UNSET + else: + dashboard_data = DashboardRequestDashboardData.from_dict(_dashboard_data) + + _info = d.pop("info", UNSET) + info: Union[Unset, DashboardRequestInfo] + if isinstance(_info, Unset): + info = UNSET + else: + info = DashboardRequestInfo.from_dict(_info) dashboard_request = cls( name=name, diff --git a/cirro_api_client/v1/models/dataset_detail.py b/cirro_api_client/v1/models/dataset_detail.py index c706b1e..b892146 100644 --- a/cirro_api_client/v1/models/dataset_detail.py +++ b/cirro_api_client/v1/models/dataset_detail.py @@ -46,6 +46,7 @@ class DatasetDetail: originating_project_id (Union[Unset, str]): The originating project ID might be different if the dataset was shared from another project. share (Union['NamedItem', None, Unset]): + total_size_bytes (Union[None, Unset, int]): Total size of dataset files (in bytes) """ id: str @@ -69,6 +70,7 @@ class DatasetDetail: updated_at: datetime.datetime originating_project_id: Union[Unset, str] = UNSET share: Union["NamedItem", None, Unset] = UNSET + total_size_bytes: Union[None, Unset, int] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -128,6 +130,12 @@ def to_dict(self) -> Dict[str, Any]: else: share = self.share + total_size_bytes: Union[None, Unset, int] + if isinstance(self.total_size_bytes, Unset): + total_size_bytes = UNSET + else: + total_size_bytes = self.total_size_bytes + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -157,6 +165,8 @@ def to_dict(self) -> Dict[str, Any]: field_dict["originatingProjectId"] = originating_project_id if share is not UNSET: field_dict["share"] = share + if total_size_bytes is not UNSET: + field_dict["totalSizeBytes"] = total_size_bytes return field_dict @@ -236,6 +246,15 @@ def _parse_share(data: object) -> Union["NamedItem", None, Unset]: share = _parse_share(d.pop("share", UNSET)) + def _parse_total_size_bytes(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + total_size_bytes = _parse_total_size_bytes(d.pop("totalSizeBytes", UNSET)) + dataset_detail = cls( id=id, name=name, @@ -258,6 +277,7 @@ def _parse_share(data: object) -> Union["NamedItem", None, Unset]: updated_at=updated_at, originating_project_id=originating_project_id, share=share, + total_size_bytes=total_size_bytes, ) dataset_detail.additional_properties = d diff --git a/cirro_api_client/v1/models/dataset_viz.py b/cirro_api_client/v1/models/dataset_viz.py index 278e989..4d4b24d 100644 --- a/cirro_api_client/v1/models/dataset_viz.py +++ b/cirro_api_client/v1/models/dataset_viz.py @@ -1,10 +1,14 @@ -from typing import Any, Dict, List, Type, TypeVar, Union +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.dataset_viz_config import DatasetVizConfig + + T = TypeVar("T", bound="DatasetViz") @@ -16,14 +20,14 @@ class DatasetViz: name (Union[Unset, str]): Name of viz desc (Union[Unset, str]): Description of viz type (Union[Unset, str]): Type of viz Example: vitescce. - config (Union[Unset, Any]): Config or path to config used to render viz + config (Union[Unset, DatasetVizConfig]): Config or path to config used to render viz """ path: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET desc: Union[Unset, str] = UNSET type: Union[Unset, str] = UNSET - config: Union[Unset, Any] = UNSET + config: Union[Unset, "DatasetVizConfig"] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -35,7 +39,9 @@ def to_dict(self) -> Dict[str, Any]: type = self.type - config = self.config + config: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.config, Unset): + config = self.config.to_dict() field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) @@ -55,6 +61,8 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.dataset_viz_config import DatasetVizConfig + d = src_dict.copy() path = d.pop("path", UNSET) @@ -64,7 +72,12 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: type = d.pop("type", UNSET) - config = d.pop("config", UNSET) + _config = d.pop("config", UNSET) + config: Union[Unset, DatasetVizConfig] + if isinstance(_config, Unset): + config = UNSET + else: + config = DatasetVizConfig.from_dict(_config) dataset_viz = cls( path=path, diff --git a/cirro_api_client/v1/models/dataset_viz_config.py b/cirro_api_client/v1/models/dataset_viz_config.py new file mode 100644 index 0000000..7cd5cff --- /dev/null +++ b/cirro_api_client/v1/models/dataset_viz_config.py @@ -0,0 +1,32 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="DatasetVizConfig") + + +@_attrs_define +class DatasetVizConfig: + """Config or path to config used to render viz""" + + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + dataset_viz_config = cls() + + dataset_viz_config.additional_properties = d + return dataset_viz_config + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/entity_type.py b/cirro_api_client/v1/models/entity_type.py index 84a0500..dd9e295 100644 --- a/cirro_api_client/v1/models/entity_type.py +++ b/cirro_api_client/v1/models/entity_type.py @@ -11,8 +11,9 @@ class EntityType(str, Enum): SAMPLE = "SAMPLE" SHARE = "SHARE" TAG = "TAG" - UNKNOWN = "UNKNOWN" USER = "USER" + UNKNOWN = "UNKNOWN" + """ This is a fallback value for when the value is not known, do not use this value when making requests """ def __str__(self) -> str: return str(self.value) diff --git a/cirro_api_client/v1/models/feature_flags.py b/cirro_api_client/v1/models/feature_flags.py index d74ced4..3107594 100644 --- a/cirro_api_client/v1/models/feature_flags.py +++ b/cirro_api_client/v1/models/feature_flags.py @@ -13,11 +13,15 @@ class FeatureFlags: sftp_enabled (bool): governance_enabled (bool): project_requests_enabled (bool): + workspaces_enabled (bool): + drive_enabled (bool): """ sftp_enabled: bool governance_enabled: bool project_requests_enabled: bool + workspaces_enabled: bool + drive_enabled: bool additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -27,6 +31,10 @@ def to_dict(self) -> Dict[str, Any]: project_requests_enabled = self.project_requests_enabled + workspaces_enabled = self.workspaces_enabled + + drive_enabled = self.drive_enabled + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -34,6 +42,8 @@ def to_dict(self) -> Dict[str, Any]: "sftpEnabled": sftp_enabled, "governanceEnabled": governance_enabled, "projectRequestsEnabled": project_requests_enabled, + "workspacesEnabled": workspaces_enabled, + "driveEnabled": drive_enabled, } ) @@ -48,10 +58,16 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: project_requests_enabled = d.pop("projectRequestsEnabled") + workspaces_enabled = d.pop("workspacesEnabled") + + drive_enabled = d.pop("driveEnabled") + feature_flags = cls( sftp_enabled=sftp_enabled, governance_enabled=governance_enabled, project_requests_enabled=project_requests_enabled, + workspaces_enabled=workspaces_enabled, + drive_enabled=drive_enabled, ) feature_flags.additional_properties = d diff --git a/cirro_api_client/v1/models/group_cost.py b/cirro_api_client/v1/models/group_cost.py new file mode 100644 index 0000000..18de1d7 --- /dev/null +++ b/cirro_api_client/v1/models/group_cost.py @@ -0,0 +1,55 @@ +from typing import Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="GroupCost") + + +@_attrs_define +class GroupCost: + """ + Attributes: + name (Union[Unset, str]): Task status group Example: CACHED. + cost (Union[Unset, float]): Cost + """ + + name: Union[Unset, str] = UNSET + cost: Union[Unset, float] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + cost = self.cost + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if name is not UNSET: + field_dict["name"] = name + if cost is not UNSET: + field_dict["cost"] = cost + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name", UNSET) + + cost = d.pop("cost", UNSET) + + group_cost = cls( + name=name, + cost=cost, + ) + + group_cost.additional_properties = d + return group_cost + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/mounted_dataset.py b/cirro_api_client/v1/models/mounted_dataset.py new file mode 100644 index 0000000..d7f9e5c --- /dev/null +++ b/cirro_api_client/v1/models/mounted_dataset.py @@ -0,0 +1,55 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MountedDataset") + + +@_attrs_define +class MountedDataset: + """Represents a mounted dataset in a workspace + + Attributes: + name (str): Folder name that appears in the workspace + uri (str): Full S3 prefix to the data + """ + + name: str + uri: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + uri = self.uri + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "uri": uri, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + uri = d.pop("uri") + + mounted_dataset = cls( + name=name, + uri=uri, + ) + + mounted_dataset.additional_properties = d + return mounted_dataset + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/project_detail.py b/cirro_api_client/v1/models/project_detail.py index fe1d17c..e6588bd 100644 --- a/cirro_api_client/v1/models/project_detail.py +++ b/cirro_api_client/v1/models/project_detail.py @@ -1,11 +1,12 @@ import datetime -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from dateutil.parser import isoparse from ..models.status import Status +from ..types import UNSET, Unset if TYPE_CHECKING: from ..models.cloud_account import CloudAccount @@ -36,6 +37,7 @@ class ProjectDetail: created_by (str): created_at (datetime.datetime): updated_at (datetime.datetime): + deployed_at (Union[None, Unset, datetime.datetime]): """ id: str @@ -53,6 +55,7 @@ class ProjectDetail: created_by: str created_at: datetime.datetime updated_at: datetime.datetime + deployed_at: Union[None, Unset, datetime.datetime] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -92,6 +95,14 @@ def to_dict(self) -> Dict[str, Any]: updated_at = self.updated_at.isoformat() + deployed_at: Union[None, Unset, str] + if isinstance(self.deployed_at, Unset): + deployed_at = UNSET + elif isinstance(self.deployed_at, datetime.datetime): + deployed_at = self.deployed_at.isoformat() + else: + deployed_at = self.deployed_at + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -113,6 +124,8 @@ def to_dict(self) -> Dict[str, Any]: "updatedAt": updated_at, } ) + if deployed_at is not UNSET: + field_dict["deployedAt"] = deployed_at return field_dict @@ -164,6 +177,23 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: updated_at = isoparse(d.pop("updatedAt")) + def _parse_deployed_at(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + deployed_at_type_0 = isoparse(data) + + return deployed_at_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, datetime.datetime], data) + + deployed_at = _parse_deployed_at(d.pop("deployedAt", UNSET)) + project_detail = cls( id=id, name=name, @@ -180,6 +210,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: created_by=created_by, created_at=created_at, updated_at=updated_at, + deployed_at=deployed_at, ) project_detail.additional_properties = d diff --git a/cirro_api_client/v1/models/project_metrics.py b/cirro_api_client/v1/models/project_metrics.py index 1c7de9f..158aa75 100644 --- a/cirro_api_client/v1/models/project_metrics.py +++ b/cirro_api_client/v1/models/project_metrics.py @@ -17,29 +17,12 @@ class ProjectMetrics: """ Attributes: project_id (str): - costs (Union[Unset, List['MetricRecord']]): Costs by service by month Example: [{ - "date": "2022-11-01", - "unit": "$", - "service": { - "Other": 26.47, - "EC2 - Other": 3.66, - "Amazon Elastic Compute Cloud - Compute": 140.59, - "Amazon Simple Storage Service": 24.91, - "AmazonCloudWatch": 2.09 - } - }] - . - storage_metrics (Union[Unset, List['MetricRecord']]): Storage usage by tier by day Example: [{ - "date": "2023-12-12", - "unit": "GB", - "service": { - "IntelligentTieringAIAStorage": 4198.95, - "IntelligentTieringFAStorage": 1516.48, - "StandardStorage": 1.9, - "IntelligentTieringIAStorage": 2154.6 - } - }] - . + costs (Union[Unset, List['MetricRecord']]): Costs by service by month Example: [{'date': datetime.date(2022, 11, + 1), 'unit': '$', 'service': {'Other': 26.47, 'EC2 - Other': 3.66, 'Amazon Elastic Compute Cloud - Compute': + 140.59, 'Amazon Simple Storage Service': 24.91, 'AmazonCloudWatch': 2.09}}]. + storage_metrics (Union[Unset, List['MetricRecord']]): Storage usage by tier by day Example: [{'date': + datetime.date(2023, 12, 12), 'unit': 'GB', 'service': {'IntelligentTieringAIAStorage': 4198.95, + 'IntelligentTieringFAStorage': 1516.48, 'StandardStorage': 1.9, 'IntelligentTieringIAStorage': 2154.6}}]. """ project_id: str diff --git a/cirro_api_client/v1/models/project_requirement.py b/cirro_api_client/v1/models/project_requirement.py index d73099b..e5f3353 100644 --- a/cirro_api_client/v1/models/project_requirement.py +++ b/cirro_api_client/v1/models/project_requirement.py @@ -52,6 +52,8 @@ class ProjectRequirement: fulfillment_date (Union[None, Unset, datetime.datetime]): The date the requirement was fulfilled by the user fulfillment_file (Union[None, Unset, str]): The optional file uploaded to fulfill the requirement fulfillment_path (Union[None, Unset, str]): The path to the optional fulfillment file + requires_user_fulfillment (Union[Unset, bool]): Whether this requirement requires the user to fulfill (it is + active, requires fulfillment, and user has not fulfilled """ id: str @@ -78,6 +80,7 @@ class ProjectRequirement: fulfillment_date: Union[None, Unset, datetime.datetime] = UNSET fulfillment_file: Union[None, Unset, str] = UNSET fulfillment_path: Union[None, Unset, str] = UNSET + requires_user_fulfillment: Union[Unset, bool] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -204,6 +207,8 @@ def to_dict(self) -> Dict[str, Any]: else: fulfillment_path = self.fulfillment_path + requires_user_fulfillment = self.requires_user_fulfillment + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -247,6 +252,8 @@ def to_dict(self) -> Dict[str, Any]: field_dict["fulfillmentFile"] = fulfillment_file if fulfillment_path is not UNSET: field_dict["fulfillmentPath"] = fulfillment_path + if requires_user_fulfillment is not UNSET: + field_dict["requiresUserFulfillment"] = requires_user_fulfillment return field_dict @@ -469,6 +476,8 @@ def _parse_fulfillment_path(data: object) -> Union[None, Unset, str]: fulfillment_path = _parse_fulfillment_path(d.pop("fulfillmentPath", UNSET)) + requires_user_fulfillment = d.pop("requiresUserFulfillment", UNSET) + project_requirement = cls( id=id, name=name, @@ -494,6 +503,7 @@ def _parse_fulfillment_path(data: object) -> Union[None, Unset, str]: fulfillment_date=fulfillment_date, fulfillment_file=fulfillment_file, fulfillment_path=fulfillment_path, + requires_user_fulfillment=requires_user_fulfillment, ) project_requirement.additional_properties = d diff --git a/cirro_api_client/v1/models/project_settings.py b/cirro_api_client/v1/models/project_settings.py index e7c8e57..3ec8132 100644 --- a/cirro_api_client/v1/models/project_settings.py +++ b/cirro_api_client/v1/models/project_settings.py @@ -15,50 +15,65 @@ class ProjectSettings: Attributes: budget_amount (int): Total allowed cost for the budget period budget_period (BudgetPeriod): Time period associated with the budget amount - dragen_ami (Union[None, Unset, str]): AMI ID for the DRAGEN compute environment (if enabled) - enable_compute (Union[Unset, bool]): Enables the default compute environment Default: True. - enable_dragen (Union[Unset, bool]): Enables the DRAGEN compute environment Default: False. enable_backup (Union[Unset, bool]): Enables the AWS Backup service for S3 Default: False. enable_sftp (Union[Unset, bool]): Enables access to files over SFTP Default: False. - max_f1vcpu (Union[Unset, int]): Service quota limit for On Demand F1 instances Default: 0. - max_spot_vcpu (Union[Unset, int]): Service quota limit for Spot instances Default: 0. - max_gpuvcpu (Union[Unset, int]): Service quota limit for GPU Spot instances Default: 0. + service_connections (Union[Unset, List[str]]): List of service connections to enable + kms_arn (Union[None, Unset, str]): KMS Key ARN to encrypt S3 objects, if not provided, default bucket encryption + will be used retention_policy_days (Union[Unset, int]): Days to keep deleted datasets before being permanently erased Default: 7. temporary_storage_lifetime_days (Union[Unset, int]): Days to keep temporary storage space (workflow executor cache) Default: 14. - service_connections (Union[Unset, List[str]]): List of service connections to enable vpc_id (Union[None, Unset, str]): VPC that the compute environment will use Example: vpc-00000000000000000. - batch_subnets (Union[List[str], None, Unset]): List of subnets that the compute environment will use Example: - ['subnet-00000000000000000']. + batch_subnets (Union[List[str], None, Unset]): List of subnets that the pipeline compute environment will use + Example: ['subnet-00000000000000000']. sagemaker_subnets (Union[List[str], None, Unset]): List of subnets that the sagemaker instances will use Example: ['subnet-00000000000000000']. - kms_arn (Union[None, Unset, str]): KMS Key ARN to encrypt S3 objects, if not provided, default bucket encryption - will be used + workspace_subnets (Union[List[str], None, Unset]): List of subnets that workspace instances will use Example: + ['subnet-00000000000000000']. + max_spot_vcpu (Union[Unset, int]): vCPU service quota limit for standard spot instances (pipelines) Default: 0. + max_fpgavcpu (Union[Unset, int]): vCPU service quota limit for FPGA-enabled instances (pipelines) Default: 0. + max_gpuvcpu (Union[Unset, int]): vCPU service quota limit for GPU-enabled spot instances (pipelines) Default: 0. + enable_dragen (Union[Unset, bool]): Enables the DRAGEN compute environment (pipelines) Default: False. + dragen_ami (Union[None, Unset, str]): AMI ID for the DRAGEN compute environment, if enabled (pipelines) + max_workspaces_vcpu (Union[Unset, int]): vCPU service quota limit for standard instances (workspaces) Default: + 0. + max_workspaces_gpuvcpu (Union[Unset, int]): vCPU service quota limit for GPU-enabled instances (workspaces) + Default: 0. + max_workspaces_per_user (Union[Unset, int]): Maximum number of workspaces per user (workspaces) Default: 0. is_discoverable (Union[None, Unset, bool]): Enables the project to be discoverable by other users Default: False. is_shareable (Union[None, Unset, bool]): Enables the project to be shared with other projects Default: False. + has_pipelines_enabled (Union[None, Unset, bool]): (Read-only) Whether this project has pipelines enabled + Default: False. + has_workspaces_enabled (Union[None, Unset, bool]): (Read-only) Whether this project has workspaces enabled + Default: False. """ budget_amount: int budget_period: BudgetPeriod - dragen_ami: Union[None, Unset, str] = UNSET - enable_compute: Union[Unset, bool] = True - enable_dragen: Union[Unset, bool] = False enable_backup: Union[Unset, bool] = False enable_sftp: Union[Unset, bool] = False - max_f1vcpu: Union[Unset, int] = 0 - max_spot_vcpu: Union[Unset, int] = 0 - max_gpuvcpu: Union[Unset, int] = 0 + service_connections: Union[Unset, List[str]] = UNSET + kms_arn: Union[None, Unset, str] = UNSET retention_policy_days: Union[Unset, int] = 7 temporary_storage_lifetime_days: Union[Unset, int] = 14 - service_connections: Union[Unset, List[str]] = UNSET vpc_id: Union[None, Unset, str] = UNSET batch_subnets: Union[List[str], None, Unset] = UNSET sagemaker_subnets: Union[List[str], None, Unset] = UNSET - kms_arn: Union[None, Unset, str] = UNSET + workspace_subnets: Union[List[str], None, Unset] = UNSET + max_spot_vcpu: Union[Unset, int] = 0 + max_fpgavcpu: Union[Unset, int] = 0 + max_gpuvcpu: Union[Unset, int] = 0 + enable_dragen: Union[Unset, bool] = False + dragen_ami: Union[None, Unset, str] = UNSET + max_workspaces_vcpu: Union[Unset, int] = 0 + max_workspaces_gpuvcpu: Union[Unset, int] = 0 + max_workspaces_per_user: Union[Unset, int] = 0 is_discoverable: Union[None, Unset, bool] = False is_shareable: Union[None, Unset, bool] = False + has_pipelines_enabled: Union[None, Unset, bool] = False + has_workspaces_enabled: Union[None, Unset, bool] = False additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -66,34 +81,24 @@ def to_dict(self) -> Dict[str, Any]: budget_period = self.budget_period.value - dragen_ami: Union[None, Unset, str] - if isinstance(self.dragen_ami, Unset): - dragen_ami = UNSET - else: - dragen_ami = self.dragen_ami - - enable_compute = self.enable_compute - - enable_dragen = self.enable_dragen - enable_backup = self.enable_backup enable_sftp = self.enable_sftp - max_f1vcpu = self.max_f1vcpu - - max_spot_vcpu = self.max_spot_vcpu + service_connections: Union[Unset, List[str]] = UNSET + if not isinstance(self.service_connections, Unset): + service_connections = self.service_connections - max_gpuvcpu = self.max_gpuvcpu + kms_arn: Union[None, Unset, str] + if isinstance(self.kms_arn, Unset): + kms_arn = UNSET + else: + kms_arn = self.kms_arn retention_policy_days = self.retention_policy_days temporary_storage_lifetime_days = self.temporary_storage_lifetime_days - service_connections: Union[Unset, List[str]] = UNSET - if not isinstance(self.service_connections, Unset): - service_connections = self.service_connections - vpc_id: Union[None, Unset, str] if isinstance(self.vpc_id, Unset): vpc_id = UNSET @@ -118,11 +123,34 @@ def to_dict(self) -> Dict[str, Any]: else: sagemaker_subnets = self.sagemaker_subnets - kms_arn: Union[None, Unset, str] - if isinstance(self.kms_arn, Unset): - kms_arn = UNSET + workspace_subnets: Union[List[str], None, Unset] + if isinstance(self.workspace_subnets, Unset): + workspace_subnets = UNSET + elif isinstance(self.workspace_subnets, list): + workspace_subnets = self.workspace_subnets + else: - kms_arn = self.kms_arn + workspace_subnets = self.workspace_subnets + + max_spot_vcpu = self.max_spot_vcpu + + max_fpgavcpu = self.max_fpgavcpu + + max_gpuvcpu = self.max_gpuvcpu + + enable_dragen = self.enable_dragen + + dragen_ami: Union[None, Unset, str] + if isinstance(self.dragen_ami, Unset): + dragen_ami = UNSET + else: + dragen_ami = self.dragen_ami + + max_workspaces_vcpu = self.max_workspaces_vcpu + + max_workspaces_gpuvcpu = self.max_workspaces_gpuvcpu + + max_workspaces_per_user = self.max_workspaces_per_user is_discoverable: Union[None, Unset, bool] if isinstance(self.is_discoverable, Unset): @@ -136,6 +164,18 @@ def to_dict(self) -> Dict[str, Any]: else: is_shareable = self.is_shareable + has_pipelines_enabled: Union[None, Unset, bool] + if isinstance(self.has_pipelines_enabled, Unset): + has_pipelines_enabled = UNSET + else: + has_pipelines_enabled = self.has_pipelines_enabled + + has_workspaces_enabled: Union[None, Unset, bool] + if isinstance(self.has_workspaces_enabled, Unset): + has_workspaces_enabled = UNSET + else: + has_workspaces_enabled = self.has_workspaces_enabled + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -144,40 +184,50 @@ def to_dict(self) -> Dict[str, Any]: "budgetPeriod": budget_period, } ) - if dragen_ami is not UNSET: - field_dict["dragenAmi"] = dragen_ami - if enable_compute is not UNSET: - field_dict["enableCompute"] = enable_compute - if enable_dragen is not UNSET: - field_dict["enableDragen"] = enable_dragen if enable_backup is not UNSET: field_dict["enableBackup"] = enable_backup if enable_sftp is not UNSET: field_dict["enableSftp"] = enable_sftp - if max_f1vcpu is not UNSET: - field_dict["maxF1VCPU"] = max_f1vcpu - if max_spot_vcpu is not UNSET: - field_dict["maxSpotVCPU"] = max_spot_vcpu - if max_gpuvcpu is not UNSET: - field_dict["maxGPUVCPU"] = max_gpuvcpu + if service_connections is not UNSET: + field_dict["serviceConnections"] = service_connections + if kms_arn is not UNSET: + field_dict["kmsArn"] = kms_arn if retention_policy_days is not UNSET: field_dict["retentionPolicyDays"] = retention_policy_days if temporary_storage_lifetime_days is not UNSET: field_dict["temporaryStorageLifetimeDays"] = temporary_storage_lifetime_days - if service_connections is not UNSET: - field_dict["serviceConnections"] = service_connections if vpc_id is not UNSET: field_dict["vpcId"] = vpc_id if batch_subnets is not UNSET: field_dict["batchSubnets"] = batch_subnets if sagemaker_subnets is not UNSET: field_dict["sagemakerSubnets"] = sagemaker_subnets - if kms_arn is not UNSET: - field_dict["kmsArn"] = kms_arn + if workspace_subnets is not UNSET: + field_dict["workspaceSubnets"] = workspace_subnets + if max_spot_vcpu is not UNSET: + field_dict["maxSpotVCPU"] = max_spot_vcpu + if max_fpgavcpu is not UNSET: + field_dict["maxFPGAVCPU"] = max_fpgavcpu + if max_gpuvcpu is not UNSET: + field_dict["maxGPUVCPU"] = max_gpuvcpu + if enable_dragen is not UNSET: + field_dict["enableDragen"] = enable_dragen + if dragen_ami is not UNSET: + field_dict["dragenAmi"] = dragen_ami + if max_workspaces_vcpu is not UNSET: + field_dict["maxWorkspacesVCPU"] = max_workspaces_vcpu + if max_workspaces_gpuvcpu is not UNSET: + field_dict["maxWorkspacesGPUVCPU"] = max_workspaces_gpuvcpu + if max_workspaces_per_user is not UNSET: + field_dict["maxWorkspacesPerUser"] = max_workspaces_per_user if is_discoverable is not UNSET: field_dict["isDiscoverable"] = is_discoverable if is_shareable is not UNSET: field_dict["isShareable"] = is_shareable + if has_pipelines_enabled is not UNSET: + field_dict["hasPipelinesEnabled"] = has_pipelines_enabled + if has_workspaces_enabled is not UNSET: + field_dict["hasWorkspacesEnabled"] = has_workspaces_enabled return field_dict @@ -188,35 +238,25 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: budget_period = BudgetPeriod(d.pop("budgetPeriod")) - def _parse_dragen_ami(data: object) -> Union[None, Unset, str]: - if data is None: - return data - if isinstance(data, Unset): - return data - return cast(Union[None, Unset, str], data) - - dragen_ami = _parse_dragen_ami(d.pop("dragenAmi", UNSET)) - - enable_compute = d.pop("enableCompute", UNSET) - - enable_dragen = d.pop("enableDragen", UNSET) - enable_backup = d.pop("enableBackup", UNSET) enable_sftp = d.pop("enableSftp", UNSET) - max_f1vcpu = d.pop("maxF1VCPU", UNSET) + service_connections = cast(List[str], d.pop("serviceConnections", UNSET)) - max_spot_vcpu = d.pop("maxSpotVCPU", UNSET) + def _parse_kms_arn(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) - max_gpuvcpu = d.pop("maxGPUVCPU", UNSET) + kms_arn = _parse_kms_arn(d.pop("kmsArn", UNSET)) retention_policy_days = d.pop("retentionPolicyDays", UNSET) temporary_storage_lifetime_days = d.pop("temporaryStorageLifetimeDays", UNSET) - service_connections = cast(List[str], d.pop("serviceConnections", UNSET)) - def _parse_vpc_id(data: object) -> Union[None, Unset, str]: if data is None: return data @@ -260,14 +300,45 @@ def _parse_sagemaker_subnets(data: object) -> Union[List[str], None, Unset]: sagemaker_subnets = _parse_sagemaker_subnets(d.pop("sagemakerSubnets", UNSET)) - def _parse_kms_arn(data: object) -> Union[None, Unset, str]: + def _parse_workspace_subnets(data: object) -> Union[List[str], None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + workspace_subnets_type_0 = cast(List[str], data) + + return workspace_subnets_type_0 + except: # noqa: E722 + pass + return cast(Union[List[str], None, Unset], data) + + workspace_subnets = _parse_workspace_subnets(d.pop("workspaceSubnets", UNSET)) + + max_spot_vcpu = d.pop("maxSpotVCPU", UNSET) + + max_fpgavcpu = d.pop("maxFPGAVCPU", UNSET) + + max_gpuvcpu = d.pop("maxGPUVCPU", UNSET) + + enable_dragen = d.pop("enableDragen", UNSET) + + def _parse_dragen_ami(data: object) -> Union[None, Unset, str]: if data is None: return data if isinstance(data, Unset): return data return cast(Union[None, Unset, str], data) - kms_arn = _parse_kms_arn(d.pop("kmsArn", UNSET)) + dragen_ami = _parse_dragen_ami(d.pop("dragenAmi", UNSET)) + + max_workspaces_vcpu = d.pop("maxWorkspacesVCPU", UNSET) + + max_workspaces_gpuvcpu = d.pop("maxWorkspacesGPUVCPU", UNSET) + + max_workspaces_per_user = d.pop("maxWorkspacesPerUser", UNSET) def _parse_is_discoverable(data: object) -> Union[None, Unset, bool]: if data is None: @@ -287,26 +358,49 @@ def _parse_is_shareable(data: object) -> Union[None, Unset, bool]: is_shareable = _parse_is_shareable(d.pop("isShareable", UNSET)) + def _parse_has_pipelines_enabled(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + has_pipelines_enabled = _parse_has_pipelines_enabled(d.pop("hasPipelinesEnabled", UNSET)) + + def _parse_has_workspaces_enabled(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + has_workspaces_enabled = _parse_has_workspaces_enabled(d.pop("hasWorkspacesEnabled", UNSET)) + project_settings = cls( budget_amount=budget_amount, budget_period=budget_period, - dragen_ami=dragen_ami, - enable_compute=enable_compute, - enable_dragen=enable_dragen, enable_backup=enable_backup, enable_sftp=enable_sftp, - max_f1vcpu=max_f1vcpu, - max_spot_vcpu=max_spot_vcpu, - max_gpuvcpu=max_gpuvcpu, + service_connections=service_connections, + kms_arn=kms_arn, retention_policy_days=retention_policy_days, temporary_storage_lifetime_days=temporary_storage_lifetime_days, - service_connections=service_connections, vpc_id=vpc_id, batch_subnets=batch_subnets, sagemaker_subnets=sagemaker_subnets, - kms_arn=kms_arn, + workspace_subnets=workspace_subnets, + max_spot_vcpu=max_spot_vcpu, + max_fpgavcpu=max_fpgavcpu, + max_gpuvcpu=max_gpuvcpu, + enable_dragen=enable_dragen, + dragen_ami=dragen_ami, + max_workspaces_vcpu=max_workspaces_vcpu, + max_workspaces_gpuvcpu=max_workspaces_gpuvcpu, + max_workspaces_per_user=max_workspaces_per_user, is_discoverable=is_discoverable, is_shareable=is_shareable, + has_pipelines_enabled=has_pipelines_enabled, + has_workspaces_enabled=has_workspaces_enabled, ) project_settings.additional_properties = d diff --git a/cirro_api_client/v1/models/project_user.py b/cirro_api_client/v1/models/project_user.py index ce224a7..f1a8616 100644 --- a/cirro_api_client/v1/models/project_user.py +++ b/cirro_api_client/v1/models/project_user.py @@ -17,6 +17,7 @@ class ProjectUser: organization (str): department (str): email (str): + job_title (str): role (ProjectRole): """ @@ -25,6 +26,7 @@ class ProjectUser: organization: str department: str email: str + job_title: str role: ProjectRole additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -39,6 +41,8 @@ def to_dict(self) -> Dict[str, Any]: email = self.email + job_title = self.job_title + role = self.role.value field_dict: Dict[str, Any] = {} @@ -50,6 +54,7 @@ def to_dict(self) -> Dict[str, Any]: "organization": organization, "department": department, "email": email, + "jobTitle": job_title, "role": role, } ) @@ -69,6 +74,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: email = d.pop("email") + job_title = d.pop("jobTitle") + role = ProjectRole(d.pop("role")) project_user = cls( @@ -77,6 +84,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: organization=organization, department=department, email=email, + job_title=job_title, role=role, ) diff --git a/cirro_api_client/v1/models/share_detail.py b/cirro_api_client/v1/models/share_detail.py index 5393fd5..8d685ec 100644 --- a/cirro_api_client/v1/models/share_detail.py +++ b/cirro_api_client/v1/models/share_detail.py @@ -28,7 +28,6 @@ class ShareDetail: conditions (List['DatasetCondition']): The conditions under which the dataset is shared keywords (List[str]): classification_ids (List[str]): - is_subscribed (bool): is_view_restricted (bool): created_by (str): created_at (datetime.datetime): @@ -44,7 +43,6 @@ class ShareDetail: conditions: List["DatasetCondition"] keywords: List[str] classification_ids: List[str] - is_subscribed: bool is_view_restricted: bool created_by: str created_at: datetime.datetime @@ -76,8 +74,6 @@ def to_dict(self) -> Dict[str, Any]: classification_ids = self.classification_ids - is_subscribed = self.is_subscribed - is_view_restricted = self.is_view_restricted created_by = self.created_by @@ -99,7 +95,6 @@ def to_dict(self) -> Dict[str, Any]: "conditions": conditions, "keywords": keywords, "classificationIds": classification_ids, - "isSubscribed": is_subscribed, "isViewRestricted": is_view_restricted, "createdBy": created_by, "createdAt": created_at, @@ -143,8 +138,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: classification_ids = cast(List[str], d.pop("classificationIds")) - is_subscribed = d.pop("isSubscribed") - is_view_restricted = d.pop("isViewRestricted") created_by = d.pop("createdBy") @@ -163,7 +156,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: conditions=conditions, keywords=keywords, classification_ids=classification_ids, - is_subscribed=is_subscribed, is_view_restricted=is_view_restricted, created_by=created_by, created_at=created_at, diff --git a/cirro_api_client/v1/models/sharing_type.py b/cirro_api_client/v1/models/sharing_type.py new file mode 100644 index 0000000..091ce0b --- /dev/null +++ b/cirro_api_client/v1/models/sharing_type.py @@ -0,0 +1,15 @@ +from enum import Enum + + +class SharingType(str, Enum): + PRIVATE = "PRIVATE" + READ_WRITE = "READ_WRITE" + UNKNOWN = "UNKNOWN" + """ This is a fallback value for when the value is not known, do not use this value when making requests """ + + def __str__(self) -> str: + return str(self.value) + + @classmethod + def _missing_(cls, number): + return cls(cls.UNKNOWN) diff --git a/cirro_api_client/v1/models/task_cost.py b/cirro_api_client/v1/models/task_cost.py new file mode 100644 index 0000000..d3d9653 --- /dev/null +++ b/cirro_api_client/v1/models/task_cost.py @@ -0,0 +1,70 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="TaskCost") + + +@_attrs_define +class TaskCost: + """ + Attributes: + name (str): + task_id (str): + status (str): + cost (float): + """ + + name: str + task_id: str + status: str + cost: float + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + task_id = self.task_id + + status = self.status + + cost = self.cost + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "taskId": task_id, + "status": status, + "cost": cost, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + task_id = d.pop("taskId") + + status = d.pop("status") + + cost = d.pop("cost") + + task_cost = cls( + name=name, + task_id=task_id, + status=status, + cost=cost, + ) + + task_cost.additional_properties = d + return task_cost + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/user.py b/cirro_api_client/v1/models/user.py index 2d85d52..4f02425 100644 --- a/cirro_api_client/v1/models/user.py +++ b/cirro_api_client/v1/models/user.py @@ -14,12 +14,14 @@ class User: username (str): organization (str): department (str): + job_title (str): """ name: str username: str organization: str department: str + job_title: str additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -31,6 +33,8 @@ def to_dict(self) -> Dict[str, Any]: department = self.department + job_title = self.job_title + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -39,6 +43,7 @@ def to_dict(self) -> Dict[str, Any]: "username": username, "organization": organization, "department": department, + "jobTitle": job_title, } ) @@ -55,11 +60,14 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: department = d.pop("department") + job_title = d.pop("jobTitle") + user = cls( name=name, username=username, organization=organization, department=department, + job_title=job_title, ) user.additional_properties = d diff --git a/cirro_api_client/v1/models/version_specification.py b/cirro_api_client/v1/models/version_specification.py new file mode 100644 index 0000000..e7ef984 --- /dev/null +++ b/cirro_api_client/v1/models/version_specification.py @@ -0,0 +1,62 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="VersionSpecification") + + +@_attrs_define +class VersionSpecification: + """ + Attributes: + version (str): + is_default (bool): + is_latest (bool): + """ + + version: str + is_default: bool + is_latest: bool + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + version = self.version + + is_default = self.is_default + + is_latest = self.is_latest + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "version": version, + "isDefault": is_default, + "isLatest": is_latest, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + version = d.pop("version") + + is_default = d.pop("isDefault") + + is_latest = d.pop("isLatest") + + version_specification = cls( + version=version, + is_default=is_default, + is_latest=is_latest, + ) + + version_specification.additional_properties = d + return version_specification + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace.py b/cirro_api_client/v1/models/workspace.py new file mode 100644 index 0000000..c48b15e --- /dev/null +++ b/cirro_api_client/v1/models/workspace.py @@ -0,0 +1,206 @@ +import datetime +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.sharing_type import SharingType +from ..models.status import Status +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.mounted_dataset import MountedDataset + from ..models.workspace_compute_config import WorkspaceComputeConfig + from ..models.workspace_session import WorkspaceSession + + +T = TypeVar("T", bound="Workspace") + + +@_attrs_define +class Workspace: + """ + Attributes: + id (str): + name (str): + description (str): + status (Status): + status_message (str): + environment_id (str): + mounted_datasets (List['MountedDataset']): + compute_config (WorkspaceComputeConfig): Configuration parameters for a containerized workspace compute + environment. + sharing_type (SharingType): + created_by (str): + created_at (datetime.datetime): + started_at (datetime.datetime): + updated_at (datetime.datetime): + sessions (Union[List['WorkspaceSession'], None, Unset]): + """ + + id: str + name: str + description: str + status: Status + status_message: str + environment_id: str + mounted_datasets: List["MountedDataset"] + compute_config: "WorkspaceComputeConfig" + sharing_type: SharingType + created_by: str + created_at: datetime.datetime + started_at: datetime.datetime + updated_at: datetime.datetime + sessions: Union[List["WorkspaceSession"], None, Unset] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + description = self.description + + status = self.status.value + + status_message = self.status_message + + environment_id = self.environment_id + + mounted_datasets = [] + for mounted_datasets_item_data in self.mounted_datasets: + mounted_datasets_item = mounted_datasets_item_data.to_dict() + mounted_datasets.append(mounted_datasets_item) + + compute_config = self.compute_config.to_dict() + + sharing_type = self.sharing_type.value + + created_by = self.created_by + + created_at = self.created_at.isoformat() + + started_at = self.started_at.isoformat() + + updated_at = self.updated_at.isoformat() + + sessions: Union[List[Dict[str, Any]], None, Unset] + if isinstance(self.sessions, Unset): + sessions = UNSET + elif isinstance(self.sessions, list): + sessions = [] + for sessions_type_0_item_data in self.sessions: + sessions_type_0_item = sessions_type_0_item_data.to_dict() + sessions.append(sessions_type_0_item) + + else: + sessions = self.sessions + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "description": description, + "status": status, + "statusMessage": status_message, + "environmentId": environment_id, + "mountedDatasets": mounted_datasets, + "computeConfig": compute_config, + "sharingType": sharing_type, + "createdBy": created_by, + "createdAt": created_at, + "startedAt": started_at, + "updatedAt": updated_at, + } + ) + if sessions is not UNSET: + field_dict["sessions"] = sessions + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.mounted_dataset import MountedDataset + from ..models.workspace_compute_config import WorkspaceComputeConfig + from ..models.workspace_session import WorkspaceSession + + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + description = d.pop("description") + + status = Status(d.pop("status")) + + status_message = d.pop("statusMessage") + + environment_id = d.pop("environmentId") + + mounted_datasets = [] + _mounted_datasets = d.pop("mountedDatasets") + for mounted_datasets_item_data in _mounted_datasets: + mounted_datasets_item = MountedDataset.from_dict(mounted_datasets_item_data) + + mounted_datasets.append(mounted_datasets_item) + + compute_config = WorkspaceComputeConfig.from_dict(d.pop("computeConfig")) + + sharing_type = SharingType(d.pop("sharingType")) + + created_by = d.pop("createdBy") + + created_at = isoparse(d.pop("createdAt")) + + started_at = isoparse(d.pop("startedAt")) + + updated_at = isoparse(d.pop("updatedAt")) + + def _parse_sessions(data: object) -> Union[List["WorkspaceSession"], None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + sessions_type_0 = [] + _sessions_type_0 = data + for sessions_type_0_item_data in _sessions_type_0: + sessions_type_0_item = WorkspaceSession.from_dict(sessions_type_0_item_data) + + sessions_type_0.append(sessions_type_0_item) + + return sessions_type_0 + except: # noqa: E722 + pass + return cast(Union[List["WorkspaceSession"], None, Unset], data) + + sessions = _parse_sessions(d.pop("sessions", UNSET)) + + workspace = cls( + id=id, + name=name, + description=description, + status=status, + status_message=status_message, + environment_id=environment_id, + mounted_datasets=mounted_datasets, + compute_config=compute_config, + sharing_type=sharing_type, + created_by=created_by, + created_at=created_at, + started_at=started_at, + updated_at=updated_at, + sessions=sessions, + ) + + workspace.additional_properties = d + return workspace + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace_compute_config.py b/cirro_api_client/v1/models/workspace_compute_config.py new file mode 100644 index 0000000..339618e --- /dev/null +++ b/cirro_api_client/v1/models/workspace_compute_config.py @@ -0,0 +1,128 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.workspace_compute_config_environment_variables import WorkspaceComputeConfigEnvironmentVariables + + +T = TypeVar("T", bound="WorkspaceComputeConfig") + + +@_attrs_define +class WorkspaceComputeConfig: + """Configuration parameters for a containerized workspace compute environment. + + Attributes: + container_image_uri (str): Fully qualified container image URI (including registry, repository, and tag). + cpu (Union[Unset, int]): Number of vCPU cores allocated to the workspace. Example: 4. + memory_gi_b (Union[Unset, int]): Memory allocated to the workspace container in GiB. Example: 8. + volume_size_gi_b (Union[Unset, int]): Persistent storage volume size allocated to the workspace in GiB. Example: + 50. + environment_variables (Union['WorkspaceComputeConfigEnvironmentVariables', None, Unset]): Map of environment + variables injected into the container at runtime. Keys must be non-blank. Example: {'ENV_MODE': 'production', + 'LOG_LEVEL': 'debug'}. + local_port (Union[Unset, int]): User-facing web server port (http). Example: 8080. + """ + + container_image_uri: str + cpu: Union[Unset, int] = UNSET + memory_gi_b: Union[Unset, int] = UNSET + volume_size_gi_b: Union[Unset, int] = UNSET + environment_variables: Union["WorkspaceComputeConfigEnvironmentVariables", None, Unset] = UNSET + local_port: Union[Unset, int] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + from ..models.workspace_compute_config_environment_variables import WorkspaceComputeConfigEnvironmentVariables + + container_image_uri = self.container_image_uri + + cpu = self.cpu + + memory_gi_b = self.memory_gi_b + + volume_size_gi_b = self.volume_size_gi_b + + environment_variables: Union[Dict[str, Any], None, Unset] + if isinstance(self.environment_variables, Unset): + environment_variables = UNSET + elif isinstance(self.environment_variables, WorkspaceComputeConfigEnvironmentVariables): + environment_variables = self.environment_variables.to_dict() + else: + environment_variables = self.environment_variables + + local_port = self.local_port + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "containerImageUri": container_image_uri, + } + ) + if cpu is not UNSET: + field_dict["cpu"] = cpu + if memory_gi_b is not UNSET: + field_dict["memoryGiB"] = memory_gi_b + if volume_size_gi_b is not UNSET: + field_dict["volumeSizeGiB"] = volume_size_gi_b + if environment_variables is not UNSET: + field_dict["environmentVariables"] = environment_variables + if local_port is not UNSET: + field_dict["localPort"] = local_port + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.workspace_compute_config_environment_variables import WorkspaceComputeConfigEnvironmentVariables + + d = src_dict.copy() + container_image_uri = d.pop("containerImageUri") + + cpu = d.pop("cpu", UNSET) + + memory_gi_b = d.pop("memoryGiB", UNSET) + + volume_size_gi_b = d.pop("volumeSizeGiB", UNSET) + + def _parse_environment_variables( + data: object, + ) -> Union["WorkspaceComputeConfigEnvironmentVariables", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + environment_variables_type_0 = WorkspaceComputeConfigEnvironmentVariables.from_dict(data) + + return environment_variables_type_0 + except: # noqa: E722 + pass + return cast(Union["WorkspaceComputeConfigEnvironmentVariables", None, Unset], data) + + environment_variables = _parse_environment_variables(d.pop("environmentVariables", UNSET)) + + local_port = d.pop("localPort", UNSET) + + workspace_compute_config = cls( + container_image_uri=container_image_uri, + cpu=cpu, + memory_gi_b=memory_gi_b, + volume_size_gi_b=volume_size_gi_b, + environment_variables=environment_variables, + local_port=local_port, + ) + + workspace_compute_config.additional_properties = d + return workspace_compute_config + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace_connection_response.py b/cirro_api_client/v1/models/workspace_connection_response.py new file mode 100644 index 0000000..e572b9a --- /dev/null +++ b/cirro_api_client/v1/models/workspace_connection_response.py @@ -0,0 +1,64 @@ +import datetime +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +T = TypeVar("T", bound="WorkspaceConnectionResponse") + + +@_attrs_define +class WorkspaceConnectionResponse: + """ + Attributes: + connection_url (str): + expires_at (datetime.datetime): + message (str): + """ + + connection_url: str + expires_at: datetime.datetime + message: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + connection_url = self.connection_url + + expires_at = self.expires_at.isoformat() + + message = self.message + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "connectionUrl": connection_url, + "expiresAt": expires_at, + "message": message, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + connection_url = d.pop("connectionUrl") + + expires_at = isoparse(d.pop("expiresAt")) + + message = d.pop("message") + + workspace_connection_response = cls( + connection_url=connection_url, + expires_at=expires_at, + message=message, + ) + + workspace_connection_response.additional_properties = d + return workspace_connection_response + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace_environment.py b/cirro_api_client/v1/models/workspace_environment.py new file mode 100644 index 0000000..78a14ac --- /dev/null +++ b/cirro_api_client/v1/models/workspace_environment.py @@ -0,0 +1,111 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.version_specification import VersionSpecification + from ..models.workspace_compute_config import WorkspaceComputeConfig + + +T = TypeVar("T", bound="WorkspaceEnvironment") + + +@_attrs_define +class WorkspaceEnvironment: + """ + Attributes: + id (str): + name (str): + description (str): + category (str): + default_compute_config (WorkspaceComputeConfig): Configuration parameters for a containerized workspace compute + environment. + versions (List['VersionSpecification']): + owner (str): + """ + + id: str + name: str + description: str + category: str + default_compute_config: "WorkspaceComputeConfig" + versions: List["VersionSpecification"] + owner: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + description = self.description + + category = self.category + + default_compute_config = self.default_compute_config.to_dict() + + versions = [] + for versions_item_data in self.versions: + versions_item = versions_item_data.to_dict() + versions.append(versions_item) + + owner = self.owner + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "description": description, + "category": category, + "defaultComputeConfig": default_compute_config, + "versions": versions, + "owner": owner, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.version_specification import VersionSpecification + from ..models.workspace_compute_config import WorkspaceComputeConfig + + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + description = d.pop("description") + + category = d.pop("category") + + default_compute_config = WorkspaceComputeConfig.from_dict(d.pop("defaultComputeConfig")) + + versions = [] + _versions = d.pop("versions") + for versions_item_data in _versions: + versions_item = VersionSpecification.from_dict(versions_item_data) + + versions.append(versions_item) + + owner = d.pop("owner") + + workspace_environment = cls( + id=id, + name=name, + description=description, + category=category, + default_compute_config=default_compute_config, + versions=versions, + owner=owner, + ) + + workspace_environment.additional_properties = d + return workspace_environment + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace_input.py b/cirro_api_client/v1/models/workspace_input.py new file mode 100644 index 0000000..8c0ca09 --- /dev/null +++ b/cirro_api_client/v1/models/workspace_input.py @@ -0,0 +1,119 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.sharing_type import SharingType +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.mounted_dataset import MountedDataset + from ..models.workspace_compute_config import WorkspaceComputeConfig + + +T = TypeVar("T", bound="WorkspaceInput") + + +@_attrs_define +class WorkspaceInput: + """ + Attributes: + name (str): Name of the workspace. Example: my-workspace. + mounted_datasets (List['MountedDataset']): List of datasets to mount into the workspace. + compute_config (WorkspaceComputeConfig): Configuration parameters for a containerized workspace compute + environment. + sharing_type (SharingType): + description (Union[Unset, str]): Description of the workspace. + environment_id (Union[None, Unset, str]): ID of the predefined workspace environment to use. + """ + + name: str + mounted_datasets: List["MountedDataset"] + compute_config: "WorkspaceComputeConfig" + sharing_type: SharingType + description: Union[Unset, str] = UNSET + environment_id: Union[None, Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + mounted_datasets = [] + for mounted_datasets_item_data in self.mounted_datasets: + mounted_datasets_item = mounted_datasets_item_data.to_dict() + mounted_datasets.append(mounted_datasets_item) + + compute_config = self.compute_config.to_dict() + + sharing_type = self.sharing_type.value + + description = self.description + + environment_id: Union[None, Unset, str] + if isinstance(self.environment_id, Unset): + environment_id = UNSET + else: + environment_id = self.environment_id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "mountedDatasets": mounted_datasets, + "computeConfig": compute_config, + "sharingType": sharing_type, + } + ) + if description is not UNSET: + field_dict["description"] = description + if environment_id is not UNSET: + field_dict["environmentId"] = environment_id + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.mounted_dataset import MountedDataset + from ..models.workspace_compute_config import WorkspaceComputeConfig + + d = src_dict.copy() + name = d.pop("name") + + mounted_datasets = [] + _mounted_datasets = d.pop("mountedDatasets") + for mounted_datasets_item_data in _mounted_datasets: + mounted_datasets_item = MountedDataset.from_dict(mounted_datasets_item_data) + + mounted_datasets.append(mounted_datasets_item) + + compute_config = WorkspaceComputeConfig.from_dict(d.pop("computeConfig")) + + sharing_type = SharingType(d.pop("sharingType")) + + description = d.pop("description", UNSET) + + def _parse_environment_id(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + environment_id = _parse_environment_id(d.pop("environmentId", UNSET)) + + workspace_input = cls( + name=name, + mounted_datasets=mounted_datasets, + compute_config=compute_config, + sharing_type=sharing_type, + description=description, + environment_id=environment_id, + ) + + workspace_input.additional_properties = d + return workspace_input + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/cirro_api_client/v1/models/workspace_session.py b/cirro_api_client/v1/models/workspace_session.py new file mode 100644 index 0000000..796b211 --- /dev/null +++ b/cirro_api_client/v1/models/workspace_session.py @@ -0,0 +1,64 @@ +import datetime +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +T = TypeVar("T", bound="WorkspaceSession") + + +@_attrs_define +class WorkspaceSession: + """ + Attributes: + id (str): + user (str): + created_at (datetime.datetime): + """ + + id: str + user: str + created_at: datetime.datetime + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + user = self.user + + created_at = self.created_at.isoformat() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "user": user, + "createdAt": created_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + user = d.pop("user") + + created_at = isoparse(d.pop("createdAt")) + + workspace_session = cls( + id=id, + user=user, + created_at=created_at, + ) + + workspace_session.additional_properties = d + return workspace_session + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) diff --git a/config.yml b/config.yml index 36827d2..66dd098 100644 --- a/config.yml +++ b/config.yml @@ -27,3 +27,5 @@ class_overrides: class_name: GovernanceRequirementProjectFileMap RunAnalysisRequestSourceSampleFilesMapType0: class_name: RunAnalysisRequestSourceSampleFilesMap + WorkspaceComputeConfigEnvironmentVariablesType0: + class_name: WorkspaceComputeConfigEnvironmentVariables diff --git a/pyproject.toml b/pyproject.toml index a9eed48..377bd46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cirro_api_client" -version = "1.1.0" +version = "1.2.0" description = "A client library for accessing Cirro" authors = ["Cirro "] license = "MIT"