podman_client/containers/
inspect.rs

1use http_body_util::Empty;
2use hyper::body::Bytes;
3
4use crate::{
5    client::Client,
6    models::{
7        connection::SendRequestOptions,
8        lib::Error,
9        podman::containers::inspect::{ContainerInspect, ContainerInspectOptions},
10    },
11    utils::bool_to_str::bool_to_str,
12};
13
14impl Client {
15    pub async fn container_inspect(
16        &self,
17        options: ContainerInspectOptions<'_>,
18    ) -> Result<ContainerInspect, Error> {
19        let mut path = ["/libpod/containers/", options.name, "/json"].concat();
20
21        if let Some(size) = options.size {
22            path += &["?size=", bool_to_str(size)].concat();
23        }
24
25        let (_, data) = self
26            .send_request::<_, (), _>(SendRequestOptions {
27                method: "GET",
28                path: &path,
29                header: None,
30                body: Empty::<Bytes>::new(),
31            })
32            .await?;
33
34        Ok(data)
35    }
36}