HealthcheckBuilder
pub struct HealthcheckBuilder { /* private fields */ }A builder structure for generating healthchecks for a dynamic backend
This structure can be constructed using either Backend::healthcheck_builder() or its
own new() method, and will generate a new healthcheck for use by the DynamicBackendBuilder after
consuming the BackendBuilder with finish().
Methods
expected_status
View sourcefn expected_status(self, value: u16) -> SelfSets the HTTP status code that signifies a healthy state.
Defaults to 200.
Parameters
- self: Self
- value: u16
Returns
get_expected_status
View sourcefn get_expected_status(&self) -> u16Returns the expected_status from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_host
View sourcefn get_host(&self) -> &strReturns the host from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_initial
View sourcefn get_initial(&self) -> u32Returns the initial from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_interval_ms
View sourcefn get_interval_ms(&self) -> DurationReturns the interval_ms from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_method
View sourcefn get_method(&self) -> &strReturns the method from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_path
View sourcefn get_path(&self) -> &PathAndQueryReturns the path from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_threshold
View sourcefn get_threshold(&self) -> u32Returns the threshold from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_timeout_ms
View sourcefn get_timeout_ms(&self) -> DurationReturns the timeout_ms from the HealthcheckBuilder
Parameters
- self: &Self
Returns
get_window
View sourcefn get_window(&self) -> u32Returns the window from the HealthcheckBuilder
Parameters
- self: &Self
Returns
host
View sourceSet the Host header to set when making the request (e.g. example.com).
A common mistake is setting the wrong host header, which causes the health check to fail.
Parameters
- self: Self
- name: impl ToString
Returns
initial
View sourcefn initial(self, value: u32) -> SelfSet the number of successes to assume are successful when beginning a health check. Must not be greater than the current window.
Defaults to 4.
Parameters
- self: Self
- value: u32
Returns
interval_ms
View sourceSet the interval in milliseconds where a health check should be performed. Times must be 1 second to 1 hour inclusive. Must be less than the current timeout_ms.
Defaults to 15000ms.
Parameters
- self: Self
- value: Duration
Returns
method
View sourceSet an HTTP verb (i.e., HEAD, GET, or POST) to use when performing the health check.
Defaults to "GET".
Parameters
- self: Self
- value: impl ToString
Returns
new
View sourceCreate a new health check builder for a dynamic backend.
The argument is a string describing the backend host on which to check health checks on. This can be of the form:
"<ip address>""<hostname>""<ip address>:<port>""<hostname>:<port>"
The builder will start with default values for all other possible fields for the
health check, which can be overridden using the other methods provided. Use
BackendBuilder::healthcheck to add the health check to a specific Dynamic Backend
and call BackendBuilder::finish() to complete the construction of the dynamic backend.
Values for health checks have strict limits to prevent ill-use. If you create a health
check with a value that breaks these limits, finish() will error with a
BackendCreationError:InvalidHealthcheckValues
Parameters
- host: impl ToString
Returns
path
View sourceSet a path to visit on your origins when performing the check. Use a unique path. For example, use /website-healthcheck.txt, not / or /healthcheck.
Defaults to "/".
Parameters
- self: Self
- value: impl ToString
Returns
threshold
View sourcefn threshold(self, value: u32) -> SelfSet the number of health checks that must be successful within the window to be considered healthy. Must not be greater than the current window.
Defaults to 3.
Parameters
- self: Self
- value: u32
Returns
timeout_ms
View sourceSet the time in milliseconds in which to perform the health check. Note that querying the health check renews the timer. Must not be less than the current interval_ms.
Defaults to 5000ms.
Parameters
- self: Self
- value: Duration
Returns
validate
View sourceValidate that the current health check has acceptable values
Parameters
- self: &Self
Returns
window
View sourcefn window(self, value: u32) -> SelfSet the number of most recent health check queries to keep. Must not be greater than 15.
Defaults to 5.
Parameters
- self: Self
- value: u32
Returns