pub async fn create_volume(&self, volume: VolumeCreator) -> Result<(), DockerError> {

        let uri = self.make_uri("/volumes/create");
        let request = Request::post(uri)
            .header("Content-Type", "application/json")
            .body(hyper::Body::from(json::to_string(&volume).unwrap()))
            .unwrap();

        self.execute_async(request).await
            .and_then(|response| {
                match response.status {
                    201 => Ok(()),
                    400 => Err(DockerError::BadParameters(json::from_str(response.body_as_string().as_str()).unwrap())),
                    500 => Err(DockerError::ServerError(json::from_str(response.body_as_string().as_str()).unwrap())),
                    _ => Err(DockerError::UnknownStatus),
                }
            })
    }
/// Create a volume
///
/// Return empty object or DockerError
///
/// # Arguments
/// * `volume` - VolumeCreator struct.
///
/// # Examples
///
/// ```rust
/// # use docker_client::{DockerClient, DockerError};
/// # use docker_client::volume::VolumeCreator;
/// fn main() {
///    let client = DockerClient::new();
///
///     let creator = VolumeCreator::builder()
///         .name("test")
///         .build();
///
///     match client.create_volume(creator) {
///         Ok(_) => {},
///         Err(e) => { println!("Error: {:?}", e); },
///     }
///
/// }
/// ```
Create a volume
Return empty object or DockerError
Create a volume Return empty object or DockerError
pub async fn create_volume(&self, volume: VolumeCreator) -> Result<(), DockerError> {
        let uri = self.make_uri("/volumes/create");
        let request = Request::post(uri)
            .header("Content-Type", "application/json")
            .body(hyper::Body::from(json::to_string(&volume).unwrap()))
            .unwrap();
        self.execute_async(request).await
            .and_then(|response| {
                match response.status {
                    201 => Ok(()),
                    400 => Err(DockerError::BadParameters(json::from_str(response.body_as_string().as_str()).unwrap())),
                    500 => Err(DockerError::ServerError(json::from_str(response.body_as_string().as_str()).unwrap())),
                    _ => Err(DockerError::UnknownStatus),
                }
            })
    }
pub async fn create_volume ( & self , volume : VolumeCreator ) -> Result < ( ) , DockerError > { let uri = self . make_uri ( " " ) ; let request = Request :: post ( uri ) . header ( " " , " " ) . body ( hyper :: Body :: from ( json :: to_string ( & volume ) . unwrap ( ) ) ) . unwrap ( ) ; self . execute_async ( request ) . await . and_then ( | response | { match response . status { 201 => Ok ( ( ) ) , 400 => Err ( DockerError :: BadParameters ( json :: from_str ( response . body_as_string ( ) . as_str ( ) ) . unwrap ( ) ) ) , 500 => Err ( DockerError :: ServerError ( json :: from_str ( response . body_as_string ( ) . as_str ( ) ) . unwrap ( ) ) ) , _ => Err ( DockerError :: UnknownStatus ) , } } ) }
Create a volume
Return empty object or DockerError
Create a volume Return empty object or DockerError
&self
volume
VolumeCreator
&self
volume
VolumeCreator
examples
None
use docker_client::{dockerclient, dockererror};
None
use docker_client::volume::volumecreator;
fn main() {
let client = DockerClient::new().

let creator = VolumeCreator::builder()
.name("test")
.build().




fn main () { let client = DockerClient :: new () . let creator = VolumeCreator :: builder () . name ( " test " ) . build () .