orvanta_api/models/workers_health.rs
1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 3.0.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// WorkersHealth : Workers health status
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct WorkersHealth {
17 /// Whether any workers are active
18 #[serde(rename = "healthy")]
19 pub healthy: bool,
20 /// Number of active workers (pinged in last 5 minutes)
21 #[serde(rename = "active_count")]
22 pub active_count: i64,
23 /// List of active worker groups
24 #[serde(rename = "worker_groups")]
25 pub worker_groups: Vec<String>,
26 /// Minimum required worker version
27 #[serde(rename = "min_version")]
28 pub min_version: String,
29 /// List of active worker versions
30 #[serde(rename = "versions")]
31 pub versions: Vec<String>,
32 /// Distinct job isolation modes reported by live workers. `nsjail` means the worker both asked for nsjail sandboxing and has a working nsjail binary; `unshare` is PID-namespace isolation only; `none` means jobs run with no process isolation; `unknown` is a worker that reported no mode. Sorted for stability across polls.
33 #[serde(rename = "job_isolation")]
34 pub job_isolation: Vec<JobIsolation>,
35 /// Number of live workers running with no process isolation (reported `none`, or nothing at all).
36 #[serde(rename = "workers_without_isolation")]
37 pub workers_without_isolation: i64,
38}
39
40impl WorkersHealth {
41 /// Workers health status
42 pub fn new(healthy: bool, active_count: i64, worker_groups: Vec<String>, min_version: String, versions: Vec<String>, job_isolation: Vec<JobIsolation>, workers_without_isolation: i64) -> WorkersHealth {
43 WorkersHealth {
44 healthy,
45 active_count,
46 worker_groups,
47 min_version,
48 versions,
49 job_isolation,
50 workers_without_isolation,
51 }
52 }
53}
54/// Distinct job isolation modes reported by live workers. `nsjail` means the worker both asked for nsjail sandboxing and has a working nsjail binary; `unshare` is PID-namespace isolation only; `none` means jobs run with no process isolation; `unknown` is a worker that reported no mode. Sorted for stability across polls.
55#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
56pub enum JobIsolation {
57 #[serde(rename = "nsjail")]
58 Nsjail,
59 #[serde(rename = "unshare")]
60 Unshare,
61 #[serde(rename = "none")]
62 None,
63 #[serde(rename = "unknown")]
64 Unknown,
65}
66
67impl Default for JobIsolation {
68 fn default() -> JobIsolation {
69 Self::Nsjail
70 }
71}
72