Skip to main content

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

1#[derive(Debug, Clone)]
2pub struct LvmthinClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> LvmthinClient<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, "/lvmthin"),
14        }
15    }
16}
17impl<T> LvmthinClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List local LVM Thin Pools."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/storage\", [\"Datastore.Allocate\"])"]
24    pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
25        let path = self.path.to_string();
26        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &params).await?;
27        Ok(optional_vec.unwrap_or_default())
28    }
29}
30impl GetOutputItems {
31    pub fn new(lv: String) -> Self {
32        Self {
33            lv,
34            additional_properties: ::std::default::Default::default(),
35        }
36    }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct GetOutputItems {
40    #[doc = "The LVM Thin Pool name (LVM logical volume)."]
41    #[doc = ""]
42    pub lv: String,
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 GetParams {
51    pub fn new(vg: VgStr) -> Self {
52        Self {
53            vg,
54            additional_properties: ::std::default::Default::default(),
55        }
56    }
57}
58#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
59pub struct GetParams {
60    pub vg: VgStr,
61    #[serde(
62        flatten,
63        default,
64        skip_serializing_if = "::std::collections::HashMap::is_empty"
65    )]
66    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68#[derive(Debug, Clone, PartialEq, PartialOrd)]
69pub struct VgStr {
70    value: String,
71}
72impl crate::types::bounded_string::BoundedString for VgStr {
73    const MIN_LENGTH: Option<usize> = None::<usize>;
74    const MAX_LENGTH: Option<usize> = Some(100usize);
75    const DEFAULT: Option<&'static str> = None::<&'static str>;
76    const PATTERN: Option<&'static str> = Some("[a-zA-Z0-9\\.\\+\\_][a-zA-Z0-9\\.\\+\\_\\-]+");
77    const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"[a-zA-Z0-9\\.\\+\\_][a-zA-Z0-9\\.\\+\\_\\-]+\" and length at most 100";
78    fn get_value(&self) -> &str {
79        &self.value
80    }
81    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
82        Self::validate(&value)?;
83        Ok(Self { value })
84    }
85}
86impl std::convert::TryFrom<String> for VgStr {
87    type Error = crate::types::bounded_string::BoundedStringError;
88    fn try_from(value: String) -> Result<Self, Self::Error> {
89        crate::types::bounded_string::BoundedString::new(value)
90    }
91}
92impl ::serde::Serialize for VgStr {
93    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
94    where
95        S: ::serde::Serializer,
96    {
97        crate::types::bounded_string::serialize_bounded_string(self, serializer)
98    }
99}
100impl<'de> ::serde::Deserialize<'de> for VgStr {
101    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
102    where
103        D: ::serde::Deserializer<'de>,
104    {
105        crate::types::bounded_string::deserialize_bounded_string(deserializer)
106    }
107}