proxmox_api/generated/cluster/sdn/fabrics/
all.rs1#[derive(Debug, Clone)]
2pub struct AllClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> AllClient<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, "/all"),
14 }
15 }
16}
17impl<T> AllClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "SDN Fabrics Index"]
22 #[doc = ""]
23 #[doc = "Only list fabrics where you have 'SDN.Audit' or 'SDN.Allocate' permissions on\n'/sdn/fabrics/\\<fabric\\>', only list nodes where you have 'Sys.Audit' or 'Sys.Modify' on /nodes/\\<node_id\\>"]
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}
29impl FabricsGetOutputFabricsItems {
30 pub fn new(id: String, protocol: Protocol) -> Self {
31 Self {
32 id,
33 protocol,
34 area: ::std::default::Default::default(),
35 csnp_interval: ::std::default::Default::default(),
36 digest: ::std::default::Default::default(),
37 hello_interval: ::std::default::Default::default(),
38 ip6_prefix: ::std::default::Default::default(),
39 ip_prefix: ::std::default::Default::default(),
40 lock_token: ::std::default::Default::default(),
41 additional_properties: ::std::default::Default::default(),
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct FabricsGetOutputFabricsItems {
47 #[serde(skip_serializing_if = "Option::is_none", default)]
48 #[doc = "OSPF area. Either a IPv4 address or a 32-bit number. Gets validated in rust."]
49 #[doc = ""]
50 pub area: Option<String>,
51 #[serde(skip_serializing_if = "Option::is_none", default)]
52 #[doc = "The csnp_interval property for Openfabric"]
53 #[doc = ""]
54 pub csnp_interval: Option<CsnpIntervalNum>,
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
57 #[doc = ""]
58 pub digest: Option<DigestStr>,
59 #[serde(skip_serializing_if = "Option::is_none", default)]
60 #[doc = "The hello_interval property for Openfabric"]
61 #[doc = ""]
62 pub hello_interval: Option<HelloIntervalNum>,
63 #[doc = "Identifier for SDN fabrics"]
64 #[doc = ""]
65 pub id: String,
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "The IP prefix for Node IPs"]
68 #[doc = ""]
69 pub ip6_prefix: Option<String>,
70 #[serde(skip_serializing_if = "Option::is_none", default)]
71 #[doc = "The IP prefix for Node IPs"]
72 #[doc = ""]
73 pub ip_prefix: Option<String>,
74 #[serde(rename = "lock-token")]
75 #[serde(skip_serializing_if = "Option::is_none", default)]
76 #[doc = "the token for unlocking the global SDN configuration"]
77 #[doc = ""]
78 pub lock_token: Option<String>,
79 #[doc = "Type of configuration entry in an SDN Fabric section config"]
80 #[doc = ""]
81 pub protocol: Protocol,
82 #[serde(
83 flatten,
84 default,
85 skip_serializing_if = "::std::collections::HashMap::is_empty"
86 )]
87 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
88}
89impl GetOutput {
90 pub fn new(
91 fabrics: Vec<FabricsGetOutputFabricsItems>,
92 nodes: Vec<NodesGetOutputNodesItems>,
93 ) -> Self {
94 Self {
95 fabrics,
96 nodes,
97 additional_properties: ::std::default::Default::default(),
98 }
99 }
100}
101#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
102pub struct GetOutput {
103 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
104 pub fabrics: Vec<FabricsGetOutputFabricsItems>,
105 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
106 pub nodes: Vec<NodesGetOutputNodesItems>,
107 #[serde(
108 flatten,
109 default,
110 skip_serializing_if = "::std::collections::HashMap::is_empty"
111 )]
112 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
113}
114#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
115pub struct GetParams {
116 #[serde(
117 serialize_with = "crate::types::serialize_bool_optional",
118 deserialize_with = "crate::types::deserialize_bool_optional"
119 )]
120 #[serde(skip_serializing_if = "Option::is_none", default)]
121 #[doc = "Display pending config."]
122 #[doc = ""]
123 pub pending: Option<bool>,
124 #[serde(
125 serialize_with = "crate::types::serialize_bool_optional",
126 deserialize_with = "crate::types::deserialize_bool_optional"
127 )]
128 #[serde(skip_serializing_if = "Option::is_none", default)]
129 #[doc = "Display running config."]
130 #[doc = ""]
131 pub running: Option<bool>,
132 #[serde(
133 flatten,
134 default,
135 skip_serializing_if = "::std::collections::HashMap::is_empty"
136 )]
137 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
138}
139impl NodesGetOutputNodesItems {
140 pub fn new(fabric_id: String, node_id: String, protocol: Protocol) -> Self {
141 Self {
142 fabric_id,
143 node_id,
144 protocol,
145 digest: ::std::default::Default::default(),
146 ip: ::std::default::Default::default(),
147 ip6: ::std::default::Default::default(),
148 lock_token: ::std::default::Default::default(),
149 additional_properties: ::std::default::Default::default(),
150 }
151 }
152}
153#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
154pub struct NodesGetOutputNodesItems {
155 #[serde(skip_serializing_if = "Option::is_none", default)]
156 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
157 #[doc = ""]
158 pub digest: Option<DigestStr>,
159 #[doc = "Identifier for SDN fabrics"]
160 #[doc = ""]
161 pub fabric_id: String,
162 #[serde(skip_serializing_if = "Option::is_none", default)]
163 #[doc = "IPv4 address for this node"]
164 #[doc = ""]
165 pub ip: Option<::std::net::Ipv4Addr>,
166 #[serde(skip_serializing_if = "Option::is_none", default)]
167 #[doc = "IPv6 address for this node"]
168 #[doc = ""]
169 pub ip6: Option<::std::net::Ipv6Addr>,
170 #[serde(rename = "lock-token")]
171 #[serde(skip_serializing_if = "Option::is_none", default)]
172 #[doc = "the token for unlocking the global SDN configuration"]
173 #[doc = ""]
174 pub lock_token: Option<String>,
175 #[doc = "Identifier for nodes in an SDN fabric"]
176 #[doc = ""]
177 pub node_id: String,
178 #[doc = "Type of configuration entry in an SDN Fabric section config"]
179 #[doc = ""]
180 pub protocol: Protocol,
181 #[serde(
182 flatten,
183 default,
184 skip_serializing_if = "::std::collections::HashMap::is_empty"
185 )]
186 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
187}
188#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
189#[doc = "Type of configuration entry in an SDN Fabric section config"]
190#[doc = ""]
191pub enum Protocol {
192 #[serde(rename = "openfabric")]
193 Openfabric,
194 #[serde(rename = "ospf")]
195 Ospf,
196}
197impl TryFrom<&str> for Protocol {
198 type Error = String;
199 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
200 match value {
201 "openfabric" => Ok(Self::Openfabric),
202 "ospf" => Ok(Self::Ospf),
203 v => Err(format!("Unknown variant {v}")),
204 }
205 }
206}
207#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
208pub struct CsnpIntervalNum(f64);
209impl crate::types::bounded_number::BoundedNumber for CsnpIntervalNum {
210 const MIN: Option<f64> = Some(1f64);
211 const MAX: Option<f64> = Some(600f64);
212 const DEFAULT: Option<f64> = None::<f64>;
213 const TYPE_DESCRIPTION: &'static str = "an number between 1 and 600";
214 fn get(&self) -> f64 {
215 self.0
216 }
217 fn new(value: f64) -> Result<Self, crate::types::bounded_number::BoundedNumberError> {
218 Self::validate(value)?;
219 Ok(Self(value))
220 }
221}
222impl std::convert::TryFrom<f64> for CsnpIntervalNum {
223 type Error = crate::types::bounded_number::BoundedNumberError;
224 fn try_from(value: f64) -> Result<Self, Self::Error> {
225 crate::types::bounded_number::BoundedNumber::new(value)
226 }
227}
228impl std::convert::TryFrom<f32> for CsnpIntervalNum {
229 type Error = crate::types::bounded_number::BoundedNumberError;
230 fn try_from(value: f32) -> Result<Self, Self::Error> {
231 crate::types::bounded_number::BoundedNumber::new(value as f64)
232 }
233}
234impl std::convert::TryFrom<i32> for CsnpIntervalNum {
235 type Error = crate::types::bounded_number::BoundedNumberError;
236 fn try_from(value: i32) -> Result<Self, Self::Error> {
237 crate::types::bounded_number::BoundedNumber::new(value as f64)
238 }
239}
240impl std::convert::TryFrom<i64> for CsnpIntervalNum {
241 type Error = crate::types::bounded_number::BoundedNumberError;
242 fn try_from(value: i64) -> Result<Self, Self::Error> {
243 crate::types::bounded_number::BoundedNumber::new(value as f64)
244 }
245}
246impl ::serde::Serialize for CsnpIntervalNum {
247 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
248 where
249 S: ::serde::Serializer,
250 {
251 crate::types::bounded_number::serialize_bounded_number(self, serializer)
252 }
253}
254impl<'de> ::serde::Deserialize<'de> for CsnpIntervalNum {
255 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
256 where
257 D: ::serde::Deserializer<'de>,
258 {
259 crate::types::bounded_number::deserialize_bounded_number(deserializer)
260 }
261}
262#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
263pub struct HelloIntervalNum(f64);
264impl crate::types::bounded_number::BoundedNumber for HelloIntervalNum {
265 const MIN: Option<f64> = Some(1f64);
266 const MAX: Option<f64> = Some(600f64);
267 const DEFAULT: Option<f64> = None::<f64>;
268 const TYPE_DESCRIPTION: &'static str = "an number between 1 and 600";
269 fn get(&self) -> f64 {
270 self.0
271 }
272 fn new(value: f64) -> Result<Self, crate::types::bounded_number::BoundedNumberError> {
273 Self::validate(value)?;
274 Ok(Self(value))
275 }
276}
277impl std::convert::TryFrom<f64> for HelloIntervalNum {
278 type Error = crate::types::bounded_number::BoundedNumberError;
279 fn try_from(value: f64) -> Result<Self, Self::Error> {
280 crate::types::bounded_number::BoundedNumber::new(value)
281 }
282}
283impl std::convert::TryFrom<f32> for HelloIntervalNum {
284 type Error = crate::types::bounded_number::BoundedNumberError;
285 fn try_from(value: f32) -> Result<Self, Self::Error> {
286 crate::types::bounded_number::BoundedNumber::new(value as f64)
287 }
288}
289impl std::convert::TryFrom<i32> for HelloIntervalNum {
290 type Error = crate::types::bounded_number::BoundedNumberError;
291 fn try_from(value: i32) -> Result<Self, Self::Error> {
292 crate::types::bounded_number::BoundedNumber::new(value as f64)
293 }
294}
295impl std::convert::TryFrom<i64> for HelloIntervalNum {
296 type Error = crate::types::bounded_number::BoundedNumberError;
297 fn try_from(value: i64) -> Result<Self, Self::Error> {
298 crate::types::bounded_number::BoundedNumber::new(value as f64)
299 }
300}
301impl ::serde::Serialize for HelloIntervalNum {
302 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
303 where
304 S: ::serde::Serializer,
305 {
306 crate::types::bounded_number::serialize_bounded_number(self, serializer)
307 }
308}
309impl<'de> ::serde::Deserialize<'de> for HelloIntervalNum {
310 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
311 where
312 D: ::serde::Deserializer<'de>,
313 {
314 crate::types::bounded_number::deserialize_bounded_number(deserializer)
315 }
316}
317#[derive(Debug, Clone, PartialEq, PartialOrd)]
318pub struct DigestStr {
319 value: String,
320}
321impl crate::types::bounded_string::BoundedString for DigestStr {
322 const MIN_LENGTH: Option<usize> = None::<usize>;
323 const MAX_LENGTH: Option<usize> = Some(64usize);
324 const DEFAULT: Option<&'static str> = None::<&'static str>;
325 const PATTERN: Option<&'static str> = None::<&'static str>;
326 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
327 fn get_value(&self) -> &str {
328 &self.value
329 }
330 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
331 Self::validate(&value)?;
332 Ok(Self { value })
333 }
334}
335impl std::convert::TryFrom<String> for DigestStr {
336 type Error = crate::types::bounded_string::BoundedStringError;
337 fn try_from(value: String) -> Result<Self, Self::Error> {
338 crate::types::bounded_string::BoundedString::new(value)
339 }
340}
341impl ::serde::Serialize for DigestStr {
342 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
343 where
344 S: ::serde::Serializer,
345 {
346 crate::types::bounded_string::serialize_bounded_string(self, serializer)
347 }
348}
349impl<'de> ::serde::Deserialize<'de> for DigestStr {
350 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
351 where
352 D: ::serde::Deserializer<'de>,
353 {
354 crate::types::bounded_string::deserialize_bounded_string(deserializer)
355 }
356}