container stats

This commit is contained in:
beckerinj
2022-12-04 01:59:47 -05:00
parent 38d7126959
commit 34b60c755b
13 changed files with 213 additions and 44 deletions

View File

@@ -1 +1,23 @@
use monitor_types::{Build, SystemStats};
use serde_json::json;
use crate::MonitorClient;
impl MonitorClient {
pub async fn list_builds(&self) -> anyhow::Result<Vec<Build>> {
self.get("/api/build/list").await
}
pub async fn create_build(&self, name: &str, address: &str) -> anyhow::Result<()> {
self.post(
"/api/build/create",
json!({ "name": name, "address": address }),
)
.await
}
pub async fn delete_build(&self, id: &str) -> anyhow::Result<()> {
self.delete::<(), _>(&format!("/api/build/delete/{id}"), None)
.await
}
}

View File

@@ -1 +1,23 @@
use monitor_types::{Deployment, SystemStats};
use serde_json::json;
use crate::MonitorClient;
impl MonitorClient {
pub async fn list_deployments(&self) -> anyhow::Result<Vec<Deployment>> {
self.get("/api/deployment/list").await
}
pub async fn create_deployment(&self, name: &str, address: &str) -> anyhow::Result<()> {
self.post(
"/api/deployment/create",
json!({ "name": name, "address": address }),
)
.await
}
pub async fn delete_deployment(&self, id: &str) -> anyhow::Result<()> {
self.delete::<(), _>(&format!("/api/deployment/delete/{id}"), None)
.await
}
}