libedgegrid 0.1.1

This library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme in Rust
#[derive(Debug, Deserialize)]
pub struct AlertData {
    id: Option<String>,
    name: Option<String>,
    #[serde(rename="type")]
    alert_type: Option<String>,
    #[serde(rename="startDate")]
    start_date: Option<String>,
    #[serde(rename="errorString")]
    error_string: Option<String>,
}

impl fmt::Display for AlertData {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let mut out = String::new();
        ::push_opt(&mut out, "ID:         ", &self.id);
        ::push_opt(&mut out, "Name:       ", &self.name);
        ::push_opt(&mut out, "Type:       ", &self.alert_type);
        ::push_opt(&mut out, "Start Date: ", &self.start_date);
        ::push_opt(&mut out, "Error: ", &self.error_string);
        if out.is_empty() {
            out.push_str("AlertData: Unknown result!");
        } else {
            out = String::from(out.trim_right_matches("\n"));
        }
        write!(f, "{}", out)
    }
}

#[derive(Debug, Deserialize)]
pub struct AlertList {
    alerts: Option<Vec<AlertData>>,
    #[serde(rename="errorString")]
    error_string: Option<String>
}

impl fmt::Display for AlertList {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    let mut out = String::new();

    match self.alerts {
        Some(ref alerts) => {
            for alert in alerts.iter() {
                out.push_str(&format!("{}", alert));
            }
        },
        None            => {},
    }

    ::push_opt(&mut out, "Error: ", &self.error_string);

    if out.is_empty() {
        out.push_str("AlertList: Unknown result!");
    } else {
        out = String::from(out.trim_right_matches("\n"));
    }
        write!(f, "{}", out)
    }
}

#[derive(Debug, Deserialize)]
pub struct AlertsResponse {
    #[serde(rename="alertList")]
    alert_list: Option<AlertList>
}

impl fmt::Display for AlertsResponse {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", ::to_str(&self.alert_list))
    }
}

#[derive(Debug, Deserialize)]
pub struct AlertAttributes {
   #[serde(rename="alert_delay_keyword")]
   adk: Option<String>,
   #[serde(rename="Customer IP")]
   customer_ip: Option<String>,
   email_to_keyword: Option<String>,
   #[serde(rename="Domain")]
   domain: Option<String>,
   #[serde(rename="Property")]
   property: Option<String>,
   #[serde(rename="Data Center")]
   data_center: Option<String>,
   service_keyword: Option<String>,
   #[serde(rename="Reason")]
   reason: Option<String>,
}

impl fmt::Display for AlertAttributes {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let mut out = String::new();
        ::push_opt(&mut out, "Alert Delay Keyword: ", &self.adk);
        ::push_opt(&mut out, "Customer IP:         ", &self.customer_ip);
        ::push_opt(&mut out, "Email To Keyword:    ", &self.email_to_keyword);
        ::push_opt(&mut out, "Domain:              ", &self.domain);
        ::push_opt(&mut out, "Property:            ", &self.property);
        ::push_opt(&mut out, "Data Center:         ", &self.data_center);
        ::push_opt(&mut out, "Service Keyword:     ", &self.service_keyword);
        ::push_opt(&mut out, "Reason:              ", &self.reason);
        if out.is_empty() {
            out.push_str("AlertAttributes: Unknown result!");
        } else {
            out = String::from(out.trim_right_matches("\n"));
        }
        write!(f, "{}", out)
    }
}

#[derive(Debug, Deserialize)]
pub struct AlertDetails {
   id: Option<String>,
   #[serde(rename="type")]
   alert_type: Option<String>,
   name: Option<String>,
   #[serde(rename="startDate")]
   start_date: Option<String>,
   threshold: Option<String>,
   attributes: Option<AlertAttributes>,
   network: Option<String>,
   #[serde(rename="errorString")]
   error_string: Option<String>,
}

impl fmt::Display for AlertDetails {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let mut out = String::new();
        ::push_opt(&mut out, "ID:         ", &self.id);
        ::push_opt(&mut out, "Type:       ", &self.alert_type);
        ::push_opt(&mut out, "Name:       ", &self.name);
        ::push_opt(&mut out, "Start Date: ", &self.start_date);
        ::push_opt(&mut out, "Threshold:  ", &self.threshold);
        ::push_opt(&mut out, "Attributes: ", &self.attributes);
        ::push_opt(&mut out, "Network:    ", &self.network);
        ::push_opt(&mut out, "Error: ", &self.error_string);
        if out.is_empty() {
            out.push_str("AlertDetails: Unknown result!");
        } else {
            out = String::from(out.trim_right_matches("\n"));
        }
        write!(f, "{}", out)
    }
}

#[derive(Debug, Deserialize)]
pub struct AlertDetailsResponse {
    #[serde(rename="alertDetails")]
    alert_details: Option<AlertDetails>,
}

impl fmt::Display for AlertDetailsResponse {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", ::to_str(&self.alert_details))
    }
}