mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 07:57:13 +08:00
Add /v3/cluster/healthy endpoint
This commit is contained in:
26
docs/docs.go
26
docs/docs.go
@@ -375,6 +375,32 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v3/cluster/healthy": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Whether the cluster is healthy",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"v16.?.?"
|
||||
],
|
||||
"summary": "Whether the cluster is healthy",
|
||||
"operationId": "cluster-3-healthy",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v3/cluster/iam/policies": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
@@ -367,6 +367,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v3/cluster/healthy": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Whether the cluster is healthy",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"v16.?.?"
|
||||
],
|
||||
"summary": "Whether the cluster is healthy",
|
||||
"operationId": "cluster-3-healthy",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v3/cluster/iam/policies": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
@@ -2628,6 +2628,22 @@ paths:
|
||||
summary: List of identities in the cluster
|
||||
tags:
|
||||
- v16.?.?
|
||||
/api/v3/cluster/healthy:
|
||||
get:
|
||||
description: Whether the cluster is healthy
|
||||
operationId: cluster-3-healthy
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: bool
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Whether the cluster is healthy
|
||||
tags:
|
||||
- v16.?.?
|
||||
/api/v3/cluster/iam/policies:
|
||||
get:
|
||||
description: List of policies IAM
|
||||
|
@@ -100,6 +100,21 @@ func (h *ClusterHandler) About(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, about)
|
||||
}
|
||||
|
||||
// Healthy returns whether the cluster is healthy
|
||||
// @Summary Whether the cluster is healthy
|
||||
// @Description Whether the cluster is healthy
|
||||
// @Tags v16.?.?
|
||||
// @ID cluster-3-healthy
|
||||
// @Produce json
|
||||
// @Success 200 {bool} bool
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/v3/cluster/healthy [get]
|
||||
func (h *ClusterHandler) Healthy(c echo.Context) error {
|
||||
degraded, _ := h.cluster.IsDegraded()
|
||||
|
||||
return c.JSON(http.StatusOK, !degraded)
|
||||
}
|
||||
|
||||
// Leave the cluster gracefully
|
||||
// @Summary Leave the cluster gracefully
|
||||
// @Description Leave the cluster gracefully
|
||||
|
@@ -689,6 +689,7 @@ func (s *server) setRoutesV3(v3 *echo.Group) {
|
||||
// v3 Cluster
|
||||
if s.v3handler.cluster != nil {
|
||||
v3.GET("/cluster", s.v3handler.cluster.About)
|
||||
v3.GET("/cluster/healthy", s.v3handler.cluster.Healthy)
|
||||
|
||||
v3.GET("/cluster/snapshot", s.v3handler.cluster.GetSnapshot)
|
||||
|
||||
|
Reference in New Issue
Block a user