podman_client/containers/
kill.rs

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