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