Skip to main content

proxmox_api/generated/nodes/node/disks/
lvmthin.rs

1pub mod name;
2#[derive(Debug, Clone)]
3pub struct LvmthinClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> LvmthinClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}{}", parent_path, "/lvmthin"),
15        }
16    }
17}
18impl<T> LvmthinClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "List LVM thinpools"]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
25    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26        let path = self.path.to_string();
27        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28        Ok(optional_vec.unwrap_or_default())
29    }
30}
31impl<T> LvmthinClient<T>
32where
33    T: crate::client::Client,
34{
35    #[doc = "Create an LVM thinpool"]
36    #[doc = ""]
37    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
38    #[doc = "Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'"]
39    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
40        let path = self.path.to_string();
41        self.client.post(&path, &params).await
42    }
43}
44impl GetOutputItems {
45    pub fn new(
46        lv: String,
47        lv_size: i64,
48        metadata_size: i64,
49        metadata_used: i64,
50        used: i64,
51        vg: String,
52    ) -> Self {
53        Self {
54            lv,
55            lv_size,
56            metadata_size,
57            metadata_used,
58            used,
59            vg,
60            additional_properties: ::std::default::Default::default(),
61        }
62    }
63}
64#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
65pub struct GetOutputItems {
66    #[doc = "The name of the thinpool."]
67    #[doc = ""]
68    pub lv: String,
69    #[serde(
70        serialize_with = "crate::types::serialize_int",
71        deserialize_with = "crate::types::deserialize_int"
72    )]
73    #[doc = "The size of the thinpool in bytes."]
74    #[doc = ""]
75    pub lv_size: i64,
76    #[serde(
77        serialize_with = "crate::types::serialize_int",
78        deserialize_with = "crate::types::deserialize_int"
79    )]
80    #[doc = "The size of the metadata lv in bytes."]
81    #[doc = ""]
82    pub metadata_size: i64,
83    #[serde(
84        serialize_with = "crate::types::serialize_int",
85        deserialize_with = "crate::types::deserialize_int"
86    )]
87    #[doc = "The used bytes of the metadata lv."]
88    #[doc = ""]
89    pub metadata_used: i64,
90    #[serde(
91        serialize_with = "crate::types::serialize_int",
92        deserialize_with = "crate::types::deserialize_int"
93    )]
94    #[doc = "The used bytes of the thinpool."]
95    #[doc = ""]
96    pub used: i64,
97    #[doc = "The associated volume group."]
98    #[doc = ""]
99    pub vg: String,
100    #[serde(
101        flatten,
102        default,
103        skip_serializing_if = "::std::collections::HashMap::is_empty"
104    )]
105    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
106}
107impl PostParams {
108    pub fn new(device: String, name: String) -> Self {
109        Self {
110            device,
111            name,
112            add_storage: ::std::default::Default::default(),
113            additional_properties: ::std::default::Default::default(),
114        }
115    }
116}
117#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
118pub struct PostParams {
119    #[serde(
120        serialize_with = "crate::types::serialize_bool_optional",
121        deserialize_with = "crate::types::deserialize_bool_optional"
122    )]
123    #[serde(skip_serializing_if = "Option::is_none", default)]
124    #[doc = "Configure storage using the thinpool."]
125    #[doc = ""]
126    pub add_storage: Option<bool>,
127    #[doc = "The block device you want to create the thinpool on."]
128    #[doc = ""]
129    pub device: String,
130    #[doc = "The storage identifier."]
131    #[doc = ""]
132    pub name: String,
133    #[serde(
134        flatten,
135        default,
136        skip_serializing_if = "::std::collections::HashMap::is_empty"
137    )]
138    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
139}
140impl<T> LvmthinClient<T>
141where
142    T: crate::client::Client,
143{
144    pub fn name(&self, name: &str) -> name::NameClient<T> {
145        name::NameClient::<T>::new(self.client.clone(), &self.path, name)
146    }
147}