Skip to content

Commit

Permalink
fix: change variable endpoint to vars (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdang authored Dec 18, 2024
1 parent 04e92f5 commit 32e11e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions silverback/cluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ def update(
) -> "VariableGroup":
if name is not None:
# Update metadata
response = self.cluster.put(f"/variables/{self.id}", json=dict(name=name))
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"/variables/{self.id}", json=dict(variables=variables))
response = self.cluster.post(f"/vars/{self.id}", json=dict(variables=variables))
handle_error_with_response(response)
return VariableGroup.model_validate(response.json())

Expand All @@ -118,12 +118,12 @@ def get_revision(self, revision: int | Literal["latest"] = "latest") -> Variable
if revision == "latest":
revision = -1 # NOTE: This works with how cluster does lookup

response = self.cluster.get(f"/variables/{self.id}/{revision}")
response = self.cluster.get(f"/vars/{self.id}/{revision}")
handle_error_with_response(response)
return VariableGroupInfo.model_validate(response.json())

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


Expand Down Expand Up @@ -284,12 +284,12 @@ def new_credentials(

@property
def variable_groups(self) -> dict[str, VariableGroup]:
response = self.get("/variables")
response = self.get("/vars")
handle_error_with_response(response)
return {vg.name: vg for vg in map(VariableGroup.model_validate, response.json())}

def new_variable_group(self, name: str, variables: dict[str, str]) -> VariableGroup:
response = self.post("/variables", json=dict(name=name, variables=variables))
response = self.post("/vars", json=dict(name=name, variables=variables))
handle_error_with_response(response)
return VariableGroup.model_validate(response.json())

Expand Down

0 comments on commit 32e11e4

Please sign in to comment.