1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DispatchJobError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum EvaluateJobError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ForceNewPeriodicInstanceError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetJobError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetJobAllocationsError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetJobDeploymentsError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetJobEvaluationsError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetJobLatestDeploymentError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetJobScaleStatusError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetJobSummaryError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetJobVersionsError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetJobsError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ParseJobHclError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PlanJobError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum RegisterJobError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum RevertJobError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ScaleTaskGroupError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum SetJobStabilityError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum StopJobError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum UpdateJobError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ValidateJobError {
162 UnknownValue(serde_json::Value),
163}
164
165
166pub async fn dispatch_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_dispatch_request: Option<crate::models::JobDispatchRequest>) -> Result<crate::models::JobDispatchResponse, Error<DispatchJobError>> {
167
168 let local_var_client = &configuration.client;
169
170 let local_var_uri_str = format!("{}/job/{job_id}/dispatch", configuration.base_path, job_id=crate::apis::urlencode(job_id));
171 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
172
173 if let Some(ref local_var_str) = namespace {
174 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
175 }
176 if let Some(ref local_var_str) = region {
177 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
178 }
179 if let Some(ref local_var_str) = index {
180 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
181 }
182 if let Some(ref local_var_str) = wait {
183 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
184 }
185 if let Some(ref local_var_user_agent) = configuration.user_agent {
186 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
187 }
188 local_var_req_builder = local_var_req_builder.json(&job_dispatch_request);
189
190 let local_var_req = local_var_req_builder.build()?;
191 let local_var_resp = local_var_client.execute(local_var_req).await?;
192
193 let local_var_status = local_var_resp.status();
194 let local_var_content = local_var_resp.text().await?;
195
196 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
197 serde_json::from_str(&local_var_content).map_err(Error::from)
198 } else {
199 let local_var_entity: Option<DispatchJobError> = serde_json::from_str(&local_var_content).ok();
200 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
201 Err(Error::ResponseError(local_var_error))
202 }
203}
204
205pub async fn evaluate_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_evaluate_request: Option<crate::models::JobEvaluateRequest>) -> Result<crate::models::JobRegisterResponse, Error<EvaluateJobError>> {
206
207 let local_var_client = &configuration.client;
208
209 let local_var_uri_str = format!("{}/job/{job_id}/evaluate", configuration.base_path, job_id=crate::apis::urlencode(job_id));
210 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
211
212 if let Some(ref local_var_str) = namespace {
213 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
214 }
215 if let Some(ref local_var_str) = region {
216 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
217 }
218 if let Some(ref local_var_str) = index {
219 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
220 }
221 if let Some(ref local_var_str) = wait {
222 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
223 }
224 if let Some(ref local_var_user_agent) = configuration.user_agent {
225 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
226 }
227 local_var_req_builder = local_var_req_builder.json(&job_evaluate_request);
228
229 let local_var_req = local_var_req_builder.build()?;
230 let local_var_resp = local_var_client.execute(local_var_req).await?;
231
232 let local_var_status = local_var_resp.status();
233 let local_var_content = local_var_resp.text().await?;
234
235 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
236 serde_json::from_str(&local_var_content).map_err(Error::from)
237 } else {
238 let local_var_entity: Option<EvaluateJobError> = serde_json::from_str(&local_var_content).ok();
239 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
240 Err(Error::ResponseError(local_var_error))
241 }
242}
243
244pub async fn force_new_periodic_instance(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::PeriodicForceResponse, Error<ForceNewPeriodicInstanceError>> {
245
246 let local_var_client = &configuration.client;
247
248 let local_var_uri_str = format!("{}/job/{job_id}/periodic/force", configuration.base_path, job_id=crate::apis::urlencode(job_id));
249 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
250
251 if let Some(ref local_var_str) = namespace {
252 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
253 }
254 if let Some(ref local_var_str) = region {
255 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
256 }
257 if let Some(ref local_var_str) = index {
258 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
259 }
260 if let Some(ref local_var_str) = wait {
261 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
262 }
263 if let Some(ref local_var_user_agent) = configuration.user_agent {
264 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
265 }
266
267 let local_var_req = local_var_req_builder.build()?;
268 let local_var_resp = local_var_client.execute(local_var_req).await?;
269
270 let local_var_status = local_var_resp.status();
271 let local_var_content = local_var_resp.text().await?;
272
273 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
274 serde_json::from_str(&local_var_content).map_err(Error::from)
275 } else {
276 let local_var_entity: Option<ForceNewPeriodicInstanceError> = serde_json::from_str(&local_var_content).ok();
277 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
278 Err(Error::ResponseError(local_var_error))
279 }
280}
281
282pub async fn get_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::Job, Error<GetJobError>> {
283
284 let local_var_client = &configuration.client;
285
286 let local_var_uri_str = format!("{}/job/{job_id}", configuration.base_path, job_id=crate::apis::urlencode(job_id));
287 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
288
289 if let Some(ref local_var_str) = namespace {
290 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
291 }
292 if let Some(ref local_var_str) = region {
293 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
294 }
295 if let Some(ref local_var_str) = index {
296 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
297 }
298 if let Some(ref local_var_str) = wait {
299 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
300 }
301 if let Some(ref local_var_user_agent) = configuration.user_agent {
302 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
303 }
304
305 let local_var_req = local_var_req_builder.build()?;
306 let local_var_resp = local_var_client.execute(local_var_req).await?;
307
308 let local_var_status = local_var_resp.status();
309 let local_var_content = local_var_resp.text().await?;
310
311 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
312 serde_json::from_str(&local_var_content).map_err(Error::from)
313 } else {
314 let local_var_entity: Option<GetJobError> = serde_json::from_str(&local_var_content).ok();
315 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
316 Err(Error::ResponseError(local_var_error))
317 }
318}
319
320pub async fn get_job_allocations(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, all: Option<bool>) -> Result<Vec<crate::models::AllocationListStub>, Error<GetJobAllocationsError>> {
321
322 let local_var_client = &configuration.client;
323
324 let local_var_uri_str = format!("{}/job/{job_id}/allocations", configuration.base_path, job_id=crate::apis::urlencode(job_id));
325 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
326
327 if let Some(ref local_var_str) = namespace {
328 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
329 }
330 if let Some(ref local_var_str) = region {
331 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
332 }
333 if let Some(ref local_var_str) = index {
334 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
335 }
336 if let Some(ref local_var_str) = wait {
337 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
338 }
339 if let Some(ref local_var_str) = all {
340 local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
341 }
342 if let Some(ref local_var_user_agent) = configuration.user_agent {
343 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
344 }
345
346 let local_var_req = local_var_req_builder.build()?;
347 let local_var_resp = local_var_client.execute(local_var_req).await?;
348
349 let local_var_status = local_var_resp.status();
350 let local_var_content = local_var_resp.text().await?;
351
352 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
353 serde_json::from_str(&local_var_content).map_err(Error::from)
354 } else {
355 let local_var_entity: Option<GetJobAllocationsError> = serde_json::from_str(&local_var_content).ok();
356 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
357 Err(Error::ResponseError(local_var_error))
358 }
359}
360
361pub async fn get_job_deployments(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, all: Option<bool>) -> Result<Vec<crate::models::Deployment>, Error<GetJobDeploymentsError>> {
362
363 let local_var_client = &configuration.client;
364
365 let local_var_uri_str = format!("{}/job/{job_id}/deployments", configuration.base_path, job_id=crate::apis::urlencode(job_id));
366 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
367
368 if let Some(ref local_var_str) = namespace {
369 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
370 }
371 if let Some(ref local_var_str) = region {
372 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
373 }
374 if let Some(ref local_var_str) = index {
375 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
376 }
377 if let Some(ref local_var_str) = wait {
378 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
379 }
380 if let Some(ref local_var_str) = all {
381 local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
382 }
383 if let Some(ref local_var_user_agent) = configuration.user_agent {
384 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
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 serde_json::from_str(&local_var_content).map_err(Error::from)
395 } else {
396 let local_var_entity: Option<GetJobDeploymentsError> = serde_json::from_str(&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_job_evaluations(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<Vec<crate::models::Evaluation>, Error<GetJobEvaluationsError>> {
403
404 let local_var_client = &configuration.client;
405
406 let local_var_uri_str = format!("{}/job/{job_id}/evaluations", configuration.base_path, job_id=crate::apis::urlencode(job_id));
407 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
408
409 if let Some(ref local_var_str) = namespace {
410 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
411 }
412 if let Some(ref local_var_str) = region {
413 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
414 }
415 if let Some(ref local_var_str) = index {
416 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
417 }
418 if let Some(ref local_var_str) = wait {
419 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
420 }
421 if let Some(ref local_var_user_agent) = configuration.user_agent {
422 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
423 }
424
425 let local_var_req = local_var_req_builder.build()?;
426 let local_var_resp = local_var_client.execute(local_var_req).await?;
427
428 let local_var_status = local_var_resp.status();
429 let local_var_content = local_var_resp.text().await?;
430
431 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
432 serde_json::from_str(&local_var_content).map_err(Error::from)
433 } else {
434 let local_var_entity: Option<GetJobEvaluationsError> = serde_json::from_str(&local_var_content).ok();
435 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
436 Err(Error::ResponseError(local_var_error))
437 }
438}
439
440pub async fn get_job_latest_deployment(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::Deployment, Error<GetJobLatestDeploymentError>> {
441
442 let local_var_client = &configuration.client;
443
444 let local_var_uri_str = format!("{}/job/{job_id}/deployment", configuration.base_path, job_id=crate::apis::urlencode(job_id));
445 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
446
447 if let Some(ref local_var_str) = namespace {
448 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
449 }
450 if let Some(ref local_var_str) = region {
451 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
452 }
453 if let Some(ref local_var_str) = index {
454 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
455 }
456 if let Some(ref local_var_str) = wait {
457 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
458 }
459 if let Some(ref local_var_user_agent) = configuration.user_agent {
460 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
461 }
462
463 let local_var_req = local_var_req_builder.build()?;
464 let local_var_resp = local_var_client.execute(local_var_req).await?;
465
466 let local_var_status = local_var_resp.status();
467 let local_var_content = local_var_resp.text().await?;
468
469 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
470 serde_json::from_str(&local_var_content).map_err(Error::from)
471 } else {
472 let local_var_entity: Option<GetJobLatestDeploymentError> = serde_json::from_str(&local_var_content).ok();
473 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
474 Err(Error::ResponseError(local_var_error))
475 }
476}
477
478pub async fn get_job_scale_status(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::JobScaleStatusResponse, Error<GetJobScaleStatusError>> {
479
480 let local_var_client = &configuration.client;
481
482 let local_var_uri_str = format!("{}/job/{job_id}/scale", configuration.base_path, job_id=crate::apis::urlencode(job_id));
483 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
484
485 if let Some(ref local_var_str) = namespace {
486 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
487 }
488 if let Some(ref local_var_str) = region {
489 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
490 }
491 if let Some(ref local_var_str) = index {
492 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
493 }
494 if let Some(ref local_var_str) = wait {
495 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
496 }
497 if let Some(ref local_var_user_agent) = configuration.user_agent {
498 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
499 }
500
501 let local_var_req = local_var_req_builder.build()?;
502 let local_var_resp = local_var_client.execute(local_var_req).await?;
503
504 let local_var_status = local_var_resp.status();
505 let local_var_content = local_var_resp.text().await?;
506
507 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
508 serde_json::from_str(&local_var_content).map_err(Error::from)
509 } else {
510 let local_var_entity: Option<GetJobScaleStatusError> = serde_json::from_str(&local_var_content).ok();
511 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
512 Err(Error::ResponseError(local_var_error))
513 }
514}
515
516pub async fn get_job_summary(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::JobSummary, Error<GetJobSummaryError>> {
517
518 let local_var_client = &configuration.client;
519
520 let local_var_uri_str = format!("{}/job/{job_id}/summary", configuration.base_path, job_id=crate::apis::urlencode(job_id));
521 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
522
523 if let Some(ref local_var_str) = namespace {
524 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
525 }
526 if let Some(ref local_var_str) = region {
527 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
528 }
529 if let Some(ref local_var_str) = index {
530 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
531 }
532 if let Some(ref local_var_str) = wait {
533 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
534 }
535 if let Some(ref local_var_user_agent) = configuration.user_agent {
536 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
537 }
538
539 let local_var_req = local_var_req_builder.build()?;
540 let local_var_resp = local_var_client.execute(local_var_req).await?;
541
542 let local_var_status = local_var_resp.status();
543 let local_var_content = local_var_resp.text().await?;
544
545 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
546 serde_json::from_str(&local_var_content).map_err(Error::from)
547 } else {
548 let local_var_entity: Option<GetJobSummaryError> = serde_json::from_str(&local_var_content).ok();
549 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
550 Err(Error::ResponseError(local_var_error))
551 }
552}
553
554pub async fn get_job_versions(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>) -> Result<crate::models::JobVersionsResponse, Error<GetJobVersionsError>> {
555
556 let local_var_client = &configuration.client;
557
558 let local_var_uri_str = format!("{}/job/{job_id}/versions", configuration.base_path, job_id=crate::apis::urlencode(job_id));
559 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
560
561 if let Some(ref local_var_str) = namespace {
562 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
563 }
564 if let Some(ref local_var_str) = region {
565 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
566 }
567 if let Some(ref local_var_str) = index {
568 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
569 }
570 if let Some(ref local_var_str) = wait {
571 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
572 }
573 if let Some(ref local_var_user_agent) = configuration.user_agent {
574 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
575 }
576
577 let local_var_req = local_var_req_builder.build()?;
578 let local_var_resp = local_var_client.execute(local_var_req).await?;
579
580 let local_var_status = local_var_resp.status();
581 let local_var_content = local_var_resp.text().await?;
582
583 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
584 serde_json::from_str(&local_var_content).map_err(Error::from)
585 } else {
586 let local_var_entity: Option<GetJobVersionsError> = serde_json::from_str(&local_var_content).ok();
587 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
588 Err(Error::ResponseError(local_var_error))
589 }
590}
591
592pub async fn get_jobs(configuration: &configuration::Configuration, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, prefix: Option<&str>) -> Result<Vec<crate::models::JobListStub>, Error<GetJobsError>> {
593
594 let local_var_client = &configuration.client;
595
596 let local_var_uri_str = format!("{}/jobs", configuration.base_path);
597 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
598
599 if let Some(ref local_var_str) = namespace {
600 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
601 }
602 if let Some(ref local_var_str) = region {
603 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
604 }
605 if let Some(ref local_var_str) = index {
606 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
607 }
608 if let Some(ref local_var_str) = wait {
609 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
610 }
611 if let Some(ref local_var_str) = prefix {
612 local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
613 }
614 if let Some(ref local_var_user_agent) = configuration.user_agent {
615 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
616 }
617
618 let local_var_req = local_var_req_builder.build()?;
619 let local_var_resp = local_var_client.execute(local_var_req).await?;
620
621 let local_var_status = local_var_resp.status();
622 let local_var_content = local_var_resp.text().await?;
623
624 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
625 serde_json::from_str(&local_var_content).map_err(Error::from)
626 } else {
627 let local_var_entity: Option<GetJobsError> = serde_json::from_str(&local_var_content).ok();
628 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
629 Err(Error::ResponseError(local_var_error))
630 }
631}
632
633pub async fn parse_job_hcl(configuration: &configuration::Configuration, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, jobs_parse_request: Option<crate::models::JobsParseRequest>) -> Result<crate::models::Job, Error<ParseJobHclError>> {
634
635 let local_var_client = &configuration.client;
636
637 let local_var_uri_str = format!("{}/jobs/parse", configuration.base_path);
638 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
639
640 if let Some(ref local_var_str) = namespace {
641 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
642 }
643 if let Some(ref local_var_str) = region {
644 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
645 }
646 if let Some(ref local_var_str) = index {
647 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
648 }
649 if let Some(ref local_var_str) = wait {
650 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
651 }
652 if let Some(ref local_var_user_agent) = configuration.user_agent {
653 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
654 }
655 local_var_req_builder = local_var_req_builder.json(&jobs_parse_request);
656
657 let local_var_req = local_var_req_builder.build()?;
658 let local_var_resp = local_var_client.execute(local_var_req).await?;
659
660 let local_var_status = local_var_resp.status();
661 let local_var_content = local_var_resp.text().await?;
662
663 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
664 serde_json::from_str(&local_var_content).map_err(Error::from)
665 } else {
666 let local_var_entity: Option<ParseJobHclError> = serde_json::from_str(&local_var_content).ok();
667 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
668 Err(Error::ResponseError(local_var_error))
669 }
670}
671
672pub async fn plan_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_plan_request: Option<crate::models::JobPlanRequest>) -> Result<crate::models::JobPlanResponse, Error<PlanJobError>> {
673
674 let local_var_client = &configuration.client;
675
676 let local_var_uri_str = format!("{}/job/{job_id}/plan", configuration.base_path, job_id=crate::apis::urlencode(job_id));
677 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
678
679 if let Some(ref local_var_str) = namespace {
680 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
681 }
682 if let Some(ref local_var_str) = region {
683 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
684 }
685 if let Some(ref local_var_str) = index {
686 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
687 }
688 if let Some(ref local_var_str) = wait {
689 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
690 }
691 if let Some(ref local_var_user_agent) = configuration.user_agent {
692 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
693 }
694 local_var_req_builder = local_var_req_builder.json(&job_plan_request);
695
696 let local_var_req = local_var_req_builder.build()?;
697 let local_var_resp = local_var_client.execute(local_var_req).await?;
698
699 let local_var_status = local_var_resp.status();
700 let local_var_content = local_var_resp.text().await?;
701
702 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
703 serde_json::from_str(&local_var_content).map_err(Error::from)
704 } else {
705 let local_var_entity: Option<PlanJobError> = serde_json::from_str(&local_var_content).ok();
706 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
707 Err(Error::ResponseError(local_var_error))
708 }
709}
710
711pub async fn register_job(configuration: &configuration::Configuration, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, register_job_request: Option<crate::models::RegisterJobRequest>) -> Result<crate::models::JobRegisterResponse, Error<RegisterJobError>> {
712
713 let local_var_client = &configuration.client;
714
715 let local_var_uri_str = format!("{}/jobs", configuration.base_path);
716 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
717
718 if let Some(ref local_var_str) = namespace {
719 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
720 }
721 if let Some(ref local_var_str) = region {
722 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
723 }
724 if let Some(ref local_var_str) = index {
725 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
726 }
727 if let Some(ref local_var_str) = wait {
728 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
729 }
730 if let Some(ref local_var_user_agent) = configuration.user_agent {
731 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
732 }
733 local_var_req_builder = local_var_req_builder.json(®ister_job_request);
734
735 let local_var_req = local_var_req_builder.build()?;
736 let local_var_resp = local_var_client.execute(local_var_req).await?;
737
738 let local_var_status = local_var_resp.status();
739 let local_var_content = local_var_resp.text().await?;
740
741 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
742 serde_json::from_str(&local_var_content).map_err(Error::from)
743 } else {
744 let local_var_entity: Option<RegisterJobError> = serde_json::from_str(&local_var_content).ok();
745 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
746 Err(Error::ResponseError(local_var_error))
747 }
748}
749
750pub async fn revert_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_revert_request: Option<crate::models::JobRevertRequest>) -> Result<crate::models::JobRegisterResponse, Error<RevertJobError>> {
751
752 let local_var_client = &configuration.client;
753
754 let local_var_uri_str = format!("{}/job/{job_id}/revert", configuration.base_path, job_id=crate::apis::urlencode(job_id));
755 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
756
757 if let Some(ref local_var_str) = namespace {
758 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
759 }
760 if let Some(ref local_var_str) = region {
761 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
762 }
763 if let Some(ref local_var_str) = index {
764 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
765 }
766 if let Some(ref local_var_str) = wait {
767 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
768 }
769 if let Some(ref local_var_user_agent) = configuration.user_agent {
770 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
771 }
772 local_var_req_builder = local_var_req_builder.json(&job_revert_request);
773
774 let local_var_req = local_var_req_builder.build()?;
775 let local_var_resp = local_var_client.execute(local_var_req).await?;
776
777 let local_var_status = local_var_resp.status();
778 let local_var_content = local_var_resp.text().await?;
779
780 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
781 serde_json::from_str(&local_var_content).map_err(Error::from)
782 } else {
783 let local_var_entity: Option<RevertJobError> = serde_json::from_str(&local_var_content).ok();
784 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
785 Err(Error::ResponseError(local_var_error))
786 }
787}
788
789pub async fn scale_task_group(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, scaling_request: Option<crate::models::ScalingRequest>) -> Result<crate::models::JobRegisterResponse, Error<ScaleTaskGroupError>> {
790
791 let local_var_client = &configuration.client;
792
793 let local_var_uri_str = format!("{}/job/{job_id}/scale", configuration.base_path, job_id=crate::apis::urlencode(job_id));
794 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
795
796 if let Some(ref local_var_str) = namespace {
797 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
798 }
799 if let Some(ref local_var_str) = region {
800 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
801 }
802 if let Some(ref local_var_str) = index {
803 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
804 }
805 if let Some(ref local_var_str) = wait {
806 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
807 }
808 if let Some(ref local_var_user_agent) = configuration.user_agent {
809 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
810 }
811 local_var_req_builder = local_var_req_builder.json(&scaling_request);
812
813 let local_var_req = local_var_req_builder.build()?;
814 let local_var_resp = local_var_client.execute(local_var_req).await?;
815
816 let local_var_status = local_var_resp.status();
817 let local_var_content = local_var_resp.text().await?;
818
819 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
820 serde_json::from_str(&local_var_content).map_err(Error::from)
821 } else {
822 let local_var_entity: Option<ScaleTaskGroupError> = serde_json::from_str(&local_var_content).ok();
823 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
824 Err(Error::ResponseError(local_var_error))
825 }
826}
827
828pub async fn set_job_stability(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_stability_request: Option<crate::models::JobStabilityRequest>) -> Result<crate::models::JobStabilityResponse, Error<SetJobStabilityError>> {
829
830 let local_var_client = &configuration.client;
831
832 let local_var_uri_str = format!("{}/job/{job_id}/stable", configuration.base_path, job_id=crate::apis::urlencode(job_id));
833 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
834
835 if let Some(ref local_var_str) = namespace {
836 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
837 }
838 if let Some(ref local_var_str) = region {
839 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
840 }
841 if let Some(ref local_var_str) = index {
842 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
843 }
844 if let Some(ref local_var_str) = wait {
845 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
846 }
847 if let Some(ref local_var_user_agent) = configuration.user_agent {
848 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
849 }
850 local_var_req_builder = local_var_req_builder.json(&job_stability_request);
851
852 let local_var_req = local_var_req_builder.build()?;
853 let local_var_resp = local_var_client.execute(local_var_req).await?;
854
855 let local_var_status = local_var_resp.status();
856 let local_var_content = local_var_resp.text().await?;
857
858 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
859 serde_json::from_str(&local_var_content).map_err(Error::from)
860 } else {
861 let local_var_entity: Option<SetJobStabilityError> = serde_json::from_str(&local_var_content).ok();
862 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
863 Err(Error::ResponseError(local_var_error))
864 }
865}
866
867pub async fn stop_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, purge: Option<bool>) -> Result<crate::models::JobDeregisterResponse, Error<StopJobError>> {
868
869 let local_var_client = &configuration.client;
870
871 let local_var_uri_str = format!("{}/job/{job_id}", configuration.base_path, job_id=crate::apis::urlencode(job_id));
872 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
873
874 if let Some(ref local_var_str) = namespace {
875 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
876 }
877 if let Some(ref local_var_str) = region {
878 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
879 }
880 if let Some(ref local_var_str) = index {
881 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
882 }
883 if let Some(ref local_var_str) = wait {
884 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
885 }
886 if let Some(ref local_var_str) = purge {
887 local_var_req_builder = local_var_req_builder.query(&[("purge", &local_var_str.to_string())]);
888 }
889 if let Some(ref local_var_user_agent) = configuration.user_agent {
890 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
891 }
892
893 let local_var_req = local_var_req_builder.build()?;
894 let local_var_resp = local_var_client.execute(local_var_req).await?;
895
896 let local_var_status = local_var_resp.status();
897 let local_var_content = local_var_resp.text().await?;
898
899 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
900 serde_json::from_str(&local_var_content).map_err(Error::from)
901 } else {
902 let local_var_entity: Option<StopJobError> = serde_json::from_str(&local_var_content).ok();
903 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
904 Err(Error::ResponseError(local_var_error))
905 }
906}
907
908pub async fn update_job(configuration: &configuration::Configuration, job_id: &str, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, register_job_request: Option<crate::models::RegisterJobRequest>) -> Result<crate::models::JobRegisterResponse, Error<UpdateJobError>> {
909
910 let local_var_client = &configuration.client;
911
912 let local_var_uri_str = format!("{}/job/{job_id}", configuration.base_path, job_id=crate::apis::urlencode(job_id));
913 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
914
915 if let Some(ref local_var_str) = namespace {
916 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
917 }
918 if let Some(ref local_var_str) = region {
919 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
920 }
921 if let Some(ref local_var_str) = index {
922 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
923 }
924 if let Some(ref local_var_str) = wait {
925 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
926 }
927 if let Some(ref local_var_user_agent) = configuration.user_agent {
928 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
929 }
930 local_var_req_builder = local_var_req_builder.json(®ister_job_request);
931
932 let local_var_req = local_var_req_builder.build()?;
933 let local_var_resp = local_var_client.execute(local_var_req).await?;
934
935 let local_var_status = local_var_resp.status();
936 let local_var_content = local_var_resp.text().await?;
937
938 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
939 serde_json::from_str(&local_var_content).map_err(Error::from)
940 } else {
941 let local_var_entity: Option<UpdateJobError> = serde_json::from_str(&local_var_content).ok();
942 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
943 Err(Error::ResponseError(local_var_error))
944 }
945}
946
947pub async fn validate_job(configuration: &configuration::Configuration, namespace: Option<&str>, region: Option<&str>, index: Option<i64>, wait: Option<&str>, job_validate_request: Option<crate::models::JobValidateRequest>) -> Result<crate::models::JobValidateResponse, Error<ValidateJobError>> {
948
949 let local_var_client = &configuration.client;
950
951 let local_var_uri_str = format!("{}/validate/job", configuration.base_path);
952 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
953
954 if let Some(ref local_var_str) = namespace {
955 local_var_req_builder = local_var_req_builder.query(&[("namespace", &local_var_str.to_string())]);
956 }
957 if let Some(ref local_var_str) = region {
958 local_var_req_builder = local_var_req_builder.query(&[("region", &local_var_str.to_string())]);
959 }
960 if let Some(ref local_var_str) = index {
961 local_var_req_builder = local_var_req_builder.query(&[("index", &local_var_str.to_string())]);
962 }
963 if let Some(ref local_var_str) = wait {
964 local_var_req_builder = local_var_req_builder.query(&[("wait", &local_var_str.to_string())]);
965 }
966 if let Some(ref local_var_user_agent) = configuration.user_agent {
967 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
968 }
969 local_var_req_builder = local_var_req_builder.json(&job_validate_request);
970
971 let local_var_req = local_var_req_builder.build()?;
972 let local_var_resp = local_var_client.execute(local_var_req).await?;
973
974 let local_var_status = local_var_resp.status();
975 let local_var_content = local_var_resp.text().await?;
976
977 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
978 serde_json::from_str(&local_var_content).map_err(Error::from)
979 } else {
980 let local_var_entity: Option<ValidateJobError> = serde_json::from_str(&local_var_content).ok();
981 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
982 Err(Error::ResponseError(local_var_error))
983 }
984}
985