proxmox_api/generated/cluster/bulk_action/guest/
suspend.rs1#[derive(Debug, Clone)]
2pub struct SuspendClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> SuspendClient<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, "/suspend"),
14 }
15 }
16}
17impl<T> SuspendClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Bulk suspend all guests on the cluster."]
22 #[doc = ""]
23 #[doc = "The 'VM.PowerMgmt' permission is required on '/' or on '/vms/\\<ID\\>' for each ID passed via the 'vms' parameter. Additionally, you need 'VM.Config.Disk' on the '/vms/{vmid}' path and 'Datastore.AllocateSpace' for the configured state-storage(s)"]
24 pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
25 let path = self.path.to_string();
26 self.client.post(&path, ¶ms).await
27 }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct PostParams {
31 #[serde(skip_serializing_if = "Option::is_none", default)]
32 #[doc = "How many parallel tasks at maximum should be started."]
33 #[doc = ""]
34 pub maxworkers: Option<MaxworkersInt>,
35 #[serde(skip_serializing_if = "Option::is_none", default)]
36 #[doc = "The storage for the VM state."]
37 #[doc = ""]
38 pub statestorage: Option<String>,
39 #[serde(rename = "to-disk")]
40 #[serde(
41 serialize_with = "crate::types::serialize_bool_optional",
42 deserialize_with = "crate::types::deserialize_bool_optional"
43 )]
44 #[serde(skip_serializing_if = "Option::is_none", default)]
45 #[doc = "If set, suspends the guests to disk. Will be resumed on next start."]
46 #[doc = ""]
47 pub to_disk: Option<bool>,
48 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
49 #[doc = "Only consider guests from this list of VMIDs."]
50 #[doc = ""]
51 pub vms: Vec<VmsInt>,
52 #[serde(
53 flatten,
54 default,
55 skip_serializing_if = "::std::collections::HashMap::is_empty"
56 )]
57 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
60pub struct MaxworkersInt(i128);
61impl crate::types::bounded_integer::BoundedInteger for MaxworkersInt {
62 const MIN: Option<i128> = None::<i128>;
63 const MAX: Option<i128> = None::<i128>;
64 const DEFAULT: Option<i128> = Some(1i128);
65 const TYPE_DESCRIPTION: &'static str = "a valid integer";
66 fn get(&self) -> i128 {
67 self.0
68 }
69 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
70 Self::validate(value)?;
71 Ok(Self(value))
72 }
73}
74impl std::convert::TryFrom<i128> for MaxworkersInt {
75 type Error = crate::types::bounded_integer::BoundedIntegerError;
76 fn try_from(value: i128) -> Result<Self, Self::Error> {
77 crate::types::bounded_integer::BoundedInteger::new(value)
78 }
79}
80impl ::serde::Serialize for MaxworkersInt {
81 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
82 where
83 S: ::serde::Serializer,
84 {
85 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
86 }
87}
88impl<'de> ::serde::Deserialize<'de> for MaxworkersInt {
89 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
90 where
91 D: ::serde::Deserializer<'de>,
92 {
93 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
94 }
95}
96#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
97pub struct VmsInt(i128);
98impl crate::types::bounded_integer::BoundedInteger for VmsInt {
99 const MIN: Option<i128> = Some(100i128);
100 const MAX: Option<i128> = Some(999999999i128);
101 const DEFAULT: Option<i128> = None::<i128>;
102 const TYPE_DESCRIPTION: &'static str = "an integer between 100 and 999999999";
103 fn get(&self) -> i128 {
104 self.0
105 }
106 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
107 Self::validate(value)?;
108 Ok(Self(value))
109 }
110}
111impl std::convert::TryFrom<i128> for VmsInt {
112 type Error = crate::types::bounded_integer::BoundedIntegerError;
113 fn try_from(value: i128) -> Result<Self, Self::Error> {
114 crate::types::bounded_integer::BoundedInteger::new(value)
115 }
116}
117impl ::serde::Serialize for VmsInt {
118 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
119 where
120 S: ::serde::Serializer,
121 {
122 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
123 }
124}
125impl<'de> ::serde::Deserialize<'de> for VmsInt {
126 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
127 where
128 D: ::serde::Deserializer<'de>,
129 {
130 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
131 }
132}