pub struct HealthChecks<'a> { /* private fields */ }Expand description
Health check routes, from Client::health_checks.
A check belongs to one record value and is addressed by that value’s uuid
(record_id). Access follows the value’s zone.
Implementations§
Source§impl<'a> HealthChecks<'a>
impl<'a> HealthChecks<'a>
Sourcepub async fn get(&self, record_id: Uuid) -> Result<HealthCheck>
pub async fn get(&self, record_id: Uuid) -> Result<HealthCheck>
The check of a record value, with its last result.
GET /api/v1/health-checks/:record_id
§Errors
ErrorCode::NotFound if the value has no check.
Sourcepub async fn create(&self, check: &NewHealthCheck) -> Result<HealthCheck>
pub async fn create(&self, check: &NewHealthCheck) -> Result<HealthCheck>
Adds a check to a record value and switches the value’s host_health to
Auto, so Core starts running it right away.
The value counts as healthy until the first run says otherwise.
POST /api/v1/health-checks
§Errors
ErrorCode::Conflictif the value already has a check.ErrorCode::Validationfor out-of-range timings (seeNewHealthCheck) or a bad config.
§Examples
use dinio_sdk::models::{HealthCheckConfig, NewHealthCheck, TcpCheck};
let check = NewHealthCheck {
record_id: value.uuid,
config: HealthCheckConfig::Tcp(TcpCheck { host: "192.0.2.10".into(), port: 443 }),
name: Some("web".into()),
interval: 60,
timeout: 5,
retries: None,
retry_interval: None,
};
client.health_checks().create(&check).await?;Sourcepub async fn update(
&self,
record_id: Uuid,
patch: &HealthCheckPatch,
) -> Result<HealthCheck>
pub async fn update( &self, record_id: Uuid, patch: &HealthCheckPatch, ) -> Result<HealthCheck>
Changes a check; fields left None stay as they are.
PATCH /api/v1/health-checks/:record_id
§Errors
ErrorCode::NotFoundif the value has no check.ErrorCode::Validationif the result would havetimeout >= interval, or the config does not fit the check’s type.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for HealthChecks<'a>
impl<'a> !UnwindSafe for HealthChecks<'a>
impl<'a> Freeze for HealthChecks<'a>
impl<'a> Send for HealthChecks<'a>
impl<'a> Sync for HealthChecks<'a>
impl<'a> Unpin for HealthChecks<'a>
impl<'a> UnsafeUnpin for HealthChecks<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more