use super::funejson::Value; /// A certificate as one check behind a status page component. A warning /// is work for the operator, not something a visitor notices, so it stays /// up; critical is degraded because renewal is now urgent; an expired /// certificate breaks every client, so it is down. /// /// # Panics /// Panics on an unknown state. pub fn cert_check(state: &str) -> String { let status = match state { "ok" | "warning" => "up", "critical" => "degraded", "expired" => "down", other => panic!("unknown certificate state: {}", other), }; status.to_string() } pub fn fune_vector(args: &[Value]) -> Value { let state = args[0].as_str().to_string(); Value::str(&cert_check(&state)) }