Skip to main content

herolib_virt/nerdctl/
health_check.rs

1// File: /root/code/git.threefold.info/herocode/sal/src/virt/nerdctl/health_check.rs
2
3use super::container_types::HealthCheck;
4
5impl HealthCheck {
6    /// Create a new health check with the given command
7    pub fn new(cmd: &str) -> Self {
8        Self {
9            cmd: cmd.to_string(),
10            interval: None,
11            timeout: None,
12            retries: None,
13            start_period: None,
14        }
15    }
16
17    /// Set the interval between health checks
18    pub fn with_interval(mut self, interval: &str) -> Self {
19        self.interval = Some(interval.to_string());
20        self
21    }
22
23    /// Set the timeout for health checks
24    pub fn with_timeout(mut self, timeout: &str) -> Self {
25        self.timeout = Some(timeout.to_string());
26        self
27    }
28
29    /// Set the number of retries for health checks
30    pub fn with_retries(mut self, retries: u32) -> Self {
31        self.retries = Some(retries);
32        self
33    }
34
35    /// Set the start period for health checks
36    pub fn with_start_period(mut self, start_period: &str) -> Self {
37        self.start_period = Some(start_period.to_string());
38        self
39    }
40}