1use std::borrow::Borrow;
12#[allow(unused_imports)]
13use std::option::Option;
14use std::pin::Pin;
15use std::sync::Arc;
16
17use futures::Future;
18use hyper;
19use hyper_util::client::legacy::connect::Connect;
20
21use super::request as __internal_request;
22use super::{configuration, Error};
23use crate::models;
24
25pub struct ImagesCompatApiClient<C: Connect>
26where
27 C: Clone + std::marker::Send + Sync + 'static,
28{
29 configuration: Arc<configuration::Configuration<C>>,
30}
31
32impl<C: Connect> ImagesCompatApiClient<C>
33where
34 C: Clone + std::marker::Send + Sync,
35{
36 pub fn new(configuration: Arc<configuration::Configuration<C>>) -> ImagesCompatApiClient<C> {
37 ImagesCompatApiClient { configuration }
38 }
39}
40
41pub trait ImagesCompatApi: Send + Sync {
42 fn image_build(
43 &self,
44 content_type: Option<&str>,
45 x_registry_config: Option<&str>,
46 dockerfile: Option<&str>,
47 t: Option<&str>,
48 extrahosts: Option<&str>,
49 remote: Option<&str>,
50 q: Option<bool>,
51 nocache: Option<bool>,
52 cachefrom: Option<&str>,
53 pull: Option<bool>,
54 rm: Option<bool>,
55 forcerm: Option<bool>,
56 memory: Option<i32>,
57 memswap: Option<i32>,
58 cpushares: Option<i32>,
59 cpusetcpus: Option<&str>,
60 cpuperiod: Option<i32>,
61 cpuquota: Option<i32>,
62 buildargs: Option<&str>,
63 shmsize: Option<i32>,
64 squash: Option<bool>,
65 labels: Option<&str>,
66 networkmode: Option<&str>,
67 platform: Option<&str>,
68 target: Option<&str>,
69 outputs: Option<&str>,
70 input_stream: Option<std::path::PathBuf>,
71 ) -> Pin<Box<dyn Future<Output = Result<models::ImageBuild200Response, Error>> + Send>>;
72 fn image_create(
73 &self,
74 x_registry_auth: Option<&str>,
75 from_image: Option<&str>,
76 from_src: Option<&str>,
77 repo: Option<&str>,
78 tag: Option<&str>,
79 message: Option<&str>,
80 platform: Option<&str>,
81 input_image: Option<std::path::PathBuf>,
82 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
83 fn image_delete(
84 &self,
85 name: &str,
86 force: Option<bool>,
87 noprune: Option<bool>,
88 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>;
89 fn image_get(
90 &self,
91 name: &str,
92 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
93 fn image_get_all(
94 &self,
95 names: &str,
96 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
97 fn image_history(
98 &self,
99 name: &str,
100 ) -> Pin<Box<dyn Future<Output = Result<models::HistoryResponse, Error>> + Send>>;
101 fn image_inspect(
102 &self,
103 name: &str,
104 ) -> Pin<Box<dyn Future<Output = Result<models::ImageInspect, Error>> + Send>>;
105 fn image_list(
106 &self,
107 all: Option<bool>,
108 filters: Option<&str>,
109 digests: Option<bool>,
110 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::Summary>, Error>> + Send>>;
111 fn image_load(
112 &self,
113 quiet: Option<bool>,
114 request: Option<&str>,
115 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
116 fn image_prune(
117 &self,
118 filters: Option<&str>,
119 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>;
120 fn image_push(
121 &self,
122 name: &str,
123 tag: Option<&str>,
124 all: Option<bool>,
125 compress: Option<bool>,
126 destination: Option<&str>,
127 x_registry_auth: Option<&str>,
128 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
129 fn image_search(
130 &self,
131 term: Option<&str>,
132 limit: Option<i32>,
133 filters: Option<&str>,
134 tls_verify: Option<bool>,
135 list_tags: Option<bool>,
136 ) -> Pin<Box<dyn Future<Output = Result<models::ImageSearch200Response, Error>> + Send>>;
137 fn image_tag(
138 &self,
139 name: &str,
140 repo: Option<&str>,
141 tag: Option<&str>,
142 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
143}
144
145impl<C: Connect> ImagesCompatApi for ImagesCompatApiClient<C>
146where
147 C: Clone + std::marker::Send + Sync,
148{
149 #[allow(unused_mut)]
150 fn image_build(
151 &self,
152 content_type: Option<&str>,
153 x_registry_config: Option<&str>,
154 dockerfile: Option<&str>,
155 t: Option<&str>,
156 extrahosts: Option<&str>,
157 remote: Option<&str>,
158 q: Option<bool>,
159 nocache: Option<bool>,
160 cachefrom: Option<&str>,
161 pull: Option<bool>,
162 rm: Option<bool>,
163 forcerm: Option<bool>,
164 memory: Option<i32>,
165 memswap: Option<i32>,
166 cpushares: Option<i32>,
167 cpusetcpus: Option<&str>,
168 cpuperiod: Option<i32>,
169 cpuquota: Option<i32>,
170 buildargs: Option<&str>,
171 shmsize: Option<i32>,
172 squash: Option<bool>,
173 labels: Option<&str>,
174 networkmode: Option<&str>,
175 platform: Option<&str>,
176 target: Option<&str>,
177 outputs: Option<&str>,
178 input_stream: Option<std::path::PathBuf>,
179 ) -> Pin<Box<dyn Future<Output = Result<models::ImageBuild200Response, Error>> + Send>> {
180 let mut req = __internal_request::Request::new(hyper::Method::POST, "/build".to_string());
181 if let Some(ref s) = dockerfile {
182 let query_value = s.to_string();
183 req = req.with_query_param("dockerfile".to_string(), query_value);
184 }
185 if let Some(ref s) = t {
186 let query_value = s.to_string();
187 req = req.with_query_param("t".to_string(), query_value);
188 }
189 if let Some(ref s) = extrahosts {
190 let query_value = s.to_string();
191 req = req.with_query_param("extrahosts".to_string(), query_value);
192 }
193 if let Some(ref s) = remote {
194 let query_value = s.to_string();
195 req = req.with_query_param("remote".to_string(), query_value);
196 }
197 if let Some(ref s) = q {
198 let query_value = s.to_string();
199 req = req.with_query_param("q".to_string(), query_value);
200 }
201 if let Some(ref s) = nocache {
202 let query_value = s.to_string();
203 req = req.with_query_param("nocache".to_string(), query_value);
204 }
205 if let Some(ref s) = cachefrom {
206 let query_value = s.to_string();
207 req = req.with_query_param("cachefrom".to_string(), query_value);
208 }
209 if let Some(ref s) = pull {
210 let query_value = s.to_string();
211 req = req.with_query_param("pull".to_string(), query_value);
212 }
213 if let Some(ref s) = rm {
214 let query_value = s.to_string();
215 req = req.with_query_param("rm".to_string(), query_value);
216 }
217 if let Some(ref s) = forcerm {
218 let query_value = s.to_string();
219 req = req.with_query_param("forcerm".to_string(), query_value);
220 }
221 if let Some(ref s) = memory {
222 let query_value = s.to_string();
223 req = req.with_query_param("memory".to_string(), query_value);
224 }
225 if let Some(ref s) = memswap {
226 let query_value = s.to_string();
227 req = req.with_query_param("memswap".to_string(), query_value);
228 }
229 if let Some(ref s) = cpushares {
230 let query_value = s.to_string();
231 req = req.with_query_param("cpushares".to_string(), query_value);
232 }
233 if let Some(ref s) = cpusetcpus {
234 let query_value = s.to_string();
235 req = req.with_query_param("cpusetcpus".to_string(), query_value);
236 }
237 if let Some(ref s) = cpuperiod {
238 let query_value = s.to_string();
239 req = req.with_query_param("cpuperiod".to_string(), query_value);
240 }
241 if let Some(ref s) = cpuquota {
242 let query_value = s.to_string();
243 req = req.with_query_param("cpuquota".to_string(), query_value);
244 }
245 if let Some(ref s) = buildargs {
246 let query_value = s.to_string();
247 req = req.with_query_param("buildargs".to_string(), query_value);
248 }
249 if let Some(ref s) = shmsize {
250 let query_value = s.to_string();
251 req = req.with_query_param("shmsize".to_string(), query_value);
252 }
253 if let Some(ref s) = squash {
254 let query_value = s.to_string();
255 req = req.with_query_param("squash".to_string(), query_value);
256 }
257 if let Some(ref s) = labels {
258 let query_value = s.to_string();
259 req = req.with_query_param("labels".to_string(), query_value);
260 }
261 if let Some(ref s) = networkmode {
262 let query_value = s.to_string();
263 req = req.with_query_param("networkmode".to_string(), query_value);
264 }
265 if let Some(ref s) = platform {
266 let query_value = s.to_string();
267 req = req.with_query_param("platform".to_string(), query_value);
268 }
269 if let Some(ref s) = target {
270 let query_value = s.to_string();
271 req = req.with_query_param("target".to_string(), query_value);
272 }
273 if let Some(ref s) = outputs {
274 let query_value = s.to_string();
275 req = req.with_query_param("outputs".to_string(), query_value);
276 }
277 if let Some(param_value) = content_type {
278 req = req.with_header_param("Content-Type".to_string(), param_value.to_string());
279 }
280 if let Some(param_value) = x_registry_config {
281 req = req.with_header_param("X-Registry-Config".to_string(), param_value.to_string());
282 }
283 req = req.with_body_param(input_stream);
284
285 req.execute(self.configuration.borrow())
286 }
287
288 #[allow(unused_mut)]
289 fn image_create(
290 &self,
291 x_registry_auth: Option<&str>,
292 from_image: Option<&str>,
293 from_src: Option<&str>,
294 repo: Option<&str>,
295 tag: Option<&str>,
296 message: Option<&str>,
297 platform: Option<&str>,
298 input_image: Option<std::path::PathBuf>,
299 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
300 let mut req =
301 __internal_request::Request::new(hyper::Method::POST, "/images/create".to_string());
302 if let Some(ref s) = from_image {
303 let query_value = s.to_string();
304 req = req.with_query_param("fromImage".to_string(), query_value);
305 }
306 if let Some(ref s) = from_src {
307 let query_value = s.to_string();
308 req = req.with_query_param("fromSrc".to_string(), query_value);
309 }
310 if let Some(ref s) = repo {
311 let query_value = s.to_string();
312 req = req.with_query_param("repo".to_string(), query_value);
313 }
314 if let Some(ref s) = tag {
315 let query_value = s.to_string();
316 req = req.with_query_param("tag".to_string(), query_value);
317 }
318 if let Some(ref s) = message {
319 let query_value = s.to_string();
320 req = req.with_query_param("message".to_string(), query_value);
321 }
322 if let Some(ref s) = platform {
323 let query_value = s.to_string();
324 req = req.with_query_param("platform".to_string(), query_value);
325 }
326 if let Some(param_value) = x_registry_auth {
327 req = req.with_header_param("X-Registry-Auth".to_string(), param_value.to_string());
328 }
329 req = req.with_body_param(input_image);
330
331 req.execute(self.configuration.borrow())
332 }
333
334 #[allow(unused_mut)]
335 fn image_delete(
336 &self,
337 name: &str,
338 force: Option<bool>,
339 noprune: Option<bool>,
340 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>
341 {
342 let mut req =
343 __internal_request::Request::new(hyper::Method::DELETE, "/images/{name}".to_string());
344 if let Some(ref s) = force {
345 let query_value = s.to_string();
346 req = req.with_query_param("force".to_string(), query_value);
347 }
348 if let Some(ref s) = noprune {
349 let query_value = s.to_string();
350 req = req.with_query_param("noprune".to_string(), query_value);
351 }
352 req = req.with_path_param("name".to_string(), name.to_string());
353
354 req.execute(self.configuration.borrow())
355 }
356
357 #[allow(unused_mut)]
358 fn image_get(
359 &self,
360 name: &str,
361 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
362 let mut req =
363 __internal_request::Request::new(hyper::Method::GET, "/images/{name}/get".to_string());
364 req = req.with_path_param("name".to_string(), name.to_string());
365
366 req.execute(self.configuration.borrow())
367 }
368
369 #[allow(unused_mut)]
370 fn image_get_all(
371 &self,
372 names: &str,
373 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
374 let mut req =
375 __internal_request::Request::new(hyper::Method::GET, "/images/get".to_string());
376 req = req.with_query_param("names".to_string(), names.to_string());
377
378 req.execute(self.configuration.borrow())
379 }
380
381 #[allow(unused_mut)]
382 fn image_history(
383 &self,
384 name: &str,
385 ) -> Pin<Box<dyn Future<Output = Result<models::HistoryResponse, Error>> + Send>> {
386 let mut req = __internal_request::Request::new(
387 hyper::Method::GET,
388 "/images/{name}/history".to_string(),
389 );
390 req = req.with_path_param("name".to_string(), name.to_string());
391
392 req.execute(self.configuration.borrow())
393 }
394
395 #[allow(unused_mut)]
396 fn image_inspect(
397 &self,
398 name: &str,
399 ) -> Pin<Box<dyn Future<Output = Result<models::ImageInspect, Error>> + Send>> {
400 let mut req =
401 __internal_request::Request::new(hyper::Method::GET, "/images/{name}/json".to_string());
402 req = req.with_path_param("name".to_string(), name.to_string());
403
404 req.execute(self.configuration.borrow())
405 }
406
407 #[allow(unused_mut)]
408 fn image_list(
409 &self,
410 all: Option<bool>,
411 filters: Option<&str>,
412 digests: Option<bool>,
413 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::Summary>, Error>> + Send>> {
414 let mut req =
415 __internal_request::Request::new(hyper::Method::GET, "/images/json".to_string());
416 if let Some(ref s) = all {
417 let query_value = s.to_string();
418 req = req.with_query_param("all".to_string(), query_value);
419 }
420 if let Some(ref s) = filters {
421 let query_value = s.to_string();
422 req = req.with_query_param("filters".to_string(), query_value);
423 }
424 if let Some(ref s) = digests {
425 let query_value = s.to_string();
426 req = req.with_query_param("digests".to_string(), query_value);
427 }
428
429 req.execute(self.configuration.borrow())
430 }
431
432 #[allow(unused_mut)]
433 fn image_load(
434 &self,
435 quiet: Option<bool>,
436 request: Option<&str>,
437 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
438 let mut req =
439 __internal_request::Request::new(hyper::Method::POST, "/images/load".to_string());
440 if let Some(ref s) = quiet {
441 let query_value = s.to_string();
442 req = req.with_query_param("quiet".to_string(), query_value);
443 }
444 req = req.with_body_param(request);
445 req = req.returns_nothing();
446
447 req.execute(self.configuration.borrow())
448 }
449
450 #[allow(unused_mut)]
451 fn image_prune(
452 &self,
453 filters: Option<&str>,
454 ) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>
455 {
456 let mut req =
457 __internal_request::Request::new(hyper::Method::POST, "/images/prune".to_string());
458 if let Some(ref s) = filters {
459 let query_value = s.to_string();
460 req = req.with_query_param("filters".to_string(), query_value);
461 }
462
463 req.execute(self.configuration.borrow())
464 }
465
466 #[allow(unused_mut)]
467 fn image_push(
468 &self,
469 name: &str,
470 tag: Option<&str>,
471 all: Option<bool>,
472 compress: Option<bool>,
473 destination: Option<&str>,
474 x_registry_auth: Option<&str>,
475 ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
476 let mut req = __internal_request::Request::new(
477 hyper::Method::POST,
478 "/images/{name}/push".to_string(),
479 );
480 if let Some(ref s) = tag {
481 let query_value = s.to_string();
482 req = req.with_query_param("tag".to_string(), query_value);
483 }
484 if let Some(ref s) = all {
485 let query_value = s.to_string();
486 req = req.with_query_param("all".to_string(), query_value);
487 }
488 if let Some(ref s) = compress {
489 let query_value = s.to_string();
490 req = req.with_query_param("compress".to_string(), query_value);
491 }
492 if let Some(ref s) = destination {
493 let query_value = s.to_string();
494 req = req.with_query_param("destination".to_string(), query_value);
495 }
496 req = req.with_path_param("name".to_string(), name.to_string());
497 if let Some(param_value) = x_registry_auth {
498 req = req.with_header_param("X-Registry-Auth".to_string(), param_value.to_string());
499 }
500
501 req.execute(self.configuration.borrow())
502 }
503
504 #[allow(unused_mut)]
505 fn image_search(
506 &self,
507 term: Option<&str>,
508 limit: Option<i32>,
509 filters: Option<&str>,
510 tls_verify: Option<bool>,
511 list_tags: Option<bool>,
512 ) -> Pin<Box<dyn Future<Output = Result<models::ImageSearch200Response, Error>> + Send>> {
513 let mut req =
514 __internal_request::Request::new(hyper::Method::GET, "/images/search".to_string());
515 if let Some(ref s) = term {
516 let query_value = s.to_string();
517 req = req.with_query_param("term".to_string(), query_value);
518 }
519 if let Some(ref s) = limit {
520 let query_value = s.to_string();
521 req = req.with_query_param("limit".to_string(), query_value);
522 }
523 if let Some(ref s) = filters {
524 let query_value = s.to_string();
525 req = req.with_query_param("filters".to_string(), query_value);
526 }
527 if let Some(ref s) = tls_verify {
528 let query_value = s.to_string();
529 req = req.with_query_param("tlsVerify".to_string(), query_value);
530 }
531 if let Some(ref s) = list_tags {
532 let query_value = s.to_string();
533 req = req.with_query_param("listTags".to_string(), query_value);
534 }
535
536 req.execute(self.configuration.borrow())
537 }
538
539 #[allow(unused_mut)]
540 fn image_tag(
541 &self,
542 name: &str,
543 repo: Option<&str>,
544 tag: Option<&str>,
545 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
546 let mut req =
547 __internal_request::Request::new(hyper::Method::POST, "/images/{name}/tag".to_string());
548 if let Some(ref s) = repo {
549 let query_value = s.to_string();
550 req = req.with_query_param("repo".to_string(), query_value);
551 }
552 if let Some(ref s) = tag {
553 let query_value = s.to_string();
554 req = req.with_query_param("tag".to_string(), query_value);
555 }
556 req = req.with_path_param("name".to_string(), name.to_string());
557 req = req.returns_nothing();
558
559 req.execute(self.configuration.borrow())
560 }
561}