podman_client/containers/
restart.rs

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