diff --git a/src/clouds/monitor_rules.rs b/src/clouds/monitor_rules.rs index a1f0a06..c18ff90 100644 --- a/src/clouds/monitor_rules.rs +++ b/src/clouds/monitor_rules.rs @@ -79,6 +79,30 @@ impl MonitorAction { } } +#[derive(Eq, PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] +pub enum RuleSchedule { + None, + Check, + OnDemand, +} + +impl Default for RuleSchedule { + fn default() -> Self { + RuleSchedule::None + } +} + +impl fmt::Display for RuleSchedule { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + RuleSchedule::None => write!(f,"none"), + RuleSchedule::Check=> write!(f,"chechk"), + RuleSchedule::OnDemand=> write!(f,"ondemand"), + } + } +} + + #[derive(Eq, PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] pub enum RuleOperator { None, @@ -166,7 +190,8 @@ pub struct MonitorRule { pub value: String, pub result: bool, pub use_state: bool, - pub schedule: String, + pub wait_checks: isize, + pub schedule: RuleSchedule, #[serde(deserialize_with = "deserialize_ruleactions")] pub actions: Vec, }