Skip to main content

proxmox_api/generated/nodes/node/services/
service.rs

1pub mod reload;
2pub mod restart;
3pub mod start;
4pub mod state;
5pub mod stop;
6#[derive(Debug, Clone)]
7pub struct ServiceClient<T> {
8    client: T,
9    path: String,
10}
11impl<T> ServiceClient<T>
12where
13    T: crate::client::Client,
14{
15    pub fn new(client: T, parent_path: &str, service: &str) -> Self {
16        Self {
17            client,
18            path: format!("{}/{}", parent_path, service),
19        }
20    }
21}
22impl<T> ServiceClient<T>
23where
24    T: crate::client::Client,
25{
26    #[doc = "Directory index"]
27    #[doc = ""]
28    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Audit\"])"]
29    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
30        let path = self.path.to_string();
31        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
32        Ok(optional_vec.unwrap_or_default())
33    }
34}
35impl GetOutputItems {
36    pub fn new(subdir: String) -> Self {
37        Self {
38            subdir,
39            additional_properties: ::std::default::Default::default(),
40        }
41    }
42}
43#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
44pub struct GetOutputItems {
45    pub subdir: String,
46    #[serde(
47        flatten,
48        default,
49        skip_serializing_if = "::std::collections::HashMap::is_empty"
50    )]
51    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
52}
53impl<T> ServiceClient<T>
54where
55    T: crate::client::Client,
56{
57    pub fn state(&self) -> state::StateClient<T> {
58        state::StateClient::<T>::new(self.client.clone(), &self.path)
59    }
60}
61impl<T> ServiceClient<T>
62where
63    T: crate::client::Client,
64{
65    pub fn start(&self) -> start::StartClient<T> {
66        start::StartClient::<T>::new(self.client.clone(), &self.path)
67    }
68}
69impl<T> ServiceClient<T>
70where
71    T: crate::client::Client,
72{
73    pub fn stop(&self) -> stop::StopClient<T> {
74        stop::StopClient::<T>::new(self.client.clone(), &self.path)
75    }
76}
77impl<T> ServiceClient<T>
78where
79    T: crate::client::Client,
80{
81    pub fn restart(&self) -> restart::RestartClient<T> {
82        restart::RestartClient::<T>::new(self.client.clone(), &self.path)
83    }
84}
85impl<T> ServiceClient<T>
86where
87    T: crate::client::Client,
88{
89    pub fn reload(&self) -> reload::ReloadClient<T> {
90        reload::ReloadClient::<T>::new(self.client.clone(), &self.path)
91    }
92}