1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Local node operations and health checks
//!
//! ## Overview
//! - Query local node status
//! - Perform health checks
//! - Manage local services
use crate::client::RestClient;
use crate::error::Result;
use serde_json::Value;
/// Handler for local-node operations (`/v1/local/...`).
pub struct LocalHandler {
client: RestClient,
}
impl LocalHandler {
/// Create a new handler bound to the given REST client.
pub fn new(client: RestClient) -> Self {
LocalHandler { client }
}
/// Master healthcheck for local node - GET /v1/local/node/master_healthcheck
pub async fn master_healthcheck(&self) -> Result<Value> {
self.client.get("/v1/local/node/master_healthcheck").await
}
/// List local services - GET /v1/local/services
pub async fn services(&self) -> Result<Value> {
self.client.get("/v1/local/services").await
}
/// Create/update local services - POST /v1/local/services
pub async fn services_update(&self, body: Value) -> Result<Value> {
self.client.post("/v1/local/services", &body).await
}
}