pub struct MigrateClient<T> {
client: T,
path: String,
}
impl<T> MigrateClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str) -> Self {
Self {
client,
path: format!("{}{}", parent_path, "/migrate"),
}
}
}
impl<T> MigrateClient<T>
where
T: crate::client::Client,
{
#[doc = "Migrate the container to another node. Creates a new migration task."]
pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
let path = self.path.to_string();
self.client.post(&path, ¶ms)
}
}
impl PostParams {
pub fn new(target: String) -> Self {
Self {
target,
bwlimit: Default::default(),
online: Default::default(),
restart: Default::default(),
target_storage: Default::default(),
timeout: Default::default(),
additional_properties: Default::default(),
}
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PostParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Override I/O bandwidth limit (in KiB/s)."]
pub bwlimit: Option<()>,
#[serde(
serialize_with = "crate::types::serialize_bool_optional",
deserialize_with = "crate::types::deserialize_bool_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Use online/live migration."]
pub online: 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 = "Use restart migration"]
pub restart: Option<bool>,
#[doc = "Target node."]
pub target: String,
#[serde(rename = "target-storage")]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Mapping from source to target storages. Providing only a single storage ID maps all source storages to that storage. Providing the special value '1' will map each source storage to itself."]
pub target_storage: Option<String>,
#[serde(
serialize_with = "crate::types::serialize_int_optional",
deserialize_with = "crate::types::deserialize_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Timeout in seconds for shutdown for restart migration"]
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>,
}