Skip to content

Commit

Permalink
Merge pull request #2 from SDS/vmax_propertiesraw
Browse files Browse the repository at this point in the history
Vmax propertiesraw
  • Loading branch information
cholco202 authored and GitHub Enterprise committed Aug 30, 2018
2 parents ce1a893 + 574f75d commit 1059fa1
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/vmax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ where
.basic_auth(config.user.clone(), Some(config.password.clone()))
.send()?
.error_for_status()?;
let deserialized: T = j.json()?;
Ok(deserialized.into_point(Some(point_name)))
let deserialized: Result<T, reqwest::Error> = j.json();
debug!("deserialized: {:?}", deserialized);
Ok(deserialized?.into_point(Some(point_name)))
}

/* Changed the GET to POST and added body parameter to pass additional fields to
Expand Down Expand Up @@ -998,12 +999,15 @@ pub fn get_vmax_array_raw(
}

// This is split into objects and sub-objects based upon the new Unisphere release v9
// Added Option here since some of the arrays polled are not returning the same output, may need to be updated again down the road
#[derive(Debug, Deserialize)]
pub struct VmaxSystemCapacity {
#[serde(rename = "symmetrixId")]
pub symmetrix_id: String,
pub device_count: u64,
pub ucode: String,
#[serde(rename = "targetUcode")]
pub targetucode: Option<String>,
pub model: String,
pub local: bool,
pub default_fba_srp: String,
Expand All @@ -1023,6 +1027,9 @@ impl IntoPoint for VmaxSystemCapacity {
p.add_tag("symmetrix_id", TsValue::String(self.symmetrix_id.clone()));
p.add_field("device_count", TsValue::Long(self.device_count));
p.add_field("ucode", TsValue::String(self.ucode.clone()));
if let Some(ref target_ucode) = self.targetucode {
p.add_field("targetucode", TsValue::String(target_ucode.clone()));
}
p.add_field("model", TsValue::String(self.model.clone()));
p.add_field("local", TsValue::Boolean(self.local.clone()));
p.add_tag(
Expand Down Expand Up @@ -1105,19 +1112,22 @@ impl ChildPoint for SystemEfficiency {
}
}

// Added Option here since some of the arrays polled are not returning the same output, may need to be updated again down the road
#[allow(non_snake_case)]
#[derive(Debug, Deserialize)]
pub struct MetaDataUsage {
pub system_meta_data_used_percent: f64,
pub system_meta_data_used_percent: Option<f64>,
pub replication_cache_used_percent: u64,
}

impl ChildPoint for MetaDataUsage {
fn sub_point(&self, p: &mut TsPoint) {
p.add_field(
"system_meta_data_used_percent",
TsValue::Float(self.system_meta_data_used_percent),
);
if let Some(system_meta_data) = self.system_meta_data_used_percent {
p.add_field(
"system_meta_data_used_percent",
TsValue::Float(system_meta_data),
);
}
p.add_field(
"replication_cache_used_percent",
TsValue::Long(self.replication_cache_used_percent),
Expand Down

0 comments on commit 1059fa1

Please sign in to comment.