Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update workspaces #156

Merged
merged 6 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,15 @@ def update_workspace(
raise click.UsageError(
"No update name or slug found. Please enter a name or slug to update."
)
elif update_name == "" or update_slug == "":
raise click.UsageError("Empty string value found for name or slug.")

platform.update_workspace(
dtdang marked this conversation as resolved.
Show resolved Hide resolved
workspace=workspace,
update_name=update_name,
update_slug=update_slug,
)
click.echo(f"{click.style('SUCCESS', fg='green')}: Updated '{update_name}'")
click.echo(f"{click.style('SUCCESS', fg='green')}: Updated '{workspace}'")
dtdang marked this conversation as resolved.
Show resolved Hide resolved


@workspaces.command(name="delete", section="Platform Commands (https://silverback.apeworx.io)")
Expand Down
7 changes: 6 additions & 1 deletion silverback/cluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,14 @@ def update_workspace(
update_name: str | None,
):
workspace_id = self.workspaces[workspace].id
form_data = dict()
if update_slug:
form_data["slug"] = update_slug
if update_name:
form_data["name"] = update_name
response = self.patch(
f"/workspaces/{workspace_id}",
data=dict(slug=update_slug, name=update_name),
data=form_data,
dtdang marked this conversation as resolved.
Show resolved Hide resolved
)
handle_error_with_response(response)
update_workspace = Workspace.model_validate_json(response.text)
Expand Down
Loading