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