isilon 5.0.1

Isilon rest api bindings
Documentation
/*
 * Isilon SDK
 *
 * Isilon SDK - Language bindings for the OneFS API
 *
 * OpenAPI spec version: 5
 * Contact: sdk@isilon.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

use std::borrow::Borrow;
use std::rc::Rc;

use futures;
use futures::Future;
use hyper;

use super::{configuration, put, query, Error};

pub struct DedupeApiClient<C: hyper::client::connect::Connect> {
    configuration: Rc<configuration::Configuration<C>>,
}

impl<C: hyper::client::connect::Connect> DedupeApiClient<C> {
    pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DedupeApiClient<C> {
        DedupeApiClient {
            configuration: configuration,
        }
    }
}

pub trait DedupeApi {
    fn get_dedupe_dedupe_summary(
        &self,
    ) -> Box<dyn Future<Item = crate::models::DedupeDedupeSummary, Error = Error>>;
    fn get_dedupe_report(
        &self,
        dedupe_report_id: &str,
        scope: &str,
    ) -> Box<dyn Future<Item = crate::models::DedupeReports, Error = Error>>;
    fn get_dedupe_reports(
        &self,
        sort: &str,
        begin: i32,
        end: i32,
        job_id: i32,
        resume: &str,
        job_type: &str,
        limit: i32,
        dir: &str,
    ) -> Box<dyn Future<Item = crate::models::DedupeReportsExtended, Error = Error>>;
    fn get_dedupe_settings(
        &self,
    ) -> Box<dyn Future<Item = crate::models::DedupeSettings, Error = Error>>;
    fn update_dedupe_settings(
        &self,
        dedupe_settings: crate::models::DedupeSettingsExtended,
    ) -> Box<dyn Future<Item = (), Error = Error>>;
}

impl<C: hyper::client::connect::Connect + 'static> DedupeApi for DedupeApiClient<C> {
    fn get_dedupe_dedupe_summary(
        &self,
    ) -> Box<dyn Future<Item = crate::models::DedupeDedupeSummary, Error = Error>> {
        let uri_str = format!(
            "{}/platform/1/dedupe/dedupe-summary",
            self.configuration.base_path
        );
        query(
            self.configuration.borrow(),
            &uri_str,
            &"",
            hyper::Method::GET,
        )
    }

    fn get_dedupe_report(
        &self,
        dedupe_report_id: &str,
        scope: &str,
    ) -> Box<dyn Future<Item = crate::models::DedupeReports, Error = Error>> {
        let q = ::url::form_urlencoded::Serializer::new(String::new())
            .append_pair("scope", &scope.to_string())
            .finish();
        let uri_str = format!(
            "{}/platform/1/dedupe/reports/{DedupeReportId}?{}",
            self.configuration.base_path,
            q,
            DedupeReportId = dedupe_report_id
        );
        query(
            self.configuration.borrow(),
            &uri_str,
            &"",
            hyper::Method::GET,
        )
    }

    fn get_dedupe_reports(
        &self,
        sort: &str,
        begin: i32,
        end: i32,
        job_id: i32,
        resume: &str,
        job_type: &str,
        limit: i32,
        dir: &str,
    ) -> Box<dyn Future<Item = crate::models::DedupeReportsExtended, Error = Error>> {
        let q = ::url::form_urlencoded::Serializer::new(String::new())
            .append_pair("sort", &sort.to_string())
            .append_pair("begin", &begin.to_string())
            .append_pair("end", &end.to_string())
            .append_pair("job_id", &job_id.to_string())
            .append_pair("resume", &resume.to_string())
            .append_pair("job_type", &job_type.to_string())
            .append_pair("limit", &limit.to_string())
            .append_pair("dir", &dir.to_string())
            .finish();
        let uri_str = format!(
            "{}/platform/1/dedupe/reports?{}",
            self.configuration.base_path, q
        );
        query(
            self.configuration.borrow(),
            &uri_str,
            &"",
            hyper::Method::GET,
        )
    }

    fn get_dedupe_settings(
        &self,
    ) -> Box<dyn Future<Item = crate::models::DedupeSettings, Error = Error>> {
        let uri_str = format!(
            "{}/platform/1/dedupe/settings",
            self.configuration.base_path
        );
        query(
            self.configuration.borrow(),
            &uri_str,
            &"",
            hyper::Method::GET,
        )
    }

    fn update_dedupe_settings(
        &self,
        dedupe_settings: crate::models::DedupeSettingsExtended,
    ) -> Box<dyn Future<Item = (), Error = Error>> {
        let uri_str = format!(
            "{}/platform/1/dedupe/settings",
            self.configuration.base_path
        );

        put(self.configuration.borrow(), &uri_str, &dedupe_settings)
    }
}