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