]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/controllers/service.py
9f1e70bb94dd8688a00d9cc9eccf27b9b28fade7
1 from typing
import List
, Optional
4 from . import ApiController
, RESTController
5 from .orchestrator
import raise_if_no_orchestrator
6 from ..security
import Scope
7 from ..services
.orchestrator
import OrchClient
10 @ApiController('/service', Scope
.HOSTS
)
11 class Service(RESTController
):
13 @raise_if_no_orchestrator
14 def list(self
, service_name
: Optional
[str] = None) -> List
[dict]:
15 orch
= OrchClient
.instance()
16 return [service
.to_json() for service
in orch
.services
.list(service_name
)]
18 @raise_if_no_orchestrator
19 def get(self
, service_name
: str) -> List
[dict]:
20 orch
= OrchClient
.instance()
21 services
= orch
.services
.get(service_name
)
23 raise cherrypy
.HTTPError(404, 'Service {} not found'.format(service_name
))
24 return services
[0].to_json()
26 @RESTController.Resource('GET')
27 @raise_if_no_orchestrator
28 def daemons(self
, service_name
: str) -> List
[dict]:
29 orch
= OrchClient
.instance()
30 daemons
= orch
.services
.list_daemons(service_name
)
31 return [d
.to_json() for d
in daemons
]