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 SecretsApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> SecretsApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> SecretsApiClient<C> {
SecretsApiClient { configuration }
}
}
pub trait SecretsApi: Send + Sync {
fn secret_create_libpod(
&self,
name: &str,
driver: Option<&str>,
driveropts: Option<&str>,
labels: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::SecretCreateLibpod201Response, Error>> + Send>>;
fn secret_delete_libpod(
&self,
name: &str,
all: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn secret_exists_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn secret_inspect_libpod(
&self,
name: &str,
showsecret: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::SecretInfoReport, Error>> + Send>>;
fn secret_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::SecretInfoReport>, Error>> + Send>>;
}
impl<C: Connect> SecretsApi for SecretsApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn secret_create_libpod(
&self,
name: &str,
driver: Option<&str>,
driveropts: Option<&str>,
labels: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::SecretCreateLibpod201Response, Error>> + Send>>
{
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/secrets/create".to_string(),
);
req = req.with_query_param("name".to_string(), name.to_string());
if let Some(ref s) = driver {
let query_value = s.to_string();
req = req.with_query_param("driver".to_string(), query_value);
}
if let Some(ref s) = driveropts {
let query_value = s.to_string();
req = req.with_query_param("driveropts".to_string(), query_value);
}
if let Some(ref s) = labels {
let query_value = s.to_string();
req = req.with_query_param("labels".to_string(), query_value);
}
req = req.with_body_param(request);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn secret_delete_libpod(
&self,
name: &str,
all: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/libpod/secrets/{name}".to_string(),
);
if let Some(ref s) = all {
let query_value = s.to_string();
req = req.with_query_param("all".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 secret_exists_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/secrets/{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 secret_inspect_libpod(
&self,
name: &str,
showsecret: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::SecretInfoReport, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/secrets/{name}/json".to_string(),
);
if let Some(ref s) = showsecret {
let query_value = s.to_string();
req = req.with_query_param("showsecret".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn secret_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::SecretInfoReport>, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/secrets/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())
}
}