proxmox_api/generated/nodes/node/qemu/vmid/
migrate.rs

1pub struct MigrateClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> MigrateClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}{}", parent_path, "/migrate"),
13        }
14    }
15}
16impl<T> MigrateClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Get preconditions for migration."]
21    pub fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
22        let path = self.path.to_string();
23        self.client.get(&path, &params)
24    }
25}
26impl<T> MigrateClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Migrate virtual machine. Creates a new migration task."]
31    pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
32        let path = self.path.to_string();
33        self.client.post(&path, &params)
34    }
35}
36impl GetOutput {
37    pub fn new(running: bool) -> Self {
38        Self {
39            running,
40            allowed_nodes: Default::default(),
41            not_allowed_nodes: Default::default(),
42            additional_properties: Default::default(),
43        }
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
47pub struct GetOutput {
48    #[serde(skip_serializing_if = "Option::is_none", default)]
49    #[doc = "List nodes allowed for offline migration, only passed if VM is offline"]
50    pub allowed_nodes: Option<()>,
51    #[serde(skip_serializing_if = "Option::is_none", default)]
52    #[doc = "List not allowed nodes with additional informations, only passed if VM is offline"]
53    pub not_allowed_nodes: Option<NotAllowedNodesGetOutputNotAllowedNodes>,
54    #[serde(
55        serialize_with = "crate::types::serialize_bool",
56        deserialize_with = "crate::types::deserialize_bool"
57    )]
58    pub running: bool,
59    #[serde(
60        flatten,
61        default,
62        skip_serializing_if = "::std::collections::HashMap::is_empty"
63    )]
64    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
65}
66#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
67pub struct GetParams {
68    #[serde(skip_serializing_if = "Option::is_none", default)]
69    #[doc = "Target node."]
70    pub target: Option<String>,
71    #[serde(
72        flatten,
73        default,
74        skip_serializing_if = "::std::collections::HashMap::is_empty"
75    )]
76    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
77}
78#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
79pub struct NotAllowedNodesGetOutputNotAllowedNodes {
80    #[serde(
81        flatten,
82        default,
83        skip_serializing_if = "::std::collections::HashMap::is_empty"
84    )]
85    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
86}
87impl PostParams {
88    pub fn new(target: String) -> Self {
89        Self {
90            target,
91            bwlimit: Default::default(),
92            force: Default::default(),
93            migration_network: Default::default(),
94            migration_type: Default::default(),
95            online: Default::default(),
96            targetstorage: Default::default(),
97            with_local_disks: Default::default(),
98            additional_properties: Default::default(),
99        }
100    }
101}
102#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
103pub struct PostParams {
104    #[serde(skip_serializing_if = "Option::is_none", default)]
105    #[doc = "Override I/O bandwidth limit (in KiB/s)."]
106    pub bwlimit: Option<()>,
107    #[serde(
108        serialize_with = "crate::types::serialize_bool_optional",
109        deserialize_with = "crate::types::deserialize_bool_optional"
110    )]
111    #[serde(skip_serializing_if = "Option::is_none", default)]
112    #[doc = "Allow to migrate VMs which use local devices. Only root may use this option."]
113    pub force: Option<bool>,
114    #[serde(skip_serializing_if = "Option::is_none", default)]
115    #[doc = "CIDR of the (sub) network that is used for migration."]
116    pub migration_network: Option<String>,
117    #[serde(skip_serializing_if = "Option::is_none", default)]
118    #[doc = "Migration traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance."]
119    pub migration_type: Option<MigrationType>,
120    #[serde(
121        serialize_with = "crate::types::serialize_bool_optional",
122        deserialize_with = "crate::types::deserialize_bool_optional"
123    )]
124    #[serde(skip_serializing_if = "Option::is_none", default)]
125    #[doc = "Use online/live migration if VM is running. Ignored if VM is stopped."]
126    pub online: Option<bool>,
127    #[doc = "Target node."]
128    pub target: String,
129    #[serde(skip_serializing_if = "Option::is_none", default)]
130    #[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."]
131    pub targetstorage: Option<String>,
132    #[serde(rename = "with-local-disks")]
133    #[serde(
134        serialize_with = "crate::types::serialize_bool_optional",
135        deserialize_with = "crate::types::deserialize_bool_optional"
136    )]
137    #[serde(skip_serializing_if = "Option::is_none", default)]
138    #[doc = "Enable live storage migration for local disk"]
139    pub with_local_disks: Option<bool>,
140    #[serde(
141        flatten,
142        default,
143        skip_serializing_if = "::std::collections::HashMap::is_empty"
144    )]
145    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
146}
147#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
148pub enum MigrationType {
149    #[serde(rename = "insecure")]
150    Insecure,
151    #[serde(rename = "secure")]
152    Secure,
153}