Skip to main content

proxmox_api/generated/nodes/node/qemu/vmid/status/
start.rs

1#[derive(Debug, Clone)]
2pub struct StartClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> StartClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/start"),
14        }
15    }
16}
17impl<T> StartClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Start virtual machine."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.PowerMgmt\"])"]
24    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
25        let path = self.path.to_string();
26        self.client.post(&path, &params).await
27    }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct PostParams {
31    #[serde(rename = "force-cpu")]
32    #[serde(skip_serializing_if = "Option::is_none", default)]
33    #[doc = "Override QEMU's -cpu argument with the given string."]
34    #[doc = ""]
35    pub force_cpu: Option<String>,
36    #[serde(skip_serializing_if = "Option::is_none", default)]
37    #[doc = "Specify the QEMU machine."]
38    #[doc = ""]
39    pub machine: Option<String>,
40    #[serde(skip_serializing_if = "Option::is_none", default)]
41    #[doc = "The cluster node name."]
42    #[doc = ""]
43    pub migratedfrom: Option<String>,
44    #[serde(skip_serializing_if = "Option::is_none", default)]
45    #[doc = "CIDR of the (sub) network that is used for migration."]
46    #[doc = ""]
47    pub migration_network: Option<String>,
48    #[serde(skip_serializing_if = "Option::is_none", default)]
49    #[doc = "Migration traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance."]
50    #[doc = ""]
51    pub migration_type: Option<MigrationType>,
52    #[serde(rename = "nets-host-mtu")]
53    #[serde(skip_serializing_if = "Option::is_none", default)]
54    #[doc = "Used for migration compat. List of VirtIO network devices and their effective host_mtu setting according to the QEMU object model on the source side of the migration. A value of 0 means that the host_mtu parameter is to be avoided for the corresponding device."]
55    #[doc = ""]
56    pub nets_host_mtu: Option<NetsHostMtuStr>,
57    #[serde(
58        serialize_with = "crate::types::serialize_bool_optional",
59        deserialize_with = "crate::types::deserialize_bool_optional"
60    )]
61    #[serde(skip_serializing_if = "Option::is_none", default)]
62    #[doc = "Ignore locks - only root is allowed to use this option."]
63    #[doc = ""]
64    pub skiplock: Option<bool>,
65    #[serde(skip_serializing_if = "Option::is_none", default)]
66    #[doc = "Some command save/restore state from this location."]
67    #[doc = ""]
68    pub stateuri: Option<StateuriStr>,
69    #[serde(skip_serializing_if = "Option::is_none", default)]
70    #[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."]
71    #[doc = ""]
72    pub targetstorage: Option<String>,
73    #[serde(
74        serialize_with = "crate::types::serialize_unsigned_int_optional",
75        deserialize_with = "crate::types::deserialize_unsigned_int_optional"
76    )]
77    #[serde(skip_serializing_if = "Option::is_none", default)]
78    #[doc = "Wait maximal timeout seconds."]
79    #[doc = ""]
80    pub timeout: Option<u64>,
81    #[serde(rename = "with-conntrack-state")]
82    #[serde(
83        serialize_with = "crate::types::serialize_bool_optional",
84        deserialize_with = "crate::types::deserialize_bool_optional"
85    )]
86    #[serde(skip_serializing_if = "Option::is_none", default)]
87    #[doc = "Whether to migrate conntrack entries for running VMs."]
88    #[doc = ""]
89    pub with_conntrack_state: Option<bool>,
90    #[serde(
91        flatten,
92        default,
93        skip_serializing_if = "::std::collections::HashMap::is_empty"
94    )]
95    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
96}
97#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
98#[doc = "Migration traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance."]
99#[doc = ""]
100pub enum MigrationType {
101    #[serde(rename = "insecure")]
102    Insecure,
103    #[serde(rename = "secure")]
104    Secure,
105}
106impl TryFrom<&str> for MigrationType {
107    type Error = String;
108    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
109        match value {
110            "insecure" => Ok(Self::Insecure),
111            "secure" => Ok(Self::Secure),
112            v => Err(format!("Unknown variant {v}")),
113        }
114    }
115}
116#[derive(Debug, Clone, PartialEq, PartialOrd)]
117pub struct NetsHostMtuStr {
118    value: String,
119}
120impl crate::types::bounded_string::BoundedString for NetsHostMtuStr {
121    const MIN_LENGTH: Option<usize> = None::<usize>;
122    const MAX_LENGTH: Option<usize> = None::<usize>;
123    const DEFAULT: Option<&'static str> = None::<&'static str>;
124    const PATTERN: Option<&'static str> = Some("net\\d+=\\d+(,net\\d+=\\d+)*");
125    const TYPE_DESCRIPTION: &'static str =
126        "a string with pattern r\"net\\d+=\\d+(,net\\d+=\\d+)*\" and no length constraints";
127    fn get_value(&self) -> &str {
128        &self.value
129    }
130    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
131        Self::validate(&value)?;
132        Ok(Self { value })
133    }
134}
135impl std::convert::TryFrom<String> for NetsHostMtuStr {
136    type Error = crate::types::bounded_string::BoundedStringError;
137    fn try_from(value: String) -> Result<Self, Self::Error> {
138        crate::types::bounded_string::BoundedString::new(value)
139    }
140}
141impl ::serde::Serialize for NetsHostMtuStr {
142    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
143    where
144        S: ::serde::Serializer,
145    {
146        crate::types::bounded_string::serialize_bounded_string(self, serializer)
147    }
148}
149impl<'de> ::serde::Deserialize<'de> for NetsHostMtuStr {
150    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
151    where
152        D: ::serde::Deserializer<'de>,
153    {
154        crate::types::bounded_string::deserialize_bounded_string(deserializer)
155    }
156}
157#[derive(Debug, Clone, PartialEq, PartialOrd)]
158pub struct StateuriStr {
159    value: String,
160}
161impl crate::types::bounded_string::BoundedString for StateuriStr {
162    const MIN_LENGTH: Option<usize> = None::<usize>;
163    const MAX_LENGTH: Option<usize> = Some(128usize);
164    const DEFAULT: Option<&'static str> = None::<&'static str>;
165    const PATTERN: Option<&'static str> = None::<&'static str>;
166    const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
167    fn get_value(&self) -> &str {
168        &self.value
169    }
170    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
171        Self::validate(&value)?;
172        Ok(Self { value })
173    }
174}
175impl std::convert::TryFrom<String> for StateuriStr {
176    type Error = crate::types::bounded_string::BoundedStringError;
177    fn try_from(value: String) -> Result<Self, Self::Error> {
178        crate::types::bounded_string::BoundedString::new(value)
179    }
180}
181impl ::serde::Serialize for StateuriStr {
182    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
183    where
184        S: ::serde::Serializer,
185    {
186        crate::types::bounded_string::serialize_bounded_string(self, serializer)
187    }
188}
189impl<'de> ::serde::Deserialize<'de> for StateuriStr {
190    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
191    where
192        D: ::serde::Deserializer<'de>,
193    {
194        crate::types::bounded_string::deserialize_bounded_string(deserializer)
195    }
196}