Skip to main content

windmill_api/models/
health_status_response.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.634.3
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// HealthStatusResponse : Health status response (cached with 5s TTL)
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct HealthStatusResponse {
17    /// Overall health status
18    #[serde(rename = "status")]
19    pub status: Status,
20    /// Timestamp when the health check was actually performed (not cache return time)
21    #[serde(rename = "checked_at")]
22    pub checked_at: String,
23    /// Whether the database is reachable
24    #[serde(rename = "database_healthy")]
25    pub database_healthy: bool,
26    /// Number of workers that pinged within last 5 minutes
27    #[serde(rename = "workers_alive")]
28    pub workers_alive: i64,
29}
30
31impl HealthStatusResponse {
32    /// Health status response (cached with 5s TTL)
33    pub fn new(status: Status, checked_at: String, database_healthy: bool, workers_alive: i64) -> HealthStatusResponse {
34        HealthStatusResponse {
35            status,
36            checked_at,
37            database_healthy,
38            workers_alive,
39        }
40    }
41}
42/// Overall health status
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum Status {
45    #[serde(rename = "healthy")]
46    Healthy,
47    #[serde(rename = "degraded")]
48    Degraded,
49    #[serde(rename = "unhealthy")]
50    Unhealthy,
51}
52
53impl Default for Status {
54    fn default() -> Status {
55        Self::Healthy
56    }
57}
58