Skip to main content

proxmox_api/generated/cluster/ceph/flags/
flag.rs

1#[derive(Debug, Clone)]
2pub struct FlagClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> FlagClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str, flag: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}/{}", parent_path, flag),
14        }
15    }
16}
17impl<T> FlagClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get the status of a specific ceph flag."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
24    pub async fn get(&self) -> Result<bool, T::Error> {
25        let path = self.path.to_string();
26        Ok(self
27            .client
28            .get::<_, crate::types::Bool>(&path, &())
29            .await?
30            .get())
31    }
32}
33impl<T> FlagClient<T>
34where
35    T: crate::client::Client,
36{
37    #[doc = "Set or clear (unset) a specific ceph flag"]
38    #[doc = ""]
39    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
40    pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
41        let path = self.path.to_string();
42        self.client.put(&path, &params).await
43    }
44}
45impl PutParams {
46    pub fn new(value: bool) -> Self {
47        Self {
48            value,
49            additional_properties: ::std::default::Default::default(),
50        }
51    }
52}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
54pub struct PutParams {
55    #[serde(
56        serialize_with = "crate::types::serialize_bool",
57        deserialize_with = "crate::types::deserialize_bool"
58    )]
59    #[doc = "The new value of the flag"]
60    #[doc = ""]
61    pub value: bool,
62    #[serde(
63        flatten,
64        default,
65        skip_serializing_if = "::std::collections::HashMap::is_empty"
66    )]
67    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
68}