podman-client 0.0.2

A native Rust client for the Podman REST API over Unix sockets
Documentation
use http_body_util::Full;
use hyper::body::Bytes;

use crate::{
    client::Client,
    models::{
        connection::SendRequestOptions,
        lib::Error,
        podman::volumes::create::{VolumeCreate, VolumeCreateOptions},
    },
};

impl Client {
    pub async fn volume_create(
        &self,
        options: VolumeCreateOptions<'_>,
    ) -> Result<VolumeCreate, Error> {
        let (_, data) = self
            .send_request::<_, (), _>(SendRequestOptions {
                method: "POST",
                path: "/libpod/volumes/create",
                header: None,
                body: Full::new(Bytes::from(serde_json::to_vec(&options)?)),
            })
            .await?;

        Ok(data)
    }
}