1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum NodesSdnBridgesError {
22 Status400(models::PveError),
23 Status401(models::PveError),
24 Status403(models::PveError),
25 Status404(models::PveError),
26 Status500(models::PveError),
27 Status501(models::PveError),
28 Status503(models::PveError),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum NodesSdnDiridxError {
36 Status400(models::PveError),
37 Status401(models::PveError),
38 Status403(models::PveError),
39 Status404(models::PveError),
40 Status500(models::PveError),
41 Status501(models::PveError),
42 Status503(models::PveError),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum NodesSdnDiridxGetZonesError {
50 Status400(models::PveError),
51 Status401(models::PveError),
52 Status403(models::PveError),
53 Status404(models::PveError),
54 Status500(models::PveError),
55 Status501(models::PveError),
56 Status503(models::PveError),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum NodesSdnGetContentError {
64 Status400(models::PveError),
65 Status401(models::PveError),
66 Status403(models::PveError),
67 Status404(models::PveError),
68 Status500(models::PveError),
69 Status501(models::PveError),
70 Status503(models::PveError),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum NodesSdnGetVnetsError {
78 Status400(models::PveError),
79 Status401(models::PveError),
80 Status403(models::PveError),
81 Status404(models::PveError),
82 Status500(models::PveError),
83 Status501(models::PveError),
84 Status503(models::PveError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum NodesSdnGetZonesError {
92 Status400(models::PveError),
93 Status401(models::PveError),
94 Status403(models::PveError),
95 Status404(models::PveError),
96 Status500(models::PveError),
97 Status501(models::PveError),
98 Status503(models::PveError),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum NodesSdnInterfacesError {
106 Status400(models::PveError),
107 Status401(models::PveError),
108 Status403(models::PveError),
109 Status404(models::PveError),
110 Status500(models::PveError),
111 Status501(models::PveError),
112 Status503(models::PveError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum NodesSdnIpVrfError {
120 Status400(models::PveError),
121 Status401(models::PveError),
122 Status403(models::PveError),
123 Status404(models::PveError),
124 Status500(models::PveError),
125 Status501(models::PveError),
126 Status503(models::PveError),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum NodesSdnMacVrfError {
134 Status400(models::PveError),
135 Status401(models::PveError),
136 Status403(models::PveError),
137 Status404(models::PveError),
138 Status500(models::PveError),
139 Status501(models::PveError),
140 Status503(models::PveError),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum NodesSdnNeighborsError {
148 Status400(models::PveError),
149 Status401(models::PveError),
150 Status403(models::PveError),
151 Status404(models::PveError),
152 Status500(models::PveError),
153 Status501(models::PveError),
154 Status503(models::PveError),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum NodesSdnRoutesError {
162 Status400(models::PveError),
163 Status401(models::PveError),
164 Status403(models::PveError),
165 Status404(models::PveError),
166 Status500(models::PveError),
167 Status501(models::PveError),
168 Status503(models::PveError),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum NodesSdnSdnindexError {
176 Status400(models::PveError),
177 Status401(models::PveError),
178 Status403(models::PveError),
179 Status404(models::PveError),
180 Status500(models::PveError),
181 Status501(models::PveError),
182 Status503(models::PveError),
183 UnknownValue(serde_json::Value),
184}
185
186
187pub async fn nodes_sdn_bridges(configuration: &configuration::Configuration, node: &str, zone: &str) -> Result<models::NodesSdnBridgesResponse, Error<NodesSdnBridgesError>> {
189 let p_path_node = node;
191 let p_path_zone = zone;
192
193 let uri_str = format!("{}/nodes/{node}/sdn/zones/{zone}/bridges", configuration.base_path, node=crate::apis::urlencode(p_path_node), zone=crate::apis::urlencode(p_path_zone));
194 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
195
196 if let Some(ref user_agent) = configuration.user_agent {
197 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
198 }
199 if let Some(ref apikey) = configuration.api_key {
200 let key = apikey.key.clone();
201 let value = match apikey.prefix {
202 Some(ref prefix) => format!("{} {}", prefix, key),
203 None => key,
204 };
205 req_builder = req_builder.header("Authorization", value);
206 };
207 if let Some(ref apikey) = configuration.api_key {
208 let key = apikey.key.clone();
209 let value = match apikey.prefix {
210 Some(ref prefix) => format!("{} {}", prefix, key),
211 None => key,
212 };
213 req_builder = req_builder.header("CSRFPreventionToken", value);
214 };
215
216 let req = req_builder.build()?;
217 let resp = configuration.client.execute(req).await?;
218
219 let status = resp.status();
220 let content_type = resp
221 .headers()
222 .get("content-type")
223 .and_then(|v| v.to_str().ok())
224 .unwrap_or("application/octet-stream");
225 let content_type = super::ContentType::from(content_type);
226
227 if !status.is_client_error() && !status.is_server_error() {
228 let content = resp.text().await?;
229 match content_type {
230 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
231 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnBridgesResponse`"))),
232 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnBridgesResponse`")))),
233 }
234 } else {
235 let content = resp.text().await?;
236 let entity: Option<NodesSdnBridgesError> = serde_json::from_str(&content).ok();
237 Err(Error::ResponseError(ResponseContent { status, content, entity }))
238 }
239}
240
241pub async fn nodes_sdn_diridx(configuration: &configuration::Configuration, fabric: &str, node: &str) -> Result<models::NodesSdnDiridxResponse, Error<NodesSdnDiridxError>> {
243 let p_path_fabric = fabric;
245 let p_path_node = node;
246
247 let uri_str = format!("{}/nodes/{node}/sdn/fabrics/{fabric}", configuration.base_path, fabric=crate::apis::urlencode(p_path_fabric), node=crate::apis::urlencode(p_path_node));
248 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
249
250 if let Some(ref user_agent) = configuration.user_agent {
251 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
252 }
253 if let Some(ref apikey) = configuration.api_key {
254 let key = apikey.key.clone();
255 let value = match apikey.prefix {
256 Some(ref prefix) => format!("{} {}", prefix, key),
257 None => key,
258 };
259 req_builder = req_builder.header("Authorization", value);
260 };
261 if let Some(ref apikey) = configuration.api_key {
262 let key = apikey.key.clone();
263 let value = match apikey.prefix {
264 Some(ref prefix) => format!("{} {}", prefix, key),
265 None => key,
266 };
267 req_builder = req_builder.header("CSRFPreventionToken", value);
268 };
269
270 let req = req_builder.build()?;
271 let resp = configuration.client.execute(req).await?;
272
273 let status = resp.status();
274 let content_type = resp
275 .headers()
276 .get("content-type")
277 .and_then(|v| v.to_str().ok())
278 .unwrap_or("application/octet-stream");
279 let content_type = super::ContentType::from(content_type);
280
281 if !status.is_client_error() && !status.is_server_error() {
282 let content = resp.text().await?;
283 match content_type {
284 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
285 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnDiridxResponse`"))),
286 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnDiridxResponse`")))),
287 }
288 } else {
289 let content = resp.text().await?;
290 let entity: Option<NodesSdnDiridxError> = serde_json::from_str(&content).ok();
291 Err(Error::ResponseError(ResponseContent { status, content, entity }))
292 }
293}
294
295pub async fn nodes_sdn_diridx_get_zones(configuration: &configuration::Configuration, node: &str, zone: &str) -> Result<models::NodesSdnDiridxGetZonesResponse, Error<NodesSdnDiridxGetZonesError>> {
297 let p_path_node = node;
299 let p_path_zone = zone;
300
301 let uri_str = format!("{}/nodes/{node}/sdn/zones/{zone}", configuration.base_path, node=crate::apis::urlencode(p_path_node), zone=crate::apis::urlencode(p_path_zone));
302 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
303
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307 if let Some(ref apikey) = configuration.api_key {
308 let key = apikey.key.clone();
309 let value = match apikey.prefix {
310 Some(ref prefix) => format!("{} {}", prefix, key),
311 None => key,
312 };
313 req_builder = req_builder.header("Authorization", value);
314 };
315 if let Some(ref apikey) = configuration.api_key {
316 let key = apikey.key.clone();
317 let value = match apikey.prefix {
318 Some(ref prefix) => format!("{} {}", prefix, key),
319 None => key,
320 };
321 req_builder = req_builder.header("CSRFPreventionToken", value);
322 };
323
324 let req = req_builder.build()?;
325 let resp = configuration.client.execute(req).await?;
326
327 let status = resp.status();
328 let content_type = resp
329 .headers()
330 .get("content-type")
331 .and_then(|v| v.to_str().ok())
332 .unwrap_or("application/octet-stream");
333 let content_type = super::ContentType::from(content_type);
334
335 if !status.is_client_error() && !status.is_server_error() {
336 let content = resp.text().await?;
337 match content_type {
338 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
339 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnDiridxGetZonesResponse`"))),
340 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnDiridxGetZonesResponse`")))),
341 }
342 } else {
343 let content = resp.text().await?;
344 let entity: Option<NodesSdnDiridxGetZonesError> = serde_json::from_str(&content).ok();
345 Err(Error::ResponseError(ResponseContent { status, content, entity }))
346 }
347}
348
349pub async fn nodes_sdn_get_content(configuration: &configuration::Configuration, node: &str, zone: &str) -> Result<models::NodesSdnGetContentResponse, Error<NodesSdnGetContentError>> {
351 let p_path_node = node;
353 let p_path_zone = zone;
354
355 let uri_str = format!("{}/nodes/{node}/sdn/zones/{zone}/content", configuration.base_path, node=crate::apis::urlencode(p_path_node), zone=crate::apis::urlencode(p_path_zone));
356 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
357
358 if let Some(ref user_agent) = configuration.user_agent {
359 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
360 }
361 if let Some(ref apikey) = configuration.api_key {
362 let key = apikey.key.clone();
363 let value = match apikey.prefix {
364 Some(ref prefix) => format!("{} {}", prefix, key),
365 None => key,
366 };
367 req_builder = req_builder.header("Authorization", value);
368 };
369 if let Some(ref apikey) = configuration.api_key {
370 let key = apikey.key.clone();
371 let value = match apikey.prefix {
372 Some(ref prefix) => format!("{} {}", prefix, key),
373 None => key,
374 };
375 req_builder = req_builder.header("CSRFPreventionToken", value);
376 };
377
378 let req = req_builder.build()?;
379 let resp = configuration.client.execute(req).await?;
380
381 let status = resp.status();
382 let content_type = resp
383 .headers()
384 .get("content-type")
385 .and_then(|v| v.to_str().ok())
386 .unwrap_or("application/octet-stream");
387 let content_type = super::ContentType::from(content_type);
388
389 if !status.is_client_error() && !status.is_server_error() {
390 let content = resp.text().await?;
391 match content_type {
392 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
393 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnGetContentResponse`"))),
394 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnGetContentResponse`")))),
395 }
396 } else {
397 let content = resp.text().await?;
398 let entity: Option<NodesSdnGetContentError> = serde_json::from_str(&content).ok();
399 Err(Error::ResponseError(ResponseContent { status, content, entity }))
400 }
401}
402
403pub async fn nodes_sdn_get_vnets(configuration: &configuration::Configuration, node: &str, vnet: &str) -> Result<models::NodesSdnGetVnetsResponse, Error<NodesSdnGetVnetsError>> {
405 let p_path_node = node;
407 let p_path_vnet = vnet;
408
409 let uri_str = format!("{}/nodes/{node}/sdn/vnets/{vnet}", configuration.base_path, node=crate::apis::urlencode(p_path_node), vnet=crate::apis::urlencode(p_path_vnet));
410 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
411
412 if let Some(ref user_agent) = configuration.user_agent {
413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
414 }
415 if let Some(ref apikey) = configuration.api_key {
416 let key = apikey.key.clone();
417 let value = match apikey.prefix {
418 Some(ref prefix) => format!("{} {}", prefix, key),
419 None => key,
420 };
421 req_builder = req_builder.header("Authorization", value);
422 };
423 if let Some(ref apikey) = configuration.api_key {
424 let key = apikey.key.clone();
425 let value = match apikey.prefix {
426 Some(ref prefix) => format!("{} {}", prefix, key),
427 None => key,
428 };
429 req_builder = req_builder.header("CSRFPreventionToken", value);
430 };
431
432 let req = req_builder.build()?;
433 let resp = configuration.client.execute(req).await?;
434
435 let status = resp.status();
436 let content_type = resp
437 .headers()
438 .get("content-type")
439 .and_then(|v| v.to_str().ok())
440 .unwrap_or("application/octet-stream");
441 let content_type = super::ContentType::from(content_type);
442
443 if !status.is_client_error() && !status.is_server_error() {
444 let content = resp.text().await?;
445 match content_type {
446 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
447 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnGetVnetsResponse`"))),
448 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnGetVnetsResponse`")))),
449 }
450 } else {
451 let content = resp.text().await?;
452 let entity: Option<NodesSdnGetVnetsError> = serde_json::from_str(&content).ok();
453 Err(Error::ResponseError(ResponseContent { status, content, entity }))
454 }
455}
456
457pub async fn nodes_sdn_get_zones(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesSdnGetZonesResponse, Error<NodesSdnGetZonesError>> {
459 let p_path_node = node;
461
462 let uri_str = format!("{}/nodes/{node}/sdn/zones", configuration.base_path, node=crate::apis::urlencode(p_path_node));
463 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
464
465 if let Some(ref user_agent) = configuration.user_agent {
466 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
467 }
468 if let Some(ref apikey) = configuration.api_key {
469 let key = apikey.key.clone();
470 let value = match apikey.prefix {
471 Some(ref prefix) => format!("{} {}", prefix, key),
472 None => key,
473 };
474 req_builder = req_builder.header("Authorization", value);
475 };
476 if let Some(ref apikey) = configuration.api_key {
477 let key = apikey.key.clone();
478 let value = match apikey.prefix {
479 Some(ref prefix) => format!("{} {}", prefix, key),
480 None => key,
481 };
482 req_builder = req_builder.header("CSRFPreventionToken", value);
483 };
484
485 let req = req_builder.build()?;
486 let resp = configuration.client.execute(req).await?;
487
488 let status = resp.status();
489 let content_type = resp
490 .headers()
491 .get("content-type")
492 .and_then(|v| v.to_str().ok())
493 .unwrap_or("application/octet-stream");
494 let content_type = super::ContentType::from(content_type);
495
496 if !status.is_client_error() && !status.is_server_error() {
497 let content = resp.text().await?;
498 match content_type {
499 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
500 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnGetZonesResponse`"))),
501 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnGetZonesResponse`")))),
502 }
503 } else {
504 let content = resp.text().await?;
505 let entity: Option<NodesSdnGetZonesError> = serde_json::from_str(&content).ok();
506 Err(Error::ResponseError(ResponseContent { status, content, entity }))
507 }
508}
509
510pub async fn nodes_sdn_interfaces(configuration: &configuration::Configuration, fabric: &str, node: &str) -> Result<models::NodesSdnInterfacesResponse, Error<NodesSdnInterfacesError>> {
512 let p_path_fabric = fabric;
514 let p_path_node = node;
515
516 let uri_str = format!("{}/nodes/{node}/sdn/fabrics/{fabric}/interfaces", configuration.base_path, fabric=crate::apis::urlencode(p_path_fabric), node=crate::apis::urlencode(p_path_node));
517 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
518
519 if let Some(ref user_agent) = configuration.user_agent {
520 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
521 }
522 if let Some(ref apikey) = configuration.api_key {
523 let key = apikey.key.clone();
524 let value = match apikey.prefix {
525 Some(ref prefix) => format!("{} {}", prefix, key),
526 None => key,
527 };
528 req_builder = req_builder.header("Authorization", value);
529 };
530 if let Some(ref apikey) = configuration.api_key {
531 let key = apikey.key.clone();
532 let value = match apikey.prefix {
533 Some(ref prefix) => format!("{} {}", prefix, key),
534 None => key,
535 };
536 req_builder = req_builder.header("CSRFPreventionToken", value);
537 };
538
539 let req = req_builder.build()?;
540 let resp = configuration.client.execute(req).await?;
541
542 let status = resp.status();
543 let content_type = resp
544 .headers()
545 .get("content-type")
546 .and_then(|v| v.to_str().ok())
547 .unwrap_or("application/octet-stream");
548 let content_type = super::ContentType::from(content_type);
549
550 if !status.is_client_error() && !status.is_server_error() {
551 let content = resp.text().await?;
552 match content_type {
553 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
554 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnInterfacesResponse`"))),
555 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnInterfacesResponse`")))),
556 }
557 } else {
558 let content = resp.text().await?;
559 let entity: Option<NodesSdnInterfacesError> = serde_json::from_str(&content).ok();
560 Err(Error::ResponseError(ResponseContent { status, content, entity }))
561 }
562}
563
564pub async fn nodes_sdn_ip_vrf(configuration: &configuration::Configuration, node: &str, zone: &str) -> Result<models::NodesSdnIpVrfResponse, Error<NodesSdnIpVrfError>> {
566 let p_path_node = node;
568 let p_path_zone = zone;
569
570 let uri_str = format!("{}/nodes/{node}/sdn/zones/{zone}/ip-vrf", configuration.base_path, node=crate::apis::urlencode(p_path_node), zone=crate::apis::urlencode(p_path_zone));
571 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
572
573 if let Some(ref user_agent) = configuration.user_agent {
574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
575 }
576 if let Some(ref apikey) = configuration.api_key {
577 let key = apikey.key.clone();
578 let value = match apikey.prefix {
579 Some(ref prefix) => format!("{} {}", prefix, key),
580 None => key,
581 };
582 req_builder = req_builder.header("Authorization", value);
583 };
584 if let Some(ref apikey) = configuration.api_key {
585 let key = apikey.key.clone();
586 let value = match apikey.prefix {
587 Some(ref prefix) => format!("{} {}", prefix, key),
588 None => key,
589 };
590 req_builder = req_builder.header("CSRFPreventionToken", value);
591 };
592
593 let req = req_builder.build()?;
594 let resp = configuration.client.execute(req).await?;
595
596 let status = resp.status();
597 let content_type = resp
598 .headers()
599 .get("content-type")
600 .and_then(|v| v.to_str().ok())
601 .unwrap_or("application/octet-stream");
602 let content_type = super::ContentType::from(content_type);
603
604 if !status.is_client_error() && !status.is_server_error() {
605 let content = resp.text().await?;
606 match content_type {
607 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
608 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnIpVrfResponse`"))),
609 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnIpVrfResponse`")))),
610 }
611 } else {
612 let content = resp.text().await?;
613 let entity: Option<NodesSdnIpVrfError> = serde_json::from_str(&content).ok();
614 Err(Error::ResponseError(ResponseContent { status, content, entity }))
615 }
616}
617
618pub async fn nodes_sdn_mac_vrf(configuration: &configuration::Configuration, node: &str, vnet: &str) -> Result<models::NodesSdnMacVrfResponse, Error<NodesSdnMacVrfError>> {
620 let p_path_node = node;
622 let p_path_vnet = vnet;
623
624 let uri_str = format!("{}/nodes/{node}/sdn/vnets/{vnet}/mac-vrf", configuration.base_path, node=crate::apis::urlencode(p_path_node), vnet=crate::apis::urlencode(p_path_vnet));
625 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
626
627 if let Some(ref user_agent) = configuration.user_agent {
628 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
629 }
630 if let Some(ref apikey) = configuration.api_key {
631 let key = apikey.key.clone();
632 let value = match apikey.prefix {
633 Some(ref prefix) => format!("{} {}", prefix, key),
634 None => key,
635 };
636 req_builder = req_builder.header("Authorization", value);
637 };
638 if let Some(ref apikey) = configuration.api_key {
639 let key = apikey.key.clone();
640 let value = match apikey.prefix {
641 Some(ref prefix) => format!("{} {}", prefix, key),
642 None => key,
643 };
644 req_builder = req_builder.header("CSRFPreventionToken", value);
645 };
646
647 let req = req_builder.build()?;
648 let resp = configuration.client.execute(req).await?;
649
650 let status = resp.status();
651 let content_type = resp
652 .headers()
653 .get("content-type")
654 .and_then(|v| v.to_str().ok())
655 .unwrap_or("application/octet-stream");
656 let content_type = super::ContentType::from(content_type);
657
658 if !status.is_client_error() && !status.is_server_error() {
659 let content = resp.text().await?;
660 match content_type {
661 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
662 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnMacVrfResponse`"))),
663 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnMacVrfResponse`")))),
664 }
665 } else {
666 let content = resp.text().await?;
667 let entity: Option<NodesSdnMacVrfError> = serde_json::from_str(&content).ok();
668 Err(Error::ResponseError(ResponseContent { status, content, entity }))
669 }
670}
671
672pub async fn nodes_sdn_neighbors(configuration: &configuration::Configuration, fabric: &str, node: &str) -> Result<models::NodesSdnNeighborsResponse, Error<NodesSdnNeighborsError>> {
674 let p_path_fabric = fabric;
676 let p_path_node = node;
677
678 let uri_str = format!("{}/nodes/{node}/sdn/fabrics/{fabric}/neighbors", configuration.base_path, fabric=crate::apis::urlencode(p_path_fabric), node=crate::apis::urlencode(p_path_node));
679 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
680
681 if let Some(ref user_agent) = configuration.user_agent {
682 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
683 }
684 if let Some(ref apikey) = configuration.api_key {
685 let key = apikey.key.clone();
686 let value = match apikey.prefix {
687 Some(ref prefix) => format!("{} {}", prefix, key),
688 None => key,
689 };
690 req_builder = req_builder.header("Authorization", value);
691 };
692 if let Some(ref apikey) = configuration.api_key {
693 let key = apikey.key.clone();
694 let value = match apikey.prefix {
695 Some(ref prefix) => format!("{} {}", prefix, key),
696 None => key,
697 };
698 req_builder = req_builder.header("CSRFPreventionToken", value);
699 };
700
701 let req = req_builder.build()?;
702 let resp = configuration.client.execute(req).await?;
703
704 let status = resp.status();
705 let content_type = resp
706 .headers()
707 .get("content-type")
708 .and_then(|v| v.to_str().ok())
709 .unwrap_or("application/octet-stream");
710 let content_type = super::ContentType::from(content_type);
711
712 if !status.is_client_error() && !status.is_server_error() {
713 let content = resp.text().await?;
714 match content_type {
715 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
716 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnNeighborsResponse`"))),
717 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnNeighborsResponse`")))),
718 }
719 } else {
720 let content = resp.text().await?;
721 let entity: Option<NodesSdnNeighborsError> = serde_json::from_str(&content).ok();
722 Err(Error::ResponseError(ResponseContent { status, content, entity }))
723 }
724}
725
726pub async fn nodes_sdn_routes(configuration: &configuration::Configuration, fabric: &str, node: &str) -> Result<models::NodesSdnRoutesResponse, Error<NodesSdnRoutesError>> {
728 let p_path_fabric = fabric;
730 let p_path_node = node;
731
732 let uri_str = format!("{}/nodes/{node}/sdn/fabrics/{fabric}/routes", configuration.base_path, fabric=crate::apis::urlencode(p_path_fabric), node=crate::apis::urlencode(p_path_node));
733 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
734
735 if let Some(ref user_agent) = configuration.user_agent {
736 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
737 }
738 if let Some(ref apikey) = configuration.api_key {
739 let key = apikey.key.clone();
740 let value = match apikey.prefix {
741 Some(ref prefix) => format!("{} {}", prefix, key),
742 None => key,
743 };
744 req_builder = req_builder.header("Authorization", value);
745 };
746 if let Some(ref apikey) = configuration.api_key {
747 let key = apikey.key.clone();
748 let value = match apikey.prefix {
749 Some(ref prefix) => format!("{} {}", prefix, key),
750 None => key,
751 };
752 req_builder = req_builder.header("CSRFPreventionToken", value);
753 };
754
755 let req = req_builder.build()?;
756 let resp = configuration.client.execute(req).await?;
757
758 let status = resp.status();
759 let content_type = resp
760 .headers()
761 .get("content-type")
762 .and_then(|v| v.to_str().ok())
763 .unwrap_or("application/octet-stream");
764 let content_type = super::ContentType::from(content_type);
765
766 if !status.is_client_error() && !status.is_server_error() {
767 let content = resp.text().await?;
768 match content_type {
769 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
770 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnRoutesResponse`"))),
771 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnRoutesResponse`")))),
772 }
773 } else {
774 let content = resp.text().await?;
775 let entity: Option<NodesSdnRoutesError> = serde_json::from_str(&content).ok();
776 Err(Error::ResponseError(ResponseContent { status, content, entity }))
777 }
778}
779
780pub async fn nodes_sdn_sdnindex(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesSdnSdnindexResponse, Error<NodesSdnSdnindexError>> {
782 let p_path_node = node;
784
785 let uri_str = format!("{}/nodes/{node}/sdn", configuration.base_path, node=crate::apis::urlencode(p_path_node));
786 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
787
788 if let Some(ref user_agent) = configuration.user_agent {
789 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
790 }
791 if let Some(ref apikey) = configuration.api_key {
792 let key = apikey.key.clone();
793 let value = match apikey.prefix {
794 Some(ref prefix) => format!("{} {}", prefix, key),
795 None => key,
796 };
797 req_builder = req_builder.header("Authorization", value);
798 };
799 if let Some(ref apikey) = configuration.api_key {
800 let key = apikey.key.clone();
801 let value = match apikey.prefix {
802 Some(ref prefix) => format!("{} {}", prefix, key),
803 None => key,
804 };
805 req_builder = req_builder.header("CSRFPreventionToken", value);
806 };
807
808 let req = req_builder.build()?;
809 let resp = configuration.client.execute(req).await?;
810
811 let status = resp.status();
812 let content_type = resp
813 .headers()
814 .get("content-type")
815 .and_then(|v| v.to_str().ok())
816 .unwrap_or("application/octet-stream");
817 let content_type = super::ContentType::from(content_type);
818
819 if !status.is_client_error() && !status.is_server_error() {
820 let content = resp.text().await?;
821 match content_type {
822 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
823 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesSdnSdnindexResponse`"))),
824 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesSdnSdnindexResponse`")))),
825 }
826 } else {
827 let content = resp.text().await?;
828 let entity: Option<NodesSdnSdnindexError> = serde_json::from_str(&content).ok();
829 Err(Error::ResponseError(ResponseContent { status, content, entity }))
830 }
831}
832