Skip to main content

proxmox_api/generated/nodes/node/ceph/fs/
name.rs

1#[derive(Debug, Clone)]
2pub struct NameClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> NameClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str, name: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}/{}", parent_path, name),
14        }
15    }
16}
17impl<T> NameClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Create a Ceph filesystem"]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
24    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
25        let path = self.path.to_string();
26        self.client.post(&path, &params).await
27    }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct PostParams {
31    #[serde(rename = "add-storage")]
32    #[serde(
33        serialize_with = "crate::types::serialize_bool_optional",
34        deserialize_with = "crate::types::deserialize_bool_optional"
35    )]
36    #[serde(skip_serializing_if = "Option::is_none", default)]
37    #[doc = "Configure the created CephFS as storage for this cluster."]
38    #[doc = ""]
39    pub add_storage: Option<bool>,
40    #[serde(skip_serializing_if = "Option::is_none", default)]
41    #[doc = "Number of placement groups for the backing data pool. The metadata pool will use a quarter of this."]
42    #[doc = ""]
43    pub pg_num: Option<PgNumInt>,
44    #[serde(
45        flatten,
46        default,
47        skip_serializing_if = "::std::collections::HashMap::is_empty"
48    )]
49    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
50}
51#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
52pub struct PgNumInt(i128);
53impl crate::types::bounded_integer::BoundedInteger for PgNumInt {
54    const MIN: Option<i128> = Some(8i128);
55    const MAX: Option<i128> = Some(32768i128);
56    const DEFAULT: Option<i128> = Some(128i128);
57    const TYPE_DESCRIPTION: &'static str = "an integer between 8 and 32768";
58    fn get(&self) -> i128 {
59        self.0
60    }
61    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
62        Self::validate(value)?;
63        Ok(Self(value))
64    }
65}
66impl std::convert::TryFrom<i128> for PgNumInt {
67    type Error = crate::types::bounded_integer::BoundedIntegerError;
68    fn try_from(value: i128) -> Result<Self, Self::Error> {
69        crate::types::bounded_integer::BoundedInteger::new(value)
70    }
71}
72impl ::serde::Serialize for PgNumInt {
73    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
74    where
75        S: ::serde::Serializer,
76    {
77        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
78    }
79}
80impl<'de> ::serde::Deserialize<'de> for PgNumInt {
81    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
82    where
83        D: ::serde::Deserializer<'de>,
84    {
85        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
86    }
87}