use super::*;
impl ApiClient {
pub async fn set_maintenance(
&self,
service_environment_id: &str,
enabled: bool,
message: Option<&str>,
) -> Result<Answer<EdgeAccessPage>> {
let mut body = serde_json::Map::new();
body.insert("enabled".into(), enabled.into());
if let Some(message) = message {
body.insert("message".into(), message.into());
}
self.answer(
Method::PUT,
&format!("/api/infra/services/{service_environment_id}/maintenance"),
Some(&serde_json::Value::Object(body)),
)
.await
}
pub async fn protect_service(
&self,
service_environment_id: &str,
username: &str,
password: &str,
) -> Result<Answer<EdgeAccessPage>> {
self.answer(
Method::PUT,
&format!("/api/infra/services/{service_environment_id}/protection"),
Some(&serde_json::json!({ "username": username, "password": password })),
)
.await
}
pub async fn unprotect_service(
&self,
service_environment_id: &str,
) -> Result<Answer<EdgeAccessPage>> {
self.answer(
Method::DELETE,
&format!("/api/infra/services/{service_environment_id}/protection"),
None::<&()>,
)
.await
}
}