Skip to main content

proxmox_api/generated/nodes/node/tasks/
upid.rs

1pub mod log;
2pub mod status;
3#[derive(Debug, Clone)]
4pub struct UpidClient<T> {
5    client: T,
6    path: String,
7}
8impl<T> UpidClient<T>
9where
10    T: crate::client::Client,
11{
12    pub fn new(client: T, parent_path: &str, upid: &str) -> Self {
13        Self {
14            client,
15            path: format!("{}/{}", parent_path, upid),
16        }
17    }
18}
19impl<T> UpidClient<T>
20where
21    T: crate::client::Client,
22{
23    #[doc = "Stop a task."]
24    #[doc = ""]
25    #[doc = "The user needs 'Sys.Modify' permissions on '/nodes/\\<node\\>' if they aren't the owner of the task."]
26    pub async fn delete(&self) -> Result<(), T::Error> {
27        let path = self.path.to_string();
28        self.client.delete(&path, &()).await
29    }
30}
31impl<T> UpidClient<T>
32where
33    T: crate::client::Client,
34{
35    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
36        let path = self.path.to_string();
37        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
38        Ok(optional_vec.unwrap_or_default())
39    }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
42pub struct GetOutputItems {
43    #[serde(
44        flatten,
45        default,
46        skip_serializing_if = "::std::collections::HashMap::is_empty"
47    )]
48    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
49}
50impl<T> UpidClient<T>
51where
52    T: crate::client::Client,
53{
54    pub fn log(&self) -> log::LogClient<T> {
55        log::LogClient::<T>::new(self.client.clone(), &self.path)
56    }
57}
58impl<T> UpidClient<T>
59where
60    T: crate::client::Client,
61{
62    pub fn status(&self) -> status::StatusClient<T> {
63        status::StatusClient::<T>::new(self.client.clone(), &self.path)
64    }
65}