proxmox_api/generated/nodes/node/
status.rs1pub struct StatusClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> StatusClient<T>
6where
7 T: crate::client::Client,
8{
9 pub fn new(client: T, parent_path: &str) -> Self {
10 Self {
11 client,
12 path: format!("{}{}", parent_path, "/status"),
13 }
14 }
15}
16impl<T> StatusClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Read node status"]
21 pub fn get(&self) -> Result<GetOutput, T::Error> {
22 let path = self.path.to_string();
23 self.client.get(&path, &())
24 }
25}
26impl<T> StatusClient<T>
27where
28 T: crate::client::Client,
29{
30 #[doc = "Reboot or shutdown a node."]
31 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
32 let path = self.path.to_string();
33 self.client.post(&path, ¶ms)
34 }
35}
36impl BootInfoGetOutputBootInfo {
37 pub fn new(mode: Mode) -> Self {
38 Self {
39 mode,
40 secureboot: Default::default(),
41 additional_properties: Default::default(),
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct BootInfoGetOutputBootInfo {
47 #[doc = "Through which firmware the system got booted."]
48 pub mode: Mode,
49 #[serde(
50 serialize_with = "crate::types::serialize_bool_optional",
51 deserialize_with = "crate::types::deserialize_bool_optional"
52 )]
53 #[serde(skip_serializing_if = "Option::is_none", default)]
54 #[doc = "System is booted in secure mode, only applicable for the \"efi\" mode."]
55 pub secureboot: Option<bool>,
56 #[serde(
57 flatten,
58 default,
59 skip_serializing_if = "::std::collections::HashMap::is_empty"
60 )]
61 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
62}
63impl CurrentKernelGetOutputCurrentKernel {
64 pub fn new(machine: String, release: String, sysname: String, version: String) -> Self {
65 Self {
66 machine,
67 release,
68 sysname,
69 version,
70 additional_properties: Default::default(),
71 }
72 }
73}
74#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
75pub struct CurrentKernelGetOutputCurrentKernel {
76 #[doc = "Hardware (architecture) type"]
77 pub machine: String,
78 #[doc = "OS kernel release (e.g., \"6.8.0\")"]
79 pub release: String,
80 #[doc = "OS kernel name (e.g., \"Linux\")"]
81 pub sysname: String,
82 #[doc = "OS kernel version with build info"]
83 pub version: String,
84 #[serde(
85 flatten,
86 default,
87 skip_serializing_if = "::std::collections::HashMap::is_empty"
88 )]
89 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
90}
91impl GetOutput {
92 pub fn new(
93 boot_info: BootInfoGetOutputBootInfo,
94 current_kernel: CurrentKernelGetOutputCurrentKernel,
95 ) -> Self {
96 Self {
97 boot_info,
98 current_kernel,
99 additional_properties: Default::default(),
100 }
101 }
102}
103#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
104pub struct GetOutput {
105 #[serde(rename = "boot-info")]
106 #[doc = "Meta-information about the boot mode."]
107 pub boot_info: BootInfoGetOutputBootInfo,
108 #[serde(rename = "current-kernel")]
109 #[doc = "The uptime of the system in seconds."]
110 pub current_kernel: CurrentKernelGetOutputCurrentKernel,
111 #[serde(
112 flatten,
113 default,
114 skip_serializing_if = "::std::collections::HashMap::is_empty"
115 )]
116 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
117}
118impl PostParams {
119 pub fn new(command: Command) -> Self {
120 Self {
121 command,
122 additional_properties: Default::default(),
123 }
124 }
125}
126#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
127pub struct PostParams {
128 #[doc = "Specify the command."]
129 pub command: Command,
130 #[serde(
131 flatten,
132 default,
133 skip_serializing_if = "::std::collections::HashMap::is_empty"
134 )]
135 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
136}
137#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
138pub enum Command {
139 #[serde(rename = "reboot")]
140 Reboot,
141 #[serde(rename = "shutdown")]
142 Shutdown,
143}
144#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
145pub enum Mode {
146 #[serde(rename = "efi")]
147 Efi,
148 #[serde(rename = "legacy-bios")]
149 LegacyBios,
150}