Skip to main content

StatusPayloadBuilder

Struct StatusPayloadBuilder 

Source
pub struct StatusPayloadBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> StatusPayloadBuilder<S>

Source

pub fn build(self) -> StatusPayload
where S: IsComplete,

Finish building and return the requested object

Source

pub fn applications( self, value: HashMap<String, ApplicationReport>, ) -> StatusPayloadBuilder<SetApplications<S>>
where S::Applications: IsUnset,

Optional (Some / Option setters). The applications the reporter found on the machine, each with its own health checks and detail, keyed by a key the reporter chooses.

The key must be unique among the applications on that machine and must identify the same application across this reporter’s pushes; what it is derived from is the reporter’s own business. Canopy correlates on the machine, the key and the type together, and never discloses its own identifier for an application.

Only read alongside machine. An application named here that Canopy does not already hold is created.

Source

pub fn maybe_applications( self, value: Option<HashMap<String, ApplicationReport>>, ) -> StatusPayloadBuilder<SetApplications<S>>
where S::Applications: IsUnset,

Optional (Some / Option setters). The applications the reporter found on the machine, each with its own health checks and detail, keyed by a key the reporter chooses.

The key must be unique among the applications on that machine and must identify the same application across this reporter’s pushes; what it is derived from is the reporter’s own business. Canopy correlates on the machine, the key and the type together, and never discloses its own identifier for an application.

Only read alongside machine. An application named here that Canopy does not already hold is created.

Source

pub fn health( self, value: Vec<HealthCheck>, ) -> StatusPayloadBuilder<SetHealth<S>>
where S::Health: IsUnset,

Required.

Per-check breakdown. A push without a health array is the legacy Tamanu direct-report format: it is treated as the tamanu source reporting a single always-passing tasks heartbeat check. May be empty ([]) for a source that genuinely runs no checks — which recovers every check it previously reported. Each entry must include a non-empty check name and exactly one of result / healthy; any additional fields per check (latency, free disk %, certificate expiry, etc.) are passed through verbatim and shown in the status UI.

Every check name seen — whatever its result — is added to the operator-facing check catalog, where the policy grading its results can be reviewed and adjusted. A check whose effective result is failed or warning opens (or keeps open) its issue; a broken check keeps the same issue open, retaining a known failure’s contribution while warning the check itself is broken; effective passed and skipped results open nothing and close prior issues.

Source

pub fn healthy(self, value: bool) -> StatusPayloadBuilder<SetHealthy<S>>
where S::Healthy: IsUnset,

Optional (Some / Option setters). Overall self-reported health of the server. Absent means true, so senders that predate this field are never treated as unhealthy by omission. Recorded for historical analysis and display, but not consulted for incident or severity decisions — those are derived from the per-check results in health, with each check’s severity controlled by an operator-managed catalog.

Source

pub fn maybe_healthy( self, value: Option<bool>, ) -> StatusPayloadBuilder<SetHealthy<S>>
where S::Healthy: IsUnset,

Optional (Some / Option setters). Overall self-reported health of the server. Absent means true, so senders that predate this field are never treated as unhealthy by omission. Recorded for historical analysis and display, but not consulted for incident or severity decisions — those are derived from the per-check results in health, with each check’s severity controlled by an operator-managed catalog.

Source

pub fn machine(self, value: TargetReport) -> StatusPayloadBuilder<SetMachine<S>>
where S::Machine: IsUnset,

Optional (Some / Option setters).

Source

pub fn maybe_machine( self, value: Option<TargetReport>, ) -> StatusPayloadBuilder<SetMachine<S>>
where S::Machine: IsUnset,

Optional (Some / Option setters).

Source

pub fn source(self, value: String) -> StatusPayloadBuilder<SetSource<S>>
where S::Source: IsUnset,

Optional (Some / Option setters). The name of the source pushing this status: the reporting agent, e.g. alertd. Multiple sources may report on one server, each with its own set of checks; a source’s push only opens and recovers its own checks.

Transitionally optional: this field will become mandatory. A push without a source is attributed to alertd; new reporters must send their own name. Must be a non-empty string; the names canopy and manual are reserved for canopy itself and are rejected.

Source

pub fn maybe_source( self, value: Option<String>, ) -> StatusPayloadBuilder<SetSource<S>>
where S::Source: IsUnset,

Optional (Some / Option setters). The name of the source pushing this status: the reporting agent, e.g. alertd. Multiple sources may report on one server, each with its own set of checks; a source’s push only opens and recovers its own checks.

Transitionally optional: this field will become mandatory. A push without a source is attributed to alertd; new reporters must send their own name. Must be a non-empty string; the names canopy and manual are reserved for canopy itself and are rejected.

Source

pub fn extra( self, value: Map<String, Value>, ) -> StatusPayloadBuilder<SetExtra<S>>
where S::Extra: IsUnset,

Optional (Some / Option setters). Default:

<::serde_json::Map<
    ::std::string::String,
    ::serde_json::Value,
> as Default>::default()

Any further keys the schema accepts alongside those above, carried verbatim.

Source

pub fn maybe_extra( self, value: Option<Map<String, Value>>, ) -> StatusPayloadBuilder<SetExtra<S>>
where S::Extra: IsUnset,

Optional (Some / Option setters). Default:

<::serde_json::Map<
    ::std::string::String,
    ::serde_json::Value,
> as Default>::default()

Any further keys the schema accepts alongside those above, carried verbatim.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.