proxmox_api/generated/nodes/node/
stopall.rs1#[derive(Debug, Clone)]
2pub struct StopallClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> StopallClient<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, "/stopall"),
14 }
15 }
16}
17impl<T> StopallClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Stop all VMs and Containers."]
22 #[doc = ""]
23 #[doc = "The 'VM.PowerMgmt' permission is required on '/' or on '/vms/\\<ID\\>' for each ID passed via the 'vms' parameter."]
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(rename = "force-stop")]
32 #[serde(
33 serialize_with = "crate::types::serialize_bool_optional",
34 deserialize_with = "crate::types::deserialize_bool_optional"
35 )]
36 #[serde(skip_serializing_if = "Option::is_none", default)]
37 #[doc = "Force a hard-stop after the timeout."]
38 #[doc = ""]
39 pub force_stop: Option<bool>,
40 #[serde(skip_serializing_if = "Option::is_none", default)]
41 #[doc = "Timeout for each guest shutdown task. Depending on `force-stop`, the shutdown gets then simply aborted or a hard-stop is forced."]
42 #[doc = ""]
43 pub timeout: Option<TimeoutInt>,
44 #[serde(skip_serializing_if = "Option::is_none", default)]
45 #[doc = "Only consider Guests with these IDs."]
46 #[doc = ""]
47 pub vms: Option<String>,
48 #[serde(
49 flatten,
50 default,
51 skip_serializing_if = "::std::collections::HashMap::is_empty"
52 )]
53 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
54}
55#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
56pub struct TimeoutInt(i128);
57impl crate::types::bounded_integer::BoundedInteger for TimeoutInt {
58 const MIN: Option<i128> = Some(0i128);
59 const MAX: Option<i128> = Some(7200i128);
60 const DEFAULT: Option<i128> = Some(180i128);
61 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 7200";
62 fn get(&self) -> i128 {
63 self.0
64 }
65 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
66 Self::validate(value)?;
67 Ok(Self(value))
68 }
69}
70impl std::convert::TryFrom<i128> for TimeoutInt {
71 type Error = crate::types::bounded_integer::BoundedIntegerError;
72 fn try_from(value: i128) -> Result<Self, Self::Error> {
73 crate::types::bounded_integer::BoundedInteger::new(value)
74 }
75}
76impl ::serde::Serialize for TimeoutInt {
77 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
78 where
79 S: ::serde::Serializer,
80 {
81 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
82 }
83}
84impl<'de> ::serde::Deserialize<'de> for TimeoutInt {
85 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
86 where
87 D: ::serde::Deserializer<'de>,
88 {
89 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
90 }
91}