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 ContainersCompatApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> ContainersCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(
configuration: Arc<configuration::Configuration<C>>,
) -> ContainersCompatApiClient<C> {
ContainersCompatApiClient { configuration }
}
}
pub trait ContainersCompatApi: Send + Sync {
fn container_archive(
&self,
name: &str,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn container_archive_libpod(
&self,
name: &str,
path: &str,
rename: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn container_attach(
&self,
name: &str,
detach_keys: Option<&str>,
logs: Option<bool>,
stream: Option<bool>,
stdout: Option<bool>,
stderr: Option<bool>,
stdin: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_changes_libpod(
&self,
name: &str,
parent: Option<&str>,
diff_type: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_create(
&self,
body: models::CreateContainerConfig,
name: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerCreateResponse, Error>> + Send>>;
fn container_delete(
&self,
name: &str,
force: Option<bool>,
v: Option<bool>,
link: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_export(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_inspect(
&self,
name: &str,
size: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerJson, Error>> + Send>>;
fn container_kill(
&self,
name: &str,
all: Option<bool>,
signal: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_list(
&self,
all: Option<bool>,
external: Option<bool>,
limit: Option<i32>,
size: Option<bool>,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Container>, Error>> + Send>>;
fn container_logs(
&self,
name: &str,
follow: Option<bool>,
stdout: Option<bool>,
stderr: Option<bool>,
since: Option<&str>,
until: Option<&str>,
timestamps: Option<bool>,
tail: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_pause(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_prune(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ContainersPruneReport>, Error>> + Send>>;
fn container_rename(
&self,
name: &str,
name2: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_resize(
&self,
name: &str,
h: Option<i32>,
w: Option<i32>,
running: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<serde_json::Value, Error>> + Send>>;
fn container_restart(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_start(
&self,
name: &str,
detach_keys: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_stats(
&self,
name: &str,
stream: Option<bool>,
one_shot: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<serde_json::Value, Error>> + Send>>;
fn container_stop(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_top(
&self,
name: &str,
ps_args: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerTopOkBody, Error>> + Send>>;
fn container_unpause(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_update(
&self,
name: &str,
resources: Option<models::UpdateConfig>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn container_wait(
&self,
name: &str,
condition: Option<&str>,
interval: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerWait200Response, Error>> + Send>>;
fn image_commit(
&self,
container: Option<&str>,
repo: Option<&str>,
tag: Option<&str>,
comment: Option<&str>,
author: Option<&str>,
pause: Option<bool>,
changes: Option<&str>,
squash: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn put_container_archive(
&self,
name: &str,
path: &str,
no_overwrite_dir_non_dir: Option<&str>,
copy_uidgid: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
}
impl<C: Connect> ContainersCompatApi for ContainersCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn container_archive(
&self,
name: &str,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/archive".to_string(),
);
req = req.with_query_param("path".to_string(), path.to_string());
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_archive_libpod(
&self,
name: &str,
path: &str,
rename: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/containers/{name}/archive".to_string(),
);
req = req.with_query_param("path".to_string(), path.to_string());
if let Some(ref s) = rename {
let query_value = s.to_string();
req = req.with_query_param("rename".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_attach(
&self,
name: &str,
detach_keys: Option<&str>,
logs: Option<bool>,
stream: Option<bool>,
stdout: Option<bool>,
stderr: Option<bool>,
stdin: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/attach".to_string(),
);
if let Some(ref s) = detach_keys {
let query_value = s.to_string();
req = req.with_query_param("detachKeys".to_string(), query_value);
}
if let Some(ref s) = logs {
let query_value = s.to_string();
req = req.with_query_param("logs".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);
}
if let Some(ref s) = stdout {
let query_value = s.to_string();
req = req.with_query_param("stdout".to_string(), query_value);
}
if let Some(ref s) = stderr {
let query_value = s.to_string();
req = req.with_query_param("stderr".to_string(), query_value);
}
if let Some(ref s) = stdin {
let query_value = s.to_string();
req = req.with_query_param("stdin".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 container_changes_libpod(
&self,
name: &str,
parent: Option<&str>,
diff_type: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/libpod/containers/{name}/changes".to_string(),
);
if let Some(ref s) = parent {
let query_value = s.to_string();
req = req.with_query_param("parent".to_string(), query_value);
}
if let Some(ref s) = diff_type {
let query_value = s.to_string();
req = req.with_query_param("diffType".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 container_create(
&self,
body: models::CreateContainerConfig,
name: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerCreateResponse, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/containers/create".to_string());
if let Some(ref s) = name {
let query_value = s.to_string();
req = req.with_query_param("name".to_string(), query_value);
}
req = req.with_body_param(body);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_delete(
&self,
name: &str,
force: Option<bool>,
v: Option<bool>,
link: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::DELETE,
"/containers/{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);
}
if let Some(ref s) = v {
let query_value = s.to_string();
req = req.with_query_param("v".to_string(), query_value);
}
if let Some(ref s) = link {
let query_value = s.to_string();
req = req.with_query_param("link".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 container_export(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/export".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 container_inspect(
&self,
name: &str,
size: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerJson, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/json".to_string(),
);
if let Some(ref s) = size {
let query_value = s.to_string();
req = req.with_query_param("size".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_kill(
&self,
name: &str,
all: Option<bool>,
signal: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/kill".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) = 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 = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_list(
&self,
all: Option<bool>,
external: Option<bool>,
limit: Option<i32>,
size: Option<bool>,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Container>, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/containers/json".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) = external {
let query_value = s.to_string();
req = req.with_query_param("external".to_string(), query_value);
}
if let Some(ref s) = limit {
let query_value = s.to_string();
req = req.with_query_param("limit".to_string(), query_value);
}
if let Some(ref s) = size {
let query_value = s.to_string();
req = req.with_query_param("size".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.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_logs(
&self,
name: &str,
follow: Option<bool>,
stdout: Option<bool>,
stderr: Option<bool>,
since: Option<&str>,
until: Option<&str>,
timestamps: Option<bool>,
tail: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/logs".to_string(),
);
if let Some(ref s) = follow {
let query_value = s.to_string();
req = req.with_query_param("follow".to_string(), query_value);
}
if let Some(ref s) = stdout {
let query_value = s.to_string();
req = req.with_query_param("stdout".to_string(), query_value);
}
if let Some(ref s) = stderr {
let query_value = s.to_string();
req = req.with_query_param("stderr".to_string(), query_value);
}
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) = timestamps {
let query_value = s.to_string();
req = req.with_query_param("timestamps".to_string(), query_value);
}
if let Some(ref s) = tail {
let query_value = s.to_string();
req = req.with_query_param("tail".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 container_pause(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/pause".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 container_prune(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ContainersPruneReport>, Error>> + Send>>
{
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/containers/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 container_rename(
&self,
name: &str,
name2: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/rename".to_string(),
);
req = req.with_query_param("name".to_string(), name2.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 container_resize(
&self,
name: &str,
h: Option<i32>,
w: Option<i32>,
running: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<serde_json::Value, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/resize".to_string(),
);
if let Some(ref s) = h {
let query_value = s.to_string();
req = req.with_query_param("h".to_string(), query_value);
}
if let Some(ref s) = w {
let query_value = s.to_string();
req = req.with_query_param("w".to_string(), query_value);
}
if let Some(ref s) = running {
let query_value = s.to_string();
req = req.with_query_param("running".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_restart(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/restart".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 = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_start(
&self,
name: &str,
detach_keys: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/start".to_string(),
);
if let Some(ref s) = detach_keys {
let query_value = s.to_string();
req = req.with_query_param("detachKeys".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 container_stats(
&self,
name: &str,
stream: Option<bool>,
one_shot: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<serde_json::Value, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/stats".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) = one_shot {
let query_value = s.to_string();
req = req.with_query_param("one-shot".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_stop(
&self,
name: &str,
t: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{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 = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_top(
&self,
name: &str,
ps_args: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerTopOkBody, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/containers/{name}/top".to_string(),
);
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 container_unpause(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/unpause".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 container_update(
&self,
name: &str,
resources: Option<models::UpdateConfig>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/update".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req = req.with_body_param(resources);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn container_wait(
&self,
name: &str,
condition: Option<&str>,
interval: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<models::ContainerWait200Response, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/containers/{name}/wait".to_string(),
);
if let Some(ref s) = condition {
let query_value = s.to_string();
req = req.with_query_param("condition".to_string(), query_value);
}
if let Some(ref s) = interval {
let query_value = s.to_string();
req = req.with_query_param("interval".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_commit(
&self,
container: Option<&str>,
repo: Option<&str>,
tag: Option<&str>,
comment: Option<&str>,
author: Option<&str>,
pause: Option<bool>,
changes: Option<&str>,
squash: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/commit".to_string());
if let Some(ref s) = container {
let query_value = s.to_string();
req = req.with_query_param("container".to_string(), query_value);
}
if let Some(ref s) = repo {
let query_value = s.to_string();
req = req.with_query_param("repo".to_string(), query_value);
}
if let Some(ref s) = tag {
let query_value = s.to_string();
req = req.with_query_param("tag".to_string(), query_value);
}
if let Some(ref s) = comment {
let query_value = s.to_string();
req = req.with_query_param("comment".to_string(), query_value);
}
if let Some(ref s) = author {
let query_value = s.to_string();
req = req.with_query_param("author".to_string(), query_value);
}
if let Some(ref s) = pause {
let query_value = s.to_string();
req = req.with_query_param("pause".to_string(), query_value);
}
if let Some(ref s) = changes {
let query_value = s.to_string();
req = req.with_query_param("changes".to_string(), query_value);
}
if let Some(ref s) = squash {
let query_value = s.to_string();
req = req.with_query_param("squash".to_string(), query_value);
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn put_container_archive(
&self,
name: &str,
path: &str,
no_overwrite_dir_non_dir: Option<&str>,
copy_uidgid: Option<&str>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::PUT,
"/containers/{name}/archive".to_string(),
);
req = req.with_query_param("path".to_string(), path.to_string());
if let Some(ref s) = no_overwrite_dir_non_dir {
let query_value = s.to_string();
req = req.with_query_param("noOverwriteDirNonDir".to_string(), query_value);
}
if let Some(ref s) = copy_uidgid {
let query_value = s.to_string();
req = req.with_query_param("copyUIDGID".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
req = req.with_body_param(request);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}