podman_client/volumes/
remove.rs

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