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: change variable endpoint to vars #176

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
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
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
Loading