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 ImagesCompatApiClient<C: Connect>
where
C: Clone + std::marker::Send + Sync + 'static,
{
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: Connect> ImagesCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> ImagesCompatApiClient<C> {
ImagesCompatApiClient { configuration }
}
}
pub trait ImagesCompatApi: Send + Sync {
fn image_build(
&self,
content_type: Option<&str>,
x_registry_config: Option<&str>,
dockerfile: Option<&str>,
t: Option<&str>,
extrahosts: Option<&str>,
remote: Option<&str>,
q: Option<bool>,
nocache: Option<bool>,
cachefrom: Option<&str>,
pull: Option<bool>,
rm: Option<bool>,
forcerm: Option<bool>,
memory: Option<i32>,
memswap: Option<i32>,
cpushares: Option<i32>,
cpusetcpus: Option<&str>,
cpuperiod: Option<i32>,
cpuquota: Option<i32>,
buildargs: Option<&str>,
shmsize: Option<i32>,
squash: Option<bool>,
labels: Option<&str>,
networkmode: Option<&str>,
platform: Option<&str>,
target: Option<&str>,
outputs: Option<&str>,
input_stream: Option<std::path::PathBuf>,
) -> Pin<Box<dyn Future<Output = Result<models::ImageBuild200Response, Error>> + Send>>;
fn image_create(
&self,
x_registry_auth: Option<&str>,
from_image: Option<&str>,
from_src: Option<&str>,
repo: Option<&str>,
tag: Option<&str>,
message: Option<&str>,
platform: Option<&str>,
input_image: Option<std::path::PathBuf>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn image_delete(
&self,
name: &str,
force: Option<bool>,
noprune: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>;
fn image_get(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn image_get_all(
&self,
names: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn image_history(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::HistoryResponse, Error>> + Send>>;
fn image_inspect(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::ImageInspect, Error>> + Send>>;
fn image_list(
&self,
all: Option<bool>,
filters: Option<&str>,
digests: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Summary>, Error>> + Send>>;
fn image_load(
&self,
quiet: Option<bool>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn image_prune(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>;
fn image_push(
&self,
name: &str,
tag: Option<&str>,
all: Option<bool>,
compress: Option<bool>,
destination: Option<&str>,
x_registry_auth: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn image_search(
&self,
term: Option<&str>,
limit: Option<i32>,
filters: Option<&str>,
tls_verify: Option<bool>,
list_tags: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::ImageSearch200Response, Error>> + Send>>;
fn image_tag(
&self,
name: &str,
repo: Option<&str>,
tag: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
}
impl<C: Connect> ImagesCompatApi for ImagesCompatApiClient<C>
where
C: Clone + std::marker::Send + Sync,
{
#[allow(unused_mut)]
fn image_build(
&self,
content_type: Option<&str>,
x_registry_config: Option<&str>,
dockerfile: Option<&str>,
t: Option<&str>,
extrahosts: Option<&str>,
remote: Option<&str>,
q: Option<bool>,
nocache: Option<bool>,
cachefrom: Option<&str>,
pull: Option<bool>,
rm: Option<bool>,
forcerm: Option<bool>,
memory: Option<i32>,
memswap: Option<i32>,
cpushares: Option<i32>,
cpusetcpus: Option<&str>,
cpuperiod: Option<i32>,
cpuquota: Option<i32>,
buildargs: Option<&str>,
shmsize: Option<i32>,
squash: Option<bool>,
labels: Option<&str>,
networkmode: Option<&str>,
platform: Option<&str>,
target: Option<&str>,
outputs: Option<&str>,
input_stream: Option<std::path::PathBuf>,
) -> Pin<Box<dyn Future<Output = Result<models::ImageBuild200Response, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/build".to_string());
if let Some(ref s) = dockerfile {
let query_value = s.to_string();
req = req.with_query_param("dockerfile".to_string(), query_value);
}
if let Some(ref s) = t {
let query_value = s.to_string();
req = req.with_query_param("t".to_string(), query_value);
}
if let Some(ref s) = extrahosts {
let query_value = s.to_string();
req = req.with_query_param("extrahosts".to_string(), query_value);
}
if let Some(ref s) = remote {
let query_value = s.to_string();
req = req.with_query_param("remote".to_string(), query_value);
}
if let Some(ref s) = q {
let query_value = s.to_string();
req = req.with_query_param("q".to_string(), query_value);
}
if let Some(ref s) = nocache {
let query_value = s.to_string();
req = req.with_query_param("nocache".to_string(), query_value);
}
if let Some(ref s) = cachefrom {
let query_value = s.to_string();
req = req.with_query_param("cachefrom".to_string(), query_value);
}
if let Some(ref s) = pull {
let query_value = s.to_string();
req = req.with_query_param("pull".to_string(), query_value);
}
if let Some(ref s) = rm {
let query_value = s.to_string();
req = req.with_query_param("rm".to_string(), query_value);
}
if let Some(ref s) = forcerm {
let query_value = s.to_string();
req = req.with_query_param("forcerm".to_string(), query_value);
}
if let Some(ref s) = memory {
let query_value = s.to_string();
req = req.with_query_param("memory".to_string(), query_value);
}
if let Some(ref s) = memswap {
let query_value = s.to_string();
req = req.with_query_param("memswap".to_string(), query_value);
}
if let Some(ref s) = cpushares {
let query_value = s.to_string();
req = req.with_query_param("cpushares".to_string(), query_value);
}
if let Some(ref s) = cpusetcpus {
let query_value = s.to_string();
req = req.with_query_param("cpusetcpus".to_string(), query_value);
}
if let Some(ref s) = cpuperiod {
let query_value = s.to_string();
req = req.with_query_param("cpuperiod".to_string(), query_value);
}
if let Some(ref s) = cpuquota {
let query_value = s.to_string();
req = req.with_query_param("cpuquota".to_string(), query_value);
}
if let Some(ref s) = buildargs {
let query_value = s.to_string();
req = req.with_query_param("buildargs".to_string(), query_value);
}
if let Some(ref s) = shmsize {
let query_value = s.to_string();
req = req.with_query_param("shmsize".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);
}
if let Some(ref s) = labels {
let query_value = s.to_string();
req = req.with_query_param("labels".to_string(), query_value);
}
if let Some(ref s) = networkmode {
let query_value = s.to_string();
req = req.with_query_param("networkmode".to_string(), query_value);
}
if let Some(ref s) = platform {
let query_value = s.to_string();
req = req.with_query_param("platform".to_string(), query_value);
}
if let Some(ref s) = target {
let query_value = s.to_string();
req = req.with_query_param("target".to_string(), query_value);
}
if let Some(ref s) = outputs {
let query_value = s.to_string();
req = req.with_query_param("outputs".to_string(), query_value);
}
if let Some(param_value) = content_type {
req = req.with_header_param("Content-Type".to_string(), param_value.to_string());
}
if let Some(param_value) = x_registry_config {
req = req.with_header_param("X-Registry-Config".to_string(), param_value.to_string());
}
req = req.with_body_param(input_stream);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_create(
&self,
x_registry_auth: Option<&str>,
from_image: Option<&str>,
from_src: Option<&str>,
repo: Option<&str>,
tag: Option<&str>,
message: Option<&str>,
platform: Option<&str>,
input_image: Option<std::path::PathBuf>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/images/create".to_string());
if let Some(ref s) = from_image {
let query_value = s.to_string();
req = req.with_query_param("fromImage".to_string(), query_value);
}
if let Some(ref s) = from_src {
let query_value = s.to_string();
req = req.with_query_param("fromSrc".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) = message {
let query_value = s.to_string();
req = req.with_query_param("message".to_string(), query_value);
}
if let Some(ref s) = platform {
let query_value = s.to_string();
req = req.with_query_param("platform".to_string(), query_value);
}
if let Some(param_value) = x_registry_auth {
req = req.with_header_param("X-Registry-Auth".to_string(), param_value.to_string());
}
req = req.with_body_param(input_image);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_delete(
&self,
name: &str,
force: Option<bool>,
noprune: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>
{
let mut req =
__internal_request::Request::new(hyper::Method::DELETE, "/images/{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) = noprune {
let query_value = s.to_string();
req = req.with_query_param("noprune".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_get(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/images/{name}/get".to_string());
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_get_all(
&self,
names: &str,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/images/get".to_string());
req = req.with_query_param("names".to_string(), names.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_history(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::HistoryResponse, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::GET,
"/images/{name}/history".to_string(),
);
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_inspect(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<models::ImageInspect, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/images/{name}/json".to_string());
req = req.with_path_param("name".to_string(), name.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_list(
&self,
all: Option<bool>,
filters: Option<&str>,
digests: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::Summary>, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/images/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) = filters {
let query_value = s.to_string();
req = req.with_query_param("filters".to_string(), query_value);
}
if let Some(ref s) = digests {
let query_value = s.to_string();
req = req.with_query_param("digests".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_load(
&self,
quiet: Option<bool>,
request: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/images/load".to_string());
if let Some(ref s) = quiet {
let query_value = s.to_string();
req = req.with_query_param("quiet".to_string(), query_value);
}
req = req.with_body_param(request);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_prune(
&self,
filters: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<models::ImageDelete200ResponseInner>, Error>> + Send>>
{
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/images/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 image_push(
&self,
name: &str,
tag: Option<&str>,
all: Option<bool>,
compress: Option<bool>,
destination: Option<&str>,
x_registry_auth: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req = __internal_request::Request::new(
hyper::Method::POST,
"/images/{name}/push".to_string(),
);
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) = all {
let query_value = s.to_string();
req = req.with_query_param("all".to_string(), query_value);
}
if let Some(ref s) = compress {
let query_value = s.to_string();
req = req.with_query_param("compress".to_string(), query_value);
}
if let Some(ref s) = destination {
let query_value = s.to_string();
req = req.with_query_param("destination".to_string(), query_value);
}
req = req.with_path_param("name".to_string(), name.to_string());
if let Some(param_value) = x_registry_auth {
req = req.with_header_param("X-Registry-Auth".to_string(), param_value.to_string());
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_search(
&self,
term: Option<&str>,
limit: Option<i32>,
filters: Option<&str>,
tls_verify: Option<bool>,
list_tags: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<models::ImageSearch200Response, Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::GET, "/images/search".to_string());
if let Some(ref s) = term {
let query_value = s.to_string();
req = req.with_query_param("term".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) = filters {
let query_value = s.to_string();
req = req.with_query_param("filters".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) = list_tags {
let query_value = s.to_string();
req = req.with_query_param("listTags".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn image_tag(
&self,
name: &str,
repo: Option<&str>,
tag: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req =
__internal_request::Request::new(hyper::Method::POST, "/images/{name}/tag".to_string());
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);
}
req = req.with_path_param("name".to_string(), name.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}