use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use std::pin::Pin;
use std::rc::Rc;
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 NetworksApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: Connect> NetworksApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> NetworksApiClient<C> {
NetworksApiClient { configuration }
}
}
pub trait NetworksApi {
fn network_connect_libpod(
&self,
name: &str,
create: Option<models::NetworkConnectOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn network_create_libpod(
&self,
create: Option<models::NetworkCreateLibpod>,
) -> Pin<Box<dyn Future<Output = Result<models::Network, Error>>>>;
fn network_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::NetworkRmReport>, Error>>>>;
fn network_disconnect_libpod(
&self,
name: &str,
create: Option<models::NetworkDisconnect>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn network_exists_libpod(&self, name: &str)
-> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn network_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::NetworkInspectReport, Error>>>>;
fn network_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Network>, Error>>>>;
fn network_prune_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::NetworkPruneReport>, Error>>>>;
fn network_update_libpod(
&self,
name: &str,
update: Option<models::NetworkUpdateOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: Connect> NetworksApi for NetworksApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn network_connect_libpod(
&self,
name: &str,
create: Option<models::NetworkConnectOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/networks/{name}/connect".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req = req.with_body_param(create);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn network_create_libpod(
&self,
create: Option<models::NetworkCreateLibpod>,
) -> Pin<Box<dyn Future<Output = Result<models::Network, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/networks/create".to_string(),
);
req = req.with_body_param(create);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn network_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::NetworkRmReport>, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/libpod/networks/{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.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn network_disconnect_libpod(
&self,
name: &str,
create: Option<models::NetworkDisconnect>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/networks/{name}/disconnect".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req = req.with_body_param(create);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn network_exists_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/networks/{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 network_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::NetworkInspectReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/networks/{name}/json".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn network_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Network>, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/networks/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 network_prune_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::NetworkPruneReport>, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/networks/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())
}
#[allow(unused_mut)]
fn network_update_libpod(
&self,
name: &str,
update: Option<models::NetworkUpdateOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/networks/{name}/update".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req = req.with_body_param(update);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}