#[derive(Debug, Clone)]
pub struct StopClient<T> {
client: T,
path: String,
}
impl<T> StopClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str) -> Self {
Self {
client,
path: format!("{}{}", parent_path, "/stop"),
}
}
}
impl<T> StopClient<T>
where
T: crate::client::Client,
{
#[doc = "Stop virtual machine. The qemu process will exit immediately. This is akin to pulling the power plug of a running computer and may damage the VM data."]
#[doc = ""]
#[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.PowerMgmt\"])"]
pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
let path = self.path.to_string();
self.client.post(&path, ¶ms).await
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct PostParams {
#[serde(rename = "keepActive")]
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Do not deactivate storage volumes."]
#[doc = ""]
pub keepactive: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "The cluster node name."]
#[doc = ""]
pub migratedfrom: Option<String>,
#[serde(rename = "overrule-shutdown")]
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Try to abort active 'qmshutdown' tasks before stopping."]
#[doc = ""]
pub overrule_shutdown: Option<bool>,
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Ignore locks - only root is allowed to use this option."]
#[doc = ""]
pub skiplock: Option<bool>,
#[serde(
serialize_with = "crate::types::serialize_unsigned_int_optional",
deserialize_with = "crate::types::deserialize_unsigned_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Wait maximal timeout seconds."]
#[doc = ""]
pub timeout: Option<u64>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}