summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/controllers/cluster.py
blob: d8170e672e9929fc7a80b381f352cc603cf4eb56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-

from ..security import Scope
from ..services.cluster import ClusterModel
from . import APIDoc, APIRouter, EndpointDoc, RESTController
from ._version import APIVersion


@APIRouter('/cluster', Scope.CONFIG_OPT)
@APIDoc("Get Cluster Details", "Cluster")
class Cluster(RESTController):
    @RESTController.MethodMap(version=APIVersion.EXPERIMENTAL)
    @EndpointDoc("Get the cluster status")
    def list(self):
        return ClusterModel.from_db().dict()

    @RESTController.MethodMap(version=APIVersion.EXPERIMENTAL)
    @EndpointDoc("Update the cluster status",
                 parameters={'status': (str, 'Cluster Status')})
    def singleton_set(self, status: str):
        ClusterModel(status).to_db()