Skip to content

Commit

Permalink
add endpoint for services
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Jan 6, 2024
1 parent 5418612 commit ec9e8a9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
1 change: 1 addition & 0 deletions jhub_apps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def install_jhub_apps(c, spawner_to_subclass):
"admin:server_state", # start/stop servers
"access:services",
"list:services",
"read:services", # read service models
],
},
{
Expand Down
5 changes: 5 additions & 0 deletions jhub_apps/hub_client/hub_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ def delete_server(self, username, server_name, remove=False):
r = requests.delete(API_URL + url, headers=self._headers(), json=params)
r.raise_for_status()
return r.status_code

def get_services(self):
r = requests.get(API_URL + "/services", headers=self._headers())
r.raise_for_status()
return r.json()
7 changes: 7 additions & 0 deletions jhub_apps/service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ async def spawner_profiles(user: User = Depends(get_current_user)):
return spawner_profiles_


@router.get("/services/", description="Get all services")
async def hub_services(user: User = Depends(get_current_user)):
logging.info("Getting hub services")
hub_client = HubClient()
return hub_client.get_services()


@router.get(
"/status",
)
Expand Down
Loading

0 comments on commit ec9e8a9

Please sign in to comment.