podman_client/containers/
start.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::start::ContainerStartOptions,
9    },
10};
11
12impl Client {
13    pub async fn container_start(&self, options: ContainerStartOptions<'_>) -> Result<(), Error> {
14        let mut path = ["/libpod/containers/", options.name, "/start"].concat();
15
16        if let Some(detach_keys) = options.detach_keys {
17            path += &["?detachKeys=", detach_keys].concat();
18        }
19
20        let (_, data) = self
21            .send_request::<_, (), _>(SendRequestOptions {
22                method: "POST",
23                path: &path,
24                header: None,
25                body: Empty::<Bytes>::new(),
26            })
27            .await?;
28
29        Ok(data)
30    }
31}