proxmox-api 0.2.0

Rust bindings for the Proxmox VE HTTP API
Documentation
#[derive(Debug, Clone)]
pub struct LvInfoClient<T> {
    client: T,
    path: String,
}
impl<T> LvInfoClient<T>
where
    T: crate::client::Client,
{
    pub fn new(client: T, parent_path: &str) -> Self {
        Self {
            client,
            path: format!("{}{}", parent_path, "/lv-info"),
        }
    }
}
impl<T> LvInfoClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Get OSD volume details"]
    #[doc = ""]
    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"], any)"]
    pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
        let path = self.path.to_string();
        self.client.get(&path, &params).await
    }
}
impl GetOutput {
    pub fn new(
        creation_time: String,
        lv_name: String,
        lv_path: String,
        lv_size: i64,
        lv_uuid: String,
        vg_name: String,
    ) -> Self {
        Self {
            creation_time,
            lv_name,
            lv_path,
            lv_size,
            lv_uuid,
            vg_name,
            additional_properties: ::std::default::Default::default(),
        }
    }
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct GetOutput {
    #[doc = "Creation time as reported by `lvs`."]
    #[doc = ""]
    pub creation_time: String,
    #[doc = "Name of the logical volume (LV)."]
    #[doc = ""]
    pub lv_name: String,
    #[doc = "Path to the logical volume (LV)."]
    #[doc = ""]
    pub lv_path: String,
    #[serde(
        serialize_with = "crate::types::serialize_int",
        deserialize_with = "crate::types::deserialize_int"
    )]
    #[doc = "Size of the logical volume (LV)."]
    #[doc = ""]
    pub lv_size: i64,
    #[doc = "UUID of the logical volume (LV)."]
    #[doc = ""]
    pub lv_uuid: String,
    #[doc = "Name of the volume group (VG)."]
    #[doc = ""]
    pub vg_name: String,
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct GetParams {
    #[serde(rename = "type")]
    #[serde(skip_serializing_if = "Option::is_none", default)]
    #[doc = "OSD device type"]
    #[doc = ""]
    pub ty: Option<Type>,
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
#[doc = "OSD device type"]
#[doc = ""]
pub enum Type {
    #[serde(rename = "block")]
    #[default]
    Block,
    #[serde(rename = "db")]
    Db,
    #[serde(rename = "wal")]
    Wal,
}
impl TryFrom<&str> for Type {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
        match value {
            "block" => Ok(Self::Block),
            "db" => Ok(Self::Db),
            "wal" => Ok(Self::Wal),
            v => Err(format!("Unknown variant {v}")),
        }
    }
}