proxmox_api/generated/nodes/node/tasks/upid/
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 = "Read task status."]
22 #[doc = ""]
23 #[doc = "The user needs 'Sys.Audit' permissions on '/nodes/\\<node\\>' if they are not the owner of the task."]
24 pub async fn get(&self) -> Result<GetOutput, T::Error> {
25 let path = self.path.to_string();
26 self.client.get(&path, &()).await
27 }
28}
29impl GetOutput {
30 pub fn new(
31 id: String,
32 node: String,
33 pid: i64,
34 pstart: i64,
35 starttime: i64,
36 status: Status,
37 ty: String,
38 upid: String,
39 user: String,
40 ) -> Self {
41 Self {
42 id,
43 node,
44 pid,
45 pstart,
46 starttime,
47 status,
48 ty,
49 upid,
50 user,
51 exitstatus: ::std::default::Default::default(),
52 additional_properties: ::std::default::Default::default(),
53 }
54 }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
57pub struct GetOutput {
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 pub exitstatus: Option<String>,
60 pub id: String,
61 pub node: String,
62 #[serde(
63 serialize_with = "crate::types::serialize_int",
64 deserialize_with = "crate::types::deserialize_int"
65 )]
66 pub pid: i64,
67 #[serde(
68 serialize_with = "crate::types::serialize_int",
69 deserialize_with = "crate::types::deserialize_int"
70 )]
71 pub pstart: i64,
72 #[serde(
73 serialize_with = "crate::types::serialize_int",
74 deserialize_with = "crate::types::deserialize_int"
75 )]
76 pub starttime: i64,
77 pub status: Status,
78 #[serde(rename = "type")]
79 pub ty: String,
80 pub upid: String,
81 pub user: String,
82 #[serde(
83 flatten,
84 default,
85 skip_serializing_if = "::std::collections::HashMap::is_empty"
86 )]
87 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
88}
89#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
90pub enum Status {
91 #[serde(rename = "running")]
92 Running,
93 #[serde(rename = "stopped")]
94 Stopped,
95}
96impl TryFrom<&str> for Status {
97 type Error = String;
98 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
99 match value {
100 "running" => Ok(Self::Running),
101 "stopped" => Ok(Self::Stopped),
102 v => Err(format!("Unknown variant {v}")),
103 }
104 }
105}