Skip to content

Commit

Permalink
fix: delete method (#180)
Browse files Browse the repository at this point in the history
* fix: delete method

* fix: update

* chore: lint

* chore: undo testname

* chore: restore update
  • Loading branch information
Ninjagod1251 authored Jan 3, 2025
1 parent 86dded2 commit 3c61e4c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions silverback/cluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ def __hash__(self) -> int:
def update(
self, name: str | None = None, variables: dict[str, str | None] | None = None
) -> "VariableGroup":

if name is not None:
# Update metadata
response = self.cluster.put(f"/vars/{self.id}", json=dict(name=name))
handle_error_with_response(response)

if variables is not None:
# Create a new revision
response = self.cluster.post(f"/vars/{self.id}", json=dict(variables=variables))
handle_error_with_response(response)
return VariableGroup.model_validate(response.json())

return self

def get_revision(self, revision: int | Literal["latest"] = "latest") -> VariableGroupInfo:
Expand All @@ -123,7 +122,7 @@ def get_revision(self, revision: int | Literal["latest"] = "latest") -> Variable
return VariableGroupInfo.model_validate(response.json())

def remove(self):
response = self.cluster.delete(f"/vars/{self.id}")
response = self.cluster.delete(f"/vars/{self.name}")
handle_error_with_response(response)


Expand Down

0 comments on commit 3c61e4c

Please sign in to comment.