1use reqwest;
13
14use crate::apis::ResponseContent;
15#[allow(unused)]
16use crate::models;
17use super::Error;
18use dtz_config::Configuration;
19
20fn build_url(config: &Configuration) -> String {
21 if let Some(base_path) = &config.base_path {
22 let base = url::Url::parse(base_path).unwrap();
23 let mut target_url = url::Url::parse(crate::apis::configuration::SVC_URL).unwrap();
24 let _ = target_url.set_scheme(base.scheme());
25 let _ = target_url.set_port(base.port());
26 let _ = target_url.set_host(Some(base.host_str().unwrap()));
27 format!("{target_url}")
28 } else {
29 crate::apis::configuration::SVC_URL.to_string()
30 }
31}
32
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum PullTaskFromQueueSuccess {
38 Status200(models::PullTaskFromQueue200Response),
39 Status204(),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum ContextContextIdEnableServiceGetError {
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum CreateContextError {
54 UnknownValue(serde_json::Value),
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum CreateIngressError {
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum CreateRootIngressError {
68 UnknownValue(serde_json::Value),
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum CreateTaskError {
75 UnknownValue(serde_json::Value),
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum DeleteContextError {
82 UnknownValue(serde_json::Value),
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum DeleteIngressError {
89 UnknownValue(serde_json::Value),
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum DeleteRootIngressError {
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum GetContextError {
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetCurrentContextError {
110 UnknownValue(serde_json::Value),
111}
112
113#[derive(Debug, Clone, Serialize, Deserialize)]
115#[serde(untagged)]
116pub enum GetIngressError {
117 UnknownValue(serde_json::Value),
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum GetRootIngressError {
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum GetTaskHistoryError {
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum IssueCertificateError {
138 Status429(),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum ListIngressError {
146 UnknownValue(serde_json::Value),
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum PullTaskFromQueueError {
153 UnknownValue(serde_json::Value),
154}
155
156#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum UpdateContextError {
160 UnknownValue(serde_json::Value),
161}
162
163
164pub async fn context_context_id_enable_service_get(configuration: &Configuration, context_id: &str) -> Result<(), Error<ContextContextIdEnableServiceGetError>> {
165 let local_var_configuration = configuration;
166
167 let local_var_client = &local_var_configuration.client;
168
169 let local_var_uri_str = format!("{}/context/{context_id}/enableService", build_url(configuration), context_id=crate::apis::urlencode(context_id));
170 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
171
172 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
173 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
174 };
175 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
176 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
177 };
178
179 let local_var_req = local_var_req_builder.build()?;
180 let local_var_resp = local_var_client.execute(local_var_req).await?;
181
182 let local_var_status = local_var_resp.status();
183 let local_var_content = local_var_resp.text().await?;
184
185 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
186 Ok(())
187 } else {
188 let local_var_entity: Option<ContextContextIdEnableServiceGetError> = serde_json::from_str(&local_var_content).ok();
189 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
190 Err(Error::ResponseError(local_var_error))
191 }
192}
193
194pub async fn create_context(configuration: &Configuration, create_context_request: Option<crate::models::CreateContextRequest>) -> Result<models::ContextResponse, Error<CreateContextError>> {
196 let local_var_configuration = configuration;
197
198 let local_var_client = &local_var_configuration.client;
199
200 let local_var_uri_str = format!("{}/context", build_url(configuration));
201 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
202
203 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
204 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
205 };
206 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
207 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
208 };
209 local_var_req_builder = local_var_req_builder.json(&create_context_request);
210
211 let local_var_req = local_var_req_builder.build()?;
212 let local_var_resp = local_var_client.execute(local_var_req).await?;
213
214 let local_var_status = local_var_resp.status();
215 let local_var_content = local_var_resp.text().await?;
216
217 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
218 serde_json::from_str(&local_var_content).map_err(Error::from)
219 } else {
220 let local_var_entity: Option<CreateContextError> = serde_json::from_str(&local_var_content).ok();
221 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
222 Err(Error::ResponseError(local_var_error))
223 }
224}
225
226pub async fn create_ingress(configuration: &Configuration, domain: &str, uri: &str, create_ingress_request: Option<crate::models::CreateIngressRequest>) -> Result<models::IngressResponse, Error<CreateIngressError>> {
227 let local_var_configuration = configuration;
228
229 let local_var_client = &local_var_configuration.client;
230
231 let local_var_uri_str = format!("{}/ingress/{domain}/{uri}", build_url(configuration), domain=crate::apis::urlencode(domain), uri=crate::apis::urlencode(uri));
232 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
233
234 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
235 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
236 };
237 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
238 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
239 };
240 local_var_req_builder = local_var_req_builder.json(&create_ingress_request);
241
242 let local_var_req = local_var_req_builder.build()?;
243 let local_var_resp = local_var_client.execute(local_var_req).await?;
244
245 let local_var_status = local_var_resp.status();
246 let local_var_content = local_var_resp.text().await?;
247
248 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
249 serde_json::from_str(&local_var_content).map_err(Error::from)
250 } else {
251 let local_var_entity: Option<CreateIngressError> = serde_json::from_str(&local_var_content).ok();
252 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
253 Err(Error::ResponseError(local_var_error))
254 }
255}
256
257pub async fn create_root_ingress(configuration: &Configuration, domain: &str, create_ingress_request: Option<crate::models::CreateIngressRequest>) -> Result<models::IngressResponse, Error<CreateRootIngressError>> {
258 let local_var_configuration = configuration;
259
260 let local_var_client = &local_var_configuration.client;
261
262 let local_var_uri_str = format!("{}/ingress/{domain}/", build_url(configuration), domain=crate::apis::urlencode(domain));
263 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
264
265 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
266 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
267 };
268 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
269 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
270 };
271 local_var_req_builder = local_var_req_builder.json(&create_ingress_request);
272
273 let local_var_req = local_var_req_builder.build()?;
274 let local_var_resp = local_var_client.execute(local_var_req).await?;
275
276 let local_var_status = local_var_resp.status();
277 let local_var_content = local_var_resp.text().await?;
278
279 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
280 serde_json::from_str(&local_var_content).map_err(Error::from)
281 } else {
282 let local_var_entity: Option<CreateRootIngressError> = serde_json::from_str(&local_var_content).ok();
283 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
284 Err(Error::ResponseError(local_var_error))
285 }
286}
287
288pub async fn create_task(configuration: &Configuration, task_id: &str, create_task_request: Option<crate::models::CreateTaskRequest>) -> Result<(), Error<CreateTaskError>> {
289 let local_var_configuration = configuration;
290
291 let local_var_client = &local_var_configuration.client;
292
293 let local_var_uri_str = format!("{}/task/{task_id}", build_url(configuration), task_id=crate::apis::urlencode(task_id));
294 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
295
296 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
297 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
298 };
299 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
300 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
301 };
302 local_var_req_builder = local_var_req_builder.json(&create_task_request);
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 Ok(())
312 } else {
313 let local_var_entity: Option<CreateTaskError> = serde_json::from_str(&local_var_content).ok();
314 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
315 Err(Error::ResponseError(local_var_error))
316 }
317}
318
319pub async fn delete_context(configuration: &Configuration, context_id: &str) -> Result<(), Error<DeleteContextError>> {
320 let local_var_configuration = configuration;
321
322 let local_var_client = &local_var_configuration.client;
323
324 let local_var_uri_str = format!("{}/context/{context_id}", build_url(configuration), context_id=crate::apis::urlencode(context_id));
325 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
326
327 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
328 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
329 };
330 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
331 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
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 Ok(())
342 } else {
343 let local_var_entity: Option<DeleteContextError> = serde_json::from_str(&local_var_content).ok();
344 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
345 Err(Error::ResponseError(local_var_error))
346 }
347}
348
349pub async fn delete_ingress(configuration: &Configuration, domain: &str, uri: &str) -> Result<(), Error<DeleteIngressError>> {
350 let local_var_configuration = configuration;
351
352 let local_var_client = &local_var_configuration.client;
353
354 let local_var_uri_str = format!("{}/ingress/{domain}/{uri}", build_url(configuration), domain=crate::apis::urlencode(domain), uri=crate::apis::urlencode(uri));
355 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
356
357 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
358 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
359 };
360 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
361 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
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 Ok(())
372 } else {
373 let local_var_entity: Option<DeleteIngressError> = serde_json::from_str(&local_var_content).ok();
374 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
375 Err(Error::ResponseError(local_var_error))
376 }
377}
378
379pub async fn delete_root_ingress(configuration: &Configuration, domain: &str) -> Result<(), Error<DeleteRootIngressError>> {
380 let local_var_configuration = configuration;
381
382 let local_var_client = &local_var_configuration.client;
383
384 let local_var_uri_str = format!("{}/ingress/{domain}/", build_url(configuration), domain=crate::apis::urlencode(domain));
385 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
386
387 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
388 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
389 };
390 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
391 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
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 Ok(())
402 } else {
403 let local_var_entity: Option<DeleteRootIngressError> = serde_json::from_str(&local_var_content).ok();
404 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
405 Err(Error::ResponseError(local_var_error))
406 }
407}
408
409pub async fn get_context(configuration: &Configuration, context_id: &str) -> Result<models::ContextResponse, Error<GetContextError>> {
410 let local_var_configuration = configuration;
411
412 let local_var_client = &local_var_configuration.client;
413
414 let local_var_uri_str = format!("{}/context/{context_id}", build_url(configuration), context_id=crate::apis::urlencode(context_id));
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_token) = local_var_configuration.oauth_access_token {
418 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
419 };
420 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
421 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
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 serde_json::from_str(&local_var_content).map_err(Error::from)
432 } else {
433 let local_var_entity: Option<GetContextError> = serde_json::from_str(&local_var_content).ok();
434 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
435 Err(Error::ResponseError(local_var_error))
436 }
437}
438
439pub async fn get_current_context(configuration: &Configuration, ) -> Result<models::ContextResponse, Error<GetCurrentContextError>> {
441 let local_var_configuration = configuration;
442
443 let local_var_client = &local_var_configuration.client;
444
445 let local_var_uri_str = format!("{}/context", build_url(configuration));
446 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
447
448 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
449 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
450 };
451 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
452 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
453 };
454
455 let local_var_req = local_var_req_builder.build()?;
456 let local_var_resp = local_var_client.execute(local_var_req).await?;
457
458 let local_var_status = local_var_resp.status();
459 let local_var_content = local_var_resp.text().await?;
460
461 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
462 serde_json::from_str(&local_var_content).map_err(Error::from)
463 } else {
464 let local_var_entity: Option<GetCurrentContextError> = serde_json::from_str(&local_var_content).ok();
465 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
466 Err(Error::ResponseError(local_var_error))
467 }
468}
469
470pub async fn get_ingress(configuration: &Configuration, domain: &str, uri: &str, scope: &str) -> Result<models::IngressResponse, Error<GetIngressError>> {
471 let local_var_configuration = configuration;
472
473 let local_var_client = &local_var_configuration.client;
474
475 let local_var_uri_str = format!("{}/ingress/{domain}/{uri}", build_url(configuration), domain=crate::apis::urlencode(domain), uri=crate::apis::urlencode(uri));
476 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
477
478 local_var_req_builder = local_var_req_builder.query(&[("scope", &scope.to_string())]);
479 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
480 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
481 };
482 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
483 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
484 };
485
486 let local_var_req = local_var_req_builder.build()?;
487 let local_var_resp = local_var_client.execute(local_var_req).await?;
488
489 let local_var_status = local_var_resp.status();
490 let local_var_content = local_var_resp.text().await?;
491
492 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
493 serde_json::from_str(&local_var_content).map_err(Error::from)
494 } else {
495 let local_var_entity: Option<GetIngressError> = serde_json::from_str(&local_var_content).ok();
496 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
497 Err(Error::ResponseError(local_var_error))
498 }
499}
500
501pub async fn get_root_ingress(configuration: &Configuration, domain: &str, scope: &str) -> Result<models::IngressResponse, Error<GetRootIngressError>> {
502 let local_var_configuration = configuration;
503
504 let local_var_client = &local_var_configuration.client;
505
506 let local_var_uri_str = format!("{}/ingress/{domain}/", build_url(configuration), domain=crate::apis::urlencode(domain));
507 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
508
509 local_var_req_builder = local_var_req_builder.query(&[("scope", &scope.to_string())]);
510 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
511 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
512 };
513 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
514 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
515 };
516
517 let local_var_req = local_var_req_builder.build()?;
518 let local_var_resp = local_var_client.execute(local_var_req).await?;
519
520 let local_var_status = local_var_resp.status();
521 let local_var_content = local_var_resp.text().await?;
522
523 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
524 serde_json::from_str(&local_var_content).map_err(Error::from)
525 } else {
526 let local_var_entity: Option<GetRootIngressError> = serde_json::from_str(&local_var_content).ok();
527 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
528 Err(Error::ResponseError(local_var_error))
529 }
530}
531
532pub async fn get_task_history(configuration: &Configuration, task_id: &str) -> Result<(), Error<GetTaskHistoryError>> {
533 let local_var_configuration = configuration;
534
535 let local_var_client = &local_var_configuration.client;
536
537 let local_var_uri_str = format!("{}/task/{task_id}", build_url(configuration), task_id=crate::apis::urlencode(task_id));
538 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
539
540 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
541 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
542 };
543 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
544 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
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 Ok(())
555 } else {
556 let local_var_entity: Option<GetTaskHistoryError> = serde_json::from_str(&local_var_content).ok();
557 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
558 Err(Error::ResponseError(local_var_error))
559 }
560}
561
562pub async fn issue_certificate(configuration: &Configuration, issue_certificate_request: Option<crate::models::IssueCertificateRequest>) -> Result<(), Error<IssueCertificateError>> {
564 let local_var_configuration = configuration;
565
566 let local_var_client = &local_var_configuration.client;
567
568 let local_var_uri_str = format!("{}/certificate", build_url(configuration));
569 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
570
571 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
572 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
573 };
574 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
575 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
576 };
577 local_var_req_builder = local_var_req_builder.json(&issue_certificate_request);
578
579 let local_var_req = local_var_req_builder.build()?;
580 let local_var_resp = local_var_client.execute(local_var_req).await?;
581
582 let local_var_status = local_var_resp.status();
583 let local_var_content = local_var_resp.text().await?;
584
585 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
586 Ok(())
587 } else {
588 let local_var_entity: Option<IssueCertificateError> = serde_json::from_str(&local_var_content).ok();
589 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
590 Err(Error::ResponseError(local_var_error))
591 }
592}
593
594pub async fn list_ingress(configuration: &Configuration, scope: Option<&str>) -> Result<Vec<models::IngressResponse>, Error<ListIngressError>> {
595 let local_var_configuration = configuration;
596
597 let local_var_client = &local_var_configuration.client;
598
599 let local_var_uri_str = format!("{}/ingress", build_url(configuration));
600 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
601
602 if let Some(ref local_var_str) = scope {
603 local_var_req_builder = local_var_req_builder.query(&[("scope", &local_var_str.to_string())]);
604 }
605 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
606 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
607 };
608 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
609 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
610 };
611
612 let local_var_req = local_var_req_builder.build()?;
613 let local_var_resp = local_var_client.execute(local_var_req).await?;
614
615 let local_var_status = local_var_resp.status();
616 let local_var_content = local_var_resp.text().await?;
617
618 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
619 serde_json::from_str(&local_var_content).map_err(Error::from)
620 } else {
621 let local_var_entity: Option<ListIngressError> = serde_json::from_str(&local_var_content).ok();
622 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
623 Err(Error::ResponseError(local_var_error))
624 }
625}
626
627pub async fn pull_task_from_queue(configuration: &Configuration, pull_task_from_queue_request: Option<crate::models::PullTaskFromQueueRequest>) -> Result<ResponseContent<PullTaskFromQueueSuccess>, Error<PullTaskFromQueueError>> {
628 let local_var_configuration = configuration;
629
630 let local_var_client = &local_var_configuration.client;
631
632 let local_var_uri_str = format!("{}/task", build_url(configuration));
633 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
634
635 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
636 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
637 };
638 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
639 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
640 };
641 local_var_req_builder = local_var_req_builder.json(&pull_task_from_queue_request);
642
643 let local_var_req = local_var_req_builder.build()?;
644 let local_var_resp = local_var_client.execute(local_var_req).await?;
645
646 let local_var_status = local_var_resp.status();
647 let local_var_content = local_var_resp.text().await?;
648
649 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
650 let local_var_entity: Option<PullTaskFromQueueSuccess> = serde_json::from_str(&local_var_content).ok();
651 let local_var_result = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
652 Ok(local_var_result)
653 } else {
654 let local_var_entity: Option<PullTaskFromQueueError> = serde_json::from_str(&local_var_content).ok();
655 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
656 Err(Error::ResponseError(local_var_error))
657 }
658}
659
660pub async fn update_context(configuration: &Configuration, context_id: &str, create_context_request: Option<crate::models::CreateContextRequest>) -> Result<models::ContextResponse, Error<UpdateContextError>> {
662 let local_var_configuration = configuration;
663
664 let local_var_client = &local_var_configuration.client;
665
666 let local_var_uri_str = format!("{}/context/{context_id}", build_url(configuration), context_id=crate::apis::urlencode(context_id));
667 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
668
669 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
670 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
671 };
672 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
673 local_var_req_builder = local_var_req_builder.header("X-API-KEY", local_var_apikey);
674 };
675 local_var_req_builder = local_var_req_builder.json(&create_context_request);
676
677 let local_var_req = local_var_req_builder.build()?;
678 let local_var_resp = local_var_client.execute(local_var_req).await?;
679
680 let local_var_status = local_var_resp.status();
681 let local_var_content = local_var_resp.text().await?;
682
683 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
684 serde_json::from_str(&local_var_content).map_err(Error::from)
685 } else {
686 let local_var_entity: Option<UpdateContextError> = serde_json::from_str(&local_var_content).ok();
687 let local_var_error = ResponseContent { status: local_var_status, content: Some(crate::apis::Content::Text(local_var_content)), entity: local_var_entity };
688 Err(Error::ResponseError(local_var_error))
689 }
690}
691