proxmox_api/generated/cluster/
nextid.rs1#[derive(Debug, Clone)]
2pub struct NextidClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> NextidClient<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, "/nextid"),
14 }
15 }
16}
17impl<T> NextidClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get next free VMID. Pass a VMID to assert that its free (at time of check)."]
22 #[doc = ""]
23 pub async fn get(&self, params: GetParams) -> Result<i64, T::Error> {
24 let path = self.path.to_string();
25 Ok(self
26 .client
27 .get::<_, crate::types::Integer>(&path, ¶ms)
28 .await?
29 .get())
30 }
31}
32#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
33pub struct GetParams {
34 #[serde(skip_serializing_if = "Option::is_none", default)]
35 #[doc = "The (unique) ID of the VM."]
36 #[doc = ""]
37 pub vmid: Option<VmidInt>,
38 #[serde(
39 flatten,
40 default,
41 skip_serializing_if = "::std::collections::HashMap::is_empty"
42 )]
43 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
44}
45#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
46pub struct VmidInt(i128);
47impl crate::types::bounded_integer::BoundedInteger for VmidInt {
48 const MIN: Option<i128> = Some(100i128);
49 const MAX: Option<i128> = Some(999999999i128);
50 const DEFAULT: Option<i128> = None::<i128>;
51 const TYPE_DESCRIPTION: &'static str = "an integer between 100 and 999999999";
52 fn get(&self) -> i128 {
53 self.0
54 }
55 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
56 Self::validate(value)?;
57 Ok(Self(value))
58 }
59}
60impl std::convert::TryFrom<i128> for VmidInt {
61 type Error = crate::types::bounded_integer::BoundedIntegerError;
62 fn try_from(value: i128) -> Result<Self, Self::Error> {
63 crate::types::bounded_integer::BoundedInteger::new(value)
64 }
65}
66impl ::serde::Serialize for VmidInt {
67 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
68 where
69 S: ::serde::Serializer,
70 {
71 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
72 }
73}
74impl<'de> ::serde::Deserialize<'de> for VmidInt {
75 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
76 where
77 D: ::serde::Deserializer<'de>,
78 {
79 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
80 }
81}