use std::borrow::Borrow;
use std::rc::Rc;
use futures;
use futures::Future;
use hyper;
use super::{configuration, put, query, Error};
pub struct AntivirusApiClient<C: hyper::client::connect::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> AntivirusApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> AntivirusApiClient<C> {
AntivirusApiClient {
configuration: configuration,
}
}
}
pub trait AntivirusApi {
fn create_antivirus_policy(
&self,
antivirus_policy: crate::models::AntivirusPolicyCreateParams,
) -> Box<dyn Future<Item = crate::models::CreateResponse, Error = Error>>;
fn create_antivirus_scan_item(
&self,
antivirus_scan_item: crate::models::AntivirusScanItem,
) -> Box<dyn Future<Item = crate::models::CreateAntivirusScanItemResponse, Error = Error>>;
fn create_antivirus_server(
&self,
antivirus_server: crate::models::AntivirusServerCreateParams,
) -> Box<dyn Future<Item = crate::models::CreateResponse, Error = Error>>;
fn delete_antivirus_policies(&self) -> Box<dyn Future<Item = (), Error = Error>>;
fn delete_antivirus_policy(
&self,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn delete_antivirus_server(
&self,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn delete_antivirus_servers(&self) -> Box<dyn Future<Item = (), Error = Error>>;
fn delete_reports_scan(
&self,
reports_scan_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn delete_reports_scans(&self, age: i32) -> Box<dyn Future<Item = (), Error = Error>>;
fn get_antivirus_policy(
&self,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusPolicies, Error = Error>>;
fn get_antivirus_quarantine_path(
&self,
antivirus_quarantine_path: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusQuarantine, Error = Error>>;
fn get_antivirus_server(
&self,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusServers, Error = Error>>;
fn get_antivirus_settings(
&self,
) -> Box<dyn Future<Item = crate::models::AntivirusSettings, Error = Error>>;
fn get_reports_scan(
&self,
reports_scan_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsScans, Error = Error>>;
fn get_reports_scans(
&self,
sort: &str,
status: &str,
resume: &str,
limit: i32,
dir: &str,
policy_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsScansExtended, Error = Error>>;
fn get_reports_threat(
&self,
reports_threat_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsThreats, Error = Error>>;
fn get_reports_threats(
&self,
sort: &str,
scan_id: &str,
resume: &str,
limit: i32,
file: &str,
remediation: &str,
dir: &str,
) -> Box<dyn Future<Item = crate::models::ReportsThreatsExtended, Error = Error>>;
fn list_antivirus_policies(
&self,
sort: &str,
limit: i32,
dir: &str,
resume: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusPoliciesExtended, Error = Error>>;
fn list_antivirus_servers(
&self,
sort: &str,
limit: i32,
dir: &str,
resume: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusServersExtended, Error = Error>>;
fn update_antivirus_policy(
&self,
antivirus_policy: crate::models::AntivirusPolicy,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn update_antivirus_quarantine_path(
&self,
antivirus_quarantine_path_params: crate::models::AntivirusQuarantinePathParams,
antivirus_quarantine_path: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn update_antivirus_server(
&self,
antivirus_server: crate::models::AntivirusServer,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>>;
fn update_antivirus_settings(
&self,
antivirus_settings: crate::models::AntivirusSettingsSettings,
) -> Box<dyn Future<Item = (), Error = Error>>;
}
impl<C: hyper::client::connect::Connect + 'static> AntivirusApi for AntivirusApiClient<C> {
fn create_antivirus_policy(
&self,
antivirus_policy: crate::models::AntivirusPolicyCreateParams,
) -> Box<dyn Future<Item = crate::models::CreateResponse, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/policies",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&antivirus_policy,
hyper::Method::POST,
)
}
fn create_antivirus_scan_item(
&self,
antivirus_scan_item: crate::models::AntivirusScanItem,
) -> Box<dyn Future<Item = crate::models::CreateAntivirusScanItemResponse, Error = Error>> {
let uri_str = format!("{}/platform/3/antivirus/scan", self.configuration.base_path);
query(
self.configuration.borrow(),
&uri_str,
&antivirus_scan_item,
hyper::Method::POST,
)
}
fn create_antivirus_server(
&self,
antivirus_server: crate::models::AntivirusServerCreateParams,
) -> Box<dyn Future<Item = crate::models::CreateResponse, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/servers",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&antivirus_server,
hyper::Method::POST,
)
}
fn delete_antivirus_policies(&self) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/policies",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn delete_antivirus_policy(
&self,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/policies/{AntivirusPolicyId}",
self.configuration.base_path,
AntivirusPolicyId = antivirus_policy_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn delete_antivirus_server(
&self,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/servers/{AntivirusServerId}",
self.configuration.base_path,
AntivirusServerId = antivirus_server_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn delete_antivirus_servers(&self) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/servers",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn delete_reports_scan(
&self,
reports_scan_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/reports/scans/{ReportsScanId}",
self.configuration.base_path,
ReportsScanId = reports_scan_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn delete_reports_scans(&self, age: i32) -> Box<dyn Future<Item = (), Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("age", &age.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/antivirus/reports/scans?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::DELETE,
)
}
fn get_antivirus_policy(
&self,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusPolicies, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/policies/{AntivirusPolicyId}",
self.configuration.base_path,
AntivirusPolicyId = antivirus_policy_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_antivirus_quarantine_path(
&self,
antivirus_quarantine_path: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusQuarantine, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/quarantine/{AntivirusQuarantinePath}",
self.configuration.base_path,
AntivirusQuarantinePath = antivirus_quarantine_path
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_antivirus_server(
&self,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusServers, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/servers/{AntivirusServerId}",
self.configuration.base_path,
AntivirusServerId = antivirus_server_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_antivirus_settings(
&self,
) -> Box<dyn Future<Item = crate::models::AntivirusSettings, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/settings",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_reports_scan(
&self,
reports_scan_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsScans, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/reports/scans/{ReportsScanId}",
self.configuration.base_path,
ReportsScanId = reports_scan_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_reports_scans(
&self,
sort: &str,
status: &str,
resume: &str,
limit: i32,
dir: &str,
policy_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsScansExtended, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("sort", &sort.to_string())
.append_pair("status", &status.to_string())
.append_pair("resume", &resume.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("dir", &dir.to_string())
.append_pair("policy_id", &policy_id.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/antivirus/reports/scans?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_reports_threat(
&self,
reports_threat_id: &str,
) -> Box<dyn Future<Item = crate::models::ReportsThreats, Error = Error>> {
let uri_str = format!(
"{}/platform/3/antivirus/reports/threats/{ReportsThreatId}",
self.configuration.base_path,
ReportsThreatId = reports_threat_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_reports_threats(
&self,
sort: &str,
scan_id: &str,
resume: &str,
limit: i32,
file: &str,
remediation: &str,
dir: &str,
) -> Box<dyn Future<Item = crate::models::ReportsThreatsExtended, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("sort", &sort.to_string())
.append_pair("scan_id", &scan_id.to_string())
.append_pair("resume", &resume.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("file", &file.to_string())
.append_pair("remediation", &remediation.to_string())
.append_pair("dir", &dir.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/antivirus/reports/threats?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn list_antivirus_policies(
&self,
sort: &str,
limit: i32,
dir: &str,
resume: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusPoliciesExtended, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("sort", &sort.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("dir", &dir.to_string())
.append_pair("resume", &resume.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/antivirus/policies?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn list_antivirus_servers(
&self,
sort: &str,
limit: i32,
dir: &str,
resume: &str,
) -> Box<dyn Future<Item = crate::models::AntivirusServersExtended, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("sort", &sort.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("dir", &dir.to_string())
.append_pair("resume", &resume.to_string())
.finish();
let uri_str = format!(
"{}/platform/3/antivirus/servers?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn update_antivirus_policy(
&self,
antivirus_policy: crate::models::AntivirusPolicy,
antivirus_policy_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri = format!(
"{}/platform/3/antivirus/policies/{AntivirusPolicyId}",
self.configuration.base_path,
AntivirusPolicyId = antivirus_policy_id
);
put(self.configuration.borrow(), &uri, &antivirus_policy)
}
fn update_antivirus_quarantine_path(
&self,
antivirus_quarantine_path_params: crate::models::AntivirusQuarantinePathParams,
antivirus_quarantine_path: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri = format!(
"{}/platform/3/antivirus/quarantine/{AntivirusQuarantinePath}",
self.configuration.base_path,
AntivirusQuarantinePath = antivirus_quarantine_path
);
put(
self.configuration.borrow(),
&uri,
&antivirus_quarantine_path_params,
)
}
fn update_antivirus_server(
&self,
antivirus_server: crate::models::AntivirusServer,
antivirus_server_id: &str,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri = format!(
"{}/platform/3/antivirus/servers/{AntivirusServerId}",
self.configuration.base_path,
AntivirusServerId = antivirus_server_id
);
put(self.configuration.borrow(), &uri, &antivirus_server)
}
fn update_antivirus_settings(
&self,
antivirus_settings: crate::models::AntivirusSettingsSettings,
) -> Box<dyn Future<Item = (), Error = Error>> {
let uri = format!(
"{}/platform/3/antivirus/settings",
self.configuration.base_path
);
put(self.configuration.borrow(), &uri, &antivirus_settings)
}
}