Skip to main content

proxmox_api/generated/cluster/ceph/
flags.rs

1pub mod flag;
2#[derive(Debug, Clone)]
3pub struct FlagsClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> FlagsClient<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, "/flags"),
15        }
16    }
17}
18impl<T> FlagsClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "get the status of all ceph flags"]
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> FlagsClient<T>
32where
33    T: crate::client::Client,
34{
35    #[doc = "Set/Unset multiple ceph flags at once."]
36    #[doc = ""]
37    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
38    pub async fn put(&self, params: PutParams) -> Result<String, T::Error> {
39        let path = self.path.to_string();
40        self.client.put(&path, &params).await
41    }
42}
43impl GetOutputItems {
44    pub fn new(description: String, name: Name, value: bool) -> Self {
45        Self {
46            description,
47            name,
48            value,
49            additional_properties: ::std::default::Default::default(),
50        }
51    }
52}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
54pub struct GetOutputItems {
55    #[doc = "Flag description."]
56    #[doc = ""]
57    pub description: String,
58    #[doc = "Flag name."]
59    #[doc = ""]
60    pub name: Name,
61    #[serde(
62        serialize_with = "crate::types::serialize_bool",
63        deserialize_with = "crate::types::deserialize_bool"
64    )]
65    #[doc = "Flag value."]
66    #[doc = ""]
67    pub value: bool,
68    #[serde(
69        flatten,
70        default,
71        skip_serializing_if = "::std::collections::HashMap::is_empty"
72    )]
73    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
74}
75#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
76pub struct PutParams {
77    #[serde(
78        serialize_with = "crate::types::serialize_bool_optional",
79        deserialize_with = "crate::types::deserialize_bool_optional"
80    )]
81    #[serde(skip_serializing_if = "Option::is_none", default)]
82    #[doc = "Backfilling of PGs is suspended."]
83    #[doc = ""]
84    pub nobackfill: Option<bool>,
85    #[serde(rename = "nodeep-scrub")]
86    #[serde(
87        serialize_with = "crate::types::serialize_bool_optional",
88        deserialize_with = "crate::types::deserialize_bool_optional"
89    )]
90    #[serde(skip_serializing_if = "Option::is_none", default)]
91    #[doc = "Deep Scrubbing is disabled."]
92    #[doc = ""]
93    pub nodeep_scrub: Option<bool>,
94    #[serde(
95        serialize_with = "crate::types::serialize_bool_optional",
96        deserialize_with = "crate::types::deserialize_bool_optional"
97    )]
98    #[serde(skip_serializing_if = "Option::is_none", default)]
99    #[doc = "OSD failure reports are being ignored, such that the monitors will not mark OSDs down."]
100    #[doc = ""]
101    pub nodown: Option<bool>,
102    #[serde(
103        serialize_with = "crate::types::serialize_bool_optional",
104        deserialize_with = "crate::types::deserialize_bool_optional"
105    )]
106    #[serde(skip_serializing_if = "Option::is_none", default)]
107    #[doc = "OSDs that were previously marked out will not be marked back in when they start."]
108    #[doc = ""]
109    pub noin: Option<bool>,
110    #[serde(
111        serialize_with = "crate::types::serialize_bool_optional",
112        deserialize_with = "crate::types::deserialize_bool_optional"
113    )]
114    #[serde(skip_serializing_if = "Option::is_none", default)]
115    #[doc = "OSDs will not automatically be marked out after the configured interval."]
116    #[doc = ""]
117    pub noout: Option<bool>,
118    #[serde(
119        serialize_with = "crate::types::serialize_bool_optional",
120        deserialize_with = "crate::types::deserialize_bool_optional"
121    )]
122    #[serde(skip_serializing_if = "Option::is_none", default)]
123    #[doc = "Rebalancing of PGs is suspended."]
124    #[doc = ""]
125    pub norebalance: Option<bool>,
126    #[serde(
127        serialize_with = "crate::types::serialize_bool_optional",
128        deserialize_with = "crate::types::deserialize_bool_optional"
129    )]
130    #[serde(skip_serializing_if = "Option::is_none", default)]
131    #[doc = "Recovery of PGs is suspended."]
132    #[doc = ""]
133    pub norecover: Option<bool>,
134    #[serde(
135        serialize_with = "crate::types::serialize_bool_optional",
136        deserialize_with = "crate::types::deserialize_bool_optional"
137    )]
138    #[serde(skip_serializing_if = "Option::is_none", default)]
139    #[doc = "Scrubbing is disabled."]
140    #[doc = ""]
141    pub noscrub: Option<bool>,
142    #[serde(
143        serialize_with = "crate::types::serialize_bool_optional",
144        deserialize_with = "crate::types::deserialize_bool_optional"
145    )]
146    #[serde(skip_serializing_if = "Option::is_none", default)]
147    #[doc = "Cache tiering activity is suspended."]
148    #[doc = ""]
149    pub notieragent: Option<bool>,
150    #[serde(
151        serialize_with = "crate::types::serialize_bool_optional",
152        deserialize_with = "crate::types::deserialize_bool_optional"
153    )]
154    #[serde(skip_serializing_if = "Option::is_none", default)]
155    #[doc = "OSDs are not allowed to start."]
156    #[doc = ""]
157    pub noup: Option<bool>,
158    #[serde(
159        serialize_with = "crate::types::serialize_bool_optional",
160        deserialize_with = "crate::types::deserialize_bool_optional"
161    )]
162    #[serde(skip_serializing_if = "Option::is_none", default)]
163    #[doc = "Pauses read and writes."]
164    #[doc = ""]
165    pub pause: Option<bool>,
166    #[serde(
167        flatten,
168        default,
169        skip_serializing_if = "::std::collections::HashMap::is_empty"
170    )]
171    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
172}
173#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
174#[doc = "Flag name."]
175#[doc = ""]
176pub enum Name {
177    #[serde(rename = "nobackfill")]
178    Nobackfill,
179    #[serde(rename = "nodeep-scrub")]
180    NodeepScrub,
181    #[serde(rename = "nodown")]
182    Nodown,
183    #[serde(rename = "noin")]
184    Noin,
185    #[serde(rename = "noout")]
186    Noout,
187    #[serde(rename = "norebalance")]
188    Norebalance,
189    #[serde(rename = "norecover")]
190    Norecover,
191    #[serde(rename = "noscrub")]
192    Noscrub,
193    #[serde(rename = "notieragent")]
194    Notieragent,
195    #[serde(rename = "noup")]
196    Noup,
197    #[serde(rename = "pause")]
198    Pause,
199}
200impl TryFrom<&str> for Name {
201    type Error = String;
202    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
203        match value {
204            "nobackfill" => Ok(Self::Nobackfill),
205            "nodeep-scrub" => Ok(Self::NodeepScrub),
206            "nodown" => Ok(Self::Nodown),
207            "noin" => Ok(Self::Noin),
208            "noout" => Ok(Self::Noout),
209            "norebalance" => Ok(Self::Norebalance),
210            "norecover" => Ok(Self::Norecover),
211            "noscrub" => Ok(Self::Noscrub),
212            "notieragent" => Ok(Self::Notieragent),
213            "noup" => Ok(Self::Noup),
214            "pause" => Ok(Self::Pause),
215            v => Err(format!("Unknown variant {v}")),
216        }
217    }
218}
219impl<T> FlagsClient<T>
220where
221    T: crate::client::Client,
222{
223    pub fn flag(&self, flag: &str) -> flag::FlagClient<T> {
224        flag::FlagClient::<T>::new(self.client.clone(), &self.path, flag)
225    }
226}