proxmox-api 0.2.0

Rust bindings for the Proxmox VE HTTP API
Documentation
#[derive(Debug, Clone)]
pub struct FlagClient<T> {
    client: T,
    path: String,
}
impl<T> FlagClient<T>
where
    T: crate::client::Client,
{
    pub fn new(client: T, parent_path: &str, flag: &str) -> Self {
        Self {
            client,
            path: format!("{}/{}", parent_path, flag),
        }
    }
}
impl<T> FlagClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Get the status of a specific ceph flag."]
    #[doc = ""]
    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
    pub async fn get(&self) -> Result<bool, T::Error> {
        let path = self.path.to_string();
        Ok(self
            .client
            .get::<_, crate::types::Bool>(&path, &())
            .await?
            .get())
    }
}
impl<T> FlagClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Set or clear (unset) a specific ceph flag"]
    #[doc = ""]
    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
    pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
        let path = self.path.to_string();
        self.client.put(&path, &params).await
    }
}
impl PutParams {
    pub fn new(value: bool) -> Self {
        Self {
            value,
            additional_properties: ::std::default::Default::default(),
        }
    }
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PutParams {
    #[serde(
        serialize_with = "crate::types::serialize_bool",
        deserialize_with = "crate::types::deserialize_bool"
    )]
    #[doc = "The new value of the flag"]
    #[doc = ""]
    pub value: bool,
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}