pylib/rest_client.py: add ownership API to ScyllaRESTAPIClient

This change adds a member function that can be used
to access 'storage_service/ownership' API.

It will be used by tests that need to access this API.

Refs: scylladb#17342
Signed-off-by: Patryk Wrobel <patryk.wrobel@scylladb.com>
This commit is contained in:
Patryk Wrobel
2024-02-23 12:44:04 +01:00
parent dea76c4763
commit a39a5b671e

View File

@@ -162,6 +162,17 @@ class ScyllaRESTAPIClient():
assert(type(data) == list)
return data
async def get_ownership(self, dst_server_ip: IPAddress, keyspace: str = None, table: str = None) -> list:
"""Retrieve the ownership"""
if keyspace is None and table is None:
api_path = f"/storage_service/ownership/"
elif table is None:
api_path = f"/storage_service/ownership/{keyspace}"
else:
api_path = f"/storage_service/ownership/{keyspace}?cf={table}"
data = await self.client.get_json(api_path, dst_server_ip)
return data
async def get_down_endpoints(self, node_ip: IPAddress) -> list[IPAddress]:
"""Retrieve down endpoints from gossiper's point of view """
data = await self.client.get_json("/gossiper/endpoint/down/", node_ip)