aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/router.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-05 14:59:15 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-05 14:59:15 +0100
commit2065f011ca3f7c736feecffd108c89d3f8019e85 (patch)
tree86d761c1d5bea219ea2013a7e72762b42097291a /src/api/admin/router.rs
parent243b7c9a1cbf0e1dc4e9cf3b935bd833e29dcf9d (diff)
downloadgarage-2065f011ca3f7c736feecffd108c89d3f8019e85.tar.gz
garage-2065f011ca3f7c736feecffd108c89d3f8019e85.zip
Implement /health admin API endpoint to check node health
Diffstat (limited to 'src/api/admin/router.rs')
-rw-r--r--src/api/admin/router.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/admin/router.rs b/src/api/admin/router.rs
index 3eee8b67..14411f75 100644
--- a/src/api/admin/router.rs
+++ b/src/api/admin/router.rs
@@ -6,6 +6,7 @@ use crate::admin::error::*;
use crate::router_macros::*;
pub enum Authorization {
+ None,
MetricsToken,
AdminToken,
}
@@ -16,6 +17,7 @@ router_match! {@func
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Endpoint {
Options,
+ Health,
Metrics,
GetClusterStatus,
ConnectClusterNodes,
@@ -88,6 +90,7 @@ impl Endpoint {
let res = router_match!(@gen_path_parser (req.method(), path, query) [
OPTIONS _ => Options,
+ GET "/health" => Health,
GET "/metrics" => Metrics,
GET "/v0/status" => GetClusterStatus,
POST "/v0/connect" => ConnectClusterNodes,
@@ -130,6 +133,7 @@ impl Endpoint {
/// Get the kind of authorization which is required to perform the operation.
pub fn authorization_type(&self) -> Authorization {
match self {
+ Self::Health => Authorization::None,
Self::Metrics => Authorization::MetricsToken,
_ => Authorization::AdminToken,
}