podman_client/secrets/
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::secrets::remove::SecretRemoveOptions,
8    },
9    utils::bool_to_str::bool_to_str,
10};
11
12impl Client {
13    pub async fn secret_remove(&self, options: SecretRemoveOptions<'_>) -> Result<(), Error> {
14        let mut path = ["/libpod/secrets/", &options.name].concat();
15
16        if let Some(all) = options.all {
17            path = [path.as_str(), "?all=", bool_to_str(all)].concat();
18        }
19
20        self.send_request::<_, (), ()>(SendRequestOptions {
21            method: "DELETE",
22            path: &path,
23            header: None,
24            body: Empty::<Bytes>::new(),
25        })
26        .await?;
27
28        Ok(())
29    }
30}