use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use std::pin::Pin;
use std::sync::Arc;
use futures::Future;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::request as __internal_request;
use super::{configuration, Error};
use crate::models;
pub struct VolumesApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> VolumesApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> VolumesApiClient<C> {
VolumesApiClient { configuration }
}
}
pub trait VolumesApi: Send + Sync {
fn volume_create_libpod(
&self,
create: Option<models::VolumeCreateOptions>,
) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>>;
fn volume_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn volume_exists_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn volume_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>>;
fn volume_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::VolumeConfigResponse>, Error>> + Send>>;
fn volume_prune_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::PruneReport>, Error>> + Send>>;
}
impl<C: Connect> VolumesApi for VolumesApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn volume_create_libpod(
&self,
create: Option<models::VolumeCreateOptions>,
) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/volumes/create".to_string(),
);
req = req.with_body_param(create);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn volume_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/libpod/volumes/{name}".to_string(),
);
if let Some(ref s) = force {
let query_value = s.to_string();
req = req.with_query_param("force".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn volume_exists_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/volumes/{name}/exists".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn volume_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/volumes/{name}/json".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn volume_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::VolumeConfigResponse>, Error>> + Send>>
{
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/volumes/json".to_string(),
);
if let Some(ref s) = filters {
let query_value = s.to_string();
req = req.with_query_param("filters".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn volume_prune_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::PruneReport>, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/volumes/prune".to_string(),
);
if let Some(ref s) = filters {
let query_value = s.to_string();
req = req.with_query_param("filters".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
}