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