1use crate::api_common::config::HasConfig;
2use crate::api_common::request;
3use crate::api_common::Error;
4use http::request::Builder;
5use std::future::Future;
6use std::pin::Pin;
7pub trait Images: HasConfig + Send + Sync {
8 fn image_build_libpod<'a>(
14 &'a self,
15 params: Option<crate::v5::params::ImageBuildLibpod<'a>>,
16 ) -> Pin<
17 Box<dyn Future<Output = Result<crate::v5::models::ImageBuildLibpod200, Error>> + Send + 'a>,
18 > {
19 Box::pin(request::execute_request_json(
20 self.get_config(),
21 move |mut req_builder: Builder| {
22 req_builder = req_builder.method("POST");
23 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
24 let mut request_path = request_url.path().to_owned();
25 if request_path.ends_with('/') {
26 request_path.pop();
27 }
28 request_path.push_str("/libpod/build");
29 request_url.set_path(&request_path);
30 if let Some(params) = ¶ms {
31 let mut query_pairs = request_url.query_pairs_mut();
32 if let Some(dockerfile) = params.dockerfile {
33 query_pairs.append_pair("dockerfile", dockerfile);
34 }
35 if let Some(t) = params.t {
36 query_pairs.append_pair("t", t);
37 }
38 if let Some(allplatforms) = params.allplatforms {
39 query_pairs.append_pair("allplatforms", &allplatforms.to_string());
40 }
41 if let Some(extrahosts) = params.extrahosts {
42 query_pairs.append_pair("extrahosts", extrahosts);
43 }
44 if let Some(remote) = params.remote {
45 query_pairs.append_pair("remote", remote);
46 }
47 if let Some(q) = params.q {
48 query_pairs.append_pair("q", &q.to_string());
49 }
50 if let Some(nocache) = params.nocache {
51 query_pairs.append_pair("nocache", &nocache.to_string());
52 }
53 if let Some(cachefrom) = params.cachefrom {
54 query_pairs.append_pair("cachefrom", cachefrom);
55 }
56 if let Some(pull) = params.pull {
57 query_pairs.append_pair("pull", &pull.to_string());
58 }
59 if let Some(rm) = params.rm {
60 query_pairs.append_pair("rm", &rm.to_string());
61 }
62 if let Some(forcerm) = params.forcerm {
63 query_pairs.append_pair("forcerm", &forcerm.to_string());
64 }
65 if let Some(memory) = params.memory {
66 query_pairs.append_pair("memory", &memory.to_string());
67 }
68 if let Some(memswap) = params.memswap {
69 query_pairs.append_pair("memswap", &memswap.to_string());
70 }
71 if let Some(cpushares) = params.cpushares {
72 query_pairs.append_pair("cpushares", &cpushares.to_string());
73 }
74 if let Some(cpusetcpus) = params.cpusetcpus {
75 query_pairs.append_pair("cpusetcpus", cpusetcpus);
76 }
77 if let Some(cpuperiod) = params.cpuperiod {
78 query_pairs.append_pair("cpuperiod", &cpuperiod.to_string());
79 }
80 if let Some(cpuquota) = params.cpuquota {
81 query_pairs.append_pair("cpuquota", &cpuquota.to_string());
82 }
83 if let Some(buildargs) = params.buildargs {
84 query_pairs.append_pair("buildargs", buildargs);
85 }
86 if let Some(shmsize) = params.shmsize {
87 query_pairs.append_pair("shmsize", &shmsize.to_string());
88 }
89 if let Some(squash) = params.squash {
90 query_pairs.append_pair("squash", &squash.to_string());
91 }
92 if let Some(labels) = params.labels {
93 query_pairs.append_pair("labels", labels);
94 }
95 if let Some(layer_label) = ¶ms.layer_label {
96 for value in layer_label {
97 query_pairs.append_pair("layerLabel", &value.to_string());
98 }
99 }
100 if let Some(layers) = params.layers {
101 query_pairs.append_pair("layers", &layers.to_string());
102 }
103 if let Some(networkmode) = params.networkmode {
104 query_pairs.append_pair("networkmode", networkmode);
105 }
106 if let Some(platform) = params.platform {
107 query_pairs.append_pair("platform", platform);
108 }
109 if let Some(target) = params.target {
110 query_pairs.append_pair("target", target);
111 }
112 if let Some(outputs) = params.outputs {
113 query_pairs.append_pair("outputs", outputs);
114 }
115 if let Some(httpproxy) = params.httpproxy {
116 query_pairs.append_pair("httpproxy", &httpproxy.to_string());
117 }
118 if let Some(unsetenv) = ¶ms.unsetenv {
119 for value in unsetenv {
120 query_pairs.append_pair("unsetenv", &value.to_string());
121 }
122 }
123 if let Some(unsetlabel) = ¶ms.unsetlabel {
124 for value in unsetlabel {
125 query_pairs.append_pair("unsetlabel", &value.to_string());
126 }
127 }
128 if let Some(volume) = ¶ms.volume {
129 for value in volume {
130 query_pairs.append_pair("volume", &value.to_string());
131 }
132 }
133 }
134 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
135 req_builder = req_builder.uri(hyper_uri);
136 Ok(req_builder.body(String::new())?)
137 },
138 ))
139 }
140 fn image_delete_libpod<'a>(
144 &'a self,
145 name: &'a str,
146 params: Option<crate::v5::params::ImageDeleteLibpod>,
147 ) -> Pin<
148 Box<
149 dyn Future<Output = Result<crate::v5::models::LibpodImagesRemoveReport, Error>>
150 + Send
151 + 'a,
152 >,
153 > {
154 Box::pin(request::execute_request_json(
155 self.get_config(),
156 move |mut req_builder: Builder| {
157 req_builder = req_builder.method("DELETE");
158 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
159 let mut request_path = request_url.path().to_owned();
160 if request_path.ends_with('/') {
161 request_path.pop();
162 }
163 request_path.push_str("/libpod/images/{name}");
164 request_path = request_path.replace("{name}", name);
165 request_url.set_path(&request_path);
166 if let Some(params) = ¶ms {
167 let mut query_pairs = request_url.query_pairs_mut();
168 if let Some(force) = params.force {
169 query_pairs.append_pair("force", &force.to_string());
170 }
171 }
172 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
173 req_builder = req_builder.uri(hyper_uri);
174 Ok(req_builder.body(String::new())?)
175 },
176 ))
177 }
178 fn image_changes_libpod<'a>(
188 &'a self,
189 name: &'a str,
190 params: Option<crate::v5::params::ImageChangesLibpod<'a>>,
191 ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
192 Box::pin(request::execute_request_text(
193 self.get_config(),
194 move |mut req_builder: Builder| {
195 req_builder = req_builder.method("GET");
196 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
197 let mut request_path = request_url.path().to_owned();
198 if request_path.ends_with('/') {
199 request_path.pop();
200 }
201 request_path.push_str("/libpod/images/{name}/changes");
202 request_path = request_path.replace("{name}", name);
203 request_url.set_path(&request_path);
204 if let Some(params) = ¶ms {
205 let mut query_pairs = request_url.query_pairs_mut();
206 if let Some(parent) = params.parent {
207 query_pairs.append_pair("parent", parent);
208 }
209 if let Some(diff_type) = params.diff_type {
210 query_pairs.append_pair("diffType", diff_type);
211 }
212 }
213 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
214 req_builder = req_builder.uri(hyper_uri);
215 Ok(req_builder.body(String::new())?)
216 },
217 ))
218 }
219 fn image_exists_libpod<'a>(
225 &'a self,
226 name: &'a str,
227 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
228 Box::pin(request::execute_request_unit(
229 self.get_config(),
230 move |mut req_builder: Builder| {
231 req_builder = req_builder.method("GET");
232 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
233 let mut request_path = request_url.path().to_owned();
234 if request_path.ends_with('/') {
235 request_path.pop();
236 }
237 request_path.push_str("/libpod/images/{name}/exists");
238 request_path = request_path.replace("{name}", name);
239 request_url.set_path(&request_path);
240 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
241 req_builder = req_builder.uri(hyper_uri);
242 Ok(req_builder.body(String::new())?)
243 },
244 ))
245 }
246 fn image_get_libpod<'a>(
250 &'a self,
251 name: &'a str,
252 params: Option<crate::v5::params::ImageGetLibpod<'a>>,
253 ) -> Pin<Box<dyn futures::stream::Stream<Item = Result<bytes::Bytes, Error>> + Send + 'a>> {
254 request::execute_request_stream(self.get_config(), move |mut req_builder: Builder| {
255 req_builder = req_builder.method("GET");
256 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
257 let mut request_path = request_url.path().to_owned();
258 if request_path.ends_with('/') {
259 request_path.pop();
260 }
261 request_path.push_str("/libpod/images/{name}/get");
262 request_path = request_path.replace("{name}", name);
263 request_url.set_path(&request_path);
264 if let Some(params) = ¶ms {
265 let mut query_pairs = request_url.query_pairs_mut();
266 if let Some(format) = params.format {
267 query_pairs.append_pair("format", format);
268 }
269 if let Some(compress) = params.compress {
270 query_pairs.append_pair("compress", &compress.to_string());
271 }
272 }
273 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
274 req_builder = req_builder.uri(hyper_uri);
275 Ok(req_builder.body(String::new())?)
276 })
277 }
278 fn image_history_libpod<'a>(
284 &'a self,
285 name: &'a str,
286 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::HistoryResponse, Error>> + Send + 'a>>
287 {
288 Box::pin(request::execute_request_json(
289 self.get_config(),
290 move |mut req_builder: Builder| {
291 req_builder = req_builder.method("GET");
292 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
293 let mut request_path = request_url.path().to_owned();
294 if request_path.ends_with('/') {
295 request_path.pop();
296 }
297 request_path.push_str("/libpod/images/{name}/history");
298 request_path = request_path.replace("{name}", name);
299 request_url.set_path(&request_path);
300 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
301 req_builder = req_builder.uri(hyper_uri);
302 Ok(req_builder.body(String::new())?)
303 },
304 ))
305 }
306 fn image_inspect_libpod<'a>(
312 &'a self,
313 name: &'a str,
314 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::ImageData, Error>> + Send + 'a>>
315 {
316 Box::pin(request::execute_request_json(
317 self.get_config(),
318 move |mut req_builder: Builder| {
319 req_builder = req_builder.method("GET");
320 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
321 let mut request_path = request_url.path().to_owned();
322 if request_path.ends_with('/') {
323 request_path.pop();
324 }
325 request_path.push_str("/libpod/images/{name}/json");
326 request_path = request_path.replace("{name}", name);
327 request_url.set_path(&request_path);
328 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
329 req_builder = req_builder.uri(hyper_uri);
330 Ok(req_builder.body(String::new())?)
331 },
332 ))
333 }
334 fn image_push_libpod<'a>(
340 &'a self,
341 name: &'a str,
342 params: Option<crate::v5::params::ImagePushLibpod<'a>>,
343 ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
344 Box::pin(request::execute_request_json(
345 self.get_config(),
346 move |mut req_builder: Builder| {
347 req_builder = req_builder.method("POST");
348 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
349 let mut request_path = request_url.path().to_owned();
350 if request_path.ends_with('/') {
351 request_path.pop();
352 }
353 request_path.push_str("/libpod/images/{name}/push");
354 request_path = request_path.replace("{name}", name);
355 request_url.set_path(&request_path);
356 if let Some(params) = ¶ms {
357 let mut query_pairs = request_url.query_pairs_mut();
358 if let Some(destination) = params.destination {
359 query_pairs.append_pair("destination", destination);
360 }
361 if let Some(force_compression_format) = params.force_compression_format {
362 query_pairs.append_pair(
363 "forceCompressionFormat",
364 &force_compression_format.to_string(),
365 );
366 }
367 if let Some(tls_verify) = params.tls_verify {
368 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
369 }
370 if let Some(quiet) = params.quiet {
371 query_pairs.append_pair("quiet", &quiet.to_string());
372 }
373 if let Some(x_registry_auth) = params.x_registry_auth {
374 req_builder = req_builder.header("X-Registry-Auth", x_registry_auth);
375 }
376 }
377 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
378 req_builder = req_builder.uri(hyper_uri);
379 Ok(req_builder.body(String::new())?)
380 },
381 ))
382 }
383 fn image_resolve_libpod<'a>(
389 &'a self,
390 name: &'a str,
391 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
392 Box::pin(request::execute_request_unit(
393 self.get_config(),
394 move |mut req_builder: Builder| {
395 req_builder = req_builder.method("GET");
396 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
397 let mut request_path = request_url.path().to_owned();
398 if request_path.ends_with('/') {
399 request_path.pop();
400 }
401 request_path.push_str("/libpod/images/{name}/resolve");
402 request_path = request_path.replace("{name}", name);
403 request_url.set_path(&request_path);
404 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
405 req_builder = req_builder.uri(hyper_uri);
406 Ok(req_builder.body(String::new())?)
407 },
408 ))
409 }
410 fn image_tag_libpod<'a>(
416 &'a self,
417 name: &'a str,
418 params: Option<crate::v5::params::ImageTagLibpod<'a>>,
419 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
420 Box::pin(request::execute_request_unit(
421 self.get_config(),
422 move |mut req_builder: Builder| {
423 req_builder = req_builder.method("POST");
424 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
425 let mut request_path = request_url.path().to_owned();
426 if request_path.ends_with('/') {
427 request_path.pop();
428 }
429 request_path.push_str("/libpod/images/{name}/tag");
430 request_path = request_path.replace("{name}", name);
431 request_url.set_path(&request_path);
432 if let Some(params) = ¶ms {
433 let mut query_pairs = request_url.query_pairs_mut();
434 if let Some(repo) = params.repo {
435 query_pairs.append_pair("repo", repo);
436 }
437 if let Some(tag) = params.tag {
438 query_pairs.append_pair("tag", tag);
439 }
440 }
441 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
442 req_builder = req_builder.uri(hyper_uri);
443 Ok(req_builder.body(String::new())?)
444 },
445 ))
446 }
447 fn image_tree_libpod<'a>(
453 &'a self,
454 name: &'a str,
455 params: Option<crate::v5::params::ImageTreeLibpod>,
456 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::ImageTreeReport, Error>> + Send + 'a>>
457 {
458 Box::pin(request::execute_request_json(
459 self.get_config(),
460 move |mut req_builder: Builder| {
461 req_builder = req_builder.method("GET");
462 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
463 let mut request_path = request_url.path().to_owned();
464 if request_path.ends_with('/') {
465 request_path.pop();
466 }
467 request_path.push_str("/libpod/images/{name}/tree");
468 request_path = request_path.replace("{name}", name);
469 request_url.set_path(&request_path);
470 if let Some(params) = ¶ms {
471 let mut query_pairs = request_url.query_pairs_mut();
472 if let Some(whatrequires) = params.whatrequires {
473 query_pairs.append_pair("whatrequires", &whatrequires.to_string());
474 }
475 }
476 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
477 req_builder = req_builder.uri(hyper_uri);
478 Ok(req_builder.body(String::new())?)
479 },
480 ))
481 }
482 fn image_untag_libpod<'a>(
488 &'a self,
489 name: &'a str,
490 params: Option<crate::v5::params::ImageUntagLibpod<'a>>,
491 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
492 Box::pin(request::execute_request_unit(
493 self.get_config(),
494 move |mut req_builder: Builder| {
495 req_builder = req_builder.method("POST");
496 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
497 let mut request_path = request_url.path().to_owned();
498 if request_path.ends_with('/') {
499 request_path.pop();
500 }
501 request_path.push_str("/libpod/images/{name}/untag");
502 request_path = request_path.replace("{name}", name);
503 request_url.set_path(&request_path);
504 if let Some(params) = ¶ms {
505 let mut query_pairs = request_url.query_pairs_mut();
506 if let Some(repo) = params.repo {
507 query_pairs.append_pair("repo", repo);
508 }
509 if let Some(tag) = params.tag {
510 query_pairs.append_pair("tag", tag);
511 }
512 }
513 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
514 req_builder = req_builder.uri(hyper_uri);
515 Ok(req_builder.body(String::new())?)
516 },
517 ))
518 }
519 fn image_export_libpod<'a>(
525 &'a self,
526 params: Option<crate::v5::params::ImageExportLibpod<'a>>,
527 ) -> Pin<Box<dyn futures::stream::Stream<Item = Result<bytes::Bytes, Error>> + Send + 'a>> {
528 request::execute_request_stream(self.get_config(), move |mut req_builder: Builder| {
529 req_builder = req_builder.method("GET");
530 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
531 let mut request_path = request_url.path().to_owned();
532 if request_path.ends_with('/') {
533 request_path.pop();
534 }
535 request_path.push_str("/libpod/images/export");
536 request_url.set_path(&request_path);
537 if let Some(params) = ¶ms {
538 let mut query_pairs = request_url.query_pairs_mut();
539 if let Some(format) = params.format {
540 query_pairs.append_pair("format", format);
541 }
542 if let Some(references) = ¶ms.references {
543 for value in references {
544 query_pairs.append_pair("references", &value.to_string());
545 }
546 }
547 if let Some(compress) = params.compress {
548 query_pairs.append_pair("compress", &compress.to_string());
549 }
550 if let Some(oci_accept_uncompressed_layers) = params.oci_accept_uncompressed_layers
551 {
552 query_pairs.append_pair(
553 "ociAcceptUncompressedLayers",
554 &oci_accept_uncompressed_layers.to_string(),
555 );
556 }
557 }
558 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
559 req_builder = req_builder.uri(hyper_uri);
560 Ok(req_builder.body(String::new())?)
561 })
562 }
563 fn image_import_libpod<'a>(
569 &'a self,
570 params: Option<crate::v5::params::ImageImportLibpod<'a>>,
571 upload: String,
572 ) -> Pin<
573 Box<dyn Future<Output = Result<crate::v5::models::ImageImportReport, Error>> + Send + 'a>,
574 > {
575 Box::pin(request::execute_request_json(
576 self.get_config(),
577 move |mut req_builder: Builder| {
578 req_builder = req_builder.method("POST");
579 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
580 let mut request_path = request_url.path().to_owned();
581 if request_path.ends_with('/') {
582 request_path.pop();
583 }
584 request_path.push_str("/libpod/images/import");
585 request_url.set_path(&request_path);
586 if let Some(params) = ¶ms {
587 let mut query_pairs = request_url.query_pairs_mut();
588 if let Some(changes) = ¶ms.changes {
589 for value in changes {
590 query_pairs.append_pair("changes", &value.to_string());
591 }
592 }
593 if let Some(message) = params.message {
594 query_pairs.append_pair("message", message);
595 }
596 if let Some(reference) = params.reference {
597 query_pairs.append_pair("reference", reference);
598 }
599 if let Some(url) = params.url {
600 query_pairs.append_pair("url", url);
601 }
602 if let Some(content_type) = params.content_type {
603 req_builder = req_builder.header("Content-Type", content_type);
604 }
605 }
606 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
607 req_builder = req_builder.uri(hyper_uri);
608 let body = serde_json::to_string(&upload)?;
609 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
610 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
611 Ok(req_builder.body(body)?)
612 },
613 ))
614 }
615 fn image_list_libpod<'a>(
621 &'a self,
622 params: Option<crate::v5::params::ImageListLibpod<'a>>,
623 ) -> Pin<
624 Box<
625 dyn Future<Output = Result<Vec<crate::v5::models::LibpodImageSummary>, Error>>
626 + Send
627 + 'a,
628 >,
629 > {
630 Box::pin(request::execute_request_json(
631 self.get_config(),
632 move |mut req_builder: Builder| {
633 req_builder = req_builder.method("GET");
634 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
635 let mut request_path = request_url.path().to_owned();
636 if request_path.ends_with('/') {
637 request_path.pop();
638 }
639 request_path.push_str("/libpod/images/json");
640 request_url.set_path(&request_path);
641 if let Some(params) = ¶ms {
642 let mut query_pairs = request_url.query_pairs_mut();
643 if let Some(all) = params.all {
644 query_pairs.append_pair("all", &all.to_string());
645 }
646 if let Some(filters) = params.filters {
647 query_pairs.append_pair("filters", filters);
648 }
649 }
650 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
651 req_builder = req_builder.uri(hyper_uri);
652 Ok(req_builder.body(String::new())?)
653 },
654 ))
655 }
656 fn image_load_libpod<'a>(
662 &'a self,
663 upload: String,
664 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::ImageLoadReport, Error>> + Send + 'a>>
665 {
666 Box::pin(request::execute_request_json(
667 self.get_config(),
668 move |mut req_builder: Builder| {
669 req_builder = req_builder.method("POST");
670 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
671 let mut request_path = request_url.path().to_owned();
672 if request_path.ends_with('/') {
673 request_path.pop();
674 }
675 request_path.push_str("/libpod/images/load");
676 request_url.set_path(&request_path);
677 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
678 req_builder = req_builder.uri(hyper_uri);
679 let body = serde_json::to_string(&upload)?;
680 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
681 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
682 Ok(req_builder.body(body)?)
683 },
684 ))
685 }
686 fn image_prune_libpod<'a>(
692 &'a self,
693 params: Option<crate::v5::params::ImagePruneLibpod<'a>>,
694 ) -> Pin<Box<dyn Future<Output = Result<Vec<crate::v5::models::PruneReport>, Error>> + Send + 'a>>
695 {
696 Box::pin(request::execute_request_json(
697 self.get_config(),
698 move |mut req_builder: Builder| {
699 req_builder = req_builder.method("POST");
700 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
701 let mut request_path = request_url.path().to_owned();
702 if request_path.ends_with('/') {
703 request_path.pop();
704 }
705 request_path.push_str("/libpod/images/prune");
706 request_url.set_path(&request_path);
707 if let Some(params) = ¶ms {
708 let mut query_pairs = request_url.query_pairs_mut();
709 if let Some(all) = params.all {
710 query_pairs.append_pair("all", &all.to_string());
711 }
712 if let Some(external) = params.external {
713 query_pairs.append_pair("external", &external.to_string());
714 }
715 if let Some(filters) = params.filters {
716 query_pairs.append_pair("filters", filters);
717 }
718 }
719 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
720 req_builder = req_builder.uri(hyper_uri);
721 Ok(req_builder.body(String::new())?)
722 },
723 ))
724 }
725 fn image_pull_libpod<'a>(
731 &'a self,
732 params: Option<crate::v5::params::ImagePullLibpod<'a>>,
733 ) -> Pin<
734 Box<
735 dyn Future<Output = Result<crate::v5::models::LibpodImagesPullReport, Error>>
736 + Send
737 + 'a,
738 >,
739 > {
740 Box::pin(request::execute_request_json(
741 self.get_config(),
742 move |mut req_builder: Builder| {
743 req_builder = req_builder.method("POST");
744 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
745 let mut request_path = request_url.path().to_owned();
746 if request_path.ends_with('/') {
747 request_path.pop();
748 }
749 request_path.push_str("/libpod/images/pull");
750 request_url.set_path(&request_path);
751 if let Some(params) = ¶ms {
752 let mut query_pairs = request_url.query_pairs_mut();
753 if let Some(reference) = params.reference {
754 query_pairs.append_pair("reference", reference);
755 }
756 if let Some(quiet) = params.quiet.or(Some(true)) {
757 query_pairs.append_pair("quiet", &quiet.to_string());
758 }
759 if let Some(compat_mode) = params.compat_mode {
760 query_pairs.append_pair("compatMode", &compat_mode.to_string());
761 }
762 if let Some(arch) = params.arch {
763 query_pairs.append_pair("Arch", arch);
764 }
765 if let Some(os) = params.os {
766 query_pairs.append_pair("OS", os);
767 }
768 if let Some(variant) = params.variant {
769 query_pairs.append_pair("Variant", variant);
770 }
771 if let Some(policy) = params.policy {
772 query_pairs.append_pair("policy", policy);
773 }
774 if let Some(tls_verify) = params.tls_verify {
775 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
776 }
777 if let Some(all_tags) = params.all_tags {
778 query_pairs.append_pair("allTags", &all_tags.to_string());
779 }
780 if let Some(x_registry_auth) = params.x_registry_auth {
781 req_builder = req_builder.header("X-Registry-Auth", x_registry_auth);
782 }
783 }
784 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
785 req_builder = req_builder.uri(hyper_uri);
786 Ok(req_builder.body(String::new())?)
787 },
788 ))
789 }
790 fn image_delete_all_libpod<'a>(
794 &'a self,
795 params: Option<crate::v5::params::ImageDeleteAllLibpod<'a>>,
796 ) -> Pin<
797 Box<
798 dyn Future<Output = Result<crate::v5::models::LibpodImagesRemoveReport, Error>>
799 + Send
800 + 'a,
801 >,
802 > {
803 Box::pin(request::execute_request_json(
804 self.get_config(),
805 move |mut req_builder: Builder| {
806 req_builder = req_builder.method("DELETE");
807 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
808 let mut request_path = request_url.path().to_owned();
809 if request_path.ends_with('/') {
810 request_path.pop();
811 }
812 request_path.push_str("/libpod/images/remove");
813 request_url.set_path(&request_path);
814 if let Some(params) = ¶ms {
815 let mut query_pairs = request_url.query_pairs_mut();
816 if let Some(images) = ¶ms.images {
817 for value in images {
818 query_pairs.append_pair("images", &value.to_string());
819 }
820 }
821 if let Some(all) = params.all {
822 query_pairs.append_pair("all", &all.to_string());
823 }
824 if let Some(force) = params.force {
825 query_pairs.append_pair("force", &force.to_string());
826 }
827 if let Some(ignore) = params.ignore {
828 query_pairs.append_pair("ignore", &ignore.to_string());
829 }
830 if let Some(lookup_manifest) = params.lookup_manifest {
831 query_pairs.append_pair("lookupManifest", &lookup_manifest.to_string());
832 }
833 }
834 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
835 req_builder = req_builder.uri(hyper_uri);
836 Ok(req_builder.body(String::new())?)
837 },
838 ))
839 }
840 fn image_scp_libpod<'a>(
844 &'a self,
845 name: &'a str,
846 params: Option<crate::v5::params::ImageScpLibpod<'a>>,
847 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::ScpReport, Error>> + Send + 'a>>
848 {
849 Box::pin(request::execute_request_json(
850 self.get_config(),
851 move |mut req_builder: Builder| {
852 req_builder = req_builder.method("POST");
853 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
854 let mut request_path = request_url.path().to_owned();
855 if request_path.ends_with('/') {
856 request_path.pop();
857 }
858 request_path.push_str("/libpod/images/scp/{name}");
859 request_path = request_path.replace("{name}", name);
860 request_url.set_path(&request_path);
861 if let Some(params) = ¶ms {
862 let mut query_pairs = request_url.query_pairs_mut();
863 if let Some(destination) = params.destination {
864 query_pairs.append_pair("destination", destination);
865 }
866 if let Some(quiet) = params.quiet.or(Some(true)) {
867 query_pairs.append_pair("quiet", &quiet.to_string());
868 }
869 }
870 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
871 req_builder = req_builder.uri(hyper_uri);
872 Ok(req_builder.body(String::new())?)
873 },
874 ))
875 }
876 fn image_search_libpod<'a>(
882 &'a self,
883 params: Option<crate::v5::params::ImageSearchLibpod<'a>>,
884 ) -> Pin<
885 Box<
886 dyn Future<Output = Result<Vec<crate::v5::models::RegistrySearchResponse>, Error>>
887 + Send
888 + 'a,
889 >,
890 > {
891 Box::pin(request::execute_request_json(
892 self.get_config(),
893 move |mut req_builder: Builder| {
894 req_builder = req_builder.method("GET");
895 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
896 let mut request_path = request_url.path().to_owned();
897 if request_path.ends_with('/') {
898 request_path.pop();
899 }
900 request_path.push_str("/libpod/images/search");
901 request_url.set_path(&request_path);
902 if let Some(params) = ¶ms {
903 let mut query_pairs = request_url.query_pairs_mut();
904 if let Some(term) = params.term {
905 query_pairs.append_pair("term", term);
906 }
907 if let Some(limit) = params.limit {
908 query_pairs.append_pair("limit", &limit.to_string());
909 }
910 if let Some(filters) = params.filters {
911 query_pairs.append_pair("filters", filters);
912 }
913 if let Some(tls_verify) = params.tls_verify {
914 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
915 }
916 if let Some(list_tags) = params.list_tags {
917 query_pairs.append_pair("listTags", &list_tags.to_string());
918 }
919 }
920 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
921 req_builder = req_builder.uri(hyper_uri);
922 Ok(req_builder.body(String::new())?)
923 },
924 ))
925 }
926}