1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcknowledgeAllCriticalAlertsError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum AcknowledgeCriticalAlertError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateCustomerPortalSessionError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetCriticalAlertsError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetGlobalError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetJwksError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetLatestKeyRenewalAttemptError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetLocalError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetMinKeepAliveVersionError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetSecondaryStorageNamesError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetStatsError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum ListCustomInstanceDbsError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ListGlobalSettingsError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum MigrateSecretsToDatabaseError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum MigrateSecretsToVaultError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum RefreshCustomInstanceUserPwdError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum RenewLicenseKeyError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum SendStatsError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum SetGlobalError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum SetPublicAppRateLimitError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum SetupCustomInstanceDbError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum TestCriticalChannelsError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum TestLicenseKeyError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum TestMetadataError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum TestObjectStorageConfigError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum TestSecretBackendError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum TestSmtpError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum WorkspaceAcknowledgeAllCriticalAlertsError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum WorkspaceAcknowledgeCriticalAlertError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum WorkspaceGetCriticalAlertsError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum WorkspaceMuteCriticalAlertsUiError {
232 UnknownValue(serde_json::Value),
233}
234
235
236pub async fn acknowledge_all_critical_alerts(configuration: &configuration::Configuration, ) -> Result<String, Error<AcknowledgeAllCriticalAlertsError>> {
237 let local_var_configuration = configuration;
238
239 let local_var_client = &local_var_configuration.client;
240
241 let local_var_uri_str = format!("{}/settings/critical_alerts/acknowledge_all", local_var_configuration.base_path);
242 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
243
244 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
245 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
246 }
247 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
248 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
249 };
250
251 let local_var_req = local_var_req_builder.build()?;
252 let local_var_resp = local_var_client.execute(local_var_req).await?;
253
254 let local_var_status = local_var_resp.status();
255 let local_var_content = local_var_resp.text().await?;
256
257 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
258 crate::from_str_patched(&local_var_content).map_err(Error::from)
259 } else {
260 let local_var_entity: Option<AcknowledgeAllCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
261 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
262 Err(Error::ResponseError(local_var_error))
263 }
264}
265
266pub async fn acknowledge_critical_alert(configuration: &configuration::Configuration, id: i32) -> Result<String, Error<AcknowledgeCriticalAlertError>> {
267 let local_var_configuration = configuration;
268
269 let local_var_client = &local_var_configuration.client;
270
271 let local_var_uri_str = format!("{}/settings/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, id=id);
272 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
273
274 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
275 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
276 }
277 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
278 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
279 };
280
281 let local_var_req = local_var_req_builder.build()?;
282 let local_var_resp = local_var_client.execute(local_var_req).await?;
283
284 let local_var_status = local_var_resp.status();
285 let local_var_content = local_var_resp.text().await?;
286
287 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
288 crate::from_str_patched(&local_var_content).map_err(Error::from)
289 } else {
290 let local_var_entity: Option<AcknowledgeCriticalAlertError> = crate::from_str_patched(&local_var_content).ok();
291 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
292 Err(Error::ResponseError(local_var_error))
293 }
294}
295
296pub async fn create_customer_portal_session(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<CreateCustomerPortalSessionError>> {
297 let local_var_configuration = configuration;
298
299 let local_var_client = &local_var_configuration.client;
300
301 let local_var_uri_str = format!("{}/settings/customer_portal", local_var_configuration.base_path);
302 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
303
304 if let Some(ref local_var_str) = license_key {
305 local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
306 }
307 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
308 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
309 }
310 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
311 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
312 };
313
314 let local_var_req = local_var_req_builder.build()?;
315 let local_var_resp = local_var_client.execute(local_var_req).await?;
316
317 let local_var_status = local_var_resp.status();
318 let local_var_content = local_var_resp.text().await?;
319
320 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
321 crate::from_str_patched(&local_var_content).map_err(Error::from)
322 } else {
323 let local_var_entity: Option<CreateCustomerPortalSessionError> = crate::from_str_patched(&local_var_content).ok();
324 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
325 Err(Error::ResponseError(local_var_error))
326 }
327}
328
329pub async fn get_critical_alerts(configuration: &configuration::Configuration, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<GetCriticalAlertsError>> {
330 let local_var_configuration = configuration;
331
332 let local_var_client = &local_var_configuration.client;
333
334 let local_var_uri_str = format!("{}/settings/critical_alerts", local_var_configuration.base_path);
335 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
336
337 if let Some(ref local_var_str) = page {
338 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
339 }
340 if let Some(ref local_var_str) = page_size {
341 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
342 }
343 if let Some(ref local_var_str) = acknowledged {
344 local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
345 }
346 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
347 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
348 }
349 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
350 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
351 };
352
353 let local_var_req = local_var_req_builder.build()?;
354 let local_var_resp = local_var_client.execute(local_var_req).await?;
355
356 let local_var_status = local_var_resp.status();
357 let local_var_content = local_var_resp.text().await?;
358
359 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
360 crate::from_str_patched(&local_var_content).map_err(Error::from)
361 } else {
362 let local_var_entity: Option<GetCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
363 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
364 Err(Error::ResponseError(local_var_error))
365 }
366}
367
368pub async fn get_global(configuration: &configuration::Configuration, key: &str) -> Result<serde_json::Value, Error<GetGlobalError>> {
369 let local_var_configuration = configuration;
370
371 let local_var_client = &local_var_configuration.client;
372
373 let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
374 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
375
376 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
377 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
378 }
379 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
380 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
381 };
382
383 let local_var_req = local_var_req_builder.build()?;
384 let local_var_resp = local_var_client.execute(local_var_req).await?;
385
386 let local_var_status = local_var_resp.status();
387 let local_var_content = local_var_resp.text().await?;
388
389 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
390 crate::from_str_patched(&local_var_content).map_err(Error::from)
391 } else {
392 let local_var_entity: Option<GetGlobalError> = crate::from_str_patched(&local_var_content).ok();
393 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
394 Err(Error::ResponseError(local_var_error))
395 }
396}
397
398pub async fn get_jwks(configuration: &configuration::Configuration, ) -> Result<models::JwksResponse, Error<GetJwksError>> {
399 let local_var_configuration = configuration;
400
401 let local_var_client = &local_var_configuration.client;
402
403 let local_var_uri_str = format!("{}/.well-known/jwks.json", local_var_configuration.base_path);
404 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
405
406 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
407 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
408 }
409 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
410 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
411 };
412
413 let local_var_req = local_var_req_builder.build()?;
414 let local_var_resp = local_var_client.execute(local_var_req).await?;
415
416 let local_var_status = local_var_resp.status();
417 let local_var_content = local_var_resp.text().await?;
418
419 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
420 crate::from_str_patched(&local_var_content).map_err(Error::from)
421 } else {
422 let local_var_entity: Option<GetJwksError> = crate::from_str_patched(&local_var_content).ok();
423 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
424 Err(Error::ResponseError(local_var_error))
425 }
426}
427
428pub async fn get_latest_key_renewal_attempt(configuration: &configuration::Configuration, ) -> Result<models::GetLatestKeyRenewalAttempt200Response, Error<GetLatestKeyRenewalAttemptError>> {
429 let local_var_configuration = configuration;
430
431 let local_var_client = &local_var_configuration.client;
432
433 let local_var_uri_str = format!("{}/settings/latest_key_renewal_attempt", local_var_configuration.base_path);
434 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
435
436 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
437 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
438 }
439 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
440 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
441 };
442
443 let local_var_req = local_var_req_builder.build()?;
444 let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446 let local_var_status = local_var_resp.status();
447 let local_var_content = local_var_resp.text().await?;
448
449 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
450 crate::from_str_patched(&local_var_content).map_err(Error::from)
451 } else {
452 let local_var_entity: Option<GetLatestKeyRenewalAttemptError> = crate::from_str_patched(&local_var_content).ok();
453 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
454 Err(Error::ResponseError(local_var_error))
455 }
456}
457
458pub async fn get_local(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetLocalError>> {
459 let local_var_configuration = configuration;
460
461 let local_var_client = &local_var_configuration.client;
462
463 let local_var_uri_str = format!("{}/settings/local", local_var_configuration.base_path);
464 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
465
466 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
467 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
468 }
469 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
470 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
471 };
472
473 let local_var_req = local_var_req_builder.build()?;
474 let local_var_resp = local_var_client.execute(local_var_req).await?;
475
476 let local_var_status = local_var_resp.status();
477 let local_var_content = local_var_resp.text().await?;
478
479 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
480 crate::from_str_patched(&local_var_content).map_err(Error::from)
481 } else {
482 let local_var_entity: Option<GetLocalError> = crate::from_str_patched(&local_var_content).ok();
483 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
484 Err(Error::ResponseError(local_var_error))
485 }
486}
487
488pub async fn get_min_keep_alive_version(configuration: &configuration::Configuration, ) -> Result<models::GetMinKeepAliveVersion200Response, Error<GetMinKeepAliveVersionError>> {
489 let local_var_configuration = configuration;
490
491 let local_var_client = &local_var_configuration.client;
492
493 let local_var_uri_str = format!("{}/min_keep_alive_version", local_var_configuration.base_path);
494 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
495
496 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
497 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
498 }
499 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
500 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
501 };
502
503 let local_var_req = local_var_req_builder.build()?;
504 let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506 let local_var_status = local_var_resp.status();
507 let local_var_content = local_var_resp.text().await?;
508
509 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510 crate::from_str_patched(&local_var_content).map_err(Error::from)
511 } else {
512 let local_var_entity: Option<GetMinKeepAliveVersionError> = crate::from_str_patched(&local_var_content).ok();
513 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514 Err(Error::ResponseError(local_var_error))
515 }
516}
517
518pub async fn get_secondary_storage_names(configuration: &configuration::Configuration, workspace: &str, include_default: Option<bool>) -> Result<Vec<String>, Error<GetSecondaryStorageNamesError>> {
519 let local_var_configuration = configuration;
520
521 let local_var_client = &local_var_configuration.client;
522
523 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/get_secondary_storage_names", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
524 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
525
526 if let Some(ref local_var_str) = include_default {
527 local_var_req_builder = local_var_req_builder.query(&[("include_default", &local_var_str.to_string())]);
528 }
529 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
530 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
531 }
532 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
533 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
534 };
535
536 let local_var_req = local_var_req_builder.build()?;
537 let local_var_resp = local_var_client.execute(local_var_req).await?;
538
539 let local_var_status = local_var_resp.status();
540 let local_var_content = local_var_resp.text().await?;
541
542 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
543 crate::from_str_patched(&local_var_content).map_err(Error::from)
544 } else {
545 let local_var_entity: Option<GetSecondaryStorageNamesError> = crate::from_str_patched(&local_var_content).ok();
546 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
547 Err(Error::ResponseError(local_var_error))
548 }
549}
550
551pub async fn get_stats(configuration: &configuration::Configuration, ) -> Result<String, Error<GetStatsError>> {
552 let local_var_configuration = configuration;
553
554 let local_var_client = &local_var_configuration.client;
555
556 let local_var_uri_str = format!("{}/settings/get_stats", local_var_configuration.base_path);
557 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
558
559 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
560 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
561 }
562 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
563 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
564 };
565
566 let local_var_req = local_var_req_builder.build()?;
567 let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569 let local_var_status = local_var_resp.status();
570 let local_var_content = local_var_resp.text().await?;
571
572 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
573 crate::from_str_patched(&local_var_content).map_err(Error::from)
574 } else {
575 let local_var_entity: Option<GetStatsError> = crate::from_str_patched(&local_var_content).ok();
576 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
577 Err(Error::ResponseError(local_var_error))
578 }
579}
580
581pub async fn list_custom_instance_dbs(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, models::CustomInstanceDb>, Error<ListCustomInstanceDbsError>> {
582 let local_var_configuration = configuration;
583
584 let local_var_client = &local_var_configuration.client;
585
586 let local_var_uri_str = format!("{}/settings/list_custom_instance_pg_databases", local_var_configuration.base_path);
587 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
588
589 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
590 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
591 }
592 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
593 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
594 };
595
596 let local_var_req = local_var_req_builder.build()?;
597 let local_var_resp = local_var_client.execute(local_var_req).await?;
598
599 let local_var_status = local_var_resp.status();
600 let local_var_content = local_var_resp.text().await?;
601
602 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
603 crate::from_str_patched(&local_var_content).map_err(Error::from)
604 } else {
605 let local_var_entity: Option<ListCustomInstanceDbsError> = crate::from_str_patched(&local_var_content).ok();
606 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
607 Err(Error::ResponseError(local_var_error))
608 }
609}
610
611pub async fn list_global_settings(configuration: &configuration::Configuration, ) -> Result<Vec<models::GlobalSetting>, Error<ListGlobalSettingsError>> {
612 let local_var_configuration = configuration;
613
614 let local_var_client = &local_var_configuration.client;
615
616 let local_var_uri_str = format!("{}/settings/list_global", local_var_configuration.base_path);
617 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
618
619 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
620 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
621 }
622 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
623 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
624 };
625
626 let local_var_req = local_var_req_builder.build()?;
627 let local_var_resp = local_var_client.execute(local_var_req).await?;
628
629 let local_var_status = local_var_resp.status();
630 let local_var_content = local_var_resp.text().await?;
631
632 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
633 crate::from_str_patched(&local_var_content).map_err(Error::from)
634 } else {
635 let local_var_entity: Option<ListGlobalSettingsError> = crate::from_str_patched(&local_var_content).ok();
636 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
637 Err(Error::ResponseError(local_var_error))
638 }
639}
640
641pub async fn migrate_secrets_to_database(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<models::SecretMigrationReport, Error<MigrateSecretsToDatabaseError>> {
642 let local_var_configuration = configuration;
643
644 let local_var_client = &local_var_configuration.client;
645
646 let local_var_uri_str = format!("{}/settings/migrate_secrets_to_database", local_var_configuration.base_path);
647 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
648
649 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
650 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
651 }
652 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
653 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
654 };
655 local_var_req_builder = local_var_req_builder.json(&vault_settings);
656
657 let local_var_req = local_var_req_builder.build()?;
658 let local_var_resp = local_var_client.execute(local_var_req).await?;
659
660 let local_var_status = local_var_resp.status();
661 let local_var_content = local_var_resp.text().await?;
662
663 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
664 crate::from_str_patched(&local_var_content).map_err(Error::from)
665 } else {
666 let local_var_entity: Option<MigrateSecretsToDatabaseError> = crate::from_str_patched(&local_var_content).ok();
667 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
668 Err(Error::ResponseError(local_var_error))
669 }
670}
671
672pub async fn migrate_secrets_to_vault(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<models::SecretMigrationReport, Error<MigrateSecretsToVaultError>> {
673 let local_var_configuration = configuration;
674
675 let local_var_client = &local_var_configuration.client;
676
677 let local_var_uri_str = format!("{}/settings/migrate_secrets_to_vault", local_var_configuration.base_path);
678 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
679
680 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
681 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
682 }
683 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
684 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
685 };
686 local_var_req_builder = local_var_req_builder.json(&vault_settings);
687
688 let local_var_req = local_var_req_builder.build()?;
689 let local_var_resp = local_var_client.execute(local_var_req).await?;
690
691 let local_var_status = local_var_resp.status();
692 let local_var_content = local_var_resp.text().await?;
693
694 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
695 crate::from_str_patched(&local_var_content).map_err(Error::from)
696 } else {
697 let local_var_entity: Option<MigrateSecretsToVaultError> = crate::from_str_patched(&local_var_content).ok();
698 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
699 Err(Error::ResponseError(local_var_error))
700 }
701}
702
703pub async fn refresh_custom_instance_user_pwd(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<RefreshCustomInstanceUserPwdError>> {
704 let local_var_configuration = configuration;
705
706 let local_var_client = &local_var_configuration.client;
707
708 let local_var_uri_str = format!("{}/settings/refresh_custom_instance_user_pwd", local_var_configuration.base_path);
709 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
710
711 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
712 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
713 }
714 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
715 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
716 };
717
718 let local_var_req = local_var_req_builder.build()?;
719 let local_var_resp = local_var_client.execute(local_var_req).await?;
720
721 let local_var_status = local_var_resp.status();
722 let local_var_content = local_var_resp.text().await?;
723
724 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
725 crate::from_str_patched(&local_var_content).map_err(Error::from)
726 } else {
727 let local_var_entity: Option<RefreshCustomInstanceUserPwdError> = crate::from_str_patched(&local_var_content).ok();
728 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
729 Err(Error::ResponseError(local_var_error))
730 }
731}
732
733pub async fn renew_license_key(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<RenewLicenseKeyError>> {
734 let local_var_configuration = configuration;
735
736 let local_var_client = &local_var_configuration.client;
737
738 let local_var_uri_str = format!("{}/settings/renew_license_key", local_var_configuration.base_path);
739 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
740
741 if let Some(ref local_var_str) = license_key {
742 local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
743 }
744 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
745 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
746 }
747 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
748 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
749 };
750
751 let local_var_req = local_var_req_builder.build()?;
752 let local_var_resp = local_var_client.execute(local_var_req).await?;
753
754 let local_var_status = local_var_resp.status();
755 let local_var_content = local_var_resp.text().await?;
756
757 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
758 crate::from_str_patched(&local_var_content).map_err(Error::from)
759 } else {
760 let local_var_entity: Option<RenewLicenseKeyError> = crate::from_str_patched(&local_var_content).ok();
761 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
762 Err(Error::ResponseError(local_var_error))
763 }
764}
765
766pub async fn send_stats(configuration: &configuration::Configuration, ) -> Result<String, Error<SendStatsError>> {
767 let local_var_configuration = configuration;
768
769 let local_var_client = &local_var_configuration.client;
770
771 let local_var_uri_str = format!("{}/settings/send_stats", local_var_configuration.base_path);
772 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
773
774 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
775 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
776 }
777 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
778 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
779 };
780
781 let local_var_req = local_var_req_builder.build()?;
782 let local_var_resp = local_var_client.execute(local_var_req).await?;
783
784 let local_var_status = local_var_resp.status();
785 let local_var_content = local_var_resp.text().await?;
786
787 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
788 crate::from_str_patched(&local_var_content).map_err(Error::from)
789 } else {
790 let local_var_entity: Option<SendStatsError> = crate::from_str_patched(&local_var_content).ok();
791 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
792 Err(Error::ResponseError(local_var_error))
793 }
794}
795
796pub async fn set_global(configuration: &configuration::Configuration, key: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<SetGlobalError>> {
797 let local_var_configuration = configuration;
798
799 let local_var_client = &local_var_configuration.client;
800
801 let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
802 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
803
804 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
805 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
806 }
807 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
808 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
809 };
810 local_var_req_builder = local_var_req_builder.json(&set_global_request);
811
812 let local_var_req = local_var_req_builder.build()?;
813 let local_var_resp = local_var_client.execute(local_var_req).await?;
814
815 let local_var_status = local_var_resp.status();
816 let local_var_content = local_var_resp.text().await?;
817
818 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
819 crate::from_str_patched(&local_var_content).map_err(Error::from)
820 } else {
821 let local_var_entity: Option<SetGlobalError> = crate::from_str_patched(&local_var_content).ok();
822 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
823 Err(Error::ResponseError(local_var_error))
824 }
825}
826
827pub async fn set_public_app_rate_limit(configuration: &configuration::Configuration, workspace: &str, set_public_app_rate_limit_request: models::SetPublicAppRateLimitRequest) -> Result<String, Error<SetPublicAppRateLimitError>> {
828 let local_var_configuration = configuration;
829
830 let local_var_client = &local_var_configuration.client;
831
832 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/public_app_rate_limit", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
833 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
834
835 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
836 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
837 }
838 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
839 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
840 };
841 local_var_req_builder = local_var_req_builder.json(&set_public_app_rate_limit_request);
842
843 let local_var_req = local_var_req_builder.build()?;
844 let local_var_resp = local_var_client.execute(local_var_req).await?;
845
846 let local_var_status = local_var_resp.status();
847 let local_var_content = local_var_resp.text().await?;
848
849 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
850 crate::from_str_patched(&local_var_content).map_err(Error::from)
851 } else {
852 let local_var_entity: Option<SetPublicAppRateLimitError> = crate::from_str_patched(&local_var_content).ok();
853 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
854 Err(Error::ResponseError(local_var_error))
855 }
856}
857
858pub async fn setup_custom_instance_db(configuration: &configuration::Configuration, name: &str, setup_custom_instance_db_request: models::SetupCustomInstanceDbRequest) -> Result<models::CustomInstanceDb, Error<SetupCustomInstanceDbError>> {
859 let local_var_configuration = configuration;
860
861 let local_var_client = &local_var_configuration.client;
862
863 let local_var_uri_str = format!("{}/settings/setup_custom_instance_pg_database/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
864 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
865
866 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
867 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
868 }
869 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
870 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
871 };
872 local_var_req_builder = local_var_req_builder.json(&setup_custom_instance_db_request);
873
874 let local_var_req = local_var_req_builder.build()?;
875 let local_var_resp = local_var_client.execute(local_var_req).await?;
876
877 let local_var_status = local_var_resp.status();
878 let local_var_content = local_var_resp.text().await?;
879
880 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
881 crate::from_str_patched(&local_var_content).map_err(Error::from)
882 } else {
883 let local_var_entity: Option<SetupCustomInstanceDbError> = crate::from_str_patched(&local_var_content).ok();
884 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
885 Err(Error::ResponseError(local_var_error))
886 }
887}
888
889pub async fn test_critical_channels(configuration: &configuration::Configuration, test_critical_channels_request_inner: Vec<models::TestCriticalChannelsRequestInner>) -> Result<String, Error<TestCriticalChannelsError>> {
890 let local_var_configuration = configuration;
891
892 let local_var_client = &local_var_configuration.client;
893
894 let local_var_uri_str = format!("{}/settings/test_critical_channels", local_var_configuration.base_path);
895 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
896
897 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
898 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
899 }
900 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
901 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
902 };
903 local_var_req_builder = local_var_req_builder.json(&test_critical_channels_request_inner);
904
905 let local_var_req = local_var_req_builder.build()?;
906 let local_var_resp = local_var_client.execute(local_var_req).await?;
907
908 let local_var_status = local_var_resp.status();
909 let local_var_content = local_var_resp.text().await?;
910
911 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
912 crate::from_str_patched(&local_var_content).map_err(Error::from)
913 } else {
914 let local_var_entity: Option<TestCriticalChannelsError> = crate::from_str_patched(&local_var_content).ok();
915 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
916 Err(Error::ResponseError(local_var_error))
917 }
918}
919
920pub async fn test_license_key(configuration: &configuration::Configuration, test_license_key_request: models::TestLicenseKeyRequest) -> Result<String, Error<TestLicenseKeyError>> {
921 let local_var_configuration = configuration;
922
923 let local_var_client = &local_var_configuration.client;
924
925 let local_var_uri_str = format!("{}/settings/test_license_key", local_var_configuration.base_path);
926 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
927
928 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
929 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
930 }
931 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
932 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
933 };
934 local_var_req_builder = local_var_req_builder.json(&test_license_key_request);
935
936 let local_var_req = local_var_req_builder.build()?;
937 let local_var_resp = local_var_client.execute(local_var_req).await?;
938
939 let local_var_status = local_var_resp.status();
940 let local_var_content = local_var_resp.text().await?;
941
942 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
943 crate::from_str_patched(&local_var_content).map_err(Error::from)
944 } else {
945 let local_var_entity: Option<TestLicenseKeyError> = crate::from_str_patched(&local_var_content).ok();
946 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
947 Err(Error::ResponseError(local_var_error))
948 }
949}
950
951pub async fn test_metadata(configuration: &configuration::Configuration, body: &str) -> Result<String, Error<TestMetadataError>> {
952 let local_var_configuration = configuration;
953
954 let local_var_client = &local_var_configuration.client;
955
956 let local_var_uri_str = format!("{}/saml/test_metadata", local_var_configuration.base_path);
957 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
958
959 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
960 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
961 }
962 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
963 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
964 };
965 local_var_req_builder = local_var_req_builder.json(&body);
966
967 let local_var_req = local_var_req_builder.build()?;
968 let local_var_resp = local_var_client.execute(local_var_req).await?;
969
970 let local_var_status = local_var_resp.status();
971 let local_var_content = local_var_resp.text().await?;
972
973 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
974 crate::from_str_patched(&local_var_content).map_err(Error::from)
975 } else {
976 let local_var_entity: Option<TestMetadataError> = crate::from_str_patched(&local_var_content).ok();
977 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
978 Err(Error::ResponseError(local_var_error))
979 }
980}
981
982pub async fn test_object_storage_config(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<TestObjectStorageConfigError>> {
983 let local_var_configuration = configuration;
984
985 let local_var_client = &local_var_configuration.client;
986
987 let local_var_uri_str = format!("{}/settings/test_object_storage_config", local_var_configuration.base_path);
988 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
989
990 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
991 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
992 }
993 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
994 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
995 };
996 local_var_req_builder = local_var_req_builder.json(&request_body);
997
998 let local_var_req = local_var_req_builder.build()?;
999 let local_var_resp = local_var_client.execute(local_var_req).await?;
1000
1001 let local_var_status = local_var_resp.status();
1002 let local_var_content = local_var_resp.text().await?;
1003
1004 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1005 crate::from_str_patched(&local_var_content).map_err(Error::from)
1006 } else {
1007 let local_var_entity: Option<TestObjectStorageConfigError> = crate::from_str_patched(&local_var_content).ok();
1008 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1009 Err(Error::ResponseError(local_var_error))
1010 }
1011}
1012
1013pub async fn test_secret_backend(configuration: &configuration::Configuration, vault_settings: models::VaultSettings) -> Result<String, Error<TestSecretBackendError>> {
1014 let local_var_configuration = configuration;
1015
1016 let local_var_client = &local_var_configuration.client;
1017
1018 let local_var_uri_str = format!("{}/settings/test_secret_backend", local_var_configuration.base_path);
1019 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1020
1021 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1022 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1023 }
1024 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1025 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1026 };
1027 local_var_req_builder = local_var_req_builder.json(&vault_settings);
1028
1029 let local_var_req = local_var_req_builder.build()?;
1030 let local_var_resp = local_var_client.execute(local_var_req).await?;
1031
1032 let local_var_status = local_var_resp.status();
1033 let local_var_content = local_var_resp.text().await?;
1034
1035 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1036 crate::from_str_patched(&local_var_content).map_err(Error::from)
1037 } else {
1038 let local_var_entity: Option<TestSecretBackendError> = crate::from_str_patched(&local_var_content).ok();
1039 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1040 Err(Error::ResponseError(local_var_error))
1041 }
1042}
1043
1044pub async fn test_smtp(configuration: &configuration::Configuration, test_smtp_request: models::TestSmtpRequest) -> Result<String, Error<TestSmtpError>> {
1045 let local_var_configuration = configuration;
1046
1047 let local_var_client = &local_var_configuration.client;
1048
1049 let local_var_uri_str = format!("{}/settings/test_smtp", local_var_configuration.base_path);
1050 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1051
1052 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1053 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1054 }
1055 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1056 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1057 };
1058 local_var_req_builder = local_var_req_builder.json(&test_smtp_request);
1059
1060 let local_var_req = local_var_req_builder.build()?;
1061 let local_var_resp = local_var_client.execute(local_var_req).await?;
1062
1063 let local_var_status = local_var_resp.status();
1064 let local_var_content = local_var_resp.text().await?;
1065
1066 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1067 crate::from_str_patched(&local_var_content).map_err(Error::from)
1068 } else {
1069 let local_var_entity: Option<TestSmtpError> = crate::from_str_patched(&local_var_content).ok();
1070 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1071 Err(Error::ResponseError(local_var_error))
1072 }
1073}
1074
1075pub async fn workspace_acknowledge_all_critical_alerts(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<WorkspaceAcknowledgeAllCriticalAlertsError>> {
1076 let local_var_configuration = configuration;
1077
1078 let local_var_client = &local_var_configuration.client;
1079
1080 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/acknowledge_all", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1081 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1082
1083 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1084 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1085 }
1086 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1087 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1088 };
1089
1090 let local_var_req = local_var_req_builder.build()?;
1091 let local_var_resp = local_var_client.execute(local_var_req).await?;
1092
1093 let local_var_status = local_var_resp.status();
1094 let local_var_content = local_var_resp.text().await?;
1095
1096 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1097 crate::from_str_patched(&local_var_content).map_err(Error::from)
1098 } else {
1099 let local_var_entity: Option<WorkspaceAcknowledgeAllCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
1100 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1101 Err(Error::ResponseError(local_var_error))
1102 }
1103}
1104
1105pub async fn workspace_acknowledge_critical_alert(configuration: &configuration::Configuration, workspace: &str, id: i32) -> Result<String, Error<WorkspaceAcknowledgeCriticalAlertError>> {
1106 let local_var_configuration = configuration;
1107
1108 let local_var_client = &local_var_configuration.client;
1109
1110 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
1111 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1112
1113 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1114 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1115 }
1116 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1117 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1118 };
1119
1120 let local_var_req = local_var_req_builder.build()?;
1121 let local_var_resp = local_var_client.execute(local_var_req).await?;
1122
1123 let local_var_status = local_var_resp.status();
1124 let local_var_content = local_var_resp.text().await?;
1125
1126 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1127 crate::from_str_patched(&local_var_content).map_err(Error::from)
1128 } else {
1129 let local_var_entity: Option<WorkspaceAcknowledgeCriticalAlertError> = crate::from_str_patched(&local_var_content).ok();
1130 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1131 Err(Error::ResponseError(local_var_error))
1132 }
1133}
1134
1135pub async fn workspace_get_critical_alerts(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<WorkspaceGetCriticalAlertsError>> {
1136 let local_var_configuration = configuration;
1137
1138 let local_var_client = &local_var_configuration.client;
1139
1140 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1141 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1142
1143 if let Some(ref local_var_str) = page {
1144 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1145 }
1146 if let Some(ref local_var_str) = page_size {
1147 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1148 }
1149 if let Some(ref local_var_str) = acknowledged {
1150 local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
1151 }
1152 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1153 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1154 }
1155 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1156 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1157 };
1158
1159 let local_var_req = local_var_req_builder.build()?;
1160 let local_var_resp = local_var_client.execute(local_var_req).await?;
1161
1162 let local_var_status = local_var_resp.status();
1163 let local_var_content = local_var_resp.text().await?;
1164
1165 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1166 crate::from_str_patched(&local_var_content).map_err(Error::from)
1167 } else {
1168 let local_var_entity: Option<WorkspaceGetCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
1169 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1170 Err(Error::ResponseError(local_var_error))
1171 }
1172}
1173
1174pub async fn workspace_mute_critical_alerts_ui(configuration: &configuration::Configuration, workspace: &str, workspace_mute_critical_alerts_ui_request: models::WorkspaceMuteCriticalAlertsUiRequest) -> Result<String, Error<WorkspaceMuteCriticalAlertsUiError>> {
1175 let local_var_configuration = configuration;
1176
1177 let local_var_client = &local_var_configuration.client;
1178
1179 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/mute", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1180 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1181
1182 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1183 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1184 }
1185 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1186 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1187 };
1188 local_var_req_builder = local_var_req_builder.json(&workspace_mute_critical_alerts_ui_request);
1189
1190 let local_var_req = local_var_req_builder.build()?;
1191 let local_var_resp = local_var_client.execute(local_var_req).await?;
1192
1193 let local_var_status = local_var_resp.status();
1194 let local_var_content = local_var_resp.text().await?;
1195
1196 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1197 crate::from_str_patched(&local_var_content).map_err(Error::from)
1198 } else {
1199 let local_var_entity: Option<WorkspaceMuteCriticalAlertsUiError> = crate::from_str_patched(&local_var_content).ok();
1200 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1201 Err(Error::ResponseError(local_var_error))
1202 }
1203}
1204