From b201ae68eb709620fcb97e05ff44ecbf7ba7eeae Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sat, 21 Dec 2024 20:54:26 -0500 Subject: [PATCH] Continued work on health checks/alarms --- src/responses.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/responses.rs b/src/responses.rs index 721ca14..caa5348 100644 --- a/src/responses.rs +++ b/src/responses.rs @@ -598,29 +598,34 @@ pub enum HealthCheckFailureDetails { NodeIsQuorumCritical(QuorumCriticalityCheckDetails), } +impl HealthCheckFailureDetails { + pub fn reason(&self) -> String { + match self { + HealthCheckFailureDetails::AlarmCheck(details) => details.reason.clone(), + HealthCheckFailureDetails::NodeIsQuorumCritical(details) => details.reason.clone(), + } + } +} + #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] -#[cfg_attr(feature = "tabled", derive(Tabled))] pub struct ClusterAlarmCheckDetails { pub reason: String, pub alarms: Vec, } #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] -#[cfg_attr(feature = "tabled", derive(Tabled))] pub struct ResourceAlarm { pub node: String, pub resource: String, } #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] -#[cfg_attr(feature = "tabled", derive(Tabled))] pub struct QuorumCriticalityCheckDetails { pub reason: String, pub queues: Vec, } #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] -#[cfg_attr(feature = "tabled", derive(Tabled))] pub struct QuorumEndangeredQueue { pub name: String, #[serde(rename(deserialize = "virtual_host"))]