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 PodsApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: Connect> PodsApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PodsApiClient<C> {
PodsApiClient { configuration }
}
}
pub trait PodsApi {
fn generate_kube_libpod(
&self,
names: Vec<String>,
service: Option<bool>,
r#type: Option<&str>,
replicas: Option<i32>,
no_trunc: Option<bool>,
podman_only: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>;
fn generate_systemd_libpod(
&self,
name: &str,
use_name: Option<bool>,
new: Option<bool>,
no_header: Option<bool>,
start_timeout: Option<i32>,
stop_timeout: Option<i32>,
restart_policy: Option<&str>,
container_prefix: Option<&str>,
pod_prefix: Option<&str>,
separator: Option<&str>,
restart_sec: Option<i32>,
wants: Option<Vec<String>>,
after: Option<Vec<String>>,
requires: Option<Vec<String>>,
additional_env_variables: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, String>, Error>>>>;
fn kube_apply_libpod(
&self,
ca_cert_file: Option<&str>,
kube_config: Option<&str>,
namespace: Option<&str>,
service: Option<bool>,
file: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>;
fn play_kube_down_libpod(
&self,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::PlayKubeReport, Error>>>>;
fn play_kube_libpod(
&self,
annotations: Option<&str>,
log_driver: Option<&str>,
log_options: Option<Vec<String>>,
network: Option<Vec<String>>,
no_hosts: Option<bool>,
no_trunc: Option<bool>,
publish_ports: Option<Vec<String>>,
publish_all_ports: Option<bool>,
replace: Option<bool>,
service_container: Option<bool>,
start: Option<bool>,
static_ips: Option<Vec<String>>,
static_macs: Option<Vec<String>>,
tls_verify: Option<bool>,
userns: Option<&str>,
wait: Option<bool>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PlayKubeReport, Error>>>>;
fn pod_create_libpod(
&self,
create: Option<models::PodSpecGenerator>,
) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>>>>;
fn pod_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::PodRmReport, Error>>>>;
fn pod_exists_libpod(&self, name: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn pod_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::InspectPodData, Error>>>>;
fn pod_kill_libpod(
&self,
name: &str,
signal: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PodKillReport, Error>>>>;
fn pod_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ListPodsReport>, Error>>>>;
fn pod_pause_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodPauseReport, Error>>>>;
fn pod_prune_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::PodPruneReport, Error>>>>;
fn pod_restart_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodRestartReport, Error>>>>;
fn pod_start_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodStartReport, Error>>>>;
fn pod_stats_all_libpod(
&self,
all: Option<bool>,
names_or_ids: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::PodStatsReport>, Error>>>>;
fn pod_stop_libpod(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<models::PodStopReport, Error>>>>;
fn pod_top_libpod(
&self,
name: &str,
stream: Option<bool>,
delay: Option<i32>,
ps_args: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PodTopOkBody, Error>>>>;
fn pod_unpause_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodUnpauseReport, Error>>>>;
}
impl<C: Connect> PodsApi for PodsApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn generate_kube_libpod(
&self,
names: Vec<String>,
service: Option<bool>,
r#type: Option<&str>,
replicas: Option<i32>,
no_trunc: Option<bool>,
podman_only: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/generate/kube".to_string(),
);
req = req.with_query_param("names".to_string(), names.join(",").to_string());
if let Some(ref s) = service {
let query_value = s.to_string();
req = req.with_query_param("service".to_string(), query_value);
}
if let Some(ref s) = r#type {
let query_value = s.to_string();
req = req.with_query_param("type".to_string(), query_value);
}
if let Some(ref s) = replicas {
let query_value = s.to_string();
req = req.with_query_param("replicas".to_string(), query_value);
}
if let Some(ref s) = no_trunc {
let query_value = s.to_string();
req = req.with_query_param("noTrunc".to_string(), query_value);
}
if let Some(ref s) = podman_only {
let query_value = s.to_string();
req = req.with_query_param("podmanOnly".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn generate_systemd_libpod(
&self,
name: &str,
use_name: Option<bool>,
new: Option<bool>,
no_header: Option<bool>,
start_timeout: Option<i32>,
stop_timeout: Option<i32>,
restart_policy: Option<&str>,
container_prefix: Option<&str>,
pod_prefix: Option<&str>,
separator: Option<&str>,
restart_sec: Option<i32>,
wants: Option<Vec<String>>,
after: Option<Vec<String>>,
requires: Option<Vec<String>>,
additional_env_variables: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, String>, Error>>>>
{
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/generate/{name}/systemd".to_string(),
);
if let Some(ref s) = use_name {
let query_value = s.to_string();
req = req.with_query_param("useName".to_string(), query_value);
}
if let Some(ref s) = new {
let query_value = s.to_string();
req = req.with_query_param("new".to_string(), query_value);
}
if let Some(ref s) = no_header {
let query_value = s.to_string();
req = req.with_query_param("noHeader".to_string(), query_value);
}
if let Some(ref s) = start_timeout {
let query_value = s.to_string();
req = req.with_query_param("startTimeout".to_string(), query_value);
}
if let Some(ref s) = stop_timeout {
let query_value = s.to_string();
req = req.with_query_param("stopTimeout".to_string(), query_value);
}
if let Some(ref s) = restart_policy {
let query_value = s.to_string();
req = req.with_query_param("restartPolicy".to_string(), query_value);
}
if let Some(ref s) = container_prefix {
let query_value = s.to_string();
req = req.with_query_param("containerPrefix".to_string(), query_value);
}
if let Some(ref s) = pod_prefix {
let query_value = s.to_string();
req = req.with_query_param("podPrefix".to_string(), query_value);
}
if let Some(ref s) = separator {
let query_value = s.to_string();
req = req.with_query_param("separator".to_string(), query_value);
}
if let Some(ref s) = restart_sec {
let query_value = s.to_string();
req = req.with_query_param("restartSec".to_string(), query_value);
}
if let Some(ref s) = wants {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("wants".to_string(), query_value);
}
if let Some(ref s) = after {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("after".to_string(), query_value);
}
if let Some(ref s) = requires {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("requires".to_string(), query_value);
}
if let Some(ref s) = additional_env_variables {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("additionalEnvVariables".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn kube_apply_libpod(
&self,
ca_cert_file: Option<&str>,
kube_config: Option<&str>,
namespace: Option<&str>,
service: Option<bool>,
file: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/libpod/kube/apply".to_string());
if let Some(ref s) = ca_cert_file {
let query_value = s.to_string();
req = req.with_query_param("caCertFile".to_string(), query_value);
}
if let Some(ref s) = kube_config {
let query_value = s.to_string();
req = req.with_query_param("kubeConfig".to_string(), query_value);
}
if let Some(ref s) = namespace {
let query_value = s.to_string();
req = req.with_query_param("namespace".to_string(), query_value);
}
if let Some(ref s) = service {
let query_value = s.to_string();
req = req.with_query_param("service".to_string(), query_value);
}
if let Some(ref s) = file {
let query_value = s.to_string();
req = req.with_query_param("file".to_string(), query_value);
}
req = req.with_body_param(request);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn play_kube_down_libpod(
&self,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::PlayKubeReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/libpod/play/kube".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.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn play_kube_libpod(
&self,
annotations: Option<&str>,
log_driver: Option<&str>,
log_options: Option<Vec<String>>,
network: Option<Vec<String>>,
no_hosts: Option<bool>,
no_trunc: Option<bool>,
publish_ports: Option<Vec<String>>,
publish_all_ports: Option<bool>,
replace: Option<bool>,
service_container: Option<bool>,
start: Option<bool>,
static_ips: Option<Vec<String>>,
static_macs: Option<Vec<String>>,
tls_verify: Option<bool>,
userns: Option<&str>,
wait: Option<bool>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PlayKubeReport, Error>>>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/libpod/play/kube".to_string());
if let Some(ref s) = annotations {
let query_value = s.to_string();
req = req.with_query_param("annotations".to_string(), query_value);
}
if let Some(ref s) = log_driver {
let query_value = s.to_string();
req = req.with_query_param("logDriver".to_string(), query_value);
}
if let Some(ref s) = log_options {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("logOptions".to_string(), query_value);
}
if let Some(ref s) = network {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("network".to_string(), query_value);
}
if let Some(ref s) = no_hosts {
let query_value = s.to_string();
req = req.with_query_param("noHosts".to_string(), query_value);
}
if let Some(ref s) = no_trunc {
let query_value = s.to_string();
req = req.with_query_param("noTrunc".to_string(), query_value);
}
if let Some(ref s) = publish_ports {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("publishPorts".to_string(), query_value);
}
if let Some(ref s) = publish_all_ports {
let query_value = s.to_string();
req = req.with_query_param("publishAllPorts".to_string(), query_value);
}
if let Some(ref s) = replace {
let query_value = s.to_string();
req = req.with_query_param("replace".to_string(), query_value);
}
if let Some(ref s) = service_container {
let query_value = s.to_string();
req = req.with_query_param("serviceContainer".to_string(), query_value);
}
if let Some(ref s) = start {
let query_value = s.to_string();
req = req.with_query_param("start".to_string(), query_value);
}
if let Some(ref s) = static_ips {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("staticIPs".to_string(), query_value);
}
if let Some(ref s) = static_macs {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("staticMACs".to_string(), query_value);
}
if let Some(ref s) = tls_verify {
let query_value = s.to_string();
req = req.with_query_param("tlsVerify".to_string(), query_value);
}
if let Some(ref s) = userns {
let query_value = s.to_string();
req = req.with_query_param("userns".to_string(), query_value);
}
if let Some(ref s) = wait {
let query_value = s.to_string();
req = req.with_query_param("wait".to_string(), query_value);
}
req = req.with_body_param(request);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_create_libpod(
&self,
create: Option<models::PodSpecGenerator>,
) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/create".to_string(),
);
req = req.with_body_param(create);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_delete_libpod(
&self,
name: &str,
force: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::PodRmReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/libpod/pods/{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 pod_exists_libpod(&self, name: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/pods/{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 pod_inspect_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::InspectPodData, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/pods/{name}/json".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_kill_libpod(
&self,
name: &str,
signal: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PodKillReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/kill".to_string(),
);
if let Some(ref s) = signal {
let query_value = s.to_string();
req = req.with_query_param("signal".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_list_libpod(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ListPodsReport>, Error>>>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/pods/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 pod_pause_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodPauseReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/pause".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_prune_libpod(
&self,
) -> Pin<Box<dyn Future<Output = Result<models::PodPruneReport, Error>>>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/libpod/pods/prune".to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_restart_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodRestartReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/restart".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_start_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodStartReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/start".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_stats_all_libpod(
&self,
all: Option<bool>,
names_or_ids: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::PodStatsReport>, Error>>>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/libpod/pods/stats".to_string());
if let Some(ref s) = all {
let query_value = s.to_string();
req = req.with_query_param("all".to_string(), query_value);
}
if let Some(ref s) = names_or_ids {
let query_value = s
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>()
.join(",");
req = req.with_query_param("namesOrIDs".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_stop_libpod(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<models::PodStopReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/stop".to_string(),
);
if let Some(ref s) = t {
let query_value = s.to_string();
req = req.with_query_param("t".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_top_libpod(
&self,
name: &str,
stream: Option<bool>,
delay: Option<i32>,
ps_args: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::PodTopOkBody, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/pods/{name}/top".to_string(),
);
if let Some(ref s) = stream {
let query_value = s.to_string();
req = req.with_query_param("stream".to_string(), query_value);
}
if let Some(ref s) = delay {
let query_value = s.to_string();
req = req.with_query_param("delay".to_string(), query_value);
}
if let Some(ref s) = ps_args {
let query_value = s.to_string();
req = req.with_query_param("ps_args".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn pod_unpause_libpod(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::PodUnpauseReport, Error>>>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/libpod/pods/{name}/unpause".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
}