pub struct FleetMonitorClient { /* private fields */ }Expand description
HTTPS client for the BrinkhausFleetManager ingest API.
All send methods are async. For sync usage, wrap in a tokio runtime.
Implementations§
Source§impl FleetMonitorClient
impl FleetMonitorClient
Sourcepub fn set_branding(&self, branding: Option<String>)
pub fn set_branding(&self, branding: Option<String>)
Set the software-specific branding sent in every heartbeat.
Sourcepub fn set_licence(&self, report: Option<Value>)
pub fn set_licence(&self, report: Option<Value>)
Set the licence report sent in every heartbeat (field licence, see the
heartbeat schema); None omits the field. Software-specific.
Sourcepub fn set_hardware(&self, report: Option<Value>)
pub fn set_hardware(&self, report: Option<Value>)
Set the hardware report sent in every heartbeat (field hardware:
model, disk_total_mb, see the heartbeat schema); None omits the field.
Sourcepub fn set_build_channel(&self, channel: Option<String>) -> Result<(), String>
pub fn set_build_channel(&self, channel: Option<String>) -> Result<(), String>
Set the release channel this build was delivered with (nightly,
candidate or stable); None if the software does not know it. An
unknown value is refused.
Sourcepub fn channel(&self) -> Option<(String, ChannelSource)>
pub fn channel(&self) -> Option<(String, ChannelSource)>
Release channel of this software with its source: while connected, the
one the FleetManager returned with the last heartbeat it answered;
otherwise (no connection, or the line is unknown to it) the one set with set_build_channel. None when
neither is known.
pub fn new(config: FleetClientConfig) -> Self
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the client is currently connected.
Sourcepub fn last_connect_error(&self) -> Option<String>
pub fn last_connect_error(&self) -> Option<String>
Last connection error message, if any.
Sourcepub fn last_send_attempt(&self) -> Option<String>
pub fn last_send_attempt(&self) -> Option<String>
Last send attempt timestamp.
Sourcepub fn last_send_success(&self) -> Option<String>
pub fn last_send_success(&self) -> Option<String>
Last successful send timestamp.
Sourcepub fn on_commands<F: Fn(Vec<Value>) + Send + Sync + 'static>(
&self,
callback: F,
)
pub fn on_commands<F: Fn(Vec<Value>) + Send + Sync + 'static>( &self, callback: F, )
Register a callback for piggybacked commands from the server.
Sourcepub fn reconfigure(
&self,
base_url: &str,
customer: &str,
machine: &str,
token: Option<String>,
)
pub fn reconfigure( &self, base_url: &str, customer: &str, machine: &str, token: Option<String>, )
Update connection parameters at runtime.
Sourcepub async fn send_heartbeat(&self) -> Result<(), String>
pub async fn send_heartbeat(&self) -> Result<(), String>
Send a heartbeat.
Sourcepub async fn send_diagnostics(
&self,
diagnostics: &[(u16, String, u8)],
) -> Result<(), String>
pub async fn send_diagnostics( &self, diagnostics: &[(u16, String, u8)], ) -> Result<(), String>
Send diagnostics as (code, message, severity) tuples.
Sourcepub async fn send_status(
&self,
status: &str,
message: Option<&str>,
) -> Result<(), String>
pub async fn send_status( &self, status: &str, message: Option<&str>, ) -> Result<(), String>
Send a status change.