use crate::error::Error;
use crate::seed::client::SeedClient;
use crate::seed::config::CallOptions;
use crate::seed::models::{ClusterHealth, MeshPeers, MeshStatus, SwarmStatus};
pub struct MeshResource<'c> {
pub(crate) client: &'c SeedClient,
}
impl<'c> MeshResource<'c> {
pub async fn status(&self) -> Result<MeshStatus, Error> {
self.client.request_get("/network/mesh/status").await
}
pub async fn status_with(&self, opts: CallOptions) -> Result<MeshStatus, Error> {
self.client
.request_get_opts("/network/mesh/status", &opts)
.await
}
pub async fn peers(&self) -> Result<MeshPeers, Error> {
self.client.request_get("/peers").await
}
pub async fn peers_with(&self, opts: CallOptions) -> Result<MeshPeers, Error> {
self.client.request_get_opts("/peers", &opts).await
}
pub async fn swarm_status(&self) -> Result<SwarmStatus, Error> {
self.client.request_get("/swarm/status").await
}
pub async fn swarm_status_with(&self, opts: CallOptions) -> Result<SwarmStatus, Error> {
self.client.request_get_opts("/swarm/status", &opts).await
}
pub async fn cluster_health(&self) -> Result<ClusterHealth, Error> {
self.client.request_get("/cluster/health").await
}
pub async fn cluster_health_with(&self, opts: CallOptions) -> Result<ClusterHealth, Error> {
self.client.request_get_opts("/cluster/health", &opts).await
}
}