proxmox_api/generated/
version.rs1#[derive(Debug, Clone)]
2pub struct VersionClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> VersionClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T) -> Self {
11 Self {
12 client,
13 path: "/version".to_string(),
14 }
15 }
16}
17impl<T> VersionClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "API version details, including some parts of the global datacenter config."]
22 #[doc = ""]
23 pub async fn get(&self) -> Result<GetOutput, T::Error> {
24 let path = self.path.to_string();
25 self.client.get(&path, &()).await
26 }
27}
28impl GetOutput {
29 pub fn new(release: String, repoid: RepoidStr, version: String) -> Self {
30 Self {
31 release,
32 repoid,
33 version,
34 console: ::std::default::Default::default(),
35 additional_properties: ::std::default::Default::default(),
36 }
37 }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct GetOutput {
41 #[serde(skip_serializing_if = "Option::is_none", default)]
42 #[doc = "The default console viewer to use."]
43 #[doc = ""]
44 pub console: Option<Console>,
45 #[doc = "The current Proxmox VE point release in `x.y` format."]
46 #[doc = ""]
47 pub release: String,
48 #[doc = "The short git revision from which this version was build."]
49 #[doc = ""]
50 pub repoid: RepoidStr,
51 #[doc = "The full pve-manager package version of this node."]
52 #[doc = ""]
53 pub version: String,
54 #[serde(
55 flatten,
56 default,
57 skip_serializing_if = "::std::collections::HashMap::is_empty"
58 )]
59 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
60}
61#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
62#[doc = "The default console viewer to use."]
63#[doc = ""]
64pub enum Console {
65 #[serde(rename = "applet")]
66 Applet,
67 #[serde(rename = "html5")]
68 Html5,
69 #[serde(rename = "vv")]
70 Vv,
71 #[serde(rename = "xtermjs")]
72 Xtermjs,
73}
74impl TryFrom<&str> for Console {
75 type Error = String;
76 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
77 match value {
78 "applet" => Ok(Self::Applet),
79 "html5" => Ok(Self::Html5),
80 "vv" => Ok(Self::Vv),
81 "xtermjs" => Ok(Self::Xtermjs),
82 v => Err(format!("Unknown variant {v}")),
83 }
84 }
85}
86#[derive(Debug, Clone, PartialEq, PartialOrd)]
87pub struct RepoidStr {
88 value: String,
89}
90impl crate::types::bounded_string::BoundedString for RepoidStr {
91 const MIN_LENGTH: Option<usize> = None::<usize>;
92 const MAX_LENGTH: Option<usize> = None::<usize>;
93 const DEFAULT: Option<&'static str> = None::<&'static str>;
94 const PATTERN: Option<&'static str> = Some("[0-9a-fA-F]{8,64}");
95 const TYPE_DESCRIPTION: &'static str =
96 "a string with pattern r\"[0-9a-fA-F]{8,64}\" and no length constraints";
97 fn get_value(&self) -> &str {
98 &self.value
99 }
100 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
101 Self::validate(&value)?;
102 Ok(Self { value })
103 }
104}
105impl std::convert::TryFrom<String> for RepoidStr {
106 type Error = crate::types::bounded_string::BoundedStringError;
107 fn try_from(value: String) -> Result<Self, Self::Error> {
108 crate::types::bounded_string::BoundedString::new(value)
109 }
110}
111impl ::serde::Serialize for RepoidStr {
112 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
113 where
114 S: ::serde::Serializer,
115 {
116 crate::types::bounded_string::serialize_bounded_string(self, serializer)
117 }
118}
119impl<'de> ::serde::Deserialize<'de> for RepoidStr {
120 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
121 where
122 D: ::serde::Deserializer<'de>,
123 {
124 crate::types::bounded_string::deserialize_bounded_string(deserializer)
125 }
126}