1use std::sync::Arc;
2
3pub use covert_types::backend::{BackendCategory, BackendType};
4pub use covert_types::methods::system::{
5 CreateMountParams, CreateMountResponse, DisableMountResponse, MountsListResponse,
6 UpdateMountParams, UpdateMountResponse,
7};
8pub use covert_types::mount::MountConfig;
9
10use crate::base::BaseClient;
11
12pub struct Client {
13 client: Arc<BaseClient>,
14}
15
16impl Client {
17 pub(crate) fn new(client: Arc<BaseClient>) -> Self {
18 Self { client }
19 }
20
21 pub async fn create(
22 &self,
23 path: &str,
24 params: &CreateMountParams,
25 ) -> Result<CreateMountResponse, String> {
26 self.client
27 .post(format!("/sys/mounts/{path}"), params)
28 .await
29 }
30
31 pub async fn update(
32 &self,
33 path: &str,
34 params: &UpdateMountParams,
35 ) -> Result<UpdateMountResponse, String> {
36 self.client.put(format!("/sys/mounts/{path}"), params).await
37 }
38
39 pub async fn list(&self) -> Result<MountsListResponse, String> {
40 self.client.get("/sys/mounts".into()).await
41 }
42
43 pub async fn remove(&self, path: &str) -> Result<DisableMountResponse, String> {
44 self.client.delete(format!("/sys/mounts/{path}")).await
45 }
46}