summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/controllers/cluster.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pybind/mgr/dashboard/controllers/cluster.py')
-rw-r--r--src/pybind/mgr/dashboard/controllers/cluster.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/controllers/cluster.py b/src/pybind/mgr/dashboard/controllers/cluster.py
new file mode 100644
index 000000000..d8170e672
--- /dev/null
+++ b/src/pybind/mgr/dashboard/controllers/cluster.py
@@ -0,0 +1,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()