podman_rest_client/v5/apis/
containers.rs

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 Containers: HasConfig + Send + Sync {
8    /// POST /libpod/commit
9    ///
10    /// Commit
11    ///
12    /// Create a new image from a container
13    fn image_commit_libpod<'a>(
14        &'a self,
15        params: Option<crate::v5::params::ImageCommitLibpod<'a>>,
16    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
17        Box::pin(request::execute_request_unit(
18            self.get_config(),
19            move |mut req_builder: Builder| {
20                req_builder = req_builder.method("POST");
21                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
22                let mut request_path = request_url.path().to_owned();
23                if request_path.ends_with('/') {
24                    request_path.pop();
25                }
26                request_path.push_str("/libpod/commit");
27                request_url.set_path(&request_path);
28                if let Some(params) = &params {
29                    let mut query_pairs = request_url.query_pairs_mut();
30                    query_pairs.append_pair("container", params.container);
31                    if let Some(author) = params.author {
32                        query_pairs.append_pair("author", author);
33                    }
34                    if let Some(changes) = &params.changes {
35                        for value in changes {
36                            query_pairs.append_pair("changes", &value.to_string());
37                        }
38                    }
39                    if let Some(comment) = params.comment {
40                        query_pairs.append_pair("comment", comment);
41                    }
42                    if let Some(format) = params.format {
43                        query_pairs.append_pair("format", format);
44                    }
45                    if let Some(pause) = params.pause {
46                        query_pairs.append_pair("pause", &pause.to_string());
47                    }
48                    if let Some(squash) = params.squash {
49                        query_pairs.append_pair("squash", &squash.to_string());
50                    }
51                    if let Some(repo) = params.repo {
52                        query_pairs.append_pair("repo", repo);
53                    }
54                    if let Some(stream) = params.stream {
55                        query_pairs.append_pair("stream", &stream.to_string());
56                    }
57                    if let Some(tag) = params.tag {
58                        query_pairs.append_pair("tag", tag);
59                    }
60                }
61                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
62                req_builder = req_builder.uri(hyper_uri);
63                Ok(req_builder.body(String::new())?)
64            },
65        ))
66    }
67    /// DELETE /libpod/containers/{name}
68    ///
69    /// Delete container
70    fn container_delete_libpod<'a>(
71        &'a self,
72        name: &'a str,
73        params: Option<crate::v5::params::ContainerDeleteLibpod>,
74    ) -> Pin<
75        Box<
76            dyn Future<Output = Result<Vec<crate::v5::models::LibpodContainersRmReport>, Error>>
77                + Send
78                + 'a,
79        >,
80    > {
81        Box::pin(request::execute_request_json(
82            self.get_config(),
83            move |mut req_builder: Builder| {
84                req_builder = req_builder.method("DELETE");
85                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
86                let mut request_path = request_url.path().to_owned();
87                if request_path.ends_with('/') {
88                    request_path.pop();
89                }
90                request_path.push_str("/libpod/containers/{name}");
91                request_path = request_path.replace("{name}", name);
92                request_url.set_path(&request_path);
93                if let Some(params) = &params {
94                    let mut query_pairs = request_url.query_pairs_mut();
95                    if let Some(depend) = params.depend {
96                        query_pairs.append_pair("depend", &depend.to_string());
97                    }
98                    if let Some(force) = params.force {
99                        query_pairs.append_pair("force", &force.to_string());
100                    }
101                    if let Some(ignore) = params.ignore {
102                        query_pairs.append_pair("ignore", &ignore.to_string());
103                    }
104                    if let Some(timeout) = params.timeout {
105                        query_pairs.append_pair("timeout", &timeout.to_string());
106                    }
107                    if let Some(v) = params.v {
108                        query_pairs.append_pair("v", &v.to_string());
109                    }
110                }
111                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
112                req_builder = req_builder.uri(hyper_uri);
113                Ok(req_builder.body(String::new())?)
114            },
115        ))
116    }
117    /// GET /libpod/containers/{name}/archive
118    ///
119    /// Copy files into a container
120    ///
121    /// Copy a tar archive of files into a container
122    fn put_container_archive_libpod<'a>(
123        &'a self,
124        name: &'a str,
125        params: Option<crate::v5::params::PutContainerArchiveLibpod<'a>>,
126        request: String,
127    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
128        Box::pin(request::execute_request_unit(
129            self.get_config(),
130            move |mut req_builder: Builder| {
131                req_builder = req_builder.method("GET");
132                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
133                let mut request_path = request_url.path().to_owned();
134                if request_path.ends_with('/') {
135                    request_path.pop();
136                }
137                request_path.push_str("/libpod/containers/{name}/archive");
138                request_path = request_path.replace("{name}", name);
139                request_url.set_path(&request_path);
140                if let Some(params) = &params {
141                    let mut query_pairs = request_url.query_pairs_mut();
142                    query_pairs.append_pair("path", params.path);
143                    if let Some(pause) = params.pause {
144                        query_pairs.append_pair("pause", &pause.to_string());
145                    }
146                }
147                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
148                req_builder = req_builder.uri(hyper_uri);
149                let body = serde_json::to_string(&request)?;
150                req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
151                req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
152                Ok(req_builder.body(body)?)
153            },
154        ))
155    }
156    /// POST /libpod/containers/{name}/attach
157    ///
158    /// Attach to a container
159    ///
160    /// Attach to a container to read its output or send it input. You can attach
161    /// to the same container multiple times and you can reattach to containers
162    /// that have been detached.
163    ///
164    /// ### Hijacking
165    ///
166    /// This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`,
167    /// and `stderr` on the same socket.
168    ///
169    /// This is the response from the service for an attach request:
170    ///
171    /// ```text
172    /// HTTP/1.1 200 OK
173    /// Content-Type: application/vnd.docker.raw-stream
174    ///
175    /// [STREAM]
176    /// ```
177    ///
178    /// After the headers and two new lines, the TCP connection can now be used
179    /// for raw, bidirectional communication between the client and server.
180    ///
181    /// To inform potential proxies about connection hijacking, the client
182    /// can also optionally send connection upgrade headers.
183    ///
184    /// For example, the client sends this request to upgrade the connection:
185    ///
186    /// ```text
187    /// POST /v4.6.0/libpod/containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1
188    /// Upgrade: tcp
189    /// Connection: Upgrade
190    /// ```
191    ///
192    /// The service will respond with a `101 UPGRADED` response, and will
193    /// similarly follow with the raw stream:
194    ///
195    /// ```text
196    /// HTTP/1.1 101 UPGRADED
197    /// Content-Type: application/vnd.docker.raw-stream
198    /// Connection: Upgrade
199    /// Upgrade: tcp
200    ///
201    /// [STREAM]
202    /// ```
203    ///
204    /// ### Stream format
205    ///
206    /// When the TTY setting is disabled for the container,
207    /// the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream
208    /// (starting with v4.7.0, previously application/vnd.docker.raw-stream was always used)
209    /// and the stream over the hijacked connected is multiplexed to separate out
210    /// `stdout` and `stderr`. The stream consists of a series of frames, each
211    /// containing a header and a payload.
212    ///
213    /// The header contains the information about the output stream type and the size of
214    /// the payload.
215    /// It is encoded on the first eight bytes like this:
216    ///
217    /// ```go
218    /// header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
219    /// ```
220    ///
221    /// `STREAM_TYPE` can be:
222    ///
223    /// - 0: `stdin` (is written on `stdout`)
224    /// - 1: `stdout`
225    /// - 2: `stderr`
226    ///
227    /// `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size
228    /// encoded as big endian.
229    ///
230    /// Following the header is the payload, which contains the specified number of
231    /// bytes as written in the size.
232    ///
233    /// The simplest way to implement this protocol is the following:
234    ///
235    /// 1. Read 8 bytes.
236    /// 2. Choose `stdout` or `stderr` depending on the first byte.
237    /// 3. Extract the frame size from the last four bytes.
238    /// 4. Read the extracted size and output it on the correct output.
239    /// 5. Goto 1.
240    ///
241    /// ### Stream format when using a TTY
242    ///
243    /// When the TTY setting is enabled for the container,
244    /// the stream is not multiplexed. The data exchanged over the hijacked
245    /// connection is simply the raw data from the process PTY and client's
246    /// `stdin`.
247    fn container_attach_libpod<'a>(
248        &'a self,
249        name: &'a str,
250        params: Option<crate::v5::params::ContainerAttachLibpod<'a>>,
251    ) -> Pin<
252        Box<
253            dyn Future<Output = Result<hyper_util::rt::TokioIo<hyper::upgrade::Upgraded>, Error>>
254                + Send
255                + 'a,
256        >,
257    > {
258        Box::pin(request::execute_request_upgrade(
259            self.get_config(),
260            move |mut req_builder: Builder| {
261                req_builder = req_builder.method("POST");
262                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
263                let mut request_path = request_url.path().to_owned();
264                if request_path.ends_with('/') {
265                    request_path.pop();
266                }
267                request_path.push_str("/libpod/containers/{name}/attach");
268                request_path = request_path.replace("{name}", name);
269                request_url.set_path(&request_path);
270                if let Some(params) = &params {
271                    let mut query_pairs = request_url.query_pairs_mut();
272                    if let Some(detach_keys) = params.detach_keys {
273                        query_pairs.append_pair("detachKeys", detach_keys);
274                    }
275                    if let Some(logs) = params.logs {
276                        query_pairs.append_pair("logs", &logs.to_string());
277                    }
278                    if let Some(stream) = params.stream {
279                        query_pairs.append_pair("stream", &stream.to_string());
280                    }
281                    if let Some(stdout) = params.stdout {
282                        query_pairs.append_pair("stdout", &stdout.to_string());
283                    }
284                    if let Some(stderr) = params.stderr {
285                        query_pairs.append_pair("stderr", &stderr.to_string());
286                    }
287                    if let Some(stdin) = params.stdin {
288                        query_pairs.append_pair("stdin", &stdin.to_string());
289                    }
290                }
291                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
292                req_builder = req_builder.uri(hyper_uri);
293                Ok(req_builder.body(String::new())?)
294            },
295        ))
296    }
297    /// GET /libpod/containers/{name}/changes
298    ///
299    /// Report on changes to container's filesystem; adds, deletes or modifications.
300    ///
301    /// Returns which files in a container's filesystem have been added, deleted, or modified. The Kind of modification can be one of:
302    ///
303    /// 0: Modified
304    /// 1: Added
305    /// 2: Deleted
306    fn container_changes_libpod<'a>(
307        &'a self,
308        name: &'a str,
309        params: Option<crate::v5::params::ContainerChangesLibpod<'a>>,
310    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
311        Box::pin(request::execute_request_text(
312            self.get_config(),
313            move |mut req_builder: Builder| {
314                req_builder = req_builder.method("GET");
315                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
316                let mut request_path = request_url.path().to_owned();
317                if request_path.ends_with('/') {
318                    request_path.pop();
319                }
320                request_path.push_str("/libpod/containers/{name}/changes");
321                request_path = request_path.replace("{name}", name);
322                request_url.set_path(&request_path);
323                if let Some(params) = &params {
324                    let mut query_pairs = request_url.query_pairs_mut();
325                    if let Some(parent) = params.parent {
326                        query_pairs.append_pair("parent", parent);
327                    }
328                    if let Some(diff_type) = params.diff_type {
329                        query_pairs.append_pair("diffType", diff_type);
330                    }
331                }
332                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
333                req_builder = req_builder.uri(hyper_uri);
334                Ok(req_builder.body(String::new())?)
335            },
336        ))
337    }
338    /// POST /libpod/containers/{name}/checkpoint
339    ///
340    /// Checkpoint a container
341    fn container_checkpoint_libpod<'a>(
342        &'a self,
343        name: &'a str,
344        params: Option<crate::v5::params::ContainerCheckpointLibpod>,
345    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
346        Box::pin(request::execute_request_unit(
347            self.get_config(),
348            move |mut req_builder: Builder| {
349                req_builder = req_builder.method("POST");
350                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
351                let mut request_path = request_url.path().to_owned();
352                if request_path.ends_with('/') {
353                    request_path.pop();
354                }
355                request_path.push_str("/libpod/containers/{name}/checkpoint");
356                request_path = request_path.replace("{name}", name);
357                request_url.set_path(&request_path);
358                if let Some(params) = &params {
359                    let mut query_pairs = request_url.query_pairs_mut();
360                    if let Some(keep) = params.keep {
361                        query_pairs.append_pair("keep", &keep.to_string());
362                    }
363                    if let Some(leave_running) = params.leave_running {
364                        query_pairs.append_pair("leaveRunning", &leave_running.to_string());
365                    }
366                    if let Some(tcp_established) = params.tcp_established {
367                        query_pairs.append_pair("tcpEstablished", &tcp_established.to_string());
368                    }
369                    if let Some(export) = params.export {
370                        query_pairs.append_pair("export", &export.to_string());
371                    }
372                    if let Some(ignore_root_fs) = params.ignore_root_fs {
373                        query_pairs.append_pair("ignoreRootFS", &ignore_root_fs.to_string());
374                    }
375                    if let Some(ignore_volumes) = params.ignore_volumes {
376                        query_pairs.append_pair("ignoreVolumes", &ignore_volumes.to_string());
377                    }
378                    if let Some(pre_checkpoint) = params.pre_checkpoint {
379                        query_pairs.append_pair("preCheckpoint", &pre_checkpoint.to_string());
380                    }
381                    if let Some(with_previous) = params.with_previous {
382                        query_pairs.append_pair("withPrevious", &with_previous.to_string());
383                    }
384                    if let Some(file_locks) = params.file_locks {
385                        query_pairs.append_pair("fileLocks", &file_locks.to_string());
386                    }
387                    if let Some(print_stats) = params.print_stats {
388                        query_pairs.append_pair("printStats", &print_stats.to_string());
389                    }
390                }
391                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
392                req_builder = req_builder.uri(hyper_uri);
393                Ok(req_builder.body(String::new())?)
394            },
395        ))
396    }
397    /// GET /libpod/containers/{name}/exists
398    ///
399    /// Check if container exists
400    ///
401    /// Quick way to determine if a container exists by name or ID
402    fn container_exists_libpod<'a>(
403        &'a self,
404        name: &'a str,
405    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
406        Box::pin(request::execute_request_unit(
407            self.get_config(),
408            move |mut req_builder: Builder| {
409                req_builder = req_builder.method("GET");
410                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
411                let mut request_path = request_url.path().to_owned();
412                if request_path.ends_with('/') {
413                    request_path.pop();
414                }
415                request_path.push_str("/libpod/containers/{name}/exists");
416                request_path = request_path.replace("{name}", name);
417                request_url.set_path(&request_path);
418                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
419                req_builder = req_builder.uri(hyper_uri);
420                Ok(req_builder.body(String::new())?)
421            },
422        ))
423    }
424    /// GET /libpod/containers/{name}/export
425    ///
426    /// Export a container
427    ///
428    /// Export the contents of a container as a tarball.
429    fn container_export_libpod<'a>(
430        &'a self,
431        name: &'a str,
432    ) -> Pin<Box<dyn futures::stream::Stream<Item = Result<bytes::Bytes, Error>> + Send + 'a>> {
433        request::execute_request_stream(self.get_config(), move |mut req_builder: Builder| {
434            req_builder = req_builder.method("GET");
435            let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
436            let mut request_path = request_url.path().to_owned();
437            if request_path.ends_with('/') {
438                request_path.pop();
439            }
440            request_path.push_str("/libpod/containers/{name}/export");
441            request_path = request_path.replace("{name}", name);
442            request_url.set_path(&request_path);
443            let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
444            req_builder = req_builder.uri(hyper_uri);
445            Ok(req_builder.body(String::new())?)
446        })
447    }
448    /// GET /libpod/containers/{name}/healthcheck
449    ///
450    /// Run a container's healthcheck
451    ///
452    /// Execute the defined healthcheck and return information about the results
453    fn container_healthcheck_libpod<'a>(
454        &'a self,
455        name: &'a str,
456    ) -> Pin<
457        Box<dyn Future<Output = Result<crate::v5::models::HealthCheckResults, Error>> + Send + 'a>,
458    > {
459        Box::pin(request::execute_request_json(
460            self.get_config(),
461            move |mut req_builder: Builder| {
462                req_builder = req_builder.method("GET");
463                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
464                let mut request_path = request_url.path().to_owned();
465                if request_path.ends_with('/') {
466                    request_path.pop();
467                }
468                request_path.push_str("/libpod/containers/{name}/healthcheck");
469                request_path = request_path.replace("{name}", name);
470                request_url.set_path(&request_path);
471                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
472                req_builder = req_builder.uri(hyper_uri);
473                Ok(req_builder.body(String::new())?)
474            },
475        ))
476    }
477    /// POST /libpod/containers/{name}/init
478    ///
479    /// Initialize a container
480    ///
481    /// Performs all tasks necessary for initializing the container but does not start the container.
482    fn container_init_libpod<'a>(
483        &'a self,
484        name: &'a str,
485    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
486        Box::pin(request::execute_request_unit(
487            self.get_config(),
488            move |mut req_builder: Builder| {
489                req_builder = req_builder.method("POST");
490                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
491                let mut request_path = request_url.path().to_owned();
492                if request_path.ends_with('/') {
493                    request_path.pop();
494                }
495                request_path.push_str("/libpod/containers/{name}/init");
496                request_path = request_path.replace("{name}", name);
497                request_url.set_path(&request_path);
498                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
499                req_builder = req_builder.uri(hyper_uri);
500                Ok(req_builder.body(String::new())?)
501            },
502        ))
503    }
504    /// GET /libpod/containers/{name}/json
505    ///
506    /// Inspect container
507    ///
508    /// Return low-level information about a container.
509    fn container_inspect_libpod<'a>(
510        &'a self,
511        name: &'a str,
512        params: Option<crate::v5::params::ContainerInspectLibpod>,
513    ) -> Pin<
514        Box<
515            dyn Future<Output = Result<crate::v5::models::InspectContainerData, Error>> + Send + 'a,
516        >,
517    > {
518        Box::pin(request::execute_request_json(
519            self.get_config(),
520            move |mut req_builder: Builder| {
521                req_builder = req_builder.method("GET");
522                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
523                let mut request_path = request_url.path().to_owned();
524                if request_path.ends_with('/') {
525                    request_path.pop();
526                }
527                request_path.push_str("/libpod/containers/{name}/json");
528                request_path = request_path.replace("{name}", name);
529                request_url.set_path(&request_path);
530                if let Some(params) = &params {
531                    let mut query_pairs = request_url.query_pairs_mut();
532                    if let Some(size) = params.size {
533                        query_pairs.append_pair("size", &size.to_string());
534                    }
535                }
536                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
537                req_builder = req_builder.uri(hyper_uri);
538                Ok(req_builder.body(String::new())?)
539            },
540        ))
541    }
542    /// POST /libpod/containers/{name}/kill
543    ///
544    /// Kill container
545    ///
546    /// send a signal to a container, defaults to killing the container
547    fn container_kill_libpod<'a>(
548        &'a self,
549        name: &'a str,
550        params: Option<crate::v5::params::ContainerKillLibpod<'a>>,
551    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
552        Box::pin(request::execute_request_unit(
553            self.get_config(),
554            move |mut req_builder: Builder| {
555                req_builder = req_builder.method("POST");
556                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
557                let mut request_path = request_url.path().to_owned();
558                if request_path.ends_with('/') {
559                    request_path.pop();
560                }
561                request_path.push_str("/libpod/containers/{name}/kill");
562                request_path = request_path.replace("{name}", name);
563                request_url.set_path(&request_path);
564                if let Some(params) = &params {
565                    let mut query_pairs = request_url.query_pairs_mut();
566                    if let Some(signal) = params.signal {
567                        query_pairs.append_pair("signal", signal);
568                    }
569                }
570                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
571                req_builder = req_builder.uri(hyper_uri);
572                Ok(req_builder.body(String::new())?)
573            },
574        ))
575    }
576    /// GET /libpod/containers/{name}/logs
577    ///
578    /// Get container logs
579    ///
580    /// Get stdout and stderr logs from a container.
581    ///
582    /// The stream format is the same as described in the attach endpoint.
583    fn container_logs_libpod<'a>(
584        &'a self,
585        name: &'a str,
586        params: Option<crate::v5::params::ContainerLogsLibpod<'a>>,
587    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
588        Box::pin(request::execute_request_unit(
589            self.get_config(),
590            move |mut req_builder: Builder| {
591                req_builder = req_builder.method("GET");
592                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
593                let mut request_path = request_url.path().to_owned();
594                if request_path.ends_with('/') {
595                    request_path.pop();
596                }
597                request_path.push_str("/libpod/containers/{name}/logs");
598                request_path = request_path.replace("{name}", name);
599                request_url.set_path(&request_path);
600                if let Some(params) = &params {
601                    let mut query_pairs = request_url.query_pairs_mut();
602                    if let Some(follow) = params.follow {
603                        query_pairs.append_pair("follow", &follow.to_string());
604                    }
605                    if let Some(stdout) = params.stdout {
606                        query_pairs.append_pair("stdout", &stdout.to_string());
607                    }
608                    if let Some(stderr) = params.stderr {
609                        query_pairs.append_pair("stderr", &stderr.to_string());
610                    }
611                    if let Some(since) = params.since {
612                        query_pairs.append_pair("since", since);
613                    }
614                    if let Some(until) = params.until {
615                        query_pairs.append_pair("until", until);
616                    }
617                    if let Some(timestamps) = params.timestamps {
618                        query_pairs.append_pair("timestamps", &timestamps.to_string());
619                    }
620                    if let Some(tail) = params.tail {
621                        query_pairs.append_pair("tail", tail);
622                    }
623                }
624                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
625                req_builder = req_builder.uri(hyper_uri);
626                Ok(req_builder.body(String::new())?)
627            },
628        ))
629    }
630    /// POST /libpod/containers/{name}/mount
631    ///
632    /// Mount a container
633    ///
634    /// Mount a container to the filesystem
635    fn container_mount_libpod<'a>(
636        &'a self,
637        name: &'a str,
638    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
639        Box::pin(request::execute_request_json(
640            self.get_config(),
641            move |mut req_builder: Builder| {
642                req_builder = req_builder.method("POST");
643                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
644                let mut request_path = request_url.path().to_owned();
645                if request_path.ends_with('/') {
646                    request_path.pop();
647                }
648                request_path.push_str("/libpod/containers/{name}/mount");
649                request_path = request_path.replace("{name}", name);
650                request_url.set_path(&request_path);
651                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
652                req_builder = req_builder.uri(hyper_uri);
653                Ok(req_builder.body(String::new())?)
654            },
655        ))
656    }
657    /// POST /libpod/containers/{name}/pause
658    ///
659    /// Pause a container
660    ///
661    /// Use the cgroups freezer to suspend all processes in a container.
662    fn container_pause_libpod<'a>(
663        &'a self,
664        name: &'a str,
665    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
666        Box::pin(request::execute_request_unit(
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/containers/{name}/pause");
676                request_path = request_path.replace("{name}", name);
677                request_url.set_path(&request_path);
678                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
679                req_builder = req_builder.uri(hyper_uri);
680                Ok(req_builder.body(String::new())?)
681            },
682        ))
683    }
684    /// POST /libpod/containers/{name}/rename
685    ///
686    /// Rename an existing container
687    ///
688    /// Change the name of an existing container.
689    fn container_rename_libpod<'a>(
690        &'a self,
691        name: &'a str,
692        params: Option<crate::v5::params::ContainerRenameLibpod<'a>>,
693    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
694        Box::pin(request::execute_request_unit(
695            self.get_config(),
696            move |mut req_builder: Builder| {
697                req_builder = req_builder.method("POST");
698                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
699                let mut request_path = request_url.path().to_owned();
700                if request_path.ends_with('/') {
701                    request_path.pop();
702                }
703                request_path.push_str("/libpod/containers/{name}/rename");
704                request_path = request_path.replace("{name}", name);
705                request_url.set_path(&request_path);
706                if let Some(params) = &params {
707                    let mut query_pairs = request_url.query_pairs_mut();
708                    query_pairs.append_pair("name", params.name);
709                }
710                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
711                req_builder = req_builder.uri(hyper_uri);
712                Ok(req_builder.body(String::new())?)
713            },
714        ))
715    }
716    /// POST /libpod/containers/{name}/resize
717    ///
718    /// Resize a container's TTY
719    ///
720    /// Resize the terminal attached to a container (for use with Attach).
721    fn container_resize_libpod<'a>(
722        &'a self,
723        name: &'a str,
724        params: Option<crate::v5::params::ContainerResizeLibpod>,
725    ) -> Pin<Box<dyn Future<Output = Result<serde_json::Value, Error>> + Send + 'a>> {
726        Box::pin(request::execute_request_json(
727            self.get_config(),
728            move |mut req_builder: Builder| {
729                req_builder = req_builder.method("POST");
730                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
731                let mut request_path = request_url.path().to_owned();
732                if request_path.ends_with('/') {
733                    request_path.pop();
734                }
735                request_path.push_str("/libpod/containers/{name}/resize");
736                request_path = request_path.replace("{name}", name);
737                request_url.set_path(&request_path);
738                if let Some(params) = &params {
739                    let mut query_pairs = request_url.query_pairs_mut();
740                    if let Some(h) = params.h {
741                        query_pairs.append_pair("h", &h.to_string());
742                    }
743                    if let Some(w) = params.w {
744                        query_pairs.append_pair("w", &w.to_string());
745                    }
746                }
747                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
748                req_builder = req_builder.uri(hyper_uri);
749                Ok(req_builder.body(String::new())?)
750            },
751        ))
752    }
753    /// POST /libpod/containers/{name}/restart
754    ///
755    /// Restart a container
756    fn container_restart_libpod<'a>(
757        &'a self,
758        name: &'a str,
759        params: Option<crate::v5::params::ContainerRestartLibpod>,
760    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
761        Box::pin(request::execute_request_unit(
762            self.get_config(),
763            move |mut req_builder: Builder| {
764                req_builder = req_builder.method("POST");
765                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
766                let mut request_path = request_url.path().to_owned();
767                if request_path.ends_with('/') {
768                    request_path.pop();
769                }
770                request_path.push_str("/libpod/containers/{name}/restart");
771                request_path = request_path.replace("{name}", name);
772                request_url.set_path(&request_path);
773                if let Some(params) = &params {
774                    let mut query_pairs = request_url.query_pairs_mut();
775                    if let Some(t) = params.t {
776                        query_pairs.append_pair("t", &t.to_string());
777                    }
778                }
779                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
780                req_builder = req_builder.uri(hyper_uri);
781                Ok(req_builder.body(String::new())?)
782            },
783        ))
784    }
785    /// POST /libpod/containers/{name}/restore
786    ///
787    /// Restore a container
788    ///
789    /// Restore a container from a checkpoint.
790    fn container_restore_libpod<'a>(
791        &'a self,
792        name: &'a str,
793        params: Option<crate::v5::params::ContainerRestoreLibpod<'a>>,
794    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
795        Box::pin(request::execute_request_unit(
796            self.get_config(),
797            move |mut req_builder: Builder| {
798                req_builder = req_builder.method("POST");
799                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
800                let mut request_path = request_url.path().to_owned();
801                if request_path.ends_with('/') {
802                    request_path.pop();
803                }
804                request_path.push_str("/libpod/containers/{name}/restore");
805                request_path = request_path.replace("{name}", name);
806                request_url.set_path(&request_path);
807                if let Some(params) = &params {
808                    let mut query_pairs = request_url.query_pairs_mut();
809                    if let Some(name) = params.name {
810                        query_pairs.append_pair("name", name);
811                    }
812                    if let Some(keep) = params.keep {
813                        query_pairs.append_pair("keep", &keep.to_string());
814                    }
815                    if let Some(tcp_established) = params.tcp_established {
816                        query_pairs.append_pair("tcpEstablished", &tcp_established.to_string());
817                    }
818                    if let Some(import) = params.import {
819                        query_pairs.append_pair("import", &import.to_string());
820                    }
821                    if let Some(ignore_root_fs) = params.ignore_root_fs {
822                        query_pairs.append_pair("ignoreRootFS", &ignore_root_fs.to_string());
823                    }
824                    if let Some(ignore_volumes) = params.ignore_volumes {
825                        query_pairs.append_pair("ignoreVolumes", &ignore_volumes.to_string());
826                    }
827                    if let Some(ignore_static_ip) = params.ignore_static_ip {
828                        query_pairs.append_pair("ignoreStaticIP", &ignore_static_ip.to_string());
829                    }
830                    if let Some(ignore_static_mac) = params.ignore_static_mac {
831                        query_pairs.append_pair("ignoreStaticMAC", &ignore_static_mac.to_string());
832                    }
833                    if let Some(file_locks) = params.file_locks {
834                        query_pairs.append_pair("fileLocks", &file_locks.to_string());
835                    }
836                    if let Some(print_stats) = params.print_stats {
837                        query_pairs.append_pair("printStats", &print_stats.to_string());
838                    }
839                    if let Some(pod) = params.pod {
840                        query_pairs.append_pair("pod", pod);
841                    }
842                }
843                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
844                req_builder = req_builder.uri(hyper_uri);
845                Ok(req_builder.body(String::new())?)
846            },
847        ))
848    }
849    /// POST /libpod/containers/{name}/start
850    ///
851    /// Start a container
852    fn container_start_libpod<'a>(
853        &'a self,
854        name: &'a str,
855        params: Option<crate::v5::params::ContainerStartLibpod<'a>>,
856    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
857        Box::pin(request::execute_request_unit(
858            self.get_config(),
859            move |mut req_builder: Builder| {
860                req_builder = req_builder.method("POST");
861                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
862                let mut request_path = request_url.path().to_owned();
863                if request_path.ends_with('/') {
864                    request_path.pop();
865                }
866                request_path.push_str("/libpod/containers/{name}/start");
867                request_path = request_path.replace("{name}", name);
868                request_url.set_path(&request_path);
869                if let Some(params) = &params {
870                    let mut query_pairs = request_url.query_pairs_mut();
871                    if let Some(detach_keys) = params.detach_keys {
872                        query_pairs.append_pair("detachKeys", detach_keys);
873                    }
874                }
875                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
876                req_builder = req_builder.uri(hyper_uri);
877                Ok(req_builder.body(String::new())?)
878            },
879        ))
880    }
881    /// GET /libpod/containers/{name}/stats
882    ///
883    /// Get stats for a container
884    ///
885    /// DEPRECATED. This endpoint will be removed with the next major release. Please use /libpod/containers/stats instead.
886    fn container_stats_libpod<'a>(
887        &'a self,
888        name: &'a str,
889        params: Option<crate::v5::params::ContainerStatsLibpod>,
890    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
891        Box::pin(request::execute_request_unit(
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/containers/{name}/stats");
901                request_path = request_path.replace("{name}", name);
902                request_url.set_path(&request_path);
903                if let Some(params) = &params {
904                    let mut query_pairs = request_url.query_pairs_mut();
905                    if let Some(stream) = params.stream {
906                        query_pairs.append_pair("stream", &stream.to_string());
907                    }
908                }
909                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
910                req_builder = req_builder.uri(hyper_uri);
911                Ok(req_builder.body(String::new())?)
912            },
913        ))
914    }
915    /// POST /libpod/containers/{name}/stop
916    ///
917    /// Stop a container
918    fn container_stop_libpod<'a>(
919        &'a self,
920        name: &'a str,
921        params: Option<crate::v5::params::ContainerStopLibpod>,
922    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
923        Box::pin(request::execute_request_unit(
924            self.get_config(),
925            move |mut req_builder: Builder| {
926                req_builder = req_builder.method("POST");
927                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
928                let mut request_path = request_url.path().to_owned();
929                if request_path.ends_with('/') {
930                    request_path.pop();
931                }
932                request_path.push_str("/libpod/containers/{name}/stop");
933                request_path = request_path.replace("{name}", name);
934                request_url.set_path(&request_path);
935                if let Some(params) = &params {
936                    let mut query_pairs = request_url.query_pairs_mut();
937                    if let Some(timeout) = params.timeout {
938                        query_pairs.append_pair("timeout", &timeout.to_string());
939                    }
940                    if let Some(ignore) = params.ignore {
941                        query_pairs.append_pair("Ignore", &ignore.to_string());
942                    }
943                }
944                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
945                req_builder = req_builder.uri(hyper_uri);
946                Ok(req_builder.body(String::new())?)
947            },
948        ))
949    }
950    /// GET /libpod/containers/{name}/top
951    ///
952    /// List processes
953    ///
954    /// List processes running inside a container
955    fn container_top_libpod<'a>(
956        &'a self,
957        name: &'a str,
958        params: Option<crate::v5::params::ContainerTopLibpod<'a>>,
959    ) -> Pin<
960        Box<dyn Future<Output = Result<crate::v5::models::ContainerTopOkBody, Error>> + Send + 'a>,
961    > {
962        Box::pin(request::execute_request_json(
963            self.get_config(),
964            move |mut req_builder: Builder| {
965                req_builder = req_builder.method("GET");
966                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
967                let mut request_path = request_url.path().to_owned();
968                if request_path.ends_with('/') {
969                    request_path.pop();
970                }
971                request_path.push_str("/libpod/containers/{name}/top");
972                request_path = request_path.replace("{name}", name);
973                request_url.set_path(&request_path);
974                if let Some(params) = &params {
975                    let mut query_pairs = request_url.query_pairs_mut();
976                    if let Some(stream) = params.stream {
977                        query_pairs.append_pair("stream", &stream.to_string());
978                    }
979                    if let Some(delay) = params.delay {
980                        query_pairs.append_pair("delay", &delay.to_string());
981                    }
982                    if let Some(ps_args) = &params.ps_args {
983                        for value in ps_args {
984                            query_pairs.append_pair("ps_args", &value.to_string());
985                        }
986                    }
987                }
988                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
989                req_builder = req_builder.uri(hyper_uri);
990                Ok(req_builder.body(String::new())?)
991            },
992        ))
993    }
994    /// POST /libpod/containers/{name}/unmount
995    ///
996    /// Unmount a container
997    ///
998    /// Unmount a container from the filesystem
999    fn container_unmount_libpod<'a>(
1000        &'a self,
1001        name: &'a str,
1002    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
1003        Box::pin(request::execute_request_unit(
1004            self.get_config(),
1005            move |mut req_builder: Builder| {
1006                req_builder = req_builder.method("POST");
1007                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1008                let mut request_path = request_url.path().to_owned();
1009                if request_path.ends_with('/') {
1010                    request_path.pop();
1011                }
1012                request_path.push_str("/libpod/containers/{name}/unmount");
1013                request_path = request_path.replace("{name}", name);
1014                request_url.set_path(&request_path);
1015                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1016                req_builder = req_builder.uri(hyper_uri);
1017                Ok(req_builder.body(String::new())?)
1018            },
1019        ))
1020    }
1021    /// POST /libpod/containers/{name}/unpause
1022    ///
1023    /// Unpause Container
1024    fn container_unpause_libpod<'a>(
1025        &'a self,
1026        name: &'a str,
1027    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
1028        Box::pin(request::execute_request_unit(
1029            self.get_config(),
1030            move |mut req_builder: Builder| {
1031                req_builder = req_builder.method("POST");
1032                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1033                let mut request_path = request_url.path().to_owned();
1034                if request_path.ends_with('/') {
1035                    request_path.pop();
1036                }
1037                request_path.push_str("/libpod/containers/{name}/unpause");
1038                request_path = request_path.replace("{name}", name);
1039                request_url.set_path(&request_path);
1040                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1041                req_builder = req_builder.uri(hyper_uri);
1042                Ok(req_builder.body(String::new())?)
1043            },
1044        ))
1045    }
1046    /// POST /libpod/containers/{name}/update
1047    ///
1048    /// Update an existing containers cgroup configuration
1049    ///
1050    /// Update an existing containers cgroup configuration.
1051    fn container_update_libpod<'a>(
1052        &'a self,
1053        name: &'a str,
1054        params: Option<crate::v5::params::ContainerUpdateLibpod<'a>>,
1055        config: crate::v5::models::UpdateEntities,
1056    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
1057        Box::pin(request::execute_request_unit(
1058            self.get_config(),
1059            move |mut req_builder: Builder| {
1060                req_builder = req_builder.method("POST");
1061                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1062                let mut request_path = request_url.path().to_owned();
1063                if request_path.ends_with('/') {
1064                    request_path.pop();
1065                }
1066                request_path.push_str("/libpod/containers/{name}/update");
1067                request_path = request_path.replace("{name}", name);
1068                request_url.set_path(&request_path);
1069                if let Some(params) = &params {
1070                    let mut query_pairs = request_url.query_pairs_mut();
1071                    if let Some(restart_policy) = params.restart_policy {
1072                        query_pairs.append_pair("restartPolicy", restart_policy);
1073                    }
1074                    if let Some(restart_retries) = params.restart_retries {
1075                        query_pairs.append_pair("restartRetries", &restart_retries.to_string());
1076                    }
1077                }
1078                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1079                req_builder = req_builder.uri(hyper_uri);
1080                let body = serde_json::to_string(&config)?;
1081                req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
1082                req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
1083                Ok(req_builder.body(body)?)
1084            },
1085        ))
1086    }
1087    /// POST /libpod/containers/{name}/wait
1088    ///
1089    /// Wait on a container
1090    ///
1091    /// Wait on a container to meet a given condition
1092    fn container_wait_libpod<'a>(
1093        &'a self,
1094        name: &'a str,
1095        params: Option<crate::v5::params::ContainerWaitLibpod<'a>>,
1096    ) -> Pin<Box<dyn Future<Output = Result<i32, Error>> + Send + 'a>> {
1097        Box::pin(request::execute_request_json(
1098            self.get_config(),
1099            move |mut req_builder: Builder| {
1100                req_builder = req_builder.method("POST");
1101                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1102                let mut request_path = request_url.path().to_owned();
1103                if request_path.ends_with('/') {
1104                    request_path.pop();
1105                }
1106                request_path.push_str("/libpod/containers/{name}/wait");
1107                request_path = request_path.replace("{name}", name);
1108                request_url.set_path(&request_path);
1109                if let Some(params) = &params {
1110                    let mut query_pairs = request_url.query_pairs_mut();
1111                    if let Some(condition) = &params.condition {
1112                        for value in condition {
1113                            query_pairs.append_pair("condition", &value.to_string());
1114                        }
1115                    }
1116                    if let Some(interval) = params.interval {
1117                        query_pairs.append_pair("interval", interval);
1118                    }
1119                }
1120                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1121                req_builder = req_builder.uri(hyper_uri);
1122                Ok(req_builder.body(String::new())?)
1123            },
1124        ))
1125    }
1126    /// POST /libpod/containers/create
1127    ///
1128    /// Create a container
1129    fn container_create_libpod<'a>(
1130        &'a self,
1131        create: crate::v5::models::SpecGenerator,
1132    ) -> Pin<
1133        Box<
1134            dyn Future<Output = Result<crate::v5::models::ContainerCreateResponse, Error>>
1135                + Send
1136                + 'a,
1137        >,
1138    > {
1139        Box::pin(request::execute_request_json(
1140            self.get_config(),
1141            move |mut req_builder: Builder| {
1142                req_builder = req_builder.method("POST");
1143                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1144                let mut request_path = request_url.path().to_owned();
1145                if request_path.ends_with('/') {
1146                    request_path.pop();
1147                }
1148                request_path.push_str("/libpod/containers/create");
1149                request_url.set_path(&request_path);
1150                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1151                req_builder = req_builder.uri(hyper_uri);
1152                let body = serde_json::to_string(&create)?;
1153                req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
1154                req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
1155                Ok(req_builder.body(body)?)
1156            },
1157        ))
1158    }
1159    /// GET /libpod/containers/json
1160    ///
1161    /// List containers
1162    ///
1163    /// Returns a list of containers
1164    fn container_list_libpod<'a>(
1165        &'a self,
1166        params: Option<crate::v5::params::ContainerListLibpod<'a>>,
1167    ) -> Pin<
1168        Box<dyn Future<Output = Result<Vec<crate::v5::models::ListContainer>, Error>> + Send + 'a>,
1169    > {
1170        Box::pin(request::execute_request_json(
1171            self.get_config(),
1172            move |mut req_builder: Builder| {
1173                req_builder = req_builder.method("GET");
1174                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1175                let mut request_path = request_url.path().to_owned();
1176                if request_path.ends_with('/') {
1177                    request_path.pop();
1178                }
1179                request_path.push_str("/libpod/containers/json");
1180                request_url.set_path(&request_path);
1181                if let Some(params) = &params {
1182                    let mut query_pairs = request_url.query_pairs_mut();
1183                    if let Some(all) = params.all {
1184                        query_pairs.append_pair("all", &all.to_string());
1185                    }
1186                    if let Some(limit) = params.limit {
1187                        query_pairs.append_pair("limit", &limit.to_string());
1188                    }
1189                    if let Some(namespace) = params.namespace {
1190                        query_pairs.append_pair("namespace", &namespace.to_string());
1191                    }
1192                    if let Some(pod) = params.pod {
1193                        query_pairs.append_pair("pod", &pod.to_string());
1194                    }
1195                    if let Some(size) = params.size {
1196                        query_pairs.append_pair("size", &size.to_string());
1197                    }
1198                    if let Some(sync) = params.sync {
1199                        query_pairs.append_pair("sync", &sync.to_string());
1200                    }
1201                    if let Some(filters) = params.filters {
1202                        query_pairs.append_pair("filters", filters);
1203                    }
1204                }
1205                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1206                req_builder = req_builder.uri(hyper_uri);
1207                Ok(req_builder.body(String::new())?)
1208            },
1209        ))
1210    }
1211    /// POST /libpod/containers/prune
1212    ///
1213    /// Delete stopped containers
1214    ///
1215    /// Remove containers not in use
1216    fn container_prune_libpod<'a>(
1217        &'a self,
1218        params: Option<crate::v5::params::ContainerPruneLibpod<'a>>,
1219    ) -> Pin<
1220        Box<
1221            dyn Future<Output = Result<Vec<crate::v5::models::ContainersPruneReportLibpod>, Error>>
1222                + Send
1223                + 'a,
1224        >,
1225    > {
1226        Box::pin(request::execute_request_json(
1227            self.get_config(),
1228            move |mut req_builder: Builder| {
1229                req_builder = req_builder.method("POST");
1230                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1231                let mut request_path = request_url.path().to_owned();
1232                if request_path.ends_with('/') {
1233                    request_path.pop();
1234                }
1235                request_path.push_str("/libpod/containers/prune");
1236                request_url.set_path(&request_path);
1237                if let Some(params) = &params {
1238                    let mut query_pairs = request_url.query_pairs_mut();
1239                    if let Some(filters) = params.filters {
1240                        query_pairs.append_pair("filters", filters);
1241                    }
1242                }
1243                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1244                req_builder = req_builder.uri(hyper_uri);
1245                Ok(req_builder.body(String::new())?)
1246            },
1247        ))
1248    }
1249    /// GET /libpod/containers/showmounted
1250    ///
1251    /// Show mounted containers
1252    ///
1253    /// Lists all mounted containers mount points
1254    fn container_show_mounted_libpod<'a>(
1255        &'a self,
1256    ) -> Pin<
1257        Box<
1258            dyn Future<Output = Result<std::collections::HashMap<String, String>, Error>>
1259                + Send
1260                + 'a,
1261        >,
1262    > {
1263        Box::pin(request::execute_request_json(
1264            self.get_config(),
1265            move |mut req_builder: Builder| {
1266                req_builder = req_builder.method("GET");
1267                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1268                let mut request_path = request_url.path().to_owned();
1269                if request_path.ends_with('/') {
1270                    request_path.pop();
1271                }
1272                request_path.push_str("/libpod/containers/showmounted");
1273                request_url.set_path(&request_path);
1274                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1275                req_builder = req_builder.uri(hyper_uri);
1276                Ok(req_builder.body(String::new())?)
1277            },
1278        ))
1279    }
1280    /// GET /libpod/containers/stats
1281    ///
1282    /// Get stats for one or more containers
1283    ///
1284    /// Return a live stream of resource usage statistics of one or more container. If no container is specified, the statistics of all containers are returned.
1285    fn containers_stats_all_libpod<'a>(
1286        &'a self,
1287        params: Option<crate::v5::params::ContainersStatsAllLibpod<'a>>,
1288    ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::ContainerStats, Error>> + Send + 'a>>
1289    {
1290        Box::pin(request::execute_request_json(
1291            self.get_config(),
1292            move |mut req_builder: Builder| {
1293                req_builder = req_builder.method("GET");
1294                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1295                let mut request_path = request_url.path().to_owned();
1296                if request_path.ends_with('/') {
1297                    request_path.pop();
1298                }
1299                request_path.push_str("/libpod/containers/stats");
1300                request_url.set_path(&request_path);
1301                if let Some(params) = &params {
1302                    let mut query_pairs = request_url.query_pairs_mut();
1303                    if let Some(containers) = &params.containers {
1304                        for value in containers {
1305                            query_pairs.append_pair("containers", &value.to_string());
1306                        }
1307                    }
1308                    if let Some(stream) = params.stream {
1309                        query_pairs.append_pair("stream", &stream.to_string());
1310                    }
1311                    if let Some(interval) = params.interval {
1312                        query_pairs.append_pair("interval", &interval.to_string());
1313                    }
1314                }
1315                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1316                req_builder = req_builder.uri(hyper_uri);
1317                Ok(req_builder.body(String::new())?)
1318            },
1319        ))
1320    }
1321    /// GET /libpod/generate/{name}/systemd
1322    ///
1323    /// Generate Systemd Units
1324    ///
1325    /// Generate Systemd Units based on a pod or container.
1326    fn generate_systemd_libpod<'a>(
1327        &'a self,
1328        name: &'a str,
1329        params: Option<crate::v5::params::GenerateSystemdLibpod<'a>>,
1330    ) -> Pin<
1331        Box<
1332            dyn Future<Output = Result<std::collections::HashMap<String, String>, Error>>
1333                + Send
1334                + 'a,
1335        >,
1336    > {
1337        Box::pin(request::execute_request_json(
1338            self.get_config(),
1339            move |mut req_builder: Builder| {
1340                req_builder = req_builder.method("GET");
1341                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1342                let mut request_path = request_url.path().to_owned();
1343                if request_path.ends_with('/') {
1344                    request_path.pop();
1345                }
1346                request_path.push_str("/libpod/generate/{name}/systemd");
1347                request_path = request_path.replace("{name}", name);
1348                request_url.set_path(&request_path);
1349                if let Some(params) = &params {
1350                    let mut query_pairs = request_url.query_pairs_mut();
1351                    if let Some(use_name) = params.use_name {
1352                        query_pairs.append_pair("useName", &use_name.to_string());
1353                    }
1354                    if let Some(new) = params.new {
1355                        query_pairs.append_pair("new", &new.to_string());
1356                    }
1357                    if let Some(no_header) = params.no_header {
1358                        query_pairs.append_pair("noHeader", &no_header.to_string());
1359                    }
1360                    if let Some(start_timeout) = params.start_timeout {
1361                        query_pairs.append_pair("startTimeout", &start_timeout.to_string());
1362                    }
1363                    if let Some(stop_timeout) = params.stop_timeout {
1364                        query_pairs.append_pair("stopTimeout", &stop_timeout.to_string());
1365                    }
1366                    if let Some(restart_policy) = params.restart_policy {
1367                        query_pairs.append_pair("restartPolicy", restart_policy);
1368                    }
1369                    if let Some(container_prefix) = params.container_prefix {
1370                        query_pairs.append_pair("containerPrefix", container_prefix);
1371                    }
1372                    if let Some(pod_prefix) = params.pod_prefix {
1373                        query_pairs.append_pair("podPrefix", pod_prefix);
1374                    }
1375                    if let Some(separator) = params.separator {
1376                        query_pairs.append_pair("separator", separator);
1377                    }
1378                    if let Some(restart_sec) = params.restart_sec {
1379                        query_pairs.append_pair("restartSec", &restart_sec.to_string());
1380                    }
1381                    if let Some(wants) = &params.wants {
1382                        for value in wants {
1383                            query_pairs.append_pair("wants", &value.to_string());
1384                        }
1385                    }
1386                    if let Some(after) = &params.after {
1387                        for value in after {
1388                            query_pairs.append_pair("after", &value.to_string());
1389                        }
1390                    }
1391                    if let Some(requires) = &params.requires {
1392                        for value in requires {
1393                            query_pairs.append_pair("requires", &value.to_string());
1394                        }
1395                    }
1396                    if let Some(additional_env_variables) = &params.additional_env_variables {
1397                        for value in additional_env_variables {
1398                            query_pairs.append_pair("additionalEnvVariables", &value.to_string());
1399                        }
1400                    }
1401                }
1402                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1403                req_builder = req_builder.uri(hyper_uri);
1404                Ok(req_builder.body(String::new())?)
1405            },
1406        ))
1407    }
1408    /// GET /libpod/generate/kube
1409    ///
1410    /// Generate a Kubernetes YAML file.
1411    ///
1412    /// Generate Kubernetes YAML based on a pod or container.
1413    fn generate_kube_libpod<'a>(
1414        &'a self,
1415        params: Option<crate::v5::params::GenerateKubeLibpod<'a>>,
1416    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
1417        Box::pin(request::execute_request_text(
1418            self.get_config(),
1419            move |mut req_builder: Builder| {
1420                req_builder = req_builder.method("GET");
1421                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1422                let mut request_path = request_url.path().to_owned();
1423                if request_path.ends_with('/') {
1424                    request_path.pop();
1425                }
1426                request_path.push_str("/libpod/generate/kube");
1427                request_url.set_path(&request_path);
1428                if let Some(params) = &params {
1429                    let mut query_pairs = request_url.query_pairs_mut();
1430                    for value in &params.names {
1431                        query_pairs.append_pair("names", &value.to_string());
1432                    }
1433                    if let Some(service) = params.service {
1434                        query_pairs.append_pair("service", &service.to_string());
1435                    }
1436                    if let Some(r#type) = params.r#type {
1437                        query_pairs.append_pair("type", r#type);
1438                    }
1439                    if let Some(replicas) = params.replicas {
1440                        query_pairs.append_pair("replicas", &replicas.to_string());
1441                    }
1442                    if let Some(no_trunc) = params.no_trunc {
1443                        query_pairs.append_pair("noTrunc", &no_trunc.to_string());
1444                    }
1445                    if let Some(podman_only) = params.podman_only {
1446                        query_pairs.append_pair("podmanOnly", &podman_only.to_string());
1447                    }
1448                }
1449                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1450                req_builder = req_builder.uri(hyper_uri);
1451                Ok(req_builder.body(String::new())?)
1452            },
1453        ))
1454    }
1455    /// POST /libpod/kube/apply
1456    ///
1457    /// Apply a podman workload or Kubernetes YAML file.
1458    ///
1459    /// Deploy a podman container, pod, volume, or Kubernetes yaml to a Kubernetes cluster.
1460    fn kube_apply_libpod<'a>(
1461        &'a self,
1462        params: Option<crate::v5::params::KubeApplyLibpod<'a>>,
1463        request: String,
1464    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> {
1465        Box::pin(request::execute_request_json(
1466            self.get_config(),
1467            move |mut req_builder: Builder| {
1468                req_builder = req_builder.method("POST");
1469                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1470                let mut request_path = request_url.path().to_owned();
1471                if request_path.ends_with('/') {
1472                    request_path.pop();
1473                }
1474                request_path.push_str("/libpod/kube/apply");
1475                request_url.set_path(&request_path);
1476                if let Some(params) = &params {
1477                    let mut query_pairs = request_url.query_pairs_mut();
1478                    if let Some(ca_cert_file) = params.ca_cert_file {
1479                        query_pairs.append_pair("caCertFile", ca_cert_file);
1480                    }
1481                    if let Some(kube_config) = params.kube_config {
1482                        query_pairs.append_pair("kubeConfig", kube_config);
1483                    }
1484                    if let Some(namespace) = params.namespace {
1485                        query_pairs.append_pair("namespace", namespace);
1486                    }
1487                    if let Some(service) = params.service {
1488                        query_pairs.append_pair("service", &service.to_string());
1489                    }
1490                    if let Some(file) = params.file {
1491                        query_pairs.append_pair("file", file);
1492                    }
1493                }
1494                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1495                req_builder = req_builder.uri(hyper_uri);
1496                let body = serde_json::to_string(&request)?;
1497                req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
1498                req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
1499                Ok(req_builder.body(body)?)
1500            },
1501        ))
1502    }
1503    /// DELETE /libpod/play/kube
1504    ///
1505    /// Remove resources created from kube play
1506    ///
1507    /// Tears down pods, secrets, and volumes defined in a YAML file
1508    fn play_kube_down_libpod<'a>(
1509        &'a self,
1510        params: Option<crate::v5::params::PlayKubeDownLibpod>,
1511    ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::PlayKubeReport, Error>> + Send + 'a>>
1512    {
1513        Box::pin(request::execute_request_json(
1514            self.get_config(),
1515            move |mut req_builder: Builder| {
1516                req_builder = req_builder.method("DELETE");
1517                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1518                let mut request_path = request_url.path().to_owned();
1519                if request_path.ends_with('/') {
1520                    request_path.pop();
1521                }
1522                request_path.push_str("/libpod/play/kube");
1523                request_url.set_path(&request_path);
1524                if let Some(params) = &params {
1525                    let mut query_pairs = request_url.query_pairs_mut();
1526                    if let Some(force) = params.force {
1527                        query_pairs.append_pair("force", &force.to_string());
1528                    }
1529                }
1530                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1531                req_builder = req_builder.uri(hyper_uri);
1532                Ok(req_builder.body(String::new())?)
1533            },
1534        ))
1535    }
1536    /// POST /libpod/play/kube
1537    ///
1538    /// Play a Kubernetes YAML file.
1539    ///
1540    /// Create and run pods based on a Kubernetes YAML file (pod or service kind).
1541    fn play_kube_libpod<'a>(
1542        &'a self,
1543        params: Option<crate::v5::params::PlayKubeLibpod<'a>>,
1544        request: String,
1545    ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::PlayKubeReport, Error>> + Send + 'a>>
1546    {
1547        Box::pin(request::execute_request_json(
1548            self.get_config(),
1549            move |mut req_builder: Builder| {
1550                req_builder = req_builder.method("POST");
1551                let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
1552                let mut request_path = request_url.path().to_owned();
1553                if request_path.ends_with('/') {
1554                    request_path.pop();
1555                }
1556                request_path.push_str("/libpod/play/kube");
1557                request_url.set_path(&request_path);
1558                if let Some(params) = &params {
1559                    let mut query_pairs = request_url.query_pairs_mut();
1560                    if let Some(annotations) = params.annotations {
1561                        query_pairs.append_pair("annotations", annotations);
1562                    }
1563                    if let Some(log_driver) = params.log_driver {
1564                        query_pairs.append_pair("logDriver", log_driver);
1565                    }
1566                    if let Some(log_options) = &params.log_options {
1567                        for value in log_options {
1568                            query_pairs.append_pair("logOptions", &value.to_string());
1569                        }
1570                    }
1571                    if let Some(network) = &params.network {
1572                        for value in network {
1573                            query_pairs.append_pair("network", &value.to_string());
1574                        }
1575                    }
1576                    if let Some(no_hosts) = params.no_hosts {
1577                        query_pairs.append_pair("noHosts", &no_hosts.to_string());
1578                    }
1579                    if let Some(no_trunc) = params.no_trunc {
1580                        query_pairs.append_pair("noTrunc", &no_trunc.to_string());
1581                    }
1582                    if let Some(publish_ports) = &params.publish_ports {
1583                        for value in publish_ports {
1584                            query_pairs.append_pair("publishPorts", &value.to_string());
1585                        }
1586                    }
1587                    if let Some(publish_all_ports) = params.publish_all_ports {
1588                        query_pairs.append_pair("publishAllPorts", &publish_all_ports.to_string());
1589                    }
1590                    if let Some(replace) = params.replace {
1591                        query_pairs.append_pair("replace", &replace.to_string());
1592                    }
1593                    if let Some(service_container) = params.service_container {
1594                        query_pairs.append_pair("serviceContainer", &service_container.to_string());
1595                    }
1596                    if let Some(start) = params.start {
1597                        query_pairs.append_pair("start", &start.to_string());
1598                    }
1599                    if let Some(static_i_ps) = &params.static_i_ps {
1600                        for value in static_i_ps {
1601                            query_pairs.append_pair("staticIPs", &value.to_string());
1602                        }
1603                    }
1604                    if let Some(static_ma_cs) = &params.static_ma_cs {
1605                        for value in static_ma_cs {
1606                            query_pairs.append_pair("staticMACs", &value.to_string());
1607                        }
1608                    }
1609                    if let Some(tls_verify) = params.tls_verify {
1610                        query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
1611                    }
1612                    if let Some(userns) = params.userns {
1613                        query_pairs.append_pair("userns", userns);
1614                    }
1615                    if let Some(wait) = params.wait {
1616                        query_pairs.append_pair("wait", &wait.to_string());
1617                    }
1618                }
1619                let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
1620                req_builder = req_builder.uri(hyper_uri);
1621                let body = serde_json::to_string(&request)?;
1622                req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
1623                req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
1624                Ok(req_builder.body(body)?)
1625            },
1626        ))
1627    }
1628}