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 ClusterNotificationsCreateGotifyEndpointError {
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 ClusterNotificationsCreateMatcherError {
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 ClusterNotificationsCreateSendmailEndpointError {
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 ClusterNotificationsCreateSmtpEndpointError {
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 ClusterNotificationsCreateWebhookEndpointError {
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 ClusterNotificationsDeleteGotifyEndpointError {
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 ClusterNotificationsDeleteMatcherError {
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 ClusterNotificationsDeleteSendmailEndpointError {
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 ClusterNotificationsDeleteSmtpEndpointError {
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 ClusterNotificationsDeleteWebhookEndpointError {
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 ClusterNotificationsEndpointsIndexError {
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 ClusterNotificationsGetAllTargetsError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ClusterNotificationsGetGotifyEndpointError {
190 Status400(models::PveError),
191 Status401(models::PveError),
192 Status403(models::PveError),
193 Status404(models::PveError),
194 Status500(models::PveError),
195 Status501(models::PveError),
196 Status503(models::PveError),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ClusterNotificationsGetGotifyEndpointsError {
204 Status400(models::PveError),
205 Status401(models::PveError),
206 Status403(models::PveError),
207 Status404(models::PveError),
208 Status500(models::PveError),
209 Status501(models::PveError),
210 Status503(models::PveError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ClusterNotificationsGetMatcherError {
218 Status400(models::PveError),
219 Status401(models::PveError),
220 Status403(models::PveError),
221 Status404(models::PveError),
222 Status500(models::PveError),
223 Status501(models::PveError),
224 Status503(models::PveError),
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ClusterNotificationsGetMatcherFieldValuesError {
232 Status400(models::PveError),
233 Status401(models::PveError),
234 Status403(models::PveError),
235 Status404(models::PveError),
236 Status500(models::PveError),
237 Status501(models::PveError),
238 Status503(models::PveError),
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum ClusterNotificationsGetMatcherFieldsError {
246 Status400(models::PveError),
247 Status401(models::PveError),
248 Status403(models::PveError),
249 Status404(models::PveError),
250 Status500(models::PveError),
251 Status501(models::PveError),
252 Status503(models::PveError),
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ClusterNotificationsGetMatchersError {
260 Status400(models::PveError),
261 Status401(models::PveError),
262 Status403(models::PveError),
263 Status404(models::PveError),
264 Status500(models::PveError),
265 Status501(models::PveError),
266 Status503(models::PveError),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum ClusterNotificationsGetNotificationsError {
274 Status400(models::PveError),
275 Status401(models::PveError),
276 Status403(models::PveError),
277 Status404(models::PveError),
278 Status500(models::PveError),
279 Status501(models::PveError),
280 Status503(models::PveError),
281 UnknownValue(serde_json::Value),
282}
283
284#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum ClusterNotificationsGetSendmailEndpointError {
288 Status400(models::PveError),
289 Status401(models::PveError),
290 Status403(models::PveError),
291 Status404(models::PveError),
292 Status500(models::PveError),
293 Status501(models::PveError),
294 Status503(models::PveError),
295 UnknownValue(serde_json::Value),
296}
297
298#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum ClusterNotificationsGetSendmailEndpointsError {
302 Status400(models::PveError),
303 Status401(models::PveError),
304 Status403(models::PveError),
305 Status404(models::PveError),
306 Status500(models::PveError),
307 Status501(models::PveError),
308 Status503(models::PveError),
309 UnknownValue(serde_json::Value),
310}
311
312#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum ClusterNotificationsGetSmtpEndpointError {
316 Status400(models::PveError),
317 Status401(models::PveError),
318 Status403(models::PveError),
319 Status404(models::PveError),
320 Status500(models::PveError),
321 Status501(models::PveError),
322 Status503(models::PveError),
323 UnknownValue(serde_json::Value),
324}
325
326#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum ClusterNotificationsGetSmtpEndpointsError {
330 Status400(models::PveError),
331 Status401(models::PveError),
332 Status403(models::PveError),
333 Status404(models::PveError),
334 Status500(models::PveError),
335 Status501(models::PveError),
336 Status503(models::PveError),
337 UnknownValue(serde_json::Value),
338}
339
340#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum ClusterNotificationsGetWebhookEndpointError {
344 Status400(models::PveError),
345 Status401(models::PveError),
346 Status403(models::PveError),
347 Status404(models::PveError),
348 Status500(models::PveError),
349 Status501(models::PveError),
350 Status503(models::PveError),
351 UnknownValue(serde_json::Value),
352}
353
354#[derive(Debug, Clone, Serialize, Deserialize)]
356#[serde(untagged)]
357pub enum ClusterNotificationsGetWebhookEndpointsError {
358 Status400(models::PveError),
359 Status401(models::PveError),
360 Status403(models::PveError),
361 Status404(models::PveError),
362 Status500(models::PveError),
363 Status501(models::PveError),
364 Status503(models::PveError),
365 UnknownValue(serde_json::Value),
366}
367
368#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum ClusterNotificationsTestTargetError {
372 Status400(models::PveError),
373 Status401(models::PveError),
374 Status403(models::PveError),
375 Status404(models::PveError),
376 Status500(models::PveError),
377 Status501(models::PveError),
378 Status503(models::PveError),
379 UnknownValue(serde_json::Value),
380}
381
382#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum ClusterNotificationsUpdateGotifyEndpointError {
386 Status400(models::PveError),
387 Status401(models::PveError),
388 Status403(models::PveError),
389 Status404(models::PveError),
390 Status500(models::PveError),
391 Status501(models::PveError),
392 Status503(models::PveError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum ClusterNotificationsUpdateMatcherError {
400 Status400(models::PveError),
401 Status401(models::PveError),
402 Status403(models::PveError),
403 Status404(models::PveError),
404 Status500(models::PveError),
405 Status501(models::PveError),
406 Status503(models::PveError),
407 UnknownValue(serde_json::Value),
408}
409
410#[derive(Debug, Clone, Serialize, Deserialize)]
412#[serde(untagged)]
413pub enum ClusterNotificationsUpdateSendmailEndpointError {
414 Status400(models::PveError),
415 Status401(models::PveError),
416 Status403(models::PveError),
417 Status404(models::PveError),
418 Status500(models::PveError),
419 Status501(models::PveError),
420 Status503(models::PveError),
421 UnknownValue(serde_json::Value),
422}
423
424#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum ClusterNotificationsUpdateSmtpEndpointError {
428 Status400(models::PveError),
429 Status401(models::PveError),
430 Status403(models::PveError),
431 Status404(models::PveError),
432 Status500(models::PveError),
433 Status501(models::PveError),
434 Status503(models::PveError),
435 UnknownValue(serde_json::Value),
436}
437
438#[derive(Debug, Clone, Serialize, Deserialize)]
440#[serde(untagged)]
441pub enum ClusterNotificationsUpdateWebhookEndpointError {
442 Status400(models::PveError),
443 Status401(models::PveError),
444 Status403(models::PveError),
445 Status404(models::PveError),
446 Status500(models::PveError),
447 Status501(models::PveError),
448 Status503(models::PveError),
449 UnknownValue(serde_json::Value),
450}
451
452
453pub async fn cluster_notifications_create_gotify_endpoint(configuration: &configuration::Configuration, cluster_notifications_create_gotify_endpoint_request: models::ClusterNotificationsCreateGotifyEndpointRequest) -> Result<models::ClusterNotificationsCreateGotifyEndpointResponse, Error<ClusterNotificationsCreateGotifyEndpointError>> {
455 let p_body_cluster_notifications_create_gotify_endpoint_request = cluster_notifications_create_gotify_endpoint_request;
457
458 let uri_str = format!("{}/cluster/notifications/endpoints/gotify", configuration.base_path);
459 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
460
461 if let Some(ref user_agent) = configuration.user_agent {
462 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
463 }
464 if let Some(ref apikey) = configuration.api_key {
465 let key = apikey.key.clone();
466 let value = match apikey.prefix {
467 Some(ref prefix) => format!("{} {}", prefix, key),
468 None => key,
469 };
470 req_builder = req_builder.header("Authorization", value);
471 };
472 if let Some(ref apikey) = configuration.api_key {
473 let key = apikey.key.clone();
474 let value = match apikey.prefix {
475 Some(ref prefix) => format!("{} {}", prefix, key),
476 None => key,
477 };
478 req_builder = req_builder.header("CSRFPreventionToken", value);
479 };
480 req_builder = req_builder.json(&p_body_cluster_notifications_create_gotify_endpoint_request);
481
482 let req = req_builder.build()?;
483 let resp = configuration.client.execute(req).await?;
484
485 let status = resp.status();
486 let content_type = resp
487 .headers()
488 .get("content-type")
489 .and_then(|v| v.to_str().ok())
490 .unwrap_or("application/octet-stream");
491 let content_type = super::ContentType::from(content_type);
492
493 if !status.is_client_error() && !status.is_server_error() {
494 let content = resp.text().await?;
495 match content_type {
496 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
497 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsCreateGotifyEndpointResponse`"))),
498 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::ClusterNotificationsCreateGotifyEndpointResponse`")))),
499 }
500 } else {
501 let content = resp.text().await?;
502 let entity: Option<ClusterNotificationsCreateGotifyEndpointError> = serde_json::from_str(&content).ok();
503 Err(Error::ResponseError(ResponseContent { status, content, entity }))
504 }
505}
506
507pub async fn cluster_notifications_create_matcher(configuration: &configuration::Configuration, cluster_notifications_create_matcher_request: models::ClusterNotificationsCreateMatcherRequest) -> Result<models::ClusterNotificationsCreateMatcherResponse, Error<ClusterNotificationsCreateMatcherError>> {
509 let p_body_cluster_notifications_create_matcher_request = cluster_notifications_create_matcher_request;
511
512 let uri_str = format!("{}/cluster/notifications/matchers", configuration.base_path);
513 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
514
515 if let Some(ref user_agent) = configuration.user_agent {
516 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
517 }
518 if let Some(ref apikey) = configuration.api_key {
519 let key = apikey.key.clone();
520 let value = match apikey.prefix {
521 Some(ref prefix) => format!("{} {}", prefix, key),
522 None => key,
523 };
524 req_builder = req_builder.header("Authorization", value);
525 };
526 if let Some(ref apikey) = configuration.api_key {
527 let key = apikey.key.clone();
528 let value = match apikey.prefix {
529 Some(ref prefix) => format!("{} {}", prefix, key),
530 None => key,
531 };
532 req_builder = req_builder.header("CSRFPreventionToken", value);
533 };
534 req_builder = req_builder.json(&p_body_cluster_notifications_create_matcher_request);
535
536 let req = req_builder.build()?;
537 let resp = configuration.client.execute(req).await?;
538
539 let status = resp.status();
540 let content_type = resp
541 .headers()
542 .get("content-type")
543 .and_then(|v| v.to_str().ok())
544 .unwrap_or("application/octet-stream");
545 let content_type = super::ContentType::from(content_type);
546
547 if !status.is_client_error() && !status.is_server_error() {
548 let content = resp.text().await?;
549 match content_type {
550 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
551 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsCreateMatcherResponse`"))),
552 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::ClusterNotificationsCreateMatcherResponse`")))),
553 }
554 } else {
555 let content = resp.text().await?;
556 let entity: Option<ClusterNotificationsCreateMatcherError> = serde_json::from_str(&content).ok();
557 Err(Error::ResponseError(ResponseContent { status, content, entity }))
558 }
559}
560
561pub async fn cluster_notifications_create_sendmail_endpoint(configuration: &configuration::Configuration, cluster_notifications_create_sendmail_endpoint_request: models::ClusterNotificationsCreateSendmailEndpointRequest) -> Result<models::ClusterNotificationsCreateSendmailEndpointResponse, Error<ClusterNotificationsCreateSendmailEndpointError>> {
563 let p_body_cluster_notifications_create_sendmail_endpoint_request = cluster_notifications_create_sendmail_endpoint_request;
565
566 let uri_str = format!("{}/cluster/notifications/endpoints/sendmail", configuration.base_path);
567 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
568
569 if let Some(ref user_agent) = configuration.user_agent {
570 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
571 }
572 if let Some(ref apikey) = configuration.api_key {
573 let key = apikey.key.clone();
574 let value = match apikey.prefix {
575 Some(ref prefix) => format!("{} {}", prefix, key),
576 None => key,
577 };
578 req_builder = req_builder.header("Authorization", value);
579 };
580 if let Some(ref apikey) = configuration.api_key {
581 let key = apikey.key.clone();
582 let value = match apikey.prefix {
583 Some(ref prefix) => format!("{} {}", prefix, key),
584 None => key,
585 };
586 req_builder = req_builder.header("CSRFPreventionToken", value);
587 };
588 req_builder = req_builder.json(&p_body_cluster_notifications_create_sendmail_endpoint_request);
589
590 let req = req_builder.build()?;
591 let resp = configuration.client.execute(req).await?;
592
593 let status = resp.status();
594 let content_type = resp
595 .headers()
596 .get("content-type")
597 .and_then(|v| v.to_str().ok())
598 .unwrap_or("application/octet-stream");
599 let content_type = super::ContentType::from(content_type);
600
601 if !status.is_client_error() && !status.is_server_error() {
602 let content = resp.text().await?;
603 match content_type {
604 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
605 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsCreateSendmailEndpointResponse`"))),
606 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::ClusterNotificationsCreateSendmailEndpointResponse`")))),
607 }
608 } else {
609 let content = resp.text().await?;
610 let entity: Option<ClusterNotificationsCreateSendmailEndpointError> = serde_json::from_str(&content).ok();
611 Err(Error::ResponseError(ResponseContent { status, content, entity }))
612 }
613}
614
615pub async fn cluster_notifications_create_smtp_endpoint(configuration: &configuration::Configuration, cluster_notifications_create_smtp_endpoint_request: models::ClusterNotificationsCreateSmtpEndpointRequest) -> Result<models::ClusterNotificationsCreateSmtpEndpointResponse, Error<ClusterNotificationsCreateSmtpEndpointError>> {
617 let p_body_cluster_notifications_create_smtp_endpoint_request = cluster_notifications_create_smtp_endpoint_request;
619
620 let uri_str = format!("{}/cluster/notifications/endpoints/smtp", configuration.base_path);
621 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
622
623 if let Some(ref user_agent) = configuration.user_agent {
624 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
625 }
626 if let Some(ref apikey) = configuration.api_key {
627 let key = apikey.key.clone();
628 let value = match apikey.prefix {
629 Some(ref prefix) => format!("{} {}", prefix, key),
630 None => key,
631 };
632 req_builder = req_builder.header("Authorization", value);
633 };
634 if let Some(ref apikey) = configuration.api_key {
635 let key = apikey.key.clone();
636 let value = match apikey.prefix {
637 Some(ref prefix) => format!("{} {}", prefix, key),
638 None => key,
639 };
640 req_builder = req_builder.header("CSRFPreventionToken", value);
641 };
642 req_builder = req_builder.json(&p_body_cluster_notifications_create_smtp_endpoint_request);
643
644 let req = req_builder.build()?;
645 let resp = configuration.client.execute(req).await?;
646
647 let status = resp.status();
648 let content_type = resp
649 .headers()
650 .get("content-type")
651 .and_then(|v| v.to_str().ok())
652 .unwrap_or("application/octet-stream");
653 let content_type = super::ContentType::from(content_type);
654
655 if !status.is_client_error() && !status.is_server_error() {
656 let content = resp.text().await?;
657 match content_type {
658 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
659 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsCreateSmtpEndpointResponse`"))),
660 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::ClusterNotificationsCreateSmtpEndpointResponse`")))),
661 }
662 } else {
663 let content = resp.text().await?;
664 let entity: Option<ClusterNotificationsCreateSmtpEndpointError> = serde_json::from_str(&content).ok();
665 Err(Error::ResponseError(ResponseContent { status, content, entity }))
666 }
667}
668
669pub async fn cluster_notifications_create_webhook_endpoint(configuration: &configuration::Configuration, cluster_notifications_create_webhook_endpoint_request: models::ClusterNotificationsCreateWebhookEndpointRequest) -> Result<models::ClusterNotificationsCreateWebhookEndpointResponse, Error<ClusterNotificationsCreateWebhookEndpointError>> {
671 let p_body_cluster_notifications_create_webhook_endpoint_request = cluster_notifications_create_webhook_endpoint_request;
673
674 let uri_str = format!("{}/cluster/notifications/endpoints/webhook", configuration.base_path);
675 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
676
677 if let Some(ref user_agent) = configuration.user_agent {
678 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
679 }
680 if let Some(ref apikey) = configuration.api_key {
681 let key = apikey.key.clone();
682 let value = match apikey.prefix {
683 Some(ref prefix) => format!("{} {}", prefix, key),
684 None => key,
685 };
686 req_builder = req_builder.header("Authorization", value);
687 };
688 if let Some(ref apikey) = configuration.api_key {
689 let key = apikey.key.clone();
690 let value = match apikey.prefix {
691 Some(ref prefix) => format!("{} {}", prefix, key),
692 None => key,
693 };
694 req_builder = req_builder.header("CSRFPreventionToken", value);
695 };
696 req_builder = req_builder.json(&p_body_cluster_notifications_create_webhook_endpoint_request);
697
698 let req = req_builder.build()?;
699 let resp = configuration.client.execute(req).await?;
700
701 let status = resp.status();
702 let content_type = resp
703 .headers()
704 .get("content-type")
705 .and_then(|v| v.to_str().ok())
706 .unwrap_or("application/octet-stream");
707 let content_type = super::ContentType::from(content_type);
708
709 if !status.is_client_error() && !status.is_server_error() {
710 let content = resp.text().await?;
711 match content_type {
712 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
713 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsCreateWebhookEndpointResponse`"))),
714 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::ClusterNotificationsCreateWebhookEndpointResponse`")))),
715 }
716 } else {
717 let content = resp.text().await?;
718 let entity: Option<ClusterNotificationsCreateWebhookEndpointError> = serde_json::from_str(&content).ok();
719 Err(Error::ResponseError(ResponseContent { status, content, entity }))
720 }
721}
722
723pub async fn cluster_notifications_delete_gotify_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsDeleteGotifyEndpointResponse, Error<ClusterNotificationsDeleteGotifyEndpointError>> {
725 let p_path_name = name;
727
728 let uri_str = format!("{}/cluster/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
729 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
730
731 if let Some(ref user_agent) = configuration.user_agent {
732 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
733 }
734 if let Some(ref apikey) = configuration.api_key {
735 let key = apikey.key.clone();
736 let value = match apikey.prefix {
737 Some(ref prefix) => format!("{} {}", prefix, key),
738 None => key,
739 };
740 req_builder = req_builder.header("Authorization", value);
741 };
742 if let Some(ref apikey) = configuration.api_key {
743 let key = apikey.key.clone();
744 let value = match apikey.prefix {
745 Some(ref prefix) => format!("{} {}", prefix, key),
746 None => key,
747 };
748 req_builder = req_builder.header("CSRFPreventionToken", value);
749 };
750
751 let req = req_builder.build()?;
752 let resp = configuration.client.execute(req).await?;
753
754 let status = resp.status();
755 let content_type = resp
756 .headers()
757 .get("content-type")
758 .and_then(|v| v.to_str().ok())
759 .unwrap_or("application/octet-stream");
760 let content_type = super::ContentType::from(content_type);
761
762 if !status.is_client_error() && !status.is_server_error() {
763 let content = resp.text().await?;
764 match content_type {
765 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
766 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsDeleteGotifyEndpointResponse`"))),
767 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::ClusterNotificationsDeleteGotifyEndpointResponse`")))),
768 }
769 } else {
770 let content = resp.text().await?;
771 let entity: Option<ClusterNotificationsDeleteGotifyEndpointError> = serde_json::from_str(&content).ok();
772 Err(Error::ResponseError(ResponseContent { status, content, entity }))
773 }
774}
775
776pub async fn cluster_notifications_delete_matcher(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsDeleteMatcherResponse, Error<ClusterNotificationsDeleteMatcherError>> {
778 let p_path_name = name;
780
781 let uri_str = format!("{}/cluster/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
782 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
783
784 if let Some(ref user_agent) = configuration.user_agent {
785 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
786 }
787 if let Some(ref apikey) = configuration.api_key {
788 let key = apikey.key.clone();
789 let value = match apikey.prefix {
790 Some(ref prefix) => format!("{} {}", prefix, key),
791 None => key,
792 };
793 req_builder = req_builder.header("Authorization", value);
794 };
795 if let Some(ref apikey) = configuration.api_key {
796 let key = apikey.key.clone();
797 let value = match apikey.prefix {
798 Some(ref prefix) => format!("{} {}", prefix, key),
799 None => key,
800 };
801 req_builder = req_builder.header("CSRFPreventionToken", value);
802 };
803
804 let req = req_builder.build()?;
805 let resp = configuration.client.execute(req).await?;
806
807 let status = resp.status();
808 let content_type = resp
809 .headers()
810 .get("content-type")
811 .and_then(|v| v.to_str().ok())
812 .unwrap_or("application/octet-stream");
813 let content_type = super::ContentType::from(content_type);
814
815 if !status.is_client_error() && !status.is_server_error() {
816 let content = resp.text().await?;
817 match content_type {
818 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
819 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsDeleteMatcherResponse`"))),
820 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::ClusterNotificationsDeleteMatcherResponse`")))),
821 }
822 } else {
823 let content = resp.text().await?;
824 let entity: Option<ClusterNotificationsDeleteMatcherError> = serde_json::from_str(&content).ok();
825 Err(Error::ResponseError(ResponseContent { status, content, entity }))
826 }
827}
828
829pub async fn cluster_notifications_delete_sendmail_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsDeleteSendmailEndpointResponse, Error<ClusterNotificationsDeleteSendmailEndpointError>> {
831 let p_path_name = name;
833
834 let uri_str = format!("{}/cluster/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
835 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
836
837 if let Some(ref user_agent) = configuration.user_agent {
838 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
839 }
840 if let Some(ref apikey) = configuration.api_key {
841 let key = apikey.key.clone();
842 let value = match apikey.prefix {
843 Some(ref prefix) => format!("{} {}", prefix, key),
844 None => key,
845 };
846 req_builder = req_builder.header("Authorization", value);
847 };
848 if let Some(ref apikey) = configuration.api_key {
849 let key = apikey.key.clone();
850 let value = match apikey.prefix {
851 Some(ref prefix) => format!("{} {}", prefix, key),
852 None => key,
853 };
854 req_builder = req_builder.header("CSRFPreventionToken", value);
855 };
856
857 let req = req_builder.build()?;
858 let resp = configuration.client.execute(req).await?;
859
860 let status = resp.status();
861 let content_type = resp
862 .headers()
863 .get("content-type")
864 .and_then(|v| v.to_str().ok())
865 .unwrap_or("application/octet-stream");
866 let content_type = super::ContentType::from(content_type);
867
868 if !status.is_client_error() && !status.is_server_error() {
869 let content = resp.text().await?;
870 match content_type {
871 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
872 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsDeleteSendmailEndpointResponse`"))),
873 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::ClusterNotificationsDeleteSendmailEndpointResponse`")))),
874 }
875 } else {
876 let content = resp.text().await?;
877 let entity: Option<ClusterNotificationsDeleteSendmailEndpointError> = serde_json::from_str(&content).ok();
878 Err(Error::ResponseError(ResponseContent { status, content, entity }))
879 }
880}
881
882pub async fn cluster_notifications_delete_smtp_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsDeleteSmtpEndpointResponse, Error<ClusterNotificationsDeleteSmtpEndpointError>> {
884 let p_path_name = name;
886
887 let uri_str = format!("{}/cluster/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
888 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
889
890 if let Some(ref user_agent) = configuration.user_agent {
891 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
892 }
893 if let Some(ref apikey) = configuration.api_key {
894 let key = apikey.key.clone();
895 let value = match apikey.prefix {
896 Some(ref prefix) => format!("{} {}", prefix, key),
897 None => key,
898 };
899 req_builder = req_builder.header("Authorization", value);
900 };
901 if let Some(ref apikey) = configuration.api_key {
902 let key = apikey.key.clone();
903 let value = match apikey.prefix {
904 Some(ref prefix) => format!("{} {}", prefix, key),
905 None => key,
906 };
907 req_builder = req_builder.header("CSRFPreventionToken", value);
908 };
909
910 let req = req_builder.build()?;
911 let resp = configuration.client.execute(req).await?;
912
913 let status = resp.status();
914 let content_type = resp
915 .headers()
916 .get("content-type")
917 .and_then(|v| v.to_str().ok())
918 .unwrap_or("application/octet-stream");
919 let content_type = super::ContentType::from(content_type);
920
921 if !status.is_client_error() && !status.is_server_error() {
922 let content = resp.text().await?;
923 match content_type {
924 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
925 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsDeleteSmtpEndpointResponse`"))),
926 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::ClusterNotificationsDeleteSmtpEndpointResponse`")))),
927 }
928 } else {
929 let content = resp.text().await?;
930 let entity: Option<ClusterNotificationsDeleteSmtpEndpointError> = serde_json::from_str(&content).ok();
931 Err(Error::ResponseError(ResponseContent { status, content, entity }))
932 }
933}
934
935pub async fn cluster_notifications_delete_webhook_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsDeleteWebhookEndpointResponse, Error<ClusterNotificationsDeleteWebhookEndpointError>> {
937 let p_path_name = name;
939
940 let uri_str = format!("{}/cluster/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
941 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
942
943 if let Some(ref user_agent) = configuration.user_agent {
944 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
945 }
946 if let Some(ref apikey) = configuration.api_key {
947 let key = apikey.key.clone();
948 let value = match apikey.prefix {
949 Some(ref prefix) => format!("{} {}", prefix, key),
950 None => key,
951 };
952 req_builder = req_builder.header("Authorization", value);
953 };
954 if let Some(ref apikey) = configuration.api_key {
955 let key = apikey.key.clone();
956 let value = match apikey.prefix {
957 Some(ref prefix) => format!("{} {}", prefix, key),
958 None => key,
959 };
960 req_builder = req_builder.header("CSRFPreventionToken", value);
961 };
962
963 let req = req_builder.build()?;
964 let resp = configuration.client.execute(req).await?;
965
966 let status = resp.status();
967 let content_type = resp
968 .headers()
969 .get("content-type")
970 .and_then(|v| v.to_str().ok())
971 .unwrap_or("application/octet-stream");
972 let content_type = super::ContentType::from(content_type);
973
974 if !status.is_client_error() && !status.is_server_error() {
975 let content = resp.text().await?;
976 match content_type {
977 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
978 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsDeleteWebhookEndpointResponse`"))),
979 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::ClusterNotificationsDeleteWebhookEndpointResponse`")))),
980 }
981 } else {
982 let content = resp.text().await?;
983 let entity: Option<ClusterNotificationsDeleteWebhookEndpointError> = serde_json::from_str(&content).ok();
984 Err(Error::ResponseError(ResponseContent { status, content, entity }))
985 }
986}
987
988pub async fn cluster_notifications_endpoints_index(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsEndpointsIndexResponse, Error<ClusterNotificationsEndpointsIndexError>> {
990
991 let uri_str = format!("{}/cluster/notifications/endpoints", configuration.base_path);
992 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
993
994 if let Some(ref user_agent) = configuration.user_agent {
995 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
996 }
997 if let Some(ref apikey) = configuration.api_key {
998 let key = apikey.key.clone();
999 let value = match apikey.prefix {
1000 Some(ref prefix) => format!("{} {}", prefix, key),
1001 None => key,
1002 };
1003 req_builder = req_builder.header("Authorization", value);
1004 };
1005 if let Some(ref apikey) = configuration.api_key {
1006 let key = apikey.key.clone();
1007 let value = match apikey.prefix {
1008 Some(ref prefix) => format!("{} {}", prefix, key),
1009 None => key,
1010 };
1011 req_builder = req_builder.header("CSRFPreventionToken", value);
1012 };
1013
1014 let req = req_builder.build()?;
1015 let resp = configuration.client.execute(req).await?;
1016
1017 let status = resp.status();
1018 let content_type = resp
1019 .headers()
1020 .get("content-type")
1021 .and_then(|v| v.to_str().ok())
1022 .unwrap_or("application/octet-stream");
1023 let content_type = super::ContentType::from(content_type);
1024
1025 if !status.is_client_error() && !status.is_server_error() {
1026 let content = resp.text().await?;
1027 match content_type {
1028 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1029 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsEndpointsIndexResponse`"))),
1030 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::ClusterNotificationsEndpointsIndexResponse`")))),
1031 }
1032 } else {
1033 let content = resp.text().await?;
1034 let entity: Option<ClusterNotificationsEndpointsIndexError> = serde_json::from_str(&content).ok();
1035 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1036 }
1037}
1038
1039pub async fn cluster_notifications_get_all_targets(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetAllTargetsResponse, Error<ClusterNotificationsGetAllTargetsError>> {
1041
1042 let uri_str = format!("{}/cluster/notifications/targets", configuration.base_path);
1043 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1044
1045 if let Some(ref user_agent) = configuration.user_agent {
1046 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1047 }
1048 if let Some(ref apikey) = configuration.api_key {
1049 let key = apikey.key.clone();
1050 let value = match apikey.prefix {
1051 Some(ref prefix) => format!("{} {}", prefix, key),
1052 None => key,
1053 };
1054 req_builder = req_builder.header("Authorization", value);
1055 };
1056 if let Some(ref apikey) = configuration.api_key {
1057 let key = apikey.key.clone();
1058 let value = match apikey.prefix {
1059 Some(ref prefix) => format!("{} {}", prefix, key),
1060 None => key,
1061 };
1062 req_builder = req_builder.header("CSRFPreventionToken", value);
1063 };
1064
1065 let req = req_builder.build()?;
1066 let resp = configuration.client.execute(req).await?;
1067
1068 let status = resp.status();
1069 let content_type = resp
1070 .headers()
1071 .get("content-type")
1072 .and_then(|v| v.to_str().ok())
1073 .unwrap_or("application/octet-stream");
1074 let content_type = super::ContentType::from(content_type);
1075
1076 if !status.is_client_error() && !status.is_server_error() {
1077 let content = resp.text().await?;
1078 match content_type {
1079 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1080 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetAllTargetsResponse`"))),
1081 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::ClusterNotificationsGetAllTargetsResponse`")))),
1082 }
1083 } else {
1084 let content = resp.text().await?;
1085 let entity: Option<ClusterNotificationsGetAllTargetsError> = serde_json::from_str(&content).ok();
1086 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1087 }
1088}
1089
1090pub async fn cluster_notifications_get_gotify_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsGetGotifyEndpointResponse, Error<ClusterNotificationsGetGotifyEndpointError>> {
1092 let p_path_name = name;
1094
1095 let uri_str = format!("{}/cluster/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1096 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1097
1098 if let Some(ref user_agent) = configuration.user_agent {
1099 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1100 }
1101 if let Some(ref apikey) = configuration.api_key {
1102 let key = apikey.key.clone();
1103 let value = match apikey.prefix {
1104 Some(ref prefix) => format!("{} {}", prefix, key),
1105 None => key,
1106 };
1107 req_builder = req_builder.header("Authorization", value);
1108 };
1109 if let Some(ref apikey) = configuration.api_key {
1110 let key = apikey.key.clone();
1111 let value = match apikey.prefix {
1112 Some(ref prefix) => format!("{} {}", prefix, key),
1113 None => key,
1114 };
1115 req_builder = req_builder.header("CSRFPreventionToken", value);
1116 };
1117
1118 let req = req_builder.build()?;
1119 let resp = configuration.client.execute(req).await?;
1120
1121 let status = resp.status();
1122 let content_type = resp
1123 .headers()
1124 .get("content-type")
1125 .and_then(|v| v.to_str().ok())
1126 .unwrap_or("application/octet-stream");
1127 let content_type = super::ContentType::from(content_type);
1128
1129 if !status.is_client_error() && !status.is_server_error() {
1130 let content = resp.text().await?;
1131 match content_type {
1132 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1133 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetGotifyEndpointResponse`"))),
1134 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::ClusterNotificationsGetGotifyEndpointResponse`")))),
1135 }
1136 } else {
1137 let content = resp.text().await?;
1138 let entity: Option<ClusterNotificationsGetGotifyEndpointError> = serde_json::from_str(&content).ok();
1139 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1140 }
1141}
1142
1143pub async fn cluster_notifications_get_gotify_endpoints(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetGotifyEndpointsResponse, Error<ClusterNotificationsGetGotifyEndpointsError>> {
1145
1146 let uri_str = format!("{}/cluster/notifications/endpoints/gotify", configuration.base_path);
1147 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1148
1149 if let Some(ref user_agent) = configuration.user_agent {
1150 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1151 }
1152 if let Some(ref apikey) = configuration.api_key {
1153 let key = apikey.key.clone();
1154 let value = match apikey.prefix {
1155 Some(ref prefix) => format!("{} {}", prefix, key),
1156 None => key,
1157 };
1158 req_builder = req_builder.header("Authorization", value);
1159 };
1160 if let Some(ref apikey) = configuration.api_key {
1161 let key = apikey.key.clone();
1162 let value = match apikey.prefix {
1163 Some(ref prefix) => format!("{} {}", prefix, key),
1164 None => key,
1165 };
1166 req_builder = req_builder.header("CSRFPreventionToken", value);
1167 };
1168
1169 let req = req_builder.build()?;
1170 let resp = configuration.client.execute(req).await?;
1171
1172 let status = resp.status();
1173 let content_type = resp
1174 .headers()
1175 .get("content-type")
1176 .and_then(|v| v.to_str().ok())
1177 .unwrap_or("application/octet-stream");
1178 let content_type = super::ContentType::from(content_type);
1179
1180 if !status.is_client_error() && !status.is_server_error() {
1181 let content = resp.text().await?;
1182 match content_type {
1183 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1184 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetGotifyEndpointsResponse`"))),
1185 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::ClusterNotificationsGetGotifyEndpointsResponse`")))),
1186 }
1187 } else {
1188 let content = resp.text().await?;
1189 let entity: Option<ClusterNotificationsGetGotifyEndpointsError> = serde_json::from_str(&content).ok();
1190 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1191 }
1192}
1193
1194pub async fn cluster_notifications_get_matcher(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsGetMatcherResponse, Error<ClusterNotificationsGetMatcherError>> {
1196 let p_path_name = name;
1198
1199 let uri_str = format!("{}/cluster/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1200 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1201
1202 if let Some(ref user_agent) = configuration.user_agent {
1203 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1204 }
1205 if let Some(ref apikey) = configuration.api_key {
1206 let key = apikey.key.clone();
1207 let value = match apikey.prefix {
1208 Some(ref prefix) => format!("{} {}", prefix, key),
1209 None => key,
1210 };
1211 req_builder = req_builder.header("Authorization", value);
1212 };
1213 if let Some(ref apikey) = configuration.api_key {
1214 let key = apikey.key.clone();
1215 let value = match apikey.prefix {
1216 Some(ref prefix) => format!("{} {}", prefix, key),
1217 None => key,
1218 };
1219 req_builder = req_builder.header("CSRFPreventionToken", value);
1220 };
1221
1222 let req = req_builder.build()?;
1223 let resp = configuration.client.execute(req).await?;
1224
1225 let status = resp.status();
1226 let content_type = resp
1227 .headers()
1228 .get("content-type")
1229 .and_then(|v| v.to_str().ok())
1230 .unwrap_or("application/octet-stream");
1231 let content_type = super::ContentType::from(content_type);
1232
1233 if !status.is_client_error() && !status.is_server_error() {
1234 let content = resp.text().await?;
1235 match content_type {
1236 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1237 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetMatcherResponse`"))),
1238 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::ClusterNotificationsGetMatcherResponse`")))),
1239 }
1240 } else {
1241 let content = resp.text().await?;
1242 let entity: Option<ClusterNotificationsGetMatcherError> = serde_json::from_str(&content).ok();
1243 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1244 }
1245}
1246
1247pub async fn cluster_notifications_get_matcher_field_values(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetMatcherFieldValuesResponse, Error<ClusterNotificationsGetMatcherFieldValuesError>> {
1249
1250 let uri_str = format!("{}/cluster/notifications/matcher-field-values", configuration.base_path);
1251 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1252
1253 if let Some(ref user_agent) = configuration.user_agent {
1254 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1255 }
1256 if let Some(ref apikey) = configuration.api_key {
1257 let key = apikey.key.clone();
1258 let value = match apikey.prefix {
1259 Some(ref prefix) => format!("{} {}", prefix, key),
1260 None => key,
1261 };
1262 req_builder = req_builder.header("Authorization", value);
1263 };
1264 if let Some(ref apikey) = configuration.api_key {
1265 let key = apikey.key.clone();
1266 let value = match apikey.prefix {
1267 Some(ref prefix) => format!("{} {}", prefix, key),
1268 None => key,
1269 };
1270 req_builder = req_builder.header("CSRFPreventionToken", value);
1271 };
1272
1273 let req = req_builder.build()?;
1274 let resp = configuration.client.execute(req).await?;
1275
1276 let status = resp.status();
1277 let content_type = resp
1278 .headers()
1279 .get("content-type")
1280 .and_then(|v| v.to_str().ok())
1281 .unwrap_or("application/octet-stream");
1282 let content_type = super::ContentType::from(content_type);
1283
1284 if !status.is_client_error() && !status.is_server_error() {
1285 let content = resp.text().await?;
1286 match content_type {
1287 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1288 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetMatcherFieldValuesResponse`"))),
1289 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::ClusterNotificationsGetMatcherFieldValuesResponse`")))),
1290 }
1291 } else {
1292 let content = resp.text().await?;
1293 let entity: Option<ClusterNotificationsGetMatcherFieldValuesError> = serde_json::from_str(&content).ok();
1294 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1295 }
1296}
1297
1298pub async fn cluster_notifications_get_matcher_fields(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetMatcherFieldsResponse, Error<ClusterNotificationsGetMatcherFieldsError>> {
1300
1301 let uri_str = format!("{}/cluster/notifications/matcher-fields", configuration.base_path);
1302 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1303
1304 if let Some(ref user_agent) = configuration.user_agent {
1305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1306 }
1307 if let Some(ref apikey) = configuration.api_key {
1308 let key = apikey.key.clone();
1309 let value = match apikey.prefix {
1310 Some(ref prefix) => format!("{} {}", prefix, key),
1311 None => key,
1312 };
1313 req_builder = req_builder.header("Authorization", value);
1314 };
1315 if let Some(ref apikey) = configuration.api_key {
1316 let key = apikey.key.clone();
1317 let value = match apikey.prefix {
1318 Some(ref prefix) => format!("{} {}", prefix, key),
1319 None => key,
1320 };
1321 req_builder = req_builder.header("CSRFPreventionToken", value);
1322 };
1323
1324 let req = req_builder.build()?;
1325 let resp = configuration.client.execute(req).await?;
1326
1327 let status = resp.status();
1328 let content_type = resp
1329 .headers()
1330 .get("content-type")
1331 .and_then(|v| v.to_str().ok())
1332 .unwrap_or("application/octet-stream");
1333 let content_type = super::ContentType::from(content_type);
1334
1335 if !status.is_client_error() && !status.is_server_error() {
1336 let content = resp.text().await?;
1337 match content_type {
1338 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1339 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetMatcherFieldsResponse`"))),
1340 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::ClusterNotificationsGetMatcherFieldsResponse`")))),
1341 }
1342 } else {
1343 let content = resp.text().await?;
1344 let entity: Option<ClusterNotificationsGetMatcherFieldsError> = serde_json::from_str(&content).ok();
1345 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1346 }
1347}
1348
1349pub async fn cluster_notifications_get_matchers(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetMatchersResponse, Error<ClusterNotificationsGetMatchersError>> {
1351
1352 let uri_str = format!("{}/cluster/notifications/matchers", configuration.base_path);
1353 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1354
1355 if let Some(ref user_agent) = configuration.user_agent {
1356 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1357 }
1358 if let Some(ref apikey) = configuration.api_key {
1359 let key = apikey.key.clone();
1360 let value = match apikey.prefix {
1361 Some(ref prefix) => format!("{} {}", prefix, key),
1362 None => key,
1363 };
1364 req_builder = req_builder.header("Authorization", value);
1365 };
1366 if let Some(ref apikey) = configuration.api_key {
1367 let key = apikey.key.clone();
1368 let value = match apikey.prefix {
1369 Some(ref prefix) => format!("{} {}", prefix, key),
1370 None => key,
1371 };
1372 req_builder = req_builder.header("CSRFPreventionToken", value);
1373 };
1374
1375 let req = req_builder.build()?;
1376 let resp = configuration.client.execute(req).await?;
1377
1378 let status = resp.status();
1379 let content_type = resp
1380 .headers()
1381 .get("content-type")
1382 .and_then(|v| v.to_str().ok())
1383 .unwrap_or("application/octet-stream");
1384 let content_type = super::ContentType::from(content_type);
1385
1386 if !status.is_client_error() && !status.is_server_error() {
1387 let content = resp.text().await?;
1388 match content_type {
1389 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1390 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetMatchersResponse`"))),
1391 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::ClusterNotificationsGetMatchersResponse`")))),
1392 }
1393 } else {
1394 let content = resp.text().await?;
1395 let entity: Option<ClusterNotificationsGetMatchersError> = serde_json::from_str(&content).ok();
1396 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1397 }
1398}
1399
1400pub async fn cluster_notifications_get_notifications(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetNotificationsResponse, Error<ClusterNotificationsGetNotificationsError>> {
1402
1403 let uri_str = format!("{}/cluster/notifications", configuration.base_path);
1404 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1405
1406 if let Some(ref user_agent) = configuration.user_agent {
1407 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1408 }
1409 if let Some(ref apikey) = configuration.api_key {
1410 let key = apikey.key.clone();
1411 let value = match apikey.prefix {
1412 Some(ref prefix) => format!("{} {}", prefix, key),
1413 None => key,
1414 };
1415 req_builder = req_builder.header("Authorization", value);
1416 };
1417 if let Some(ref apikey) = configuration.api_key {
1418 let key = apikey.key.clone();
1419 let value = match apikey.prefix {
1420 Some(ref prefix) => format!("{} {}", prefix, key),
1421 None => key,
1422 };
1423 req_builder = req_builder.header("CSRFPreventionToken", value);
1424 };
1425
1426 let req = req_builder.build()?;
1427 let resp = configuration.client.execute(req).await?;
1428
1429 let status = resp.status();
1430 let content_type = resp
1431 .headers()
1432 .get("content-type")
1433 .and_then(|v| v.to_str().ok())
1434 .unwrap_or("application/octet-stream");
1435 let content_type = super::ContentType::from(content_type);
1436
1437 if !status.is_client_error() && !status.is_server_error() {
1438 let content = resp.text().await?;
1439 match content_type {
1440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetNotificationsResponse`"))),
1442 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::ClusterNotificationsGetNotificationsResponse`")))),
1443 }
1444 } else {
1445 let content = resp.text().await?;
1446 let entity: Option<ClusterNotificationsGetNotificationsError> = serde_json::from_str(&content).ok();
1447 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1448 }
1449}
1450
1451pub async fn cluster_notifications_get_sendmail_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsGetSendmailEndpointResponse, Error<ClusterNotificationsGetSendmailEndpointError>> {
1453 let p_path_name = name;
1455
1456 let uri_str = format!("{}/cluster/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1457 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1458
1459 if let Some(ref user_agent) = configuration.user_agent {
1460 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1461 }
1462 if let Some(ref apikey) = configuration.api_key {
1463 let key = apikey.key.clone();
1464 let value = match apikey.prefix {
1465 Some(ref prefix) => format!("{} {}", prefix, key),
1466 None => key,
1467 };
1468 req_builder = req_builder.header("Authorization", value);
1469 };
1470 if let Some(ref apikey) = configuration.api_key {
1471 let key = apikey.key.clone();
1472 let value = match apikey.prefix {
1473 Some(ref prefix) => format!("{} {}", prefix, key),
1474 None => key,
1475 };
1476 req_builder = req_builder.header("CSRFPreventionToken", value);
1477 };
1478
1479 let req = req_builder.build()?;
1480 let resp = configuration.client.execute(req).await?;
1481
1482 let status = resp.status();
1483 let content_type = resp
1484 .headers()
1485 .get("content-type")
1486 .and_then(|v| v.to_str().ok())
1487 .unwrap_or("application/octet-stream");
1488 let content_type = super::ContentType::from(content_type);
1489
1490 if !status.is_client_error() && !status.is_server_error() {
1491 let content = resp.text().await?;
1492 match content_type {
1493 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1494 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetSendmailEndpointResponse`"))),
1495 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::ClusterNotificationsGetSendmailEndpointResponse`")))),
1496 }
1497 } else {
1498 let content = resp.text().await?;
1499 let entity: Option<ClusterNotificationsGetSendmailEndpointError> = serde_json::from_str(&content).ok();
1500 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1501 }
1502}
1503
1504pub async fn cluster_notifications_get_sendmail_endpoints(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetSendmailEndpointsResponse, Error<ClusterNotificationsGetSendmailEndpointsError>> {
1506
1507 let uri_str = format!("{}/cluster/notifications/endpoints/sendmail", configuration.base_path);
1508 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1509
1510 if let Some(ref user_agent) = configuration.user_agent {
1511 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1512 }
1513 if let Some(ref apikey) = configuration.api_key {
1514 let key = apikey.key.clone();
1515 let value = match apikey.prefix {
1516 Some(ref prefix) => format!("{} {}", prefix, key),
1517 None => key,
1518 };
1519 req_builder = req_builder.header("Authorization", value);
1520 };
1521 if let Some(ref apikey) = configuration.api_key {
1522 let key = apikey.key.clone();
1523 let value = match apikey.prefix {
1524 Some(ref prefix) => format!("{} {}", prefix, key),
1525 None => key,
1526 };
1527 req_builder = req_builder.header("CSRFPreventionToken", value);
1528 };
1529
1530 let req = req_builder.build()?;
1531 let resp = configuration.client.execute(req).await?;
1532
1533 let status = resp.status();
1534 let content_type = resp
1535 .headers()
1536 .get("content-type")
1537 .and_then(|v| v.to_str().ok())
1538 .unwrap_or("application/octet-stream");
1539 let content_type = super::ContentType::from(content_type);
1540
1541 if !status.is_client_error() && !status.is_server_error() {
1542 let content = resp.text().await?;
1543 match content_type {
1544 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1545 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetSendmailEndpointsResponse`"))),
1546 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::ClusterNotificationsGetSendmailEndpointsResponse`")))),
1547 }
1548 } else {
1549 let content = resp.text().await?;
1550 let entity: Option<ClusterNotificationsGetSendmailEndpointsError> = serde_json::from_str(&content).ok();
1551 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1552 }
1553}
1554
1555pub async fn cluster_notifications_get_smtp_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsGetSmtpEndpointResponse, Error<ClusterNotificationsGetSmtpEndpointError>> {
1557 let p_path_name = name;
1559
1560 let uri_str = format!("{}/cluster/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1561 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1562
1563 if let Some(ref user_agent) = configuration.user_agent {
1564 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1565 }
1566 if let Some(ref apikey) = configuration.api_key {
1567 let key = apikey.key.clone();
1568 let value = match apikey.prefix {
1569 Some(ref prefix) => format!("{} {}", prefix, key),
1570 None => key,
1571 };
1572 req_builder = req_builder.header("Authorization", value);
1573 };
1574 if let Some(ref apikey) = configuration.api_key {
1575 let key = apikey.key.clone();
1576 let value = match apikey.prefix {
1577 Some(ref prefix) => format!("{} {}", prefix, key),
1578 None => key,
1579 };
1580 req_builder = req_builder.header("CSRFPreventionToken", value);
1581 };
1582
1583 let req = req_builder.build()?;
1584 let resp = configuration.client.execute(req).await?;
1585
1586 let status = resp.status();
1587 let content_type = resp
1588 .headers()
1589 .get("content-type")
1590 .and_then(|v| v.to_str().ok())
1591 .unwrap_or("application/octet-stream");
1592 let content_type = super::ContentType::from(content_type);
1593
1594 if !status.is_client_error() && !status.is_server_error() {
1595 let content = resp.text().await?;
1596 match content_type {
1597 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1598 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetSmtpEndpointResponse`"))),
1599 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::ClusterNotificationsGetSmtpEndpointResponse`")))),
1600 }
1601 } else {
1602 let content = resp.text().await?;
1603 let entity: Option<ClusterNotificationsGetSmtpEndpointError> = serde_json::from_str(&content).ok();
1604 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1605 }
1606}
1607
1608pub async fn cluster_notifications_get_smtp_endpoints(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetSmtpEndpointsResponse, Error<ClusterNotificationsGetSmtpEndpointsError>> {
1610
1611 let uri_str = format!("{}/cluster/notifications/endpoints/smtp", configuration.base_path);
1612 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1613
1614 if let Some(ref user_agent) = configuration.user_agent {
1615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1616 }
1617 if let Some(ref apikey) = configuration.api_key {
1618 let key = apikey.key.clone();
1619 let value = match apikey.prefix {
1620 Some(ref prefix) => format!("{} {}", prefix, key),
1621 None => key,
1622 };
1623 req_builder = req_builder.header("Authorization", value);
1624 };
1625 if let Some(ref apikey) = configuration.api_key {
1626 let key = apikey.key.clone();
1627 let value = match apikey.prefix {
1628 Some(ref prefix) => format!("{} {}", prefix, key),
1629 None => key,
1630 };
1631 req_builder = req_builder.header("CSRFPreventionToken", value);
1632 };
1633
1634 let req = req_builder.build()?;
1635 let resp = configuration.client.execute(req).await?;
1636
1637 let status = resp.status();
1638 let content_type = resp
1639 .headers()
1640 .get("content-type")
1641 .and_then(|v| v.to_str().ok())
1642 .unwrap_or("application/octet-stream");
1643 let content_type = super::ContentType::from(content_type);
1644
1645 if !status.is_client_error() && !status.is_server_error() {
1646 let content = resp.text().await?;
1647 match content_type {
1648 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1649 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetSmtpEndpointsResponse`"))),
1650 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::ClusterNotificationsGetSmtpEndpointsResponse`")))),
1651 }
1652 } else {
1653 let content = resp.text().await?;
1654 let entity: Option<ClusterNotificationsGetSmtpEndpointsError> = serde_json::from_str(&content).ok();
1655 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1656 }
1657}
1658
1659pub async fn cluster_notifications_get_webhook_endpoint(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsGetWebhookEndpointResponse, Error<ClusterNotificationsGetWebhookEndpointError>> {
1661 let p_path_name = name;
1663
1664 let uri_str = format!("{}/cluster/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1665 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1666
1667 if let Some(ref user_agent) = configuration.user_agent {
1668 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1669 }
1670 if let Some(ref apikey) = configuration.api_key {
1671 let key = apikey.key.clone();
1672 let value = match apikey.prefix {
1673 Some(ref prefix) => format!("{} {}", prefix, key),
1674 None => key,
1675 };
1676 req_builder = req_builder.header("Authorization", value);
1677 };
1678 if let Some(ref apikey) = configuration.api_key {
1679 let key = apikey.key.clone();
1680 let value = match apikey.prefix {
1681 Some(ref prefix) => format!("{} {}", prefix, key),
1682 None => key,
1683 };
1684 req_builder = req_builder.header("CSRFPreventionToken", value);
1685 };
1686
1687 let req = req_builder.build()?;
1688 let resp = configuration.client.execute(req).await?;
1689
1690 let status = resp.status();
1691 let content_type = resp
1692 .headers()
1693 .get("content-type")
1694 .and_then(|v| v.to_str().ok())
1695 .unwrap_or("application/octet-stream");
1696 let content_type = super::ContentType::from(content_type);
1697
1698 if !status.is_client_error() && !status.is_server_error() {
1699 let content = resp.text().await?;
1700 match content_type {
1701 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1702 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetWebhookEndpointResponse`"))),
1703 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::ClusterNotificationsGetWebhookEndpointResponse`")))),
1704 }
1705 } else {
1706 let content = resp.text().await?;
1707 let entity: Option<ClusterNotificationsGetWebhookEndpointError> = serde_json::from_str(&content).ok();
1708 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1709 }
1710}
1711
1712pub async fn cluster_notifications_get_webhook_endpoints(configuration: &configuration::Configuration, ) -> Result<models::ClusterNotificationsGetWebhookEndpointsResponse, Error<ClusterNotificationsGetWebhookEndpointsError>> {
1714
1715 let uri_str = format!("{}/cluster/notifications/endpoints/webhook", configuration.base_path);
1716 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1717
1718 if let Some(ref user_agent) = configuration.user_agent {
1719 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1720 }
1721 if let Some(ref apikey) = configuration.api_key {
1722 let key = apikey.key.clone();
1723 let value = match apikey.prefix {
1724 Some(ref prefix) => format!("{} {}", prefix, key),
1725 None => key,
1726 };
1727 req_builder = req_builder.header("Authorization", value);
1728 };
1729 if let Some(ref apikey) = configuration.api_key {
1730 let key = apikey.key.clone();
1731 let value = match apikey.prefix {
1732 Some(ref prefix) => format!("{} {}", prefix, key),
1733 None => key,
1734 };
1735 req_builder = req_builder.header("CSRFPreventionToken", value);
1736 };
1737
1738 let req = req_builder.build()?;
1739 let resp = configuration.client.execute(req).await?;
1740
1741 let status = resp.status();
1742 let content_type = resp
1743 .headers()
1744 .get("content-type")
1745 .and_then(|v| v.to_str().ok())
1746 .unwrap_or("application/octet-stream");
1747 let content_type = super::ContentType::from(content_type);
1748
1749 if !status.is_client_error() && !status.is_server_error() {
1750 let content = resp.text().await?;
1751 match content_type {
1752 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1753 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsGetWebhookEndpointsResponse`"))),
1754 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::ClusterNotificationsGetWebhookEndpointsResponse`")))),
1755 }
1756 } else {
1757 let content = resp.text().await?;
1758 let entity: Option<ClusterNotificationsGetWebhookEndpointsError> = serde_json::from_str(&content).ok();
1759 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1760 }
1761}
1762
1763pub async fn cluster_notifications_test_target(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterNotificationsTestTargetResponse, Error<ClusterNotificationsTestTargetError>> {
1765 let p_path_name = name;
1767
1768 let uri_str = format!("{}/cluster/notifications/targets/{name}/test", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1769 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1770
1771 if let Some(ref user_agent) = configuration.user_agent {
1772 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1773 }
1774 if let Some(ref apikey) = configuration.api_key {
1775 let key = apikey.key.clone();
1776 let value = match apikey.prefix {
1777 Some(ref prefix) => format!("{} {}", prefix, key),
1778 None => key,
1779 };
1780 req_builder = req_builder.header("Authorization", value);
1781 };
1782 if let Some(ref apikey) = configuration.api_key {
1783 let key = apikey.key.clone();
1784 let value = match apikey.prefix {
1785 Some(ref prefix) => format!("{} {}", prefix, key),
1786 None => key,
1787 };
1788 req_builder = req_builder.header("CSRFPreventionToken", value);
1789 };
1790
1791 let req = req_builder.build()?;
1792 let resp = configuration.client.execute(req).await?;
1793
1794 let status = resp.status();
1795 let content_type = resp
1796 .headers()
1797 .get("content-type")
1798 .and_then(|v| v.to_str().ok())
1799 .unwrap_or("application/octet-stream");
1800 let content_type = super::ContentType::from(content_type);
1801
1802 if !status.is_client_error() && !status.is_server_error() {
1803 let content = resp.text().await?;
1804 match content_type {
1805 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1806 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsTestTargetResponse`"))),
1807 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::ClusterNotificationsTestTargetResponse`")))),
1808 }
1809 } else {
1810 let content = resp.text().await?;
1811 let entity: Option<ClusterNotificationsTestTargetError> = serde_json::from_str(&content).ok();
1812 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1813 }
1814}
1815
1816pub async fn cluster_notifications_update_gotify_endpoint(configuration: &configuration::Configuration, name: &str, cluster_notifications_update_gotify_endpoint_request: Option<models::ClusterNotificationsUpdateGotifyEndpointRequest>) -> Result<models::ClusterNotificationsUpdateGotifyEndpointResponse, Error<ClusterNotificationsUpdateGotifyEndpointError>> {
1818 let p_path_name = name;
1820 let p_body_cluster_notifications_update_gotify_endpoint_request = cluster_notifications_update_gotify_endpoint_request;
1821
1822 let uri_str = format!("{}/cluster/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1823 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1824
1825 if let Some(ref user_agent) = configuration.user_agent {
1826 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1827 }
1828 if let Some(ref apikey) = configuration.api_key {
1829 let key = apikey.key.clone();
1830 let value = match apikey.prefix {
1831 Some(ref prefix) => format!("{} {}", prefix, key),
1832 None => key,
1833 };
1834 req_builder = req_builder.header("Authorization", value);
1835 };
1836 if let Some(ref apikey) = configuration.api_key {
1837 let key = apikey.key.clone();
1838 let value = match apikey.prefix {
1839 Some(ref prefix) => format!("{} {}", prefix, key),
1840 None => key,
1841 };
1842 req_builder = req_builder.header("CSRFPreventionToken", value);
1843 };
1844 req_builder = req_builder.json(&p_body_cluster_notifications_update_gotify_endpoint_request);
1845
1846 let req = req_builder.build()?;
1847 let resp = configuration.client.execute(req).await?;
1848
1849 let status = resp.status();
1850 let content_type = resp
1851 .headers()
1852 .get("content-type")
1853 .and_then(|v| v.to_str().ok())
1854 .unwrap_or("application/octet-stream");
1855 let content_type = super::ContentType::from(content_type);
1856
1857 if !status.is_client_error() && !status.is_server_error() {
1858 let content = resp.text().await?;
1859 match content_type {
1860 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1861 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsUpdateGotifyEndpointResponse`"))),
1862 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::ClusterNotificationsUpdateGotifyEndpointResponse`")))),
1863 }
1864 } else {
1865 let content = resp.text().await?;
1866 let entity: Option<ClusterNotificationsUpdateGotifyEndpointError> = serde_json::from_str(&content).ok();
1867 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1868 }
1869}
1870
1871pub async fn cluster_notifications_update_matcher(configuration: &configuration::Configuration, name: &str, cluster_notifications_update_matcher_request: Option<models::ClusterNotificationsUpdateMatcherRequest>) -> Result<models::ClusterNotificationsUpdateMatcherResponse, Error<ClusterNotificationsUpdateMatcherError>> {
1873 let p_path_name = name;
1875 let p_body_cluster_notifications_update_matcher_request = cluster_notifications_update_matcher_request;
1876
1877 let uri_str = format!("{}/cluster/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1878 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1879
1880 if let Some(ref user_agent) = configuration.user_agent {
1881 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1882 }
1883 if let Some(ref apikey) = configuration.api_key {
1884 let key = apikey.key.clone();
1885 let value = match apikey.prefix {
1886 Some(ref prefix) => format!("{} {}", prefix, key),
1887 None => key,
1888 };
1889 req_builder = req_builder.header("Authorization", value);
1890 };
1891 if let Some(ref apikey) = configuration.api_key {
1892 let key = apikey.key.clone();
1893 let value = match apikey.prefix {
1894 Some(ref prefix) => format!("{} {}", prefix, key),
1895 None => key,
1896 };
1897 req_builder = req_builder.header("CSRFPreventionToken", value);
1898 };
1899 req_builder = req_builder.json(&p_body_cluster_notifications_update_matcher_request);
1900
1901 let req = req_builder.build()?;
1902 let resp = configuration.client.execute(req).await?;
1903
1904 let status = resp.status();
1905 let content_type = resp
1906 .headers()
1907 .get("content-type")
1908 .and_then(|v| v.to_str().ok())
1909 .unwrap_or("application/octet-stream");
1910 let content_type = super::ContentType::from(content_type);
1911
1912 if !status.is_client_error() && !status.is_server_error() {
1913 let content = resp.text().await?;
1914 match content_type {
1915 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1916 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsUpdateMatcherResponse`"))),
1917 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::ClusterNotificationsUpdateMatcherResponse`")))),
1918 }
1919 } else {
1920 let content = resp.text().await?;
1921 let entity: Option<ClusterNotificationsUpdateMatcherError> = serde_json::from_str(&content).ok();
1922 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1923 }
1924}
1925
1926pub async fn cluster_notifications_update_sendmail_endpoint(configuration: &configuration::Configuration, name: &str, cluster_notifications_update_sendmail_endpoint_request: Option<models::ClusterNotificationsUpdateSendmailEndpointRequest>) -> Result<models::ClusterNotificationsUpdateSendmailEndpointResponse, Error<ClusterNotificationsUpdateSendmailEndpointError>> {
1928 let p_path_name = name;
1930 let p_body_cluster_notifications_update_sendmail_endpoint_request = cluster_notifications_update_sendmail_endpoint_request;
1931
1932 let uri_str = format!("{}/cluster/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1933 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1934
1935 if let Some(ref user_agent) = configuration.user_agent {
1936 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1937 }
1938 if let Some(ref apikey) = configuration.api_key {
1939 let key = apikey.key.clone();
1940 let value = match apikey.prefix {
1941 Some(ref prefix) => format!("{} {}", prefix, key),
1942 None => key,
1943 };
1944 req_builder = req_builder.header("Authorization", value);
1945 };
1946 if let Some(ref apikey) = configuration.api_key {
1947 let key = apikey.key.clone();
1948 let value = match apikey.prefix {
1949 Some(ref prefix) => format!("{} {}", prefix, key),
1950 None => key,
1951 };
1952 req_builder = req_builder.header("CSRFPreventionToken", value);
1953 };
1954 req_builder = req_builder.json(&p_body_cluster_notifications_update_sendmail_endpoint_request);
1955
1956 let req = req_builder.build()?;
1957 let resp = configuration.client.execute(req).await?;
1958
1959 let status = resp.status();
1960 let content_type = resp
1961 .headers()
1962 .get("content-type")
1963 .and_then(|v| v.to_str().ok())
1964 .unwrap_or("application/octet-stream");
1965 let content_type = super::ContentType::from(content_type);
1966
1967 if !status.is_client_error() && !status.is_server_error() {
1968 let content = resp.text().await?;
1969 match content_type {
1970 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1971 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsUpdateSendmailEndpointResponse`"))),
1972 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::ClusterNotificationsUpdateSendmailEndpointResponse`")))),
1973 }
1974 } else {
1975 let content = resp.text().await?;
1976 let entity: Option<ClusterNotificationsUpdateSendmailEndpointError> = serde_json::from_str(&content).ok();
1977 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1978 }
1979}
1980
1981pub async fn cluster_notifications_update_smtp_endpoint(configuration: &configuration::Configuration, name: &str, cluster_notifications_update_smtp_endpoint_request: Option<models::ClusterNotificationsUpdateSmtpEndpointRequest>) -> Result<models::ClusterNotificationsUpdateSmtpEndpointResponse, Error<ClusterNotificationsUpdateSmtpEndpointError>> {
1983 let p_path_name = name;
1985 let p_body_cluster_notifications_update_smtp_endpoint_request = cluster_notifications_update_smtp_endpoint_request;
1986
1987 let uri_str = format!("{}/cluster/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1988 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1989
1990 if let Some(ref user_agent) = configuration.user_agent {
1991 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1992 }
1993 if let Some(ref apikey) = configuration.api_key {
1994 let key = apikey.key.clone();
1995 let value = match apikey.prefix {
1996 Some(ref prefix) => format!("{} {}", prefix, key),
1997 None => key,
1998 };
1999 req_builder = req_builder.header("Authorization", value);
2000 };
2001 if let Some(ref apikey) = configuration.api_key {
2002 let key = apikey.key.clone();
2003 let value = match apikey.prefix {
2004 Some(ref prefix) => format!("{} {}", prefix, key),
2005 None => key,
2006 };
2007 req_builder = req_builder.header("CSRFPreventionToken", value);
2008 };
2009 req_builder = req_builder.json(&p_body_cluster_notifications_update_smtp_endpoint_request);
2010
2011 let req = req_builder.build()?;
2012 let resp = configuration.client.execute(req).await?;
2013
2014 let status = resp.status();
2015 let content_type = resp
2016 .headers()
2017 .get("content-type")
2018 .and_then(|v| v.to_str().ok())
2019 .unwrap_or("application/octet-stream");
2020 let content_type = super::ContentType::from(content_type);
2021
2022 if !status.is_client_error() && !status.is_server_error() {
2023 let content = resp.text().await?;
2024 match content_type {
2025 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2026 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsUpdateSmtpEndpointResponse`"))),
2027 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::ClusterNotificationsUpdateSmtpEndpointResponse`")))),
2028 }
2029 } else {
2030 let content = resp.text().await?;
2031 let entity: Option<ClusterNotificationsUpdateSmtpEndpointError> = serde_json::from_str(&content).ok();
2032 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2033 }
2034}
2035
2036pub async fn cluster_notifications_update_webhook_endpoint(configuration: &configuration::Configuration, name: &str, cluster_notifications_update_webhook_endpoint_request: Option<models::ClusterNotificationsUpdateWebhookEndpointRequest>) -> Result<models::ClusterNotificationsUpdateWebhookEndpointResponse, Error<ClusterNotificationsUpdateWebhookEndpointError>> {
2038 let p_path_name = name;
2040 let p_body_cluster_notifications_update_webhook_endpoint_request = cluster_notifications_update_webhook_endpoint_request;
2041
2042 let uri_str = format!("{}/cluster/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2043 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2044
2045 if let Some(ref user_agent) = configuration.user_agent {
2046 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2047 }
2048 if let Some(ref apikey) = configuration.api_key {
2049 let key = apikey.key.clone();
2050 let value = match apikey.prefix {
2051 Some(ref prefix) => format!("{} {}", prefix, key),
2052 None => key,
2053 };
2054 req_builder = req_builder.header("Authorization", value);
2055 };
2056 if let Some(ref apikey) = configuration.api_key {
2057 let key = apikey.key.clone();
2058 let value = match apikey.prefix {
2059 Some(ref prefix) => format!("{} {}", prefix, key),
2060 None => key,
2061 };
2062 req_builder = req_builder.header("CSRFPreventionToken", value);
2063 };
2064 req_builder = req_builder.json(&p_body_cluster_notifications_update_webhook_endpoint_request);
2065
2066 let req = req_builder.build()?;
2067 let resp = configuration.client.execute(req).await?;
2068
2069 let status = resp.status();
2070 let content_type = resp
2071 .headers()
2072 .get("content-type")
2073 .and_then(|v| v.to_str().ok())
2074 .unwrap_or("application/octet-stream");
2075 let content_type = super::ContentType::from(content_type);
2076
2077 if !status.is_client_error() && !status.is_server_error() {
2078 let content = resp.text().await?;
2079 match content_type {
2080 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2081 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterNotificationsUpdateWebhookEndpointResponse`"))),
2082 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::ClusterNotificationsUpdateWebhookEndpointResponse`")))),
2083 }
2084 } else {
2085 let content = resp.text().await?;
2086 let entity: Option<ClusterNotificationsUpdateWebhookEndpointError> = serde_json::from_str(&content).ok();
2087 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2088 }
2089}
2090