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::v4::params::ImageBuildLibpod<'a>>,
16 ) -> Pin<
17 Box<dyn Future<Output = Result<crate::v4::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::v4::params::ImageDeleteLibpod>,
147 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
148 Box::pin(request::execute_request_unit(
149 self.get_config(),
150 move |mut req_builder: Builder| {
151 req_builder = req_builder.method("DELETE");
152 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
153 let mut request_path = request_url.path().to_owned();
154 if request_path.ends_with('/') {
155 request_path.pop();
156 }
157 request_path.push_str("/libpod/images/{name}");
158 request_path = request_path.replace("{name}", name);
159 request_url.set_path(&request_path);
160 if let Some(params) = ¶ms {
161 let mut query_pairs = request_url.query_pairs_mut();
162 if let Some(force) = params.force {
163 query_pairs.append_pair("force", &force.to_string());
164 }
165 }
166 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
167 req_builder = req_builder.uri(hyper_uri);
168 Ok(req_builder.body(String::new())?)
169 },
170 ))
171 }
172 fn image_changes_libpod<'a>(
182 &'a self,
183 name: &'a str,
184 params: Option<crate::v4::params::ImageChangesLibpod<'a>>,
185 ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
186 Box::pin(request::execute_request_text(
187 self.get_config(),
188 move |mut req_builder: Builder| {
189 req_builder = req_builder.method("GET");
190 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
191 let mut request_path = request_url.path().to_owned();
192 if request_path.ends_with('/') {
193 request_path.pop();
194 }
195 request_path.push_str("/libpod/images/{name}/changes");
196 request_path = request_path.replace("{name}", name);
197 request_url.set_path(&request_path);
198 if let Some(params) = ¶ms {
199 let mut query_pairs = request_url.query_pairs_mut();
200 if let Some(parent) = params.parent {
201 query_pairs.append_pair("parent", parent);
202 }
203 if let Some(diff_type) = params.diff_type {
204 query_pairs.append_pair("diffType", diff_type);
205 }
206 }
207 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
208 req_builder = req_builder.uri(hyper_uri);
209 Ok(req_builder.body(String::new())?)
210 },
211 ))
212 }
213 fn image_exists_libpod<'a>(
219 &'a self,
220 name: &'a str,
221 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
222 Box::pin(request::execute_request_unit(
223 self.get_config(),
224 move |mut req_builder: Builder| {
225 req_builder = req_builder.method("GET");
226 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
227 let mut request_path = request_url.path().to_owned();
228 if request_path.ends_with('/') {
229 request_path.pop();
230 }
231 request_path.push_str("/libpod/images/{name}/exists");
232 request_path = request_path.replace("{name}", name);
233 request_url.set_path(&request_path);
234 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
235 req_builder = req_builder.uri(hyper_uri);
236 Ok(req_builder.body(String::new())?)
237 },
238 ))
239 }
240 fn image_get_libpod<'a>(
244 &'a self,
245 name: &'a str,
246 params: Option<crate::v4::params::ImageGetLibpod<'a>>,
247 ) -> Pin<Box<dyn futures::stream::Stream<Item = Result<bytes::Bytes, Error>> + Send + 'a>> {
248 request::execute_request_stream(self.get_config(), move |mut req_builder: Builder| {
249 req_builder = req_builder.method("GET");
250 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
251 let mut request_path = request_url.path().to_owned();
252 if request_path.ends_with('/') {
253 request_path.pop();
254 }
255 request_path.push_str("/libpod/images/{name}/get");
256 request_path = request_path.replace("{name}", name);
257 request_url.set_path(&request_path);
258 if let Some(params) = ¶ms {
259 let mut query_pairs = request_url.query_pairs_mut();
260 if let Some(format) = params.format {
261 query_pairs.append_pair("format", format);
262 }
263 if let Some(compress) = params.compress {
264 query_pairs.append_pair("compress", &compress.to_string());
265 }
266 }
267 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
268 req_builder = req_builder.uri(hyper_uri);
269 Ok(req_builder.body(String::new())?)
270 })
271 }
272 fn image_history_libpod<'a>(
278 &'a self,
279 name: &'a str,
280 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
281 Box::pin(request::execute_request_unit(
282 self.get_config(),
283 move |mut req_builder: Builder| {
284 req_builder = req_builder.method("GET");
285 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
286 let mut request_path = request_url.path().to_owned();
287 if request_path.ends_with('/') {
288 request_path.pop();
289 }
290 request_path.push_str("/libpod/images/{name}/history");
291 request_path = request_path.replace("{name}", name);
292 request_url.set_path(&request_path);
293 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
294 req_builder = req_builder.uri(hyper_uri);
295 Ok(req_builder.body(String::new())?)
296 },
297 ))
298 }
299 fn image_inspect_libpod<'a>(
305 &'a self,
306 name: &'a str,
307 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
308 Box::pin(request::execute_request_unit(
309 self.get_config(),
310 move |mut req_builder: Builder| {
311 req_builder = req_builder.method("GET");
312 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
313 let mut request_path = request_url.path().to_owned();
314 if request_path.ends_with('/') {
315 request_path.pop();
316 }
317 request_path.push_str("/libpod/images/{name}/json");
318 request_path = request_path.replace("{name}", name);
319 request_url.set_path(&request_path);
320 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
321 req_builder = req_builder.uri(hyper_uri);
322 Ok(req_builder.body(String::new())?)
323 },
324 ))
325 }
326 fn image_push_libpod<'a>(
332 &'a self,
333 name: &'a str,
334 params: Option<crate::v4::params::ImagePushLibpod<'a>>,
335 ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
336 Box::pin(request::execute_request_json(
337 self.get_config(),
338 move |mut req_builder: Builder| {
339 req_builder = req_builder.method("POST");
340 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
341 let mut request_path = request_url.path().to_owned();
342 if request_path.ends_with('/') {
343 request_path.pop();
344 }
345 request_path.push_str("/libpod/images/{name}/push");
346 request_path = request_path.replace("{name}", name);
347 request_url.set_path(&request_path);
348 if let Some(params) = ¶ms {
349 let mut query_pairs = request_url.query_pairs_mut();
350 if let Some(destination) = params.destination {
351 query_pairs.append_pair("destination", destination);
352 }
353 if let Some(force_compression_format) = params.force_compression_format {
354 query_pairs.append_pair(
355 "forceCompressionFormat",
356 &force_compression_format.to_string(),
357 );
358 }
359 if let Some(tls_verify) = params.tls_verify {
360 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
361 }
362 if let Some(quiet) = params.quiet {
363 query_pairs.append_pair("quiet", &quiet.to_string());
364 }
365 if let Some(x_registry_auth) = params.x_registry_auth {
366 req_builder = req_builder.header("X-Registry-Auth", x_registry_auth);
367 }
368 }
369 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
370 req_builder = req_builder.uri(hyper_uri);
371 Ok(req_builder.body(String::new())?)
372 },
373 ))
374 }
375 fn image_tag_libpod<'a>(
381 &'a self,
382 name: &'a str,
383 params: Option<crate::v4::params::ImageTagLibpod<'a>>,
384 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
385 Box::pin(request::execute_request_unit(
386 self.get_config(),
387 move |mut req_builder: Builder| {
388 req_builder = req_builder.method("POST");
389 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
390 let mut request_path = request_url.path().to_owned();
391 if request_path.ends_with('/') {
392 request_path.pop();
393 }
394 request_path.push_str("/libpod/images/{name}/tag");
395 request_path = request_path.replace("{name}", name);
396 request_url.set_path(&request_path);
397 if let Some(params) = ¶ms {
398 let mut query_pairs = request_url.query_pairs_mut();
399 if let Some(repo) = params.repo {
400 query_pairs.append_pair("repo", repo);
401 }
402 if let Some(tag) = params.tag {
403 query_pairs.append_pair("tag", tag);
404 }
405 }
406 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
407 req_builder = req_builder.uri(hyper_uri);
408 Ok(req_builder.body(String::new())?)
409 },
410 ))
411 }
412 fn image_tree_libpod<'a>(
418 &'a self,
419 name: &'a str,
420 params: Option<crate::v4::params::ImageTreeLibpod>,
421 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
422 Box::pin(request::execute_request_unit(
423 self.get_config(),
424 move |mut req_builder: Builder| {
425 req_builder = req_builder.method("GET");
426 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
427 let mut request_path = request_url.path().to_owned();
428 if request_path.ends_with('/') {
429 request_path.pop();
430 }
431 request_path.push_str("/libpod/images/{name}/tree");
432 request_path = request_path.replace("{name}", name);
433 request_url.set_path(&request_path);
434 if let Some(params) = ¶ms {
435 let mut query_pairs = request_url.query_pairs_mut();
436 if let Some(whatrequires) = params.whatrequires {
437 query_pairs.append_pair("whatrequires", &whatrequires.to_string());
438 }
439 }
440 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
441 req_builder = req_builder.uri(hyper_uri);
442 Ok(req_builder.body(String::new())?)
443 },
444 ))
445 }
446 fn image_untag_libpod<'a>(
452 &'a self,
453 name: &'a str,
454 params: Option<crate::v4::params::ImageUntagLibpod<'a>>,
455 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
456 Box::pin(request::execute_request_unit(
457 self.get_config(),
458 move |mut req_builder: Builder| {
459 req_builder = req_builder.method("POST");
460 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
461 let mut request_path = request_url.path().to_owned();
462 if request_path.ends_with('/') {
463 request_path.pop();
464 }
465 request_path.push_str("/libpod/images/{name}/untag");
466 request_path = request_path.replace("{name}", name);
467 request_url.set_path(&request_path);
468 if let Some(params) = ¶ms {
469 let mut query_pairs = request_url.query_pairs_mut();
470 if let Some(repo) = params.repo {
471 query_pairs.append_pair("repo", repo);
472 }
473 if let Some(tag) = params.tag {
474 query_pairs.append_pair("tag", tag);
475 }
476 }
477 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
478 req_builder = req_builder.uri(hyper_uri);
479 Ok(req_builder.body(String::new())?)
480 },
481 ))
482 }
483 fn image_export_libpod<'a>(
489 &'a self,
490 params: Option<crate::v4::params::ImageExportLibpod<'a>>,
491 ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
492 Box::pin(request::execute_request_json(
493 self.get_config(),
494 move |mut req_builder: Builder| {
495 req_builder = req_builder.method("GET");
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/export");
502 request_url.set_path(&request_path);
503 if let Some(params) = ¶ms {
504 let mut query_pairs = request_url.query_pairs_mut();
505 if let Some(format) = params.format {
506 query_pairs.append_pair("format", format);
507 }
508 if let Some(references) = ¶ms.references {
509 for value in references {
510 query_pairs.append_pair("references", &value.to_string());
511 }
512 }
513 if let Some(compress) = params.compress {
514 query_pairs.append_pair("compress", &compress.to_string());
515 }
516 if let Some(oci_accept_uncompressed_layers) =
517 params.oci_accept_uncompressed_layers
518 {
519 query_pairs.append_pair(
520 "ociAcceptUncompressedLayers",
521 &oci_accept_uncompressed_layers.to_string(),
522 );
523 }
524 }
525 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
526 req_builder = req_builder.uri(hyper_uri);
527 Ok(req_builder.body(String::new())?)
528 },
529 ))
530 }
531 fn image_import_libpod<'a>(
537 &'a self,
538 params: Option<crate::v4::params::ImageImportLibpod<'a>>,
539 upload: String,
540 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
541 Box::pin(request::execute_request_unit(
542 self.get_config(),
543 move |mut req_builder: Builder| {
544 req_builder = req_builder.method("POST");
545 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
546 let mut request_path = request_url.path().to_owned();
547 if request_path.ends_with('/') {
548 request_path.pop();
549 }
550 request_path.push_str("/libpod/images/import");
551 request_url.set_path(&request_path);
552 if let Some(params) = ¶ms {
553 let mut query_pairs = request_url.query_pairs_mut();
554 if let Some(changes) = ¶ms.changes {
555 for value in changes {
556 query_pairs.append_pair("changes", &value.to_string());
557 }
558 }
559 if let Some(message) = params.message {
560 query_pairs.append_pair("message", message);
561 }
562 if let Some(reference) = params.reference {
563 query_pairs.append_pair("reference", reference);
564 }
565 if let Some(url) = params.url {
566 query_pairs.append_pair("url", url);
567 }
568 if let Some(content_type) = params.content_type {
569 req_builder = req_builder.header("Content-Type", content_type);
570 }
571 }
572 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
573 req_builder = req_builder.uri(hyper_uri);
574 let body = serde_json::to_string(&upload)?;
575 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
576 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
577 Ok(req_builder.body(body)?)
578 },
579 ))
580 }
581 fn image_list_libpod<'a>(
587 &'a self,
588 params: Option<crate::v4::params::ImageListLibpod<'a>>,
589 ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> {
590 Box::pin(request::execute_request_json(
591 self.get_config(),
592 move |mut req_builder: Builder| {
593 req_builder = req_builder.method("GET");
594 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
595 let mut request_path = request_url.path().to_owned();
596 if request_path.ends_with('/') {
597 request_path.pop();
598 }
599 request_path.push_str("/libpod/images/json");
600 request_url.set_path(&request_path);
601 if let Some(params) = ¶ms {
602 let mut query_pairs = request_url.query_pairs_mut();
603 if let Some(all) = params.all {
604 query_pairs.append_pair("all", &all.to_string());
605 }
606 if let Some(filters) = params.filters {
607 query_pairs.append_pair("filters", filters);
608 }
609 }
610 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
611 req_builder = req_builder.uri(hyper_uri);
612 Ok(req_builder.body(String::new())?)
613 },
614 ))
615 }
616 fn image_load_libpod<'a>(
622 &'a self,
623 upload: String,
624 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
625 Box::pin(request::execute_request_unit(
626 self.get_config(),
627 move |mut req_builder: Builder| {
628 req_builder = req_builder.method("POST");
629 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
630 let mut request_path = request_url.path().to_owned();
631 if request_path.ends_with('/') {
632 request_path.pop();
633 }
634 request_path.push_str("/libpod/images/load");
635 request_url.set_path(&request_path);
636 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
637 req_builder = req_builder.uri(hyper_uri);
638 let body = serde_json::to_string(&upload)?;
639 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
640 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
641 Ok(req_builder.body(body)?)
642 },
643 ))
644 }
645 fn image_prune_libpod<'a>(
651 &'a self,
652 params: Option<crate::v4::params::ImagePruneLibpod<'a>>,
653 ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> {
654 Box::pin(request::execute_request_json(
655 self.get_config(),
656 move |mut req_builder: Builder| {
657 req_builder = req_builder.method("POST");
658 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
659 let mut request_path = request_url.path().to_owned();
660 if request_path.ends_with('/') {
661 request_path.pop();
662 }
663 request_path.push_str("/libpod/images/prune");
664 request_url.set_path(&request_path);
665 if let Some(params) = ¶ms {
666 let mut query_pairs = request_url.query_pairs_mut();
667 if let Some(all) = params.all {
668 query_pairs.append_pair("all", &all.to_string());
669 }
670 if let Some(external) = params.external {
671 query_pairs.append_pair("external", &external.to_string());
672 }
673 if let Some(filters) = params.filters {
674 query_pairs.append_pair("filters", filters);
675 }
676 }
677 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
678 req_builder = req_builder.uri(hyper_uri);
679 Ok(req_builder.body(String::new())?)
680 },
681 ))
682 }
683 fn image_pull_libpod<'a>(
689 &'a self,
690 params: Option<crate::v4::params::ImagePullLibpod<'a>>,
691 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
692 Box::pin(request::execute_request_unit(
693 self.get_config(),
694 move |mut req_builder: Builder| {
695 req_builder = req_builder.method("POST");
696 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
697 let mut request_path = request_url.path().to_owned();
698 if request_path.ends_with('/') {
699 request_path.pop();
700 }
701 request_path.push_str("/libpod/images/pull");
702 request_url.set_path(&request_path);
703 if let Some(params) = ¶ms {
704 let mut query_pairs = request_url.query_pairs_mut();
705 if let Some(reference) = params.reference {
706 query_pairs.append_pair("reference", reference);
707 }
708 if let Some(quiet) = params.quiet {
709 query_pairs.append_pair("quiet", &quiet.to_string());
710 }
711 if let Some(compat_mode) = params.compat_mode {
712 query_pairs.append_pair("compatMode", &compat_mode.to_string());
713 }
714 if let Some(arch) = params.arch {
715 query_pairs.append_pair("Arch", arch);
716 }
717 if let Some(os) = params.os {
718 query_pairs.append_pair("OS", os);
719 }
720 if let Some(variant) = params.variant {
721 query_pairs.append_pair("Variant", variant);
722 }
723 if let Some(policy) = params.policy {
724 query_pairs.append_pair("policy", policy);
725 }
726 if let Some(tls_verify) = params.tls_verify {
727 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
728 }
729 if let Some(all_tags) = params.all_tags {
730 query_pairs.append_pair("allTags", &all_tags.to_string());
731 }
732 if let Some(x_registry_auth) = params.x_registry_auth {
733 req_builder = req_builder.header("X-Registry-Auth", x_registry_auth);
734 }
735 }
736 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
737 req_builder = req_builder.uri(hyper_uri);
738 Ok(req_builder.body(String::new())?)
739 },
740 ))
741 }
742 fn image_delete_all_libpod<'a>(
746 &'a self,
747 params: Option<crate::v4::params::ImageDeleteAllLibpod<'a>>,
748 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
749 Box::pin(request::execute_request_unit(
750 self.get_config(),
751 move |mut req_builder: Builder| {
752 req_builder = req_builder.method("DELETE");
753 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
754 let mut request_path = request_url.path().to_owned();
755 if request_path.ends_with('/') {
756 request_path.pop();
757 }
758 request_path.push_str("/libpod/images/remove");
759 request_url.set_path(&request_path);
760 if let Some(params) = ¶ms {
761 let mut query_pairs = request_url.query_pairs_mut();
762 if let Some(images) = ¶ms.images {
763 for value in images {
764 query_pairs.append_pair("images", &value.to_string());
765 }
766 }
767 if let Some(all) = params.all {
768 query_pairs.append_pair("all", &all.to_string());
769 }
770 if let Some(force) = params.force {
771 query_pairs.append_pair("force", &force.to_string());
772 }
773 if let Some(ignore) = params.ignore {
774 query_pairs.append_pair("ignore", &ignore.to_string());
775 }
776 if let Some(lookup_manifest) = params.lookup_manifest {
777 query_pairs.append_pair("lookupManifest", &lookup_manifest.to_string());
778 }
779 }
780 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
781 req_builder = req_builder.uri(hyper_uri);
782 Ok(req_builder.body(String::new())?)
783 },
784 ))
785 }
786 fn image_scp_libpod<'a>(
790 &'a self,
791 name: &'a str,
792 params: Option<crate::v4::params::ImageScpLibpod<'a>>,
793 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
794 Box::pin(request::execute_request_unit(
795 self.get_config(),
796 move |mut req_builder: Builder| {
797 req_builder = req_builder.method("POST");
798 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
799 let mut request_path = request_url.path().to_owned();
800 if request_path.ends_with('/') {
801 request_path.pop();
802 }
803 request_path.push_str("/libpod/images/scp/{name}");
804 request_path = request_path.replace("{name}", name);
805 request_url.set_path(&request_path);
806 if let Some(params) = ¶ms {
807 let mut query_pairs = request_url.query_pairs_mut();
808 if let Some(destination) = params.destination {
809 query_pairs.append_pair("destination", destination);
810 }
811 if let Some(quiet) = params.quiet {
812 query_pairs.append_pair("quiet", &quiet.to_string());
813 }
814 }
815 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
816 req_builder = req_builder.uri(hyper_uri);
817 Ok(req_builder.body(String::new())?)
818 },
819 ))
820 }
821 fn image_search_libpod<'a>(
827 &'a self,
828 params: Option<crate::v4::params::ImageSearchLibpod<'a>>,
829 ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> {
830 Box::pin(request::execute_request_json(
831 self.get_config(),
832 move |mut req_builder: Builder| {
833 req_builder = req_builder.method("GET");
834 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
835 let mut request_path = request_url.path().to_owned();
836 if request_path.ends_with('/') {
837 request_path.pop();
838 }
839 request_path.push_str("/libpod/images/search");
840 request_url.set_path(&request_path);
841 if let Some(params) = ¶ms {
842 let mut query_pairs = request_url.query_pairs_mut();
843 if let Some(term) = params.term {
844 query_pairs.append_pair("term", term);
845 }
846 if let Some(limit) = params.limit {
847 query_pairs.append_pair("limit", &limit.to_string());
848 }
849 if let Some(filters) = params.filters {
850 query_pairs.append_pair("filters", filters);
851 }
852 if let Some(tls_verify) = params.tls_verify {
853 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
854 }
855 if let Some(list_tags) = params.list_tags {
856 query_pairs.append_pair("listTags", &list_tags.to_string());
857 }
858 }
859 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
860 req_builder = req_builder.uri(hyper_uri);
861 Ok(req_builder.body(String::new())?)
862 },
863 ))
864 }
865}