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