From cb737787d8d1ce300455ed48fe74eeeed6d858f1 Mon Sep 17 00:00:00 2001 From: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:35:29 -0400 Subject: [PATCH] refactor: platform updated `organizations` to `workspaces` (#102) * refactor: platform renamed `/organizations` to `/workspaces` * refactor: add `.created` to `WorkspaceInfo` --- silverback/cluster/client.py | 8 ++++---- silverback/cluster/types.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/silverback/cluster/client.py b/silverback/cluster/client.py index fd06ae8e..f4ad5f53 100644 --- a/silverback/cluster/client.py +++ b/silverback/cluster/client.py @@ -276,7 +276,7 @@ def get_cluster_client(self, cluster_name: str) -> ClusterClient: @property @cache def clusters(self) -> dict[str, ClusterInfo]: - response = self.client.get("/clusters", params=dict(org=str(self.id))) + response = self.client.get("/clusters", params=dict(workspace=str(self.id))) handle_error_with_response(response) clusters = response.json() # TODO: Support paging @@ -290,7 +290,7 @@ def create_cluster( ) -> ClusterInfo: response = self.client.post( "/clusters/", - params=dict(org=str(self.id)), + params=dict(workspace=str(self.id)), json=dict( name=cluster_name, slug=cluster_slug, @@ -331,7 +331,7 @@ def get_cluster_client(self, workspace_name: str, cluster_name: str) -> ClusterC @property @cache def workspaces(self) -> dict[str, Workspace]: - response = self.get("/organizations") + response = self.get("/workspaces") handle_error_with_response(response) workspaces = response.json() # TODO: Support paging @@ -345,7 +345,7 @@ def create_workspace( workspace_name: str = "", ) -> Workspace: response = self.post( - "/organizations", + "/workspaces", json=dict(slug=workspace_slug, name=workspace_name), ) handle_error_with_response(response) diff --git a/silverback/cluster/types.py b/silverback/cluster/types.py index 428cd371..755b7bdb 100644 --- a/silverback/cluster/types.py +++ b/silverback/cluster/types.py @@ -12,6 +12,7 @@ class WorkspaceInfo(BaseModel): owner_id: uuid.UUID name: str slug: str + created: datetime class ClusterConfiguration(BaseModel):