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 NodesCreateTermproxyError {
22 Status400(models::PbsError),
23 Status401(models::PbsError),
24 Status403(models::PbsError),
25 Status404(models::PbsError),
26 Status500(models::PbsError),
27 Status501(models::PbsError),
28 Status503(models::PbsError),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum NodesGetIdentityError {
36 Status400(models::PbsError),
37 Status401(models::PbsError),
38 Status403(models::PbsError),
39 Status404(models::PbsError),
40 Status500(models::PbsError),
41 Status501(models::PbsError),
42 Status503(models::PbsError),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum NodesGetJournalError {
50 Status400(models::PbsError),
51 Status401(models::PbsError),
52 Status403(models::PbsError),
53 Status404(models::PbsError),
54 Status500(models::PbsError),
55 Status501(models::PbsError),
56 Status503(models::PbsError),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum NodesGetNodesError {
64 Status400(models::PbsError),
65 Status401(models::PbsError),
66 Status403(models::PbsError),
67 Status404(models::PbsError),
68 Status500(models::PbsError),
69 Status501(models::PbsError),
70 Status503(models::PbsError),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum NodesGetNodesByNodeError {
78 Status400(models::PbsError),
79 Status401(models::PbsError),
80 Status403(models::PbsError),
81 Status404(models::PbsError),
82 Status500(models::PbsError),
83 Status501(models::PbsError),
84 Status503(models::PbsError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum NodesGetReportError {
92 Status400(models::PbsError),
93 Status401(models::PbsError),
94 Status403(models::PbsError),
95 Status404(models::PbsError),
96 Status500(models::PbsError),
97 Status501(models::PbsError),
98 Status503(models::PbsError),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum NodesGetRrdError {
106 Status400(models::PbsError),
107 Status401(models::PbsError),
108 Status403(models::PbsError),
109 Status404(models::PbsError),
110 Status500(models::PbsError),
111 Status501(models::PbsError),
112 Status503(models::PbsError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum NodesGetSyslogError {
120 Status400(models::PbsError),
121 Status401(models::PbsError),
122 Status403(models::PbsError),
123 Status404(models::PbsError),
124 Status500(models::PbsError),
125 Status501(models::PbsError),
126 Status503(models::PbsError),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum NodesGetVncwebsocketError {
134 Status400(models::PbsError),
135 Status401(models::PbsError),
136 Status403(models::PbsError),
137 Status404(models::PbsError),
138 Status500(models::PbsError),
139 Status501(models::PbsError),
140 Status503(models::PbsError),
141 UnknownValue(serde_json::Value),
142}
143
144
145pub async fn nodes_create_termproxy(configuration: &configuration::Configuration, node: &str, nodes_create_termproxy_request: Option<models::NodesCreateTermproxyRequest>) -> Result<models::NodesCreateTermproxyResponse, Error<NodesCreateTermproxyError>> {
147 let p_path_node = node;
149 let p_body_nodes_create_termproxy_request = nodes_create_termproxy_request;
150
151 let uri_str = format!("{}/nodes/{node}/termproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node));
152 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
153
154 if let Some(ref user_agent) = configuration.user_agent {
155 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
156 }
157 if let Some(ref apikey) = configuration.api_key {
158 let key = apikey.key.clone();
159 let value = match apikey.prefix {
160 Some(ref prefix) => format!("{} {}", prefix, key),
161 None => key,
162 };
163 req_builder = req_builder.header("Authorization", value);
164 };
165 if let Some(ref apikey) = configuration.api_key {
166 let key = apikey.key.clone();
167 let value = match apikey.prefix {
168 Some(ref prefix) => format!("{} {}", prefix, key),
169 None => key,
170 };
171 req_builder = req_builder.header("CSRFPreventionToken", value);
172 };
173 req_builder = req_builder.json(&p_body_nodes_create_termproxy_request);
174
175 let req = req_builder.build()?;
176 let resp = configuration.client.execute(req).await?;
177
178 let status = resp.status();
179 let content_type = resp
180 .headers()
181 .get("content-type")
182 .and_then(|v| v.to_str().ok())
183 .unwrap_or("application/octet-stream");
184 let content_type = super::ContentType::from(content_type);
185
186 if !status.is_client_error() && !status.is_server_error() {
187 let content = resp.text().await?;
188 match content_type {
189 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
190 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesCreateTermproxyResponse`"))),
191 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::NodesCreateTermproxyResponse`")))),
192 }
193 } else {
194 let content = resp.text().await?;
195 let entity: Option<NodesCreateTermproxyError> = serde_json::from_str(&content).ok();
196 Err(Error::ResponseError(ResponseContent { status, content, entity }))
197 }
198}
199
200pub async fn nodes_get_identity(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesGetIdentityResponse, Error<NodesGetIdentityError>> {
202 let p_path_node = node;
204
205 let uri_str = format!("{}/nodes/{node}/identity", configuration.base_path, node=crate::apis::urlencode(p_path_node));
206 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
207
208 if let Some(ref user_agent) = configuration.user_agent {
209 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
210 }
211 if let Some(ref apikey) = configuration.api_key {
212 let key = apikey.key.clone();
213 let value = match apikey.prefix {
214 Some(ref prefix) => format!("{} {}", prefix, key),
215 None => key,
216 };
217 req_builder = req_builder.header("Authorization", value);
218 };
219 if let Some(ref apikey) = configuration.api_key {
220 let key = apikey.key.clone();
221 let value = match apikey.prefix {
222 Some(ref prefix) => format!("{} {}", prefix, key),
223 None => key,
224 };
225 req_builder = req_builder.header("CSRFPreventionToken", value);
226 };
227
228 let req = req_builder.build()?;
229 let resp = configuration.client.execute(req).await?;
230
231 let status = resp.status();
232 let content_type = resp
233 .headers()
234 .get("content-type")
235 .and_then(|v| v.to_str().ok())
236 .unwrap_or("application/octet-stream");
237 let content_type = super::ContentType::from(content_type);
238
239 if !status.is_client_error() && !status.is_server_error() {
240 let content = resp.text().await?;
241 match content_type {
242 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
243 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetIdentityResponse`"))),
244 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::NodesGetIdentityResponse`")))),
245 }
246 } else {
247 let content = resp.text().await?;
248 let entity: Option<NodesGetIdentityError> = serde_json::from_str(&content).ok();
249 Err(Error::ResponseError(ResponseContent { status, content, entity }))
250 }
251}
252
253pub async fn nodes_get_journal(configuration: &configuration::Configuration, node: &str, endcursor: Option<&str>, lastentries: Option<i64>, since: Option<i64>, startcursor: Option<&str>, until: Option<i64>) -> Result<models::NodesGetJournalResponse, Error<NodesGetJournalError>> {
255 let p_path_node = node;
257 let p_query_endcursor = endcursor;
258 let p_query_lastentries = lastentries;
259 let p_query_since = since;
260 let p_query_startcursor = startcursor;
261 let p_query_until = until;
262
263 let uri_str = format!("{}/nodes/{node}/journal", configuration.base_path, node=crate::apis::urlencode(p_path_node));
264 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
265
266 if let Some(ref param_value) = p_query_endcursor {
267 req_builder = req_builder.query(&[("endcursor", ¶m_value.to_string())]);
268 }
269 if let Some(ref param_value) = p_query_lastentries {
270 req_builder = req_builder.query(&[("lastentries", ¶m_value.to_string())]);
271 }
272 if let Some(ref param_value) = p_query_since {
273 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
274 }
275 if let Some(ref param_value) = p_query_startcursor {
276 req_builder = req_builder.query(&[("startcursor", ¶m_value.to_string())]);
277 }
278 if let Some(ref param_value) = p_query_until {
279 req_builder = req_builder.query(&[("until", ¶m_value.to_string())]);
280 }
281 if let Some(ref user_agent) = configuration.user_agent {
282 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
283 }
284 if let Some(ref apikey) = configuration.api_key {
285 let key = apikey.key.clone();
286 let value = match apikey.prefix {
287 Some(ref prefix) => format!("{} {}", prefix, key),
288 None => key,
289 };
290 req_builder = req_builder.header("Authorization", value);
291 };
292 if let Some(ref apikey) = configuration.api_key {
293 let key = apikey.key.clone();
294 let value = match apikey.prefix {
295 Some(ref prefix) => format!("{} {}", prefix, key),
296 None => key,
297 };
298 req_builder = req_builder.header("CSRFPreventionToken", value);
299 };
300
301 let req = req_builder.build()?;
302 let resp = configuration.client.execute(req).await?;
303
304 let status = resp.status();
305 let content_type = resp
306 .headers()
307 .get("content-type")
308 .and_then(|v| v.to_str().ok())
309 .unwrap_or("application/octet-stream");
310 let content_type = super::ContentType::from(content_type);
311
312 if !status.is_client_error() && !status.is_server_error() {
313 let content = resp.text().await?;
314 match content_type {
315 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
316 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetJournalResponse`"))),
317 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::NodesGetJournalResponse`")))),
318 }
319 } else {
320 let content = resp.text().await?;
321 let entity: Option<NodesGetJournalError> = serde_json::from_str(&content).ok();
322 Err(Error::ResponseError(ResponseContent { status, content, entity }))
323 }
324}
325
326pub async fn nodes_get_nodes(configuration: &configuration::Configuration, ) -> Result<models::NodesGetNodesResponse, Error<NodesGetNodesError>> {
328
329 let uri_str = format!("{}/nodes", configuration.base_path);
330 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
331
332 if let Some(ref user_agent) = configuration.user_agent {
333 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
334 }
335 if let Some(ref apikey) = configuration.api_key {
336 let key = apikey.key.clone();
337 let value = match apikey.prefix {
338 Some(ref prefix) => format!("{} {}", prefix, key),
339 None => key,
340 };
341 req_builder = req_builder.header("Authorization", value);
342 };
343 if let Some(ref apikey) = configuration.api_key {
344 let key = apikey.key.clone();
345 let value = match apikey.prefix {
346 Some(ref prefix) => format!("{} {}", prefix, key),
347 None => key,
348 };
349 req_builder = req_builder.header("CSRFPreventionToken", value);
350 };
351
352 let req = req_builder.build()?;
353 let resp = configuration.client.execute(req).await?;
354
355 let status = resp.status();
356 let content_type = resp
357 .headers()
358 .get("content-type")
359 .and_then(|v| v.to_str().ok())
360 .unwrap_or("application/octet-stream");
361 let content_type = super::ContentType::from(content_type);
362
363 if !status.is_client_error() && !status.is_server_error() {
364 let content = resp.text().await?;
365 match content_type {
366 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetNodesResponse`"))),
368 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::NodesGetNodesResponse`")))),
369 }
370 } else {
371 let content = resp.text().await?;
372 let entity: Option<NodesGetNodesError> = serde_json::from_str(&content).ok();
373 Err(Error::ResponseError(ResponseContent { status, content, entity }))
374 }
375}
376
377pub async fn nodes_get_nodes_by_node(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesGetNodesByNodeResponse, Error<NodesGetNodesByNodeError>> {
379 let p_path_node = node;
381
382 let uri_str = format!("{}/nodes/{node}", configuration.base_path, node=crate::apis::urlencode(p_path_node));
383 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
384
385 if let Some(ref user_agent) = configuration.user_agent {
386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387 }
388 if let Some(ref apikey) = configuration.api_key {
389 let key = apikey.key.clone();
390 let value = match apikey.prefix {
391 Some(ref prefix) => format!("{} {}", prefix, key),
392 None => key,
393 };
394 req_builder = req_builder.header("Authorization", value);
395 };
396 if let Some(ref apikey) = configuration.api_key {
397 let key = apikey.key.clone();
398 let value = match apikey.prefix {
399 Some(ref prefix) => format!("{} {}", prefix, key),
400 None => key,
401 };
402 req_builder = req_builder.header("CSRFPreventionToken", value);
403 };
404
405 let req = req_builder.build()?;
406 let resp = configuration.client.execute(req).await?;
407
408 let status = resp.status();
409 let content_type = resp
410 .headers()
411 .get("content-type")
412 .and_then(|v| v.to_str().ok())
413 .unwrap_or("application/octet-stream");
414 let content_type = super::ContentType::from(content_type);
415
416 if !status.is_client_error() && !status.is_server_error() {
417 let content = resp.text().await?;
418 match content_type {
419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetNodesByNodeResponse`"))),
421 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::NodesGetNodesByNodeResponse`")))),
422 }
423 } else {
424 let content = resp.text().await?;
425 let entity: Option<NodesGetNodesByNodeError> = serde_json::from_str(&content).ok();
426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
427 }
428}
429
430pub async fn nodes_get_report(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesGetReportResponse, Error<NodesGetReportError>> {
432 let p_path_node = node;
434
435 let uri_str = format!("{}/nodes/{node}/report", configuration.base_path, node=crate::apis::urlencode(p_path_node));
436 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
437
438 if let Some(ref user_agent) = configuration.user_agent {
439 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
440 }
441 if let Some(ref apikey) = configuration.api_key {
442 let key = apikey.key.clone();
443 let value = match apikey.prefix {
444 Some(ref prefix) => format!("{} {}", prefix, key),
445 None => key,
446 };
447 req_builder = req_builder.header("Authorization", value);
448 };
449 if let Some(ref apikey) = configuration.api_key {
450 let key = apikey.key.clone();
451 let value = match apikey.prefix {
452 Some(ref prefix) => format!("{} {}", prefix, key),
453 None => key,
454 };
455 req_builder = req_builder.header("CSRFPreventionToken", value);
456 };
457
458 let req = req_builder.build()?;
459 let resp = configuration.client.execute(req).await?;
460
461 let status = resp.status();
462 let content_type = resp
463 .headers()
464 .get("content-type")
465 .and_then(|v| v.to_str().ok())
466 .unwrap_or("application/octet-stream");
467 let content_type = super::ContentType::from(content_type);
468
469 if !status.is_client_error() && !status.is_server_error() {
470 let content = resp.text().await?;
471 match content_type {
472 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
473 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetReportResponse`"))),
474 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::NodesGetReportResponse`")))),
475 }
476 } else {
477 let content = resp.text().await?;
478 let entity: Option<NodesGetReportError> = serde_json::from_str(&content).ok();
479 Err(Error::ResponseError(ResponseContent { status, content, entity }))
480 }
481}
482
483pub async fn nodes_get_rrd(configuration: &configuration::Configuration, cf: models::PbsCfEnum, node: &str, timeframe: models::PbsTimeframeEnum) -> Result<models::NodesGetRrdResponse, Error<NodesGetRrdError>> {
485 let p_query_cf = cf;
487 let p_path_node = node;
488 let p_query_timeframe = timeframe;
489
490 let uri_str = format!("{}/nodes/{node}/rrd", configuration.base_path, node=crate::apis::urlencode(p_path_node));
491 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
492
493 req_builder = req_builder.query(&[("cf", &p_query_cf.to_string())]);
494 req_builder = req_builder.query(&[("timeframe", &p_query_timeframe.to_string())]);
495 if let Some(ref user_agent) = configuration.user_agent {
496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
497 }
498 if let Some(ref apikey) = configuration.api_key {
499 let key = apikey.key.clone();
500 let value = match apikey.prefix {
501 Some(ref prefix) => format!("{} {}", prefix, key),
502 None => key,
503 };
504 req_builder = req_builder.header("Authorization", value);
505 };
506 if let Some(ref apikey) = configuration.api_key {
507 let key = apikey.key.clone();
508 let value = match apikey.prefix {
509 Some(ref prefix) => format!("{} {}", prefix, key),
510 None => key,
511 };
512 req_builder = req_builder.header("CSRFPreventionToken", value);
513 };
514
515 let req = req_builder.build()?;
516 let resp = configuration.client.execute(req).await?;
517
518 let status = resp.status();
519 let content_type = resp
520 .headers()
521 .get("content-type")
522 .and_then(|v| v.to_str().ok())
523 .unwrap_or("application/octet-stream");
524 let content_type = super::ContentType::from(content_type);
525
526 if !status.is_client_error() && !status.is_server_error() {
527 let content = resp.text().await?;
528 match content_type {
529 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
530 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetRrdResponse`"))),
531 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::NodesGetRrdResponse`")))),
532 }
533 } else {
534 let content = resp.text().await?;
535 let entity: Option<NodesGetRrdError> = serde_json::from_str(&content).ok();
536 Err(Error::ResponseError(ResponseContent { status, content, entity }))
537 }
538}
539
540pub async fn nodes_get_syslog(configuration: &configuration::Configuration, node: &str, limit: Option<i64>, service: Option<&str>, since: Option<&str>, start: Option<i64>, until: Option<&str>) -> Result<models::NodesGetSyslogResponse, Error<NodesGetSyslogError>> {
542 let p_path_node = node;
544 let p_query_limit = limit;
545 let p_query_service = service;
546 let p_query_since = since;
547 let p_query_start = start;
548 let p_query_until = until;
549
550 let uri_str = format!("{}/nodes/{node}/syslog", configuration.base_path, node=crate::apis::urlencode(p_path_node));
551 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
552
553 if let Some(ref param_value) = p_query_limit {
554 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
555 }
556 if let Some(ref param_value) = p_query_service {
557 req_builder = req_builder.query(&[("service", ¶m_value.to_string())]);
558 }
559 if let Some(ref param_value) = p_query_since {
560 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
561 }
562 if let Some(ref param_value) = p_query_start {
563 req_builder = req_builder.query(&[("start", ¶m_value.to_string())]);
564 }
565 if let Some(ref param_value) = p_query_until {
566 req_builder = req_builder.query(&[("until", ¶m_value.to_string())]);
567 }
568 if let Some(ref user_agent) = configuration.user_agent {
569 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
570 }
571 if let Some(ref apikey) = configuration.api_key {
572 let key = apikey.key.clone();
573 let value = match apikey.prefix {
574 Some(ref prefix) => format!("{} {}", prefix, key),
575 None => key,
576 };
577 req_builder = req_builder.header("Authorization", value);
578 };
579 if let Some(ref apikey) = configuration.api_key {
580 let key = apikey.key.clone();
581 let value = match apikey.prefix {
582 Some(ref prefix) => format!("{} {}", prefix, key),
583 None => key,
584 };
585 req_builder = req_builder.header("CSRFPreventionToken", value);
586 };
587
588 let req = req_builder.build()?;
589 let resp = configuration.client.execute(req).await?;
590
591 let status = resp.status();
592 let content_type = resp
593 .headers()
594 .get("content-type")
595 .and_then(|v| v.to_str().ok())
596 .unwrap_or("application/octet-stream");
597 let content_type = super::ContentType::from(content_type);
598
599 if !status.is_client_error() && !status.is_server_error() {
600 let content = resp.text().await?;
601 match content_type {
602 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
603 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetSyslogResponse`"))),
604 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::NodesGetSyslogResponse`")))),
605 }
606 } else {
607 let content = resp.text().await?;
608 let entity: Option<NodesGetSyslogError> = serde_json::from_str(&content).ok();
609 Err(Error::ResponseError(ResponseContent { status, content, entity }))
610 }
611}
612
613pub async fn nodes_get_vncwebsocket(configuration: &configuration::Configuration, node: &str, port: i64, vncticket: &str) -> Result<models::NodesGetVncwebsocketResponse, Error<NodesGetVncwebsocketError>> {
615 let p_path_node = node;
617 let p_query_port = port;
618 let p_query_vncticket = vncticket;
619
620 let uri_str = format!("{}/nodes/{node}/vncwebsocket", configuration.base_path, node=crate::apis::urlencode(p_path_node));
621 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
622
623 req_builder = req_builder.query(&[("port", &p_query_port.to_string())]);
624 req_builder = req_builder.query(&[("vncticket", &p_query_vncticket.to_string())]);
625 if let Some(ref user_agent) = configuration.user_agent {
626 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
627 }
628 if let Some(ref apikey) = configuration.api_key {
629 let key = apikey.key.clone();
630 let value = match apikey.prefix {
631 Some(ref prefix) => format!("{} {}", prefix, key),
632 None => key,
633 };
634 req_builder = req_builder.header("Authorization", value);
635 };
636 if let Some(ref apikey) = configuration.api_key {
637 let key = apikey.key.clone();
638 let value = match apikey.prefix {
639 Some(ref prefix) => format!("{} {}", prefix, key),
640 None => key,
641 };
642 req_builder = req_builder.header("CSRFPreventionToken", value);
643 };
644
645 let req = req_builder.build()?;
646 let resp = configuration.client.execute(req).await?;
647
648 let status = resp.status();
649 let content_type = resp
650 .headers()
651 .get("content-type")
652 .and_then(|v| v.to_str().ok())
653 .unwrap_or("application/octet-stream");
654 let content_type = super::ContentType::from(content_type);
655
656 if !status.is_client_error() && !status.is_server_error() {
657 let content = resp.text().await?;
658 match content_type {
659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
660 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesGetVncwebsocketResponse`"))),
661 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::NodesGetVncwebsocketResponse`")))),
662 }
663 } else {
664 let content = resp.text().await?;
665 let entity: Option<NodesGetVncwebsocketError> = serde_json::from_str(&content).ok();
666 Err(Error::ResponseError(ResponseContent { status, content, entity }))
667 }
668}
669