1#[derive(Debug, Clone)]
2pub struct ControllerClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> ControllerClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, controller: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, controller),
14 }
15 }
16}
17impl<T> ControllerClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Delete sdn controller object configuration."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/sdn/controllers\", [\"SDN.Allocate\"])"]
24 pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, ¶ms).await
27 }
28}
29impl<T> ControllerClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Read sdn controller configuration."]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/sdn/controllers/{controller}\", [\"SDN.Allocate\"])"]
36 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
37 let path = self.path.to_string();
38 self.client.get(&path, ¶ms).await
39 }
40}
41impl<T> ControllerClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update sdn controller object configuration."]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/sdn/controllers\", [\"SDN.Allocate\"])"]
48 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
49 let path = self.path.to_string();
50 self.client.put(&path, ¶ms).await
51 }
52}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
54pub struct DeleteParams {
55 #[serde(rename = "lock-token")]
56 #[serde(skip_serializing_if = "Option::is_none", default)]
57 #[doc = "the token for unlocking the global SDN configuration"]
58 #[doc = ""]
59 pub lock_token: Option<String>,
60 #[serde(
61 flatten,
62 default,
63 skip_serializing_if = "::std::collections::HashMap::is_empty"
64 )]
65 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
66}
67impl GetOutput {
68 pub fn new(controller: String, ty: Type) -> Self {
69 Self {
70 controller,
71 ty,
72 asn: ::std::default::Default::default(),
73 bgp_multipath_as_relax: ::std::default::Default::default(),
74 digest: ::std::default::Default::default(),
75 ebgp: ::std::default::Default::default(),
76 ebgp_multihop: ::std::default::Default::default(),
77 isis_domain: ::std::default::Default::default(),
78 isis_ifaces: ::std::default::Default::default(),
79 isis_net: ::std::default::Default::default(),
80 loopback: ::std::default::Default::default(),
81 node: ::std::default::Default::default(),
82 peers: ::std::default::Default::default(),
83 pending: ::std::default::Default::default(),
84 state: ::std::default::Default::default(),
85 additional_properties: ::std::default::Default::default(),
86 }
87 }
88}
89#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
90pub struct GetOutput {
91 #[serde(skip_serializing_if = "Option::is_none", default)]
92 #[doc = "The local ASN of the controller. BGP & EVPN only."]
93 #[doc = ""]
94 pub asn: Option<AsnInt>,
95 #[serde(rename = "bgp-multipath-as-relax")]
96 #[serde(
97 serialize_with = "crate::types::serialize_bool_optional",
98 deserialize_with = "crate::types::deserialize_bool_optional"
99 )]
100 #[serde(skip_serializing_if = "Option::is_none", default)]
101 #[doc = "Consider different AS paths of equal length for multipath computation. BGP only."]
102 #[doc = ""]
103 pub bgp_multipath_as_relax: Option<bool>,
104 #[doc = "Name of the controller."]
105 #[doc = ""]
106 pub controller: String,
107 #[serde(skip_serializing_if = "Option::is_none", default)]
108 #[doc = "Digest of the controller section."]
109 #[doc = ""]
110 pub digest: Option<String>,
111 #[serde(
112 serialize_with = "crate::types::serialize_bool_optional",
113 deserialize_with = "crate::types::deserialize_bool_optional"
114 )]
115 #[serde(skip_serializing_if = "Option::is_none", default)]
116 #[doc = "Enable eBGP (remote-as external). BGP only."]
117 #[doc = ""]
118 pub ebgp: Option<bool>,
119 #[serde(rename = "ebgp-multihop")]
120 #[serde(
121 serialize_with = "crate::types::serialize_int_optional",
122 deserialize_with = "crate::types::deserialize_int_optional"
123 )]
124 #[serde(skip_serializing_if = "Option::is_none", default)]
125 #[doc = "Set maximum amount of hops for eBGP peers. Needs ebgp set to 1. BGP only."]
126 #[doc = ""]
127 pub ebgp_multihop: Option<i64>,
128 #[serde(rename = "isis-domain")]
129 #[serde(skip_serializing_if = "Option::is_none", default)]
130 #[doc = "Name of the IS-IS domain. IS-IS only."]
131 #[doc = ""]
132 pub isis_domain: Option<String>,
133 #[serde(rename = "isis-ifaces")]
134 #[serde(skip_serializing_if = "Option::is_none", default)]
135 #[doc = "Comma-separated list of interfaces where IS-IS should be active. IS-IS only."]
136 #[doc = ""]
137 pub isis_ifaces: Option<String>,
138 #[serde(rename = "isis-net")]
139 #[serde(skip_serializing_if = "Option::is_none", default)]
140 #[doc = "Network Entity title for this node in the IS-IS network. IS-IS only."]
141 #[doc = ""]
142 pub isis_net: Option<String>,
143 #[serde(skip_serializing_if = "Option::is_none", default)]
144 #[doc = "Name of the loopback/dummy interface that provides the Router-IP. BGP only."]
145 #[doc = ""]
146 pub loopback: Option<String>,
147 #[serde(skip_serializing_if = "Option::is_none", default)]
148 #[doc = "Node(s) where this controller is active."]
149 #[doc = ""]
150 pub node: Option<String>,
151 #[serde(skip_serializing_if = "Option::is_none", default)]
152 #[doc = "Comma-separated list of the peers IP addresses."]
153 #[doc = ""]
154 pub peers: Option<String>,
155 #[serde(skip_serializing_if = "Option::is_none", default)]
156 #[doc = "Changes that have not yet been applied to the running configuration."]
157 #[doc = ""]
158 pub pending: Option<PendingGetOutputPending>,
159 #[serde(skip_serializing_if = "Option::is_none", default)]
160 #[doc = "State of the SDN configuration object."]
161 #[doc = ""]
162 pub state: Option<State>,
163 #[serde(rename = "type")]
164 #[doc = "Type of the controller"]
165 #[doc = ""]
166 pub ty: Type,
167 #[serde(
168 flatten,
169 default,
170 skip_serializing_if = "::std::collections::HashMap::is_empty"
171 )]
172 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
173}
174#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
175pub struct GetParams {
176 #[serde(
177 serialize_with = "crate::types::serialize_bool_optional",
178 deserialize_with = "crate::types::deserialize_bool_optional"
179 )]
180 #[serde(skip_serializing_if = "Option::is_none", default)]
181 #[doc = "Display pending config."]
182 #[doc = ""]
183 pub pending: Option<bool>,
184 #[serde(
185 serialize_with = "crate::types::serialize_bool_optional",
186 deserialize_with = "crate::types::deserialize_bool_optional"
187 )]
188 #[serde(skip_serializing_if = "Option::is_none", default)]
189 #[doc = "Display running config."]
190 #[doc = ""]
191 pub running: Option<bool>,
192 #[serde(
193 flatten,
194 default,
195 skip_serializing_if = "::std::collections::HashMap::is_empty"
196 )]
197 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
198}
199#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
200pub struct PendingGetOutputPending {
201 #[serde(skip_serializing_if = "Option::is_none", default)]
202 #[doc = "The local ASN of the controller. BGP & EVPN only."]
203 #[doc = ""]
204 pub asn: Option<AsnInt>,
205 #[serde(rename = "bgp-multipath-as-relax")]
206 #[serde(
207 serialize_with = "crate::types::serialize_bool_optional",
208 deserialize_with = "crate::types::deserialize_bool_optional"
209 )]
210 #[serde(skip_serializing_if = "Option::is_none", default)]
211 #[doc = "Consider different AS paths of equal length for multipath computation. BGP only."]
212 #[doc = ""]
213 pub bgp_multipath_as_relax: Option<bool>,
214 #[serde(
215 serialize_with = "crate::types::serialize_bool_optional",
216 deserialize_with = "crate::types::deserialize_bool_optional"
217 )]
218 #[serde(skip_serializing_if = "Option::is_none", default)]
219 #[doc = "Enable eBGP (remote-as external). BGP only."]
220 #[doc = ""]
221 pub ebgp: Option<bool>,
222 #[serde(rename = "ebgp-multihop")]
223 #[serde(
224 serialize_with = "crate::types::serialize_int_optional",
225 deserialize_with = "crate::types::deserialize_int_optional"
226 )]
227 #[serde(skip_serializing_if = "Option::is_none", default)]
228 #[doc = "Set maximum amount of hops for eBGP peers. Needs ebgp set to 1. BGP only."]
229 #[doc = ""]
230 pub ebgp_multihop: Option<i64>,
231 #[serde(rename = "isis-domain")]
232 #[serde(skip_serializing_if = "Option::is_none", default)]
233 #[doc = "Name of the IS-IS domain. IS-IS only."]
234 #[doc = ""]
235 pub isis_domain: Option<String>,
236 #[serde(rename = "isis-ifaces")]
237 #[serde(skip_serializing_if = "Option::is_none", default)]
238 #[doc = "Comma-separated list of interfaces where IS-IS should be active. IS-IS only."]
239 #[doc = ""]
240 pub isis_ifaces: Option<String>,
241 #[serde(rename = "isis-net")]
242 #[serde(skip_serializing_if = "Option::is_none", default)]
243 #[doc = "Network Entity title for this node in the IS-IS network. IS-IS only."]
244 #[doc = ""]
245 pub isis_net: Option<String>,
246 #[serde(skip_serializing_if = "Option::is_none", default)]
247 #[doc = "Name of the loopback/dummy interface that provides the Router-IP. BGP only."]
248 #[doc = ""]
249 pub loopback: Option<String>,
250 #[serde(skip_serializing_if = "Option::is_none", default)]
251 #[doc = "Node(s) where this controller is active."]
252 #[doc = ""]
253 pub node: Option<String>,
254 #[serde(skip_serializing_if = "Option::is_none", default)]
255 #[doc = "Comma-separated list of the peers IP addresses."]
256 #[doc = ""]
257 pub peers: Option<String>,
258 #[serde(
259 flatten,
260 default,
261 skip_serializing_if = "::std::collections::HashMap::is_empty"
262 )]
263 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
264}
265#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
266pub struct PutParams {
267 #[serde(skip_serializing_if = "Option::is_none", default)]
268 #[doc = "autonomous system number"]
269 #[doc = ""]
270 pub asn: Option<AsnInt>,
271 #[serde(rename = "bgp-multipath-as-path-relax")]
272 #[serde(
273 serialize_with = "crate::types::serialize_bool_optional",
274 deserialize_with = "crate::types::deserialize_bool_optional"
275 )]
276 #[serde(skip_serializing_if = "Option::is_none", default)]
277 #[doc = "Consider different AS paths of equal length for multipath computation."]
278 #[doc = ""]
279 pub bgp_multipath_as_path_relax: Option<bool>,
280 #[serde(skip_serializing_if = "Option::is_none", default)]
281 #[doc = "A list of settings you want to delete."]
282 #[doc = ""]
283 pub delete: Option<DeleteStr>,
284 #[serde(skip_serializing_if = "Option::is_none", default)]
285 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
286 #[doc = ""]
287 pub digest: Option<DigestStr>,
288 #[serde(
289 serialize_with = "crate::types::serialize_bool_optional",
290 deserialize_with = "crate::types::deserialize_bool_optional"
291 )]
292 #[serde(skip_serializing_if = "Option::is_none", default)]
293 #[doc = "Enable eBGP (remote-as external)."]
294 #[doc = ""]
295 pub ebgp: Option<bool>,
296 #[serde(rename = "ebgp-multihop")]
297 #[serde(
298 serialize_with = "crate::types::serialize_int_optional",
299 deserialize_with = "crate::types::deserialize_int_optional"
300 )]
301 #[serde(skip_serializing_if = "Option::is_none", default)]
302 #[doc = "Set maximum amount of hops for eBGP peers."]
303 #[doc = ""]
304 pub ebgp_multihop: Option<i64>,
305 #[serde(skip_serializing_if = "Option::is_none", default)]
306 #[doc = "SDN fabric to use as underlay for this EVPN controller."]
307 #[doc = ""]
308 pub fabric: Option<String>,
309 #[serde(rename = "isis-domain")]
310 #[serde(skip_serializing_if = "Option::is_none", default)]
311 #[doc = "Name of the IS-IS domain."]
312 #[doc = ""]
313 pub isis_domain: Option<String>,
314 #[serde(rename = "isis-ifaces")]
315 #[serde(skip_serializing_if = "Option::is_none", default)]
316 #[doc = "Comma-separated list of interfaces where IS-IS should be active."]
317 #[doc = ""]
318 pub isis_ifaces: Option<String>,
319 #[serde(rename = "isis-net")]
320 #[serde(skip_serializing_if = "Option::is_none", default)]
321 #[doc = "Network Entity title for this node in the IS-IS network."]
322 #[doc = ""]
323 pub isis_net: Option<String>,
324 #[serde(rename = "lock-token")]
325 #[serde(skip_serializing_if = "Option::is_none", default)]
326 #[doc = "the token for unlocking the global SDN configuration"]
327 #[doc = ""]
328 pub lock_token: Option<String>,
329 #[serde(skip_serializing_if = "Option::is_none", default)]
330 #[doc = "Name of the loopback/dummy interface that provides the Router-IP."]
331 #[doc = ""]
332 pub loopback: Option<String>,
333 #[serde(skip_serializing_if = "Option::is_none", default)]
334 #[doc = "The cluster node name."]
335 #[doc = ""]
336 pub node: Option<String>,
337 #[serde(skip_serializing_if = "Option::is_none", default)]
338 #[doc = "peers address list."]
339 #[doc = ""]
340 pub peers: Option<String>,
341 #[serde(
342 flatten,
343 default,
344 skip_serializing_if = "::std::collections::HashMap::is_empty"
345 )]
346 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
347}
348#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
349#[doc = "State of the SDN configuration object."]
350#[doc = ""]
351pub enum State {
352 #[serde(rename = "changed")]
353 Changed,
354 #[serde(rename = "deleted")]
355 Deleted,
356 #[serde(rename = "new")]
357 New,
358}
359impl TryFrom<&str> for State {
360 type Error = String;
361 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
362 match value {
363 "changed" => Ok(Self::Changed),
364 "deleted" => Ok(Self::Deleted),
365 "new" => Ok(Self::New),
366 v => Err(format!("Unknown variant {v}")),
367 }
368 }
369}
370#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
371#[doc = "Type of the controller"]
372#[doc = ""]
373pub enum Type {
374 #[serde(rename = "bgp")]
375 Bgp,
376 #[serde(rename = "evpn")]
377 Evpn,
378 #[serde(rename = "faucet")]
379 Faucet,
380 #[serde(rename = "isis")]
381 Isis,
382}
383impl TryFrom<&str> for Type {
384 type Error = String;
385 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
386 match value {
387 "bgp" => Ok(Self::Bgp),
388 "evpn" => Ok(Self::Evpn),
389 "faucet" => Ok(Self::Faucet),
390 "isis" => Ok(Self::Isis),
391 v => Err(format!("Unknown variant {v}")),
392 }
393 }
394}
395#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
396pub struct AsnInt(i128);
397impl crate::types::bounded_integer::BoundedInteger for AsnInt {
398 const MIN: Option<i128> = Some(0i128);
399 const MAX: Option<i128> = Some(4294967295i128);
400 const DEFAULT: Option<i128> = None::<i128>;
401 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 4294967295";
402 fn get(&self) -> i128 {
403 self.0
404 }
405 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
406 Self::validate(value)?;
407 Ok(Self(value))
408 }
409}
410impl std::convert::TryFrom<i128> for AsnInt {
411 type Error = crate::types::bounded_integer::BoundedIntegerError;
412 fn try_from(value: i128) -> Result<Self, Self::Error> {
413 crate::types::bounded_integer::BoundedInteger::new(value)
414 }
415}
416impl ::serde::Serialize for AsnInt {
417 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
418 where
419 S: ::serde::Serializer,
420 {
421 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
422 }
423}
424impl<'de> ::serde::Deserialize<'de> for AsnInt {
425 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
426 where
427 D: ::serde::Deserializer<'de>,
428 {
429 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
430 }
431}
432#[derive(Debug, Clone, PartialEq, PartialOrd)]
433pub struct DeleteStr {
434 value: String,
435}
436impl crate::types::bounded_string::BoundedString for DeleteStr {
437 const MIN_LENGTH: Option<usize> = None::<usize>;
438 const MAX_LENGTH: Option<usize> = Some(4096usize);
439 const DEFAULT: Option<&'static str> = None::<&'static str>;
440 const PATTERN: Option<&'static str> = None::<&'static str>;
441 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
442 fn get_value(&self) -> &str {
443 &self.value
444 }
445 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
446 Self::validate(&value)?;
447 Ok(Self { value })
448 }
449}
450impl std::convert::TryFrom<String> for DeleteStr {
451 type Error = crate::types::bounded_string::BoundedStringError;
452 fn try_from(value: String) -> Result<Self, Self::Error> {
453 crate::types::bounded_string::BoundedString::new(value)
454 }
455}
456impl ::serde::Serialize for DeleteStr {
457 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
458 where
459 S: ::serde::Serializer,
460 {
461 crate::types::bounded_string::serialize_bounded_string(self, serializer)
462 }
463}
464impl<'de> ::serde::Deserialize<'de> for DeleteStr {
465 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
466 where
467 D: ::serde::Deserializer<'de>,
468 {
469 crate::types::bounded_string::deserialize_bounded_string(deserializer)
470 }
471}
472#[derive(Debug, Clone, PartialEq, PartialOrd)]
473pub struct DigestStr {
474 value: String,
475}
476impl crate::types::bounded_string::BoundedString for DigestStr {
477 const MIN_LENGTH: Option<usize> = None::<usize>;
478 const MAX_LENGTH: Option<usize> = Some(64usize);
479 const DEFAULT: Option<&'static str> = None::<&'static str>;
480 const PATTERN: Option<&'static str> = None::<&'static str>;
481 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
482 fn get_value(&self) -> &str {
483 &self.value
484 }
485 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
486 Self::validate(&value)?;
487 Ok(Self { value })
488 }
489}
490impl std::convert::TryFrom<String> for DigestStr {
491 type Error = crate::types::bounded_string::BoundedStringError;
492 fn try_from(value: String) -> Result<Self, Self::Error> {
493 crate::types::bounded_string::BoundedString::new(value)
494 }
495}
496impl ::serde::Serialize for DigestStr {
497 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
498 where
499 S: ::serde::Serializer,
500 {
501 crate::types::bounded_string::serialize_bounded_string(self, serializer)
502 }
503}
504impl<'de> ::serde::Deserialize<'de> for DigestStr {
505 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
506 where
507 D: ::serde::Deserializer<'de>,
508 {
509 crate::types::bounded_string::deserialize_bounded_string(deserializer)
510 }
511}