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 SystemCompatApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> SystemCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> SystemCompatApiClient<C> {
SystemCompatApiClient { configuration }
}
}
pub trait SystemCompatApi: Send + Sync {
fn system_auth(
&self,
auth_config: Option<models::AuthConfig>,
) -> Pin<Box<dyn Future<Output = Result<models::AuthReport, Error>> + Send>>;
fn system_data_usage(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemDfReport, Error>> + Send>>;
fn system_events(
&self,
since: Option<&str>,
until: Option<&str>,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn system_info(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn system_ping(&self) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>>;
fn system_version(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemComponentVersion, Error>> + Send>>;
}
impl<C: Connect> SystemCompatApi for SystemCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn system_auth(
&self,
auth_config: Option<models::AuthConfig>,
) -> Pin<Box<dyn Future<Output = Result<models::AuthReport, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/auth".to_string());
req = req.with_body_param(auth_config);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_data_usage(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemDfReport, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/system/df".to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_events(
&self,
since: Option<&str>,
until: Option<&str>,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/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);
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn system_info(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/info".to_string());
req = req.returns_nothing();
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_version(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::SystemComponentVersion, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/version".to_string());
req.execute(self.configuration.borrow())
}
}