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 ListGlobalSettingsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum RenewLicenseKeyError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum SendStatsError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum SetGlobalError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum TestCriticalChannelsError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum TestLicenseKeyError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum TestMetadataError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum TestObjectStorageConfigError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum TestSmtpError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum WorkspaceAcknowledgeAllCriticalAlertsError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum WorkspaceAcknowledgeCriticalAlertError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum WorkspaceGetCriticalAlertsError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum WorkspaceMuteCriticalAlertsUiError {
155 UnknownValue(serde_json::Value),
156}
157
158
159pub async fn acknowledge_all_critical_alerts(configuration: &configuration::Configuration, ) -> Result<String, Error<AcknowledgeAllCriticalAlertsError>> {
160 let local_var_configuration = configuration;
161
162 let local_var_client = &local_var_configuration.client;
163
164 let local_var_uri_str = format!("{}/settings/critical_alerts/acknowledge_all", local_var_configuration.base_path);
165 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
166
167 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
168 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
169 }
170 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
171 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
172 };
173
174 let local_var_req = local_var_req_builder.build()?;
175 let local_var_resp = local_var_client.execute(local_var_req).await?;
176
177 let local_var_status = local_var_resp.status();
178 let local_var_content = local_var_resp.text().await?;
179
180 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
181 crate::from_str_patched(&local_var_content).map_err(Error::from)
182 } else {
183 let local_var_entity: Option<AcknowledgeAllCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
184 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
185 Err(Error::ResponseError(local_var_error))
186 }
187}
188
189pub async fn acknowledge_critical_alert(configuration: &configuration::Configuration, id: i32) -> Result<String, Error<AcknowledgeCriticalAlertError>> {
190 let local_var_configuration = configuration;
191
192 let local_var_client = &local_var_configuration.client;
193
194 let local_var_uri_str = format!("{}/settings/critical_alerts/{id}/acknowledge", local_var_configuration.base_path, id=id);
195 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
196
197 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
198 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
199 }
200 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
201 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
202 };
203
204 let local_var_req = local_var_req_builder.build()?;
205 let local_var_resp = local_var_client.execute(local_var_req).await?;
206
207 let local_var_status = local_var_resp.status();
208 let local_var_content = local_var_resp.text().await?;
209
210 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
211 crate::from_str_patched(&local_var_content).map_err(Error::from)
212 } else {
213 let local_var_entity: Option<AcknowledgeCriticalAlertError> = crate::from_str_patched(&local_var_content).ok();
214 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
215 Err(Error::ResponseError(local_var_error))
216 }
217}
218
219pub async fn create_customer_portal_session(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<CreateCustomerPortalSessionError>> {
220 let local_var_configuration = configuration;
221
222 let local_var_client = &local_var_configuration.client;
223
224 let local_var_uri_str = format!("{}/settings/customer_portal", local_var_configuration.base_path);
225 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
226
227 if let Some(ref local_var_str) = license_key {
228 local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
229 }
230 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
231 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
232 }
233 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
234 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
235 };
236
237 let local_var_req = local_var_req_builder.build()?;
238 let local_var_resp = local_var_client.execute(local_var_req).await?;
239
240 let local_var_status = local_var_resp.status();
241 let local_var_content = local_var_resp.text().await?;
242
243 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
244 crate::from_str_patched(&local_var_content).map_err(Error::from)
245 } else {
246 let local_var_entity: Option<CreateCustomerPortalSessionError> = crate::from_str_patched(&local_var_content).ok();
247 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
248 Err(Error::ResponseError(local_var_error))
249 }
250}
251
252pub async fn get_critical_alerts(configuration: &configuration::Configuration, page: Option<i32>, page_size: Option<i32>, acknowledged: Option<bool>) -> Result<models::GetCriticalAlerts200Response, Error<GetCriticalAlertsError>> {
253 let local_var_configuration = configuration;
254
255 let local_var_client = &local_var_configuration.client;
256
257 let local_var_uri_str = format!("{}/settings/critical_alerts", local_var_configuration.base_path);
258 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
259
260 if let Some(ref local_var_str) = page {
261 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
262 }
263 if let Some(ref local_var_str) = page_size {
264 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
265 }
266 if let Some(ref local_var_str) = acknowledged {
267 local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
268 }
269 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
270 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
271 }
272 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
273 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
274 };
275
276 let local_var_req = local_var_req_builder.build()?;
277 let local_var_resp = local_var_client.execute(local_var_req).await?;
278
279 let local_var_status = local_var_resp.status();
280 let local_var_content = local_var_resp.text().await?;
281
282 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
283 crate::from_str_patched(&local_var_content).map_err(Error::from)
284 } else {
285 let local_var_entity: Option<GetCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
286 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
287 Err(Error::ResponseError(local_var_error))
288 }
289}
290
291pub async fn get_global(configuration: &configuration::Configuration, key: &str) -> Result<serde_json::Value, Error<GetGlobalError>> {
292 let local_var_configuration = configuration;
293
294 let local_var_client = &local_var_configuration.client;
295
296 let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
297 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
298
299 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
300 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
301 }
302 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
303 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
304 };
305
306 let local_var_req = local_var_req_builder.build()?;
307 let local_var_resp = local_var_client.execute(local_var_req).await?;
308
309 let local_var_status = local_var_resp.status();
310 let local_var_content = local_var_resp.text().await?;
311
312 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
313 crate::from_str_patched(&local_var_content).map_err(Error::from)
314 } else {
315 let local_var_entity: Option<GetGlobalError> = crate::from_str_patched(&local_var_content).ok();
316 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
317 Err(Error::ResponseError(local_var_error))
318 }
319}
320
321pub async fn get_latest_key_renewal_attempt(configuration: &configuration::Configuration, ) -> Result<models::GetLatestKeyRenewalAttempt200Response, Error<GetLatestKeyRenewalAttemptError>> {
322 let local_var_configuration = configuration;
323
324 let local_var_client = &local_var_configuration.client;
325
326 let local_var_uri_str = format!("{}/settings/latest_key_renewal_attempt", local_var_configuration.base_path);
327 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
328
329 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
330 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
331 }
332 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
333 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
334 };
335
336 let local_var_req = local_var_req_builder.build()?;
337 let local_var_resp = local_var_client.execute(local_var_req).await?;
338
339 let local_var_status = local_var_resp.status();
340 let local_var_content = local_var_resp.text().await?;
341
342 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
343 crate::from_str_patched(&local_var_content).map_err(Error::from)
344 } else {
345 let local_var_entity: Option<GetLatestKeyRenewalAttemptError> = crate::from_str_patched(&local_var_content).ok();
346 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
347 Err(Error::ResponseError(local_var_error))
348 }
349}
350
351pub async fn get_local(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetLocalError>> {
352 let local_var_configuration = configuration;
353
354 let local_var_client = &local_var_configuration.client;
355
356 let local_var_uri_str = format!("{}/settings/local", local_var_configuration.base_path);
357 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
358
359 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
360 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
361 }
362 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
363 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
364 };
365
366 let local_var_req = local_var_req_builder.build()?;
367 let local_var_resp = local_var_client.execute(local_var_req).await?;
368
369 let local_var_status = local_var_resp.status();
370 let local_var_content = local_var_resp.text().await?;
371
372 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
373 crate::from_str_patched(&local_var_content).map_err(Error::from)
374 } else {
375 let local_var_entity: Option<GetLocalError> = crate::from_str_patched(&local_var_content).ok();
376 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
377 Err(Error::ResponseError(local_var_error))
378 }
379}
380
381pub async fn list_global_settings(configuration: &configuration::Configuration, ) -> Result<Vec<models::GlobalSetting>, Error<ListGlobalSettingsError>> {
382 let local_var_configuration = configuration;
383
384 let local_var_client = &local_var_configuration.client;
385
386 let local_var_uri_str = format!("{}/settings/list_global", local_var_configuration.base_path);
387 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
388
389 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
390 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
391 }
392 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
393 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
394 };
395
396 let local_var_req = local_var_req_builder.build()?;
397 let local_var_resp = local_var_client.execute(local_var_req).await?;
398
399 let local_var_status = local_var_resp.status();
400 let local_var_content = local_var_resp.text().await?;
401
402 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403 crate::from_str_patched(&local_var_content).map_err(Error::from)
404 } else {
405 let local_var_entity: Option<ListGlobalSettingsError> = crate::from_str_patched(&local_var_content).ok();
406 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
407 Err(Error::ResponseError(local_var_error))
408 }
409}
410
411pub async fn renew_license_key(configuration: &configuration::Configuration, license_key: Option<&str>) -> Result<String, Error<RenewLicenseKeyError>> {
412 let local_var_configuration = configuration;
413
414 let local_var_client = &local_var_configuration.client;
415
416 let local_var_uri_str = format!("{}/settings/renew_license_key", local_var_configuration.base_path);
417 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
418
419 if let Some(ref local_var_str) = license_key {
420 local_var_req_builder = local_var_req_builder.query(&[("license_key", &local_var_str.to_string())]);
421 }
422 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
423 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
424 }
425 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
426 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
427 };
428
429 let local_var_req = local_var_req_builder.build()?;
430 let local_var_resp = local_var_client.execute(local_var_req).await?;
431
432 let local_var_status = local_var_resp.status();
433 let local_var_content = local_var_resp.text().await?;
434
435 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
436 crate::from_str_patched(&local_var_content).map_err(Error::from)
437 } else {
438 let local_var_entity: Option<RenewLicenseKeyError> = crate::from_str_patched(&local_var_content).ok();
439 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
440 Err(Error::ResponseError(local_var_error))
441 }
442}
443
444pub async fn send_stats(configuration: &configuration::Configuration, ) -> Result<String, Error<SendStatsError>> {
445 let local_var_configuration = configuration;
446
447 let local_var_client = &local_var_configuration.client;
448
449 let local_var_uri_str = format!("{}/settings/send_stats", local_var_configuration.base_path);
450 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
451
452 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454 }
455 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
456 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
457 };
458
459 let local_var_req = local_var_req_builder.build()?;
460 let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462 let local_var_status = local_var_resp.status();
463 let local_var_content = local_var_resp.text().await?;
464
465 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466 crate::from_str_patched(&local_var_content).map_err(Error::from)
467 } else {
468 let local_var_entity: Option<SendStatsError> = crate::from_str_patched(&local_var_content).ok();
469 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470 Err(Error::ResponseError(local_var_error))
471 }
472}
473
474pub async fn set_global(configuration: &configuration::Configuration, key: &str, set_global_request: models::SetGlobalRequest) -> Result<String, Error<SetGlobalError>> {
475 let local_var_configuration = configuration;
476
477 let local_var_client = &local_var_configuration.client;
478
479 let local_var_uri_str = format!("{}/settings/global/{key}", local_var_configuration.base_path, key=crate::apis::urlencode(key));
480 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
481
482 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
483 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
484 }
485 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
486 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
487 };
488 local_var_req_builder = local_var_req_builder.json(&set_global_request);
489
490 let local_var_req = local_var_req_builder.build()?;
491 let local_var_resp = local_var_client.execute(local_var_req).await?;
492
493 let local_var_status = local_var_resp.status();
494 let local_var_content = local_var_resp.text().await?;
495
496 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
497 crate::from_str_patched(&local_var_content).map_err(Error::from)
498 } else {
499 let local_var_entity: Option<SetGlobalError> = crate::from_str_patched(&local_var_content).ok();
500 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
501 Err(Error::ResponseError(local_var_error))
502 }
503}
504
505pub async fn test_critical_channels(configuration: &configuration::Configuration, test_critical_channels_request_inner: Vec<models::TestCriticalChannelsRequestInner>) -> Result<String, Error<TestCriticalChannelsError>> {
506 let local_var_configuration = configuration;
507
508 let local_var_client = &local_var_configuration.client;
509
510 let local_var_uri_str = format!("{}/settings/test_critical_channels", local_var_configuration.base_path);
511 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
512
513 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
514 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
515 }
516 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
517 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
518 };
519 local_var_req_builder = local_var_req_builder.json(&test_critical_channels_request_inner);
520
521 let local_var_req = local_var_req_builder.build()?;
522 let local_var_resp = local_var_client.execute(local_var_req).await?;
523
524 let local_var_status = local_var_resp.status();
525 let local_var_content = local_var_resp.text().await?;
526
527 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
528 crate::from_str_patched(&local_var_content).map_err(Error::from)
529 } else {
530 let local_var_entity: Option<TestCriticalChannelsError> = crate::from_str_patched(&local_var_content).ok();
531 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
532 Err(Error::ResponseError(local_var_error))
533 }
534}
535
536pub async fn test_license_key(configuration: &configuration::Configuration, test_license_key_request: models::TestLicenseKeyRequest) -> Result<String, Error<TestLicenseKeyError>> {
537 let local_var_configuration = configuration;
538
539 let local_var_client = &local_var_configuration.client;
540
541 let local_var_uri_str = format!("{}/settings/test_license_key", local_var_configuration.base_path);
542 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
543
544 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
545 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
546 }
547 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
548 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
549 };
550 local_var_req_builder = local_var_req_builder.json(&test_license_key_request);
551
552 let local_var_req = local_var_req_builder.build()?;
553 let local_var_resp = local_var_client.execute(local_var_req).await?;
554
555 let local_var_status = local_var_resp.status();
556 let local_var_content = local_var_resp.text().await?;
557
558 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
559 crate::from_str_patched(&local_var_content).map_err(Error::from)
560 } else {
561 let local_var_entity: Option<TestLicenseKeyError> = crate::from_str_patched(&local_var_content).ok();
562 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
563 Err(Error::ResponseError(local_var_error))
564 }
565}
566
567pub async fn test_metadata(configuration: &configuration::Configuration, body: &str) -> Result<String, Error<TestMetadataError>> {
568 let local_var_configuration = configuration;
569
570 let local_var_client = &local_var_configuration.client;
571
572 let local_var_uri_str = format!("{}/saml/test_metadata", local_var_configuration.base_path);
573 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
574
575 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
576 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
577 }
578 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
579 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
580 };
581 local_var_req_builder = local_var_req_builder.json(&body);
582
583 let local_var_req = local_var_req_builder.build()?;
584 let local_var_resp = local_var_client.execute(local_var_req).await?;
585
586 let local_var_status = local_var_resp.status();
587 let local_var_content = local_var_resp.text().await?;
588
589 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
590 crate::from_str_patched(&local_var_content).map_err(Error::from)
591 } else {
592 let local_var_entity: Option<TestMetadataError> = crate::from_str_patched(&local_var_content).ok();
593 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
594 Err(Error::ResponseError(local_var_error))
595 }
596}
597
598pub async fn test_object_storage_config(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<String, Error<TestObjectStorageConfigError>> {
599 let local_var_configuration = configuration;
600
601 let local_var_client = &local_var_configuration.client;
602
603 let local_var_uri_str = format!("{}/settings/test_object_storage_config", local_var_configuration.base_path);
604 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
605
606 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
607 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
608 }
609 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
610 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
611 };
612 local_var_req_builder = local_var_req_builder.json(&request_body);
613
614 let local_var_req = local_var_req_builder.build()?;
615 let local_var_resp = local_var_client.execute(local_var_req).await?;
616
617 let local_var_status = local_var_resp.status();
618 let local_var_content = local_var_resp.text().await?;
619
620 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
621 crate::from_str_patched(&local_var_content).map_err(Error::from)
622 } else {
623 let local_var_entity: Option<TestObjectStorageConfigError> = crate::from_str_patched(&local_var_content).ok();
624 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
625 Err(Error::ResponseError(local_var_error))
626 }
627}
628
629pub async fn test_smtp(configuration: &configuration::Configuration, test_smtp_request: models::TestSmtpRequest) -> Result<String, Error<TestSmtpError>> {
630 let local_var_configuration = configuration;
631
632 let local_var_client = &local_var_configuration.client;
633
634 let local_var_uri_str = format!("{}/settings/test_smtp", local_var_configuration.base_path);
635 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
636
637 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
638 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
639 }
640 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
641 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
642 };
643 local_var_req_builder = local_var_req_builder.json(&test_smtp_request);
644
645 let local_var_req = local_var_req_builder.build()?;
646 let local_var_resp = local_var_client.execute(local_var_req).await?;
647
648 let local_var_status = local_var_resp.status();
649 let local_var_content = local_var_resp.text().await?;
650
651 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
652 crate::from_str_patched(&local_var_content).map_err(Error::from)
653 } else {
654 let local_var_entity: Option<TestSmtpError> = crate::from_str_patched(&local_var_content).ok();
655 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
656 Err(Error::ResponseError(local_var_error))
657 }
658}
659
660pub async fn workspace_acknowledge_all_critical_alerts(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<WorkspaceAcknowledgeAllCriticalAlertsError>> {
661 let local_var_configuration = configuration;
662
663 let local_var_client = &local_var_configuration.client;
664
665 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/acknowledge_all", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
666 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
667
668 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
669 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
670 }
671 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
672 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
673 };
674
675 let local_var_req = local_var_req_builder.build()?;
676 let local_var_resp = local_var_client.execute(local_var_req).await?;
677
678 let local_var_status = local_var_resp.status();
679 let local_var_content = local_var_resp.text().await?;
680
681 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
682 crate::from_str_patched(&local_var_content).map_err(Error::from)
683 } else {
684 let local_var_entity: Option<WorkspaceAcknowledgeAllCriticalAlertsError> = crate::from_str_patched(&local_var_content).ok();
685 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
686 Err(Error::ResponseError(local_var_error))
687 }
688}
689
690pub async fn workspace_acknowledge_critical_alert(configuration: &configuration::Configuration, workspace: &str, id: i32) -> Result<String, Error<WorkspaceAcknowledgeCriticalAlertError>> {
691 let local_var_configuration = configuration;
692
693 let local_var_client = &local_var_configuration.client;
694
695 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);
696 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
697
698 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
699 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
700 }
701 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
702 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
703 };
704
705 let local_var_req = local_var_req_builder.build()?;
706 let local_var_resp = local_var_client.execute(local_var_req).await?;
707
708 let local_var_status = local_var_resp.status();
709 let local_var_content = local_var_resp.text().await?;
710
711 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
712 crate::from_str_patched(&local_var_content).map_err(Error::from)
713 } else {
714 let local_var_entity: Option<WorkspaceAcknowledgeCriticalAlertError> = crate::from_str_patched(&local_var_content).ok();
715 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
716 Err(Error::ResponseError(local_var_error))
717 }
718}
719
720pub 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>> {
721 let local_var_configuration = configuration;
722
723 let local_var_client = &local_var_configuration.client;
724
725 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
726 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
727
728 if let Some(ref local_var_str) = page {
729 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
730 }
731 if let Some(ref local_var_str) = page_size {
732 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
733 }
734 if let Some(ref local_var_str) = acknowledged {
735 local_var_req_builder = local_var_req_builder.query(&[("acknowledged", &local_var_str.to_string())]);
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<WorkspaceGetCriticalAlertsError> = 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 workspace_mute_critical_alerts_ui(configuration: &configuration::Configuration, workspace: &str, workspace_mute_critical_alerts_ui_request: models::WorkspaceMuteCriticalAlertsUiRequest) -> Result<String, Error<WorkspaceMuteCriticalAlertsUiError>> {
760 let local_var_configuration = configuration;
761
762 let local_var_client = &local_var_configuration.client;
763
764 let local_var_uri_str = format!("{}/w/{workspace}/workspaces/critical_alerts/mute", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
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(&workspace_mute_critical_alerts_ui_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<WorkspaceMuteCriticalAlertsUiError> = 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