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