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 SystemApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> SystemApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> SystemApiClient<C> {
SystemApiClient { configuration }
}
}
pub trait SystemApi: Send + Sync {
fn system_data_usage_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemDfReport, Error>> + Send>>;
fn system_events_libpod(
&self,
since: Option<&str>,
until: Option<&str>,
filters: Option<&str>,
stream: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn system_info_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::LibpodInfo, Error>> + Send>>;
fn system_ping(&self) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>>;
fn system_prune_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemPruneReport, Error>> + Send>>;
fn system_version_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemComponentVersion, Error>> + Send>>;
}
impl<C: Connect> SystemApi for SystemApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn system_data_usage_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemDfReport, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/system/df".to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_events_libpod(
&self,
since: Option<&str>,
until: Option<&str>,
filters: Option<&str>,
stream: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/events".to_string());
if let Some(ref s) = since {
let query_value = s.to_string();
req = req.with_query_param("since".to_string(), query_value);
}
if let Some(ref s) = until {
let query_value = s.to_string();
req = req.with_query_param("until".to_string(), query_value);
}
if let Some(ref s) = filters {
let query_value = s.to_string();
req = req.with_query_param("filters".to_string(), query_value);
}
if let Some(ref s) = stream {
let query_value = s.to_string();
req = req.with_query_param("stream".to_string(), query_value);
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_info_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::LibpodInfo, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/info".to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_ping(&self) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/_ping".to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_prune_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemPruneReport, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/system/prune".to_string(),
);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_version_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemComponentVersion, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/version".to_string());
req.execute(self.configuration.borrow())
}
}