Skip to main content

proxmox_api/generated/nodes/node/storage/
storage.rs

1pub mod content;
2pub mod download_url;
3pub mod file_restore;
4pub mod import_metadata;
5pub mod oci_registry_pull;
6pub mod prunebackups;
7pub mod rrd;
8pub mod rrddata;
9pub mod status;
10pub mod upload;
11#[derive(Debug, Clone)]
12pub struct StorageClient<T> {
13    client: T,
14    path: String,
15}
16impl<T> StorageClient<T>
17where
18    T: crate::client::Client,
19{
20    pub fn new(client: T, parent_path: &str, storage: &str) -> Self {
21        Self {
22            client,
23            path: format!("{}/{}", parent_path, storage),
24        }
25    }
26}
27impl<T> StorageClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Permission check: perm(\"/storage/{storage}\", [\"Datastore.Audit\", \"Datastore.AllocateSpace\"], any)"]
32    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
33        let path = self.path.to_string();
34        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
35        Ok(optional_vec.unwrap_or_default())
36    }
37}
38impl GetOutputItems {
39    pub fn new(subdir: String) -> Self {
40        Self {
41            subdir,
42            additional_properties: ::std::default::Default::default(),
43        }
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
47pub struct GetOutputItems {
48    pub subdir: String,
49    #[serde(
50        flatten,
51        default,
52        skip_serializing_if = "::std::collections::HashMap::is_empty"
53    )]
54    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
55}
56impl<T> StorageClient<T>
57where
58    T: crate::client::Client,
59{
60    pub fn prunebackups(&self) -> prunebackups::PrunebackupsClient<T> {
61        prunebackups::PrunebackupsClient::<T>::new(self.client.clone(), &self.path)
62    }
63}
64impl<T> StorageClient<T>
65where
66    T: crate::client::Client,
67{
68    pub fn content(&self) -> content::ContentClient<T> {
69        content::ContentClient::<T>::new(self.client.clone(), &self.path)
70    }
71}
72impl<T> StorageClient<T>
73where
74    T: crate::client::Client,
75{
76    pub fn file_restore(&self) -> file_restore::FileRestoreClient<T> {
77        file_restore::FileRestoreClient::<T>::new(self.client.clone(), &self.path)
78    }
79}
80impl<T> StorageClient<T>
81where
82    T: crate::client::Client,
83{
84    pub fn status(&self) -> status::StatusClient<T> {
85        status::StatusClient::<T>::new(self.client.clone(), &self.path)
86    }
87}
88impl<T> StorageClient<T>
89where
90    T: crate::client::Client,
91{
92    pub fn rrd(&self) -> rrd::RrdClient<T> {
93        rrd::RrdClient::<T>::new(self.client.clone(), &self.path)
94    }
95}
96impl<T> StorageClient<T>
97where
98    T: crate::client::Client,
99{
100    pub fn rrddata(&self) -> rrddata::RrddataClient<T> {
101        rrddata::RrddataClient::<T>::new(self.client.clone(), &self.path)
102    }
103}
104impl<T> StorageClient<T>
105where
106    T: crate::client::Client,
107{
108    pub fn upload(&self) -> upload::UploadClient<T> {
109        upload::UploadClient::<T>::new(self.client.clone(), &self.path)
110    }
111}
112impl<T> StorageClient<T>
113where
114    T: crate::client::Client,
115{
116    pub fn download_url(&self) -> download_url::DownloadUrlClient<T> {
117        download_url::DownloadUrlClient::<T>::new(self.client.clone(), &self.path)
118    }
119}
120impl<T> StorageClient<T>
121where
122    T: crate::client::Client,
123{
124    pub fn oci_registry_pull(&self) -> oci_registry_pull::OciRegistryPullClient<T> {
125        oci_registry_pull::OciRegistryPullClient::<T>::new(self.client.clone(), &self.path)
126    }
127}
128impl<T> StorageClient<T>
129where
130    T: crate::client::Client,
131{
132    pub fn import_metadata(&self) -> import_metadata::ImportMetadataClient<T> {
133        import_metadata::ImportMetadataClient::<T>::new(self.client.clone(), &self.path)
134    }
135}