use std::collections::HashMap;
use manta_shared::types::dto::{CfsSessionGetResponse, Image};
pub use manta_shared::types::wire::sat_file::CreateImageCfsSessionRequest;
use serde_json::Value;
use super::MantaClient;
impl MantaClient {
pub async fn apply_sat_configuration(
&self,
token: &str,
configuration: &Value,
overwrite: bool,
dry_run: bool,
) -> anyhow::Result<Value> {
let body = serde_json::json!({
"configuration": configuration,
"overwrite": overwrite,
"dry_run": dry_run,
});
self
.post_json(token, "/sat-file/configurations", &body)
.await
}
pub async fn create_image_cfs_session(
&self,
token: &str,
req: &CreateImageCfsSessionRequest,
) -> anyhow::Result<CfsSessionGetResponse> {
self
.post_json(token, "/sat-file/images/cfs-session", req)
.await
}
pub async fn stamp_image_from_cfs_session(
&self,
token: &str,
cfs_session_name: &str,
) -> anyhow::Result<Image> {
let body = serde_json::json!({ "cfs_session_name": cfs_session_name });
self.post_json(token, "/sat-file/images/stamp", &body).await
}
pub async fn apply_sat_session_template(
&self,
token: &str,
session_template: &Value,
ref_lookup: &HashMap<String, String>,
reboot: bool,
dry_run: bool,
) -> anyhow::Result<Value> {
let body = serde_json::json!({
"session_template": session_template,
"ref_lookup": ref_lookup,
"reboot": reboot,
"dry_run": dry_run,
});
self
.post_json(token, "/sat-file/session-templates", &body)
.await
}
}