proxmox_api/generated/cluster/
status.rs1#[derive(Debug, Clone)]
2pub struct StatusClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> StatusClient<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, "/status"),
14 }
15 }
16}
17impl<T> StatusClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get cluster status information."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
24 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25 let path = self.path.to_string();
26 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27 Ok(optional_vec.unwrap_or_default())
28 }
29}
30impl GetOutputItems {
31 pub fn new(id: String, name: String, ty: Type) -> Self {
32 Self {
33 id,
34 name,
35 ty,
36 ip: ::std::default::Default::default(),
37 level: ::std::default::Default::default(),
38 local: ::std::default::Default::default(),
39 nodeid: ::std::default::Default::default(),
40 nodes: ::std::default::Default::default(),
41 online: ::std::default::Default::default(),
42 quorate: ::std::default::Default::default(),
43 version: ::std::default::Default::default(),
44 additional_properties: ::std::default::Default::default(),
45 }
46 }
47}
48#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
49pub struct GetOutputItems {
50 pub id: String,
51 #[serde(skip_serializing_if = "Option::is_none", default)]
52 #[doc = "\\\\[node\\\\] IP of the resolved nodename."]
53 #[doc = ""]
54 pub ip: Option<String>,
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "\\\\[node\\\\] Proxmox VE Subscription level, indicates if eligible for enterprise support as well as access to the stable Proxmox VE Enterprise Repository."]
57 #[doc = ""]
58 pub level: Option<String>,
59 #[serde(
60 serialize_with = "crate::types::serialize_bool_optional",
61 deserialize_with = "crate::types::deserialize_bool_optional"
62 )]
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "\\\\[node\\\\] Indicates if this is the responding node."]
65 #[doc = ""]
66 pub local: Option<bool>,
67 pub name: String,
68 #[serde(
69 serialize_with = "crate::types::serialize_int_optional",
70 deserialize_with = "crate::types::deserialize_int_optional"
71 )]
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[doc = "\\\\[node\\\\] ID of the node from the corosync configuration."]
74 #[doc = ""]
75 pub nodeid: Option<i64>,
76 #[serde(
77 serialize_with = "crate::types::serialize_int_optional",
78 deserialize_with = "crate::types::deserialize_int_optional"
79 )]
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "\\\\[cluster\\\\] Nodes count, including offline nodes."]
82 #[doc = ""]
83 pub nodes: Option<i64>,
84 #[serde(
85 serialize_with = "crate::types::serialize_bool_optional",
86 deserialize_with = "crate::types::deserialize_bool_optional"
87 )]
88 #[serde(skip_serializing_if = "Option::is_none", default)]
89 #[doc = "\\\\[node\\\\] Indicates if the node is online or offline."]
90 #[doc = ""]
91 pub online: Option<bool>,
92 #[serde(
93 serialize_with = "crate::types::serialize_bool_optional",
94 deserialize_with = "crate::types::deserialize_bool_optional"
95 )]
96 #[serde(skip_serializing_if = "Option::is_none", default)]
97 #[doc = "\\\\[cluster\\\\] Indicates if there is a majority of nodes online to make decisions"]
98 #[doc = ""]
99 pub quorate: Option<bool>,
100 #[serde(rename = "type")]
101 #[doc = "Indicates the type, either cluster or node. The type defines the object properties e.g. quorate available for type cluster."]
102 #[doc = ""]
103 pub ty: Type,
104 #[serde(
105 serialize_with = "crate::types::serialize_int_optional",
106 deserialize_with = "crate::types::deserialize_int_optional"
107 )]
108 #[serde(skip_serializing_if = "Option::is_none", default)]
109 #[doc = "\\\\[cluster\\\\] Current version of the corosync configuration file."]
110 #[doc = ""]
111 pub version: Option<i64>,
112 #[serde(
113 flatten,
114 default,
115 skip_serializing_if = "::std::collections::HashMap::is_empty"
116 )]
117 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
118}
119#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
120#[doc = "Indicates the type, either cluster or node. The type defines the object properties e.g. quorate available for type cluster."]
121#[doc = ""]
122pub enum Type {
123 #[serde(rename = "cluster")]
124 Cluster,
125 #[serde(rename = "node")]
126 Node,
127}
128impl TryFrom<&str> for Type {
129 type Error = String;
130 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
131 match value {
132 "cluster" => Ok(Self::Cluster),
133 "node" => Ok(Self::Node),
134 v => Err(format!("Unknown variant {v}")),
135 }
136 }
137}