use std::borrow::Borrow;
use std::rc::Rc;
use futures;
use futures::Future;
use hyper;
use super::{configuration, put, query, Error};
pub struct HardwareApiClient<C: hyper::client::connect::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> HardwareApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> HardwareApiClient<C> {
HardwareApiClient {
configuration: configuration,
}
}
}
pub trait HardwareApi {
fn create_hardware_tape_name(
&self,
hardware_tape_name: crate::models::Empty,
hardware_tape_name2: &str,
lnn: &str,
port: i32,
timeout: f32,
reconcile: bool,
) -> Box<dyn Future<Item = crate::models::CreateHardwareTapeNameResponse, Error = Error>>;
fn delete_hardware_tape_name(
&self,
hardware_tape_name: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn get_hardware_fcport(
&self,
hardware_fcport_id: i32,
lnn: &str,
) -> Box<dyn Future<Item = crate::models::HardwareFcports, Error = Error>>;
fn get_hardware_fcports(
&self,
lnn: &str,
limit: i32,
resume: &str,
) -> Box<dyn Future<Item = crate::models::HardwareFcports, Error = Error>>;
fn get_hardware_tapes(
&self,
node: &str,
resume: &str,
devname: &str,
limit: i32,
activepath: &str,
_type: &str,
) -> Box<dyn Future<Item = crate::models::HardwareTapes, Error = Error>>;
fn update_hardware_fcport(
&self,
hardware_fcport: crate::models::HardwareFcport,
hardware_fcport_id: i32,
lnn: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn update_hardware_tape_name(
&self,
hardware_tape_name_params: crate::models::HardwareTapeNameParams,
hardware_tape_name: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
}
impl<C: hyper::client::connect::Connect + 'static> HardwareApi for HardwareApiClient<C> {
fn create_hardware_tape_name(
&self,
hardware_tape_name: crate::models::Empty,
hardware_tape_name2: &str,
lnn: &str,
port: i32,
timeout: f32,
reconcile: bool,
) -> Box<dyn Future<Item = crate::models::CreateHardwareTapeNameResponse, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("lnn", &lnn.to_string())
.append_pair("port", &port.to_string())
.append_pair("timeout", &timeout.to_string())
.append_pair("reconcile", &reconcile.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/hardware/tape/{HardwareTapeName}?{}",
self.configuration.base_path,
q,
HardwareTapeName = hardware_tape_name2
);
query(
self.configuration.borrow(),
&uri_str,
&hardware_tape_name,
hyper::Method::POST,
)
}
fn delete_hardware_tape_name(
&self,
hardware_tape_name: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/hardware/tape/{HardwareTapeName}",
self.configuration.base_path,
HardwareTapeName = hardware_tape_name
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn get_hardware_fcport(
&self,
hardware_fcport_id: i32,
lnn: &str,
) -> Box<dyn Future<Item = crate::models::HardwareFcports, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("lnn", &lnn.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/hardware/fcports/{HardwareFcportId}?{}",
self.configuration.base_path,
q,
HardwareFcportId = hardware_fcport_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_hardware_fcports(
&self,
lnn: &str,
limit: i32,
resume: &str,
) -> Box<dyn Future<Item = crate::models::HardwareFcports, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("lnn", &lnn.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("resume", &resume.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/hardware/fcports?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_hardware_tapes(
&self,
node: &str,
resume: &str,
devname: &str,
limit: i32,
activepath: &str,
_type: &str,
) -> Box<dyn Future<Item = crate::models::HardwareTapes, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("node", &node.to_string())
.append_pair("resume", &resume.to_string())
.append_pair("devname", &devname.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("activepath", &activepath.to_string())
.append_pair("type", &_type.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/hardware/tapes?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn update_hardware_fcport(
&self,
hardware_fcport: crate::models::HardwareFcport,
hardware_fcport_id: i32,
lnn: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("lnn", &lnn.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/hardware/fcports/{HardwareFcportId}?{}",
self.configuration.base_path,
q,
HardwareFcportId = hardware_fcport_id
);
put(self.configuration.borrow(), &uri_str, &hardware_fcport)
}
fn update_hardware_tape_name(
&self,
hardware_tape_name_params: crate::models::HardwareTapeNameParams,
hardware_tape_name: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/hardware/tape/{HardwareTapeName}",
self.configuration.base_path,
HardwareTapeName = hardware_tape_name
);
put(
self.configuration.borrow(),
&uri_str,
&hardware_tape_name_params,
)
}
}