Skip to main content

proxmox_api/generated/nodes/node/ceph/
init.rs

1#[derive(Debug, Clone)]
2pub struct InitClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> InitClient<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, "/init"),
14        }
15    }
16}
17impl<T> InitClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Create initial ceph default configuration and setup symlinks."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
24    pub async fn post(&self, params: PostParams) -> Result<(), 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 = "cluster-network")]
32    #[serde(skip_serializing_if = "Option::is_none", default)]
33    #[doc = "Declare a separate cluster network, OSDs will routeheartbeat, object replication and recovery traffic over it"]
34    #[doc = ""]
35    pub cluster_network: Option<ClusterNetworkStr>,
36    #[serde(
37        serialize_with = "crate::types::serialize_bool_optional",
38        deserialize_with = "crate::types::deserialize_bool_optional"
39    )]
40    #[serde(skip_serializing_if = "Option::is_none", default)]
41    #[doc = "Disable cephx authentication."]
42    #[doc = ""]
43    #[doc = "WARNING: cephx is a security feature protecting against man-in-the-middle attacks. Only consider disabling cephx if your network is private!"]
44    #[doc = ""]
45    pub disable_cephx: Option<bool>,
46    #[serde(skip_serializing_if = "Option::is_none", default)]
47    #[doc = "Minimum number of available replicas per object to allow I/O"]
48    #[doc = ""]
49    pub min_size: Option<MinSizeInt>,
50    #[serde(skip_serializing_if = "Option::is_none", default)]
51    #[doc = "Use specific network for all ceph related traffic"]
52    #[doc = ""]
53    pub network: Option<NetworkStr>,
54    #[serde(skip_serializing_if = "Option::is_none", default)]
55    #[doc = "Placement group bits, used to specify the default number of placement groups."]
56    #[doc = ""]
57    #[doc = "Depreacted. This setting was deprecated in recent Ceph versions."]
58    #[doc = ""]
59    pub pg_bits: Option<PgBitsInt>,
60    #[serde(skip_serializing_if = "Option::is_none", default)]
61    #[doc = "Targeted number of replicas per object"]
62    #[doc = ""]
63    pub size: Option<SizeInt>,
64    #[serde(
65        flatten,
66        default,
67        skip_serializing_if = "::std::collections::HashMap::is_empty"
68    )]
69    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
70}
71#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
72pub struct MinSizeInt(i128);
73impl crate::types::bounded_integer::BoundedInteger for MinSizeInt {
74    const MIN: Option<i128> = Some(1i128);
75    const MAX: Option<i128> = Some(7i128);
76    const DEFAULT: Option<i128> = Some(2i128);
77    const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 7";
78    fn get(&self) -> i128 {
79        self.0
80    }
81    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
82        Self::validate(value)?;
83        Ok(Self(value))
84    }
85}
86impl std::convert::TryFrom<i128> for MinSizeInt {
87    type Error = crate::types::bounded_integer::BoundedIntegerError;
88    fn try_from(value: i128) -> Result<Self, Self::Error> {
89        crate::types::bounded_integer::BoundedInteger::new(value)
90    }
91}
92impl ::serde::Serialize for MinSizeInt {
93    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
94    where
95        S: ::serde::Serializer,
96    {
97        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
98    }
99}
100impl<'de> ::serde::Deserialize<'de> for MinSizeInt {
101    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
102    where
103        D: ::serde::Deserializer<'de>,
104    {
105        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
106    }
107}
108#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
109pub struct PgBitsInt(i128);
110impl crate::types::bounded_integer::BoundedInteger for PgBitsInt {
111    const MIN: Option<i128> = Some(6i128);
112    const MAX: Option<i128> = Some(14i128);
113    const DEFAULT: Option<i128> = Some(6i128);
114    const TYPE_DESCRIPTION: &'static str = "an integer between 6 and 14";
115    fn get(&self) -> i128 {
116        self.0
117    }
118    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
119        Self::validate(value)?;
120        Ok(Self(value))
121    }
122}
123impl std::convert::TryFrom<i128> for PgBitsInt {
124    type Error = crate::types::bounded_integer::BoundedIntegerError;
125    fn try_from(value: i128) -> Result<Self, Self::Error> {
126        crate::types::bounded_integer::BoundedInteger::new(value)
127    }
128}
129impl ::serde::Serialize for PgBitsInt {
130    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
131    where
132        S: ::serde::Serializer,
133    {
134        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
135    }
136}
137impl<'de> ::serde::Deserialize<'de> for PgBitsInt {
138    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
139    where
140        D: ::serde::Deserializer<'de>,
141    {
142        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
143    }
144}
145#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
146pub struct SizeInt(i128);
147impl crate::types::bounded_integer::BoundedInteger for SizeInt {
148    const MIN: Option<i128> = Some(1i128);
149    const MAX: Option<i128> = Some(7i128);
150    const DEFAULT: Option<i128> = Some(3i128);
151    const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 7";
152    fn get(&self) -> i128 {
153        self.0
154    }
155    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
156        Self::validate(value)?;
157        Ok(Self(value))
158    }
159}
160impl std::convert::TryFrom<i128> for SizeInt {
161    type Error = crate::types::bounded_integer::BoundedIntegerError;
162    fn try_from(value: i128) -> Result<Self, Self::Error> {
163        crate::types::bounded_integer::BoundedInteger::new(value)
164    }
165}
166impl ::serde::Serialize for SizeInt {
167    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
168    where
169        S: ::serde::Serializer,
170    {
171        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
172    }
173}
174impl<'de> ::serde::Deserialize<'de> for SizeInt {
175    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
176    where
177        D: ::serde::Deserializer<'de>,
178    {
179        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
180    }
181}
182#[derive(Debug, Clone, PartialEq, PartialOrd)]
183pub struct ClusterNetworkStr {
184    value: String,
185}
186impl crate::types::bounded_string::BoundedString for ClusterNetworkStr {
187    const MIN_LENGTH: Option<usize> = None::<usize>;
188    const MAX_LENGTH: Option<usize> = Some(128usize);
189    const DEFAULT: Option<&'static str> = None::<&'static str>;
190    const PATTERN: Option<&'static str> = None::<&'static str>;
191    const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
192    fn get_value(&self) -> &str {
193        &self.value
194    }
195    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
196        Self::validate(&value)?;
197        Ok(Self { value })
198    }
199}
200impl std::convert::TryFrom<String> for ClusterNetworkStr {
201    type Error = crate::types::bounded_string::BoundedStringError;
202    fn try_from(value: String) -> Result<Self, Self::Error> {
203        crate::types::bounded_string::BoundedString::new(value)
204    }
205}
206impl ::serde::Serialize for ClusterNetworkStr {
207    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
208    where
209        S: ::serde::Serializer,
210    {
211        crate::types::bounded_string::serialize_bounded_string(self, serializer)
212    }
213}
214impl<'de> ::serde::Deserialize<'de> for ClusterNetworkStr {
215    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
216    where
217        D: ::serde::Deserializer<'de>,
218    {
219        crate::types::bounded_string::deserialize_bounded_string(deserializer)
220    }
221}
222#[derive(Debug, Clone, PartialEq, PartialOrd)]
223pub struct NetworkStr {
224    value: String,
225}
226impl crate::types::bounded_string::BoundedString for NetworkStr {
227    const MIN_LENGTH: Option<usize> = None::<usize>;
228    const MAX_LENGTH: Option<usize> = Some(128usize);
229    const DEFAULT: Option<&'static str> = None::<&'static str>;
230    const PATTERN: Option<&'static str> = None::<&'static str>;
231    const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
232    fn get_value(&self) -> &str {
233        &self.value
234    }
235    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
236        Self::validate(&value)?;
237        Ok(Self { value })
238    }
239}
240impl std::convert::TryFrom<String> for NetworkStr {
241    type Error = crate::types::bounded_string::BoundedStringError;
242    fn try_from(value: String) -> Result<Self, Self::Error> {
243        crate::types::bounded_string::BoundedString::new(value)
244    }
245}
246impl ::serde::Serialize for NetworkStr {
247    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
248    where
249        S: ::serde::Serializer,
250    {
251        crate::types::bounded_string::serialize_bounded_string(self, serializer)
252    }
253}
254impl<'de> ::serde::Deserialize<'de> for NetworkStr {
255    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
256    where
257        D: ::serde::Deserializer<'de>,
258    {
259        crate::types::bounded_string::deserialize_bounded_string(deserializer)
260    }
261}