1#[derive(Debug, Clone)]
2pub struct StatusClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> StatusClient<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, "/status"),
14 }
15 }
16}
17impl<T> StatusClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Show the current pool status."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\", \"Datastore.Audit\"], any)"]
24 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25 let path = self.path.to_string();
26 self.client.get(&path, ¶ms).await
27 }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct AutoscaleStatusGetOutputAutoscaleStatus {
31 #[serde(
32 flatten,
33 default,
34 skip_serializing_if = "::std::collections::HashMap::is_empty"
35 )]
36 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
37}
38impl GetOutput {
39 pub fn new(
40 fast_read: bool,
41 hashpspool: bool,
42 id: i64,
43 name: NameStr,
44 nodeep_scrub: bool,
45 nodelete: bool,
46 nopgchange: bool,
47 noscrub: bool,
48 nosizechange: bool,
49 pgp_num: i64,
50 use_gmt_hitset: bool,
51 write_fadvise_dontneed: bool,
52 ) -> Self {
53 Self {
54 fast_read,
55 hashpspool,
56 id,
57 name,
58 nodeep_scrub,
59 nodelete,
60 nopgchange,
61 noscrub,
62 nosizechange,
63 pgp_num,
64 use_gmt_hitset,
65 write_fadvise_dontneed,
66 application: ::std::default::Default::default(),
67 autoscale_status: ::std::default::Default::default(),
68 crush_rule: ::std::default::Default::default(),
69 min_size: ::std::default::Default::default(),
70 pg_autoscale_mode: ::std::default::Default::default(),
71 pg_num: ::std::default::Default::default(),
72 pg_num_min: ::std::default::Default::default(),
73 size: ::std::default::Default::default(),
74 statistics: ::std::default::Default::default(),
75 target_size: ::std::default::Default::default(),
76 target_size_ratio: ::std::default::Default::default(),
77 additional_properties: ::std::default::Default::default(),
78 }
79 }
80}
81#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
82pub struct GetOutput {
83 #[serde(skip_serializing_if = "Option::is_none", default)]
84 #[doc = "The application of the pool."]
85 #[doc = ""]
86 pub application: Option<Application>,
87 #[serde(skip_serializing_if = "Option::is_none", default)]
88 pub autoscale_status: Option<AutoscaleStatusGetOutputAutoscaleStatus>,
89 #[serde(skip_serializing_if = "Option::is_none", default)]
90 #[doc = "The rule to use for mapping object placement in the cluster."]
91 #[doc = ""]
92 pub crush_rule: Option<String>,
93 #[serde(
94 serialize_with = "crate::types::serialize_bool",
95 deserialize_with = "crate::types::deserialize_bool"
96 )]
97 pub fast_read: bool,
98 #[serde(
99 serialize_with = "crate::types::serialize_bool",
100 deserialize_with = "crate::types::deserialize_bool"
101 )]
102 pub hashpspool: bool,
103 #[serde(
104 serialize_with = "crate::types::serialize_int",
105 deserialize_with = "crate::types::deserialize_int"
106 )]
107 pub id: i64,
108 #[serde(skip_serializing_if = "Option::is_none", default)]
109 #[doc = "Minimum number of replicas per object"]
110 #[doc = ""]
111 pub min_size: Option<MinSizeInt>,
112 #[doc = "The name of the pool. It must be unique."]
113 #[doc = ""]
114 pub name: NameStr,
115 #[serde(rename = "nodeep-scrub")]
116 #[serde(
117 serialize_with = "crate::types::serialize_bool",
118 deserialize_with = "crate::types::deserialize_bool"
119 )]
120 pub nodeep_scrub: bool,
121 #[serde(
122 serialize_with = "crate::types::serialize_bool",
123 deserialize_with = "crate::types::deserialize_bool"
124 )]
125 pub nodelete: bool,
126 #[serde(
127 serialize_with = "crate::types::serialize_bool",
128 deserialize_with = "crate::types::deserialize_bool"
129 )]
130 pub nopgchange: bool,
131 #[serde(
132 serialize_with = "crate::types::serialize_bool",
133 deserialize_with = "crate::types::deserialize_bool"
134 )]
135 pub noscrub: bool,
136 #[serde(
137 serialize_with = "crate::types::serialize_bool",
138 deserialize_with = "crate::types::deserialize_bool"
139 )]
140 pub nosizechange: bool,
141 #[serde(skip_serializing_if = "Option::is_none", default)]
142 #[doc = "The automatic PG scaling mode of the pool."]
143 #[doc = ""]
144 pub pg_autoscale_mode: Option<PgAutoscaleMode>,
145 #[serde(skip_serializing_if = "Option::is_none", default)]
146 #[doc = "Number of placement groups."]
147 #[doc = ""]
148 pub pg_num: Option<PgNumInt>,
149 #[serde(skip_serializing_if = "Option::is_none", default)]
150 #[doc = "Minimal number of placement groups."]
151 #[doc = ""]
152 pub pg_num_min: Option<PgNumMinInt>,
153 #[serde(
154 serialize_with = "crate::types::serialize_int",
155 deserialize_with = "crate::types::deserialize_int"
156 )]
157 pub pgp_num: i64,
158 #[serde(skip_serializing_if = "Option::is_none", default)]
159 #[doc = "Number of replicas per object"]
160 #[doc = ""]
161 pub size: Option<SizeInt>,
162 #[serde(skip_serializing_if = "Option::is_none", default)]
163 pub statistics: Option<StatisticsGetOutputStatistics>,
164 #[serde(skip_serializing_if = "Option::is_none", default)]
165 #[doc = "The estimated target size of the pool for the PG autoscaler."]
166 #[doc = ""]
167 pub target_size: Option<TargetSizeStr>,
168 #[serde(
169 serialize_with = "crate::types::serialize_number_optional",
170 deserialize_with = "crate::types::deserialize_number_optional"
171 )]
172 #[serde(skip_serializing_if = "Option::is_none", default)]
173 #[doc = "The estimated target ratio of the pool for the PG autoscaler."]
174 #[doc = ""]
175 pub target_size_ratio: Option<f64>,
176 #[serde(
177 serialize_with = "crate::types::serialize_bool",
178 deserialize_with = "crate::types::deserialize_bool"
179 )]
180 pub use_gmt_hitset: bool,
181 #[serde(
182 serialize_with = "crate::types::serialize_bool",
183 deserialize_with = "crate::types::deserialize_bool"
184 )]
185 pub write_fadvise_dontneed: bool,
186 #[serde(
187 flatten,
188 default,
189 skip_serializing_if = "::std::collections::HashMap::is_empty"
190 )]
191 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
192}
193#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
194pub struct GetParams {
195 #[serde(
196 serialize_with = "crate::types::serialize_bool_optional",
197 deserialize_with = "crate::types::deserialize_bool_optional"
198 )]
199 #[serde(skip_serializing_if = "Option::is_none", default)]
200 #[doc = "If enabled, will display additional data(eg. statistics)."]
201 #[doc = ""]
202 pub verbose: Option<bool>,
203 #[serde(
204 flatten,
205 default,
206 skip_serializing_if = "::std::collections::HashMap::is_empty"
207 )]
208 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
209}
210#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
211pub struct StatisticsGetOutputStatistics {
212 #[serde(
213 flatten,
214 default,
215 skip_serializing_if = "::std::collections::HashMap::is_empty"
216 )]
217 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
218}
219#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
220#[doc = "The application of the pool."]
221#[doc = ""]
222pub enum Application {
223 #[serde(rename = "cephfs")]
224 Cephfs,
225 #[serde(rename = "rbd")]
226 #[default]
227 Rbd,
228 #[serde(rename = "rgw")]
229 Rgw,
230}
231impl TryFrom<&str> for Application {
232 type Error = String;
233 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
234 match value {
235 "cephfs" => Ok(Self::Cephfs),
236 "rbd" => Ok(Self::Rbd),
237 "rgw" => Ok(Self::Rgw),
238 v => Err(format!("Unknown variant {v}")),
239 }
240 }
241}
242#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
243#[doc = "The automatic PG scaling mode of the pool."]
244#[doc = ""]
245pub enum PgAutoscaleMode {
246 #[serde(rename = "off")]
247 Off,
248 #[serde(rename = "on")]
249 On,
250 #[serde(rename = "warn")]
251 #[default]
252 Warn,
253}
254impl TryFrom<&str> for PgAutoscaleMode {
255 type Error = String;
256 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
257 match value {
258 "off" => Ok(Self::Off),
259 "on" => Ok(Self::On),
260 "warn" => Ok(Self::Warn),
261 v => Err(format!("Unknown variant {v}")),
262 }
263 }
264}
265#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
266pub struct MinSizeInt(i128);
267impl crate::types::bounded_integer::BoundedInteger for MinSizeInt {
268 const MIN: Option<i128> = Some(1i128);
269 const MAX: Option<i128> = Some(7i128);
270 const DEFAULT: Option<i128> = Some(2i128);
271 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 7";
272 fn get(&self) -> i128 {
273 self.0
274 }
275 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
276 Self::validate(value)?;
277 Ok(Self(value))
278 }
279}
280impl std::convert::TryFrom<i128> for MinSizeInt {
281 type Error = crate::types::bounded_integer::BoundedIntegerError;
282 fn try_from(value: i128) -> Result<Self, Self::Error> {
283 crate::types::bounded_integer::BoundedInteger::new(value)
284 }
285}
286impl ::serde::Serialize for MinSizeInt {
287 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
288 where
289 S: ::serde::Serializer,
290 {
291 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
292 }
293}
294impl<'de> ::serde::Deserialize<'de> for MinSizeInt {
295 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
296 where
297 D: ::serde::Deserializer<'de>,
298 {
299 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
300 }
301}
302#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
303pub struct PgNumInt(i128);
304impl crate::types::bounded_integer::BoundedInteger for PgNumInt {
305 const MIN: Option<i128> = Some(1i128);
306 const MAX: Option<i128> = Some(32768i128);
307 const DEFAULT: Option<i128> = Some(128i128);
308 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 32768";
309 fn get(&self) -> i128 {
310 self.0
311 }
312 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
313 Self::validate(value)?;
314 Ok(Self(value))
315 }
316}
317impl std::convert::TryFrom<i128> for PgNumInt {
318 type Error = crate::types::bounded_integer::BoundedIntegerError;
319 fn try_from(value: i128) -> Result<Self, Self::Error> {
320 crate::types::bounded_integer::BoundedInteger::new(value)
321 }
322}
323impl ::serde::Serialize for PgNumInt {
324 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
325 where
326 S: ::serde::Serializer,
327 {
328 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
329 }
330}
331impl<'de> ::serde::Deserialize<'de> for PgNumInt {
332 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
333 where
334 D: ::serde::Deserializer<'de>,
335 {
336 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
337 }
338}
339#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
340pub struct PgNumMinInt(i128);
341impl crate::types::bounded_integer::BoundedInteger for PgNumMinInt {
342 const MIN: Option<i128> = None::<i128>;
343 const MAX: Option<i128> = Some(32768i128);
344 const DEFAULT: Option<i128> = None::<i128>;
345 const TYPE_DESCRIPTION: &'static str = "an integer less than or equal to 32768";
346 fn get(&self) -> i128 {
347 self.0
348 }
349 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
350 Self::validate(value)?;
351 Ok(Self(value))
352 }
353}
354impl std::convert::TryFrom<i128> for PgNumMinInt {
355 type Error = crate::types::bounded_integer::BoundedIntegerError;
356 fn try_from(value: i128) -> Result<Self, Self::Error> {
357 crate::types::bounded_integer::BoundedInteger::new(value)
358 }
359}
360impl ::serde::Serialize for PgNumMinInt {
361 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
362 where
363 S: ::serde::Serializer,
364 {
365 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
366 }
367}
368impl<'de> ::serde::Deserialize<'de> for PgNumMinInt {
369 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
370 where
371 D: ::serde::Deserializer<'de>,
372 {
373 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
374 }
375}
376#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
377pub struct SizeInt(i128);
378impl crate::types::bounded_integer::BoundedInteger for SizeInt {
379 const MIN: Option<i128> = Some(1i128);
380 const MAX: Option<i128> = Some(7i128);
381 const DEFAULT: Option<i128> = Some(3i128);
382 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 7";
383 fn get(&self) -> i128 {
384 self.0
385 }
386 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
387 Self::validate(value)?;
388 Ok(Self(value))
389 }
390}
391impl std::convert::TryFrom<i128> for SizeInt {
392 type Error = crate::types::bounded_integer::BoundedIntegerError;
393 fn try_from(value: i128) -> Result<Self, Self::Error> {
394 crate::types::bounded_integer::BoundedInteger::new(value)
395 }
396}
397impl ::serde::Serialize for SizeInt {
398 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
399 where
400 S: ::serde::Serializer,
401 {
402 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
403 }
404}
405impl<'de> ::serde::Deserialize<'de> for SizeInt {
406 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
407 where
408 D: ::serde::Deserializer<'de>,
409 {
410 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
411 }
412}
413#[derive(Debug, Clone, PartialEq, PartialOrd)]
414pub struct NameStr {
415 value: String,
416}
417impl crate::types::bounded_string::BoundedString for NameStr {
418 const MIN_LENGTH: Option<usize> = None::<usize>;
419 const MAX_LENGTH: Option<usize> = None::<usize>;
420 const DEFAULT: Option<&'static str> = None::<&'static str>;
421 const PATTERN: Option<&'static str> = Some("(?^:^[^:/\\s]+$)");
422 const TYPE_DESCRIPTION: &'static str =
423 "a string with pattern r\"(?^:^[^:/\\s]+$)\" and no length constraints";
424 fn get_value(&self) -> &str {
425 &self.value
426 }
427 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
428 Self::validate(&value)?;
429 Ok(Self { value })
430 }
431}
432impl std::convert::TryFrom<String> for NameStr {
433 type Error = crate::types::bounded_string::BoundedStringError;
434 fn try_from(value: String) -> Result<Self, Self::Error> {
435 crate::types::bounded_string::BoundedString::new(value)
436 }
437}
438impl ::serde::Serialize for NameStr {
439 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
440 where
441 S: ::serde::Serializer,
442 {
443 crate::types::bounded_string::serialize_bounded_string(self, serializer)
444 }
445}
446impl<'de> ::serde::Deserialize<'de> for NameStr {
447 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
448 where
449 D: ::serde::Deserializer<'de>,
450 {
451 crate::types::bounded_string::deserialize_bounded_string(deserializer)
452 }
453}
454#[derive(Debug, Clone, PartialEq, PartialOrd)]
455pub struct TargetSizeStr {
456 value: String,
457}
458impl crate::types::bounded_string::BoundedString for TargetSizeStr {
459 const MIN_LENGTH: Option<usize> = None::<usize>;
460 const MAX_LENGTH: Option<usize> = None::<usize>;
461 const DEFAULT: Option<&'static str> = None::<&'static str>;
462 const PATTERN: Option<&'static str> = Some("^(\\d+(\\.\\d+)?)([KMGT])?$");
463 const TYPE_DESCRIPTION: &'static str =
464 "a string with pattern r\"^(\\d+(\\.\\d+)?)([KMGT])?$\" and no length constraints";
465 fn get_value(&self) -> &str {
466 &self.value
467 }
468 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
469 Self::validate(&value)?;
470 Ok(Self { value })
471 }
472}
473impl std::convert::TryFrom<String> for TargetSizeStr {
474 type Error = crate::types::bounded_string::BoundedStringError;
475 fn try_from(value: String) -> Result<Self, Self::Error> {
476 crate::types::bounded_string::BoundedString::new(value)
477 }
478}
479impl ::serde::Serialize for TargetSizeStr {
480 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
481 where
482 S: ::serde::Serializer,
483 {
484 crate::types::bounded_string::serialize_bounded_string(self, serializer)
485 }
486}
487impl<'de> ::serde::Deserialize<'de> for TargetSizeStr {
488 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
489 where
490 D: ::serde::Deserializer<'de>,
491 {
492 crate::types::bounded_string::deserialize_bounded_string(deserializer)
493 }
494}