use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto::xml::error::*;
use rusoto_core::proto::xml::util::{
characters, deserialize_elements, end_element, find_start_element, peek_at_name, skip_tree,
start_element,
};
use rusoto_core::proto::xml::util::{Next, Peek, XmlParseError, XmlResponse};
use rusoto_core::signature::SignedRequest;
use serde_urlencoded;
use std::str::FromStr;
use xml::reader::ParserConfig;
use xml::EventReader;
struct ActionsEnabledDeserializer;
impl ActionsEnabledDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<bool, XmlParseError> {
start_element(tag_name, stack)?;
let obj = bool::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct AlarmArnDeserializer;
impl AlarmArnDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct AlarmDescriptionDeserializer;
impl AlarmDescriptionDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct AlarmHistoryItem {
pub alarm_name: Option<String>,
pub history_data: Option<String>,
pub history_item_type: Option<String>,
pub history_summary: Option<String>,
pub timestamp: Option<String>,
}
struct AlarmHistoryItemDeserializer;
impl AlarmHistoryItemDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<AlarmHistoryItem, XmlParseError> {
deserialize_elements::<_, AlarmHistoryItem, _>(tag_name, stack, |name, stack, obj| {
match name {
"AlarmName" => {
obj.alarm_name = Some(AlarmNameDeserializer::deserialize("AlarmName", stack)?);
}
"HistoryData" => {
obj.history_data =
Some(HistoryDataDeserializer::deserialize("HistoryData", stack)?);
}
"HistoryItemType" => {
obj.history_item_type = Some(HistoryItemTypeDeserializer::deserialize(
"HistoryItemType",
stack,
)?);
}
"HistorySummary" => {
obj.history_summary = Some(HistorySummaryDeserializer::deserialize(
"HistorySummary",
stack,
)?);
}
"Timestamp" => {
obj.timestamp = Some(TimestampDeserializer::deserialize("Timestamp", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct AlarmHistoryItemsDeserializer;
impl AlarmHistoryItemsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<AlarmHistoryItem>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(AlarmHistoryItemDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct AlarmNameDeserializer;
impl AlarmNameDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct AlarmNamesSerializer;
impl AlarmNamesSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct ComparisonOperatorDeserializer;
impl ComparisonOperatorDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct CountsSerializer;
impl CountsSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<f64>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct DashboardArnDeserializer;
impl DashboardArnDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DashboardBodyDeserializer;
impl DashboardBodyDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DashboardEntriesDeserializer;
impl DashboardEntriesDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<DashboardEntry>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(DashboardEntryDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DashboardEntry {
pub dashboard_arn: Option<String>,
pub dashboard_name: Option<String>,
pub last_modified: Option<String>,
pub size: Option<i64>,
}
struct DashboardEntryDeserializer;
impl DashboardEntryDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DashboardEntry, XmlParseError> {
deserialize_elements::<_, DashboardEntry, _>(tag_name, stack, |name, stack, obj| {
match name {
"DashboardArn" => {
obj.dashboard_arn = Some(DashboardArnDeserializer::deserialize(
"DashboardArn",
stack,
)?);
}
"DashboardName" => {
obj.dashboard_name = Some(DashboardNameDeserializer::deserialize(
"DashboardName",
stack,
)?);
}
"LastModified" => {
obj.last_modified = Some(LastModifiedDeserializer::deserialize(
"LastModified",
stack,
)?);
}
"Size" => {
obj.size = Some(SizeDeserializer::deserialize("Size", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct DashboardNameDeserializer;
impl DashboardNameDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DashboardNamesSerializer;
impl DashboardNamesSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DashboardValidationMessage {
pub data_path: Option<String>,
pub message: Option<String>,
}
struct DashboardValidationMessageDeserializer;
impl DashboardValidationMessageDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DashboardValidationMessage, XmlParseError> {
deserialize_elements::<_, DashboardValidationMessage, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"DataPath" => {
obj.data_path = Some(DataPathDeserializer::deserialize("DataPath", stack)?);
}
"Message" => {
obj.message = Some(MessageDeserializer::deserialize("Message", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
struct DashboardValidationMessagesDeserializer;
impl DashboardValidationMessagesDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<DashboardValidationMessage>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(DashboardValidationMessageDeserializer::deserialize(
"member", stack,
)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct DataPathDeserializer;
impl DataPathDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Datapoint {
pub average: Option<f64>,
pub extended_statistics: Option<::std::collections::HashMap<String, f64>>,
pub maximum: Option<f64>,
pub minimum: Option<f64>,
pub sample_count: Option<f64>,
pub sum: Option<f64>,
pub timestamp: Option<String>,
pub unit: Option<String>,
}
struct DatapointDeserializer;
impl DatapointDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Datapoint, XmlParseError> {
deserialize_elements::<_, Datapoint, _>(tag_name, stack, |name, stack, obj| {
match name {
"Average" => {
obj.average = Some(DatapointValueDeserializer::deserialize("Average", stack)?);
}
"ExtendedStatistics" => {
obj.extended_statistics = Some(DatapointValueMapDeserializer::deserialize(
"ExtendedStatistics",
stack,
)?);
}
"Maximum" => {
obj.maximum = Some(DatapointValueDeserializer::deserialize("Maximum", stack)?);
}
"Minimum" => {
obj.minimum = Some(DatapointValueDeserializer::deserialize("Minimum", stack)?);
}
"SampleCount" => {
obj.sample_count = Some(DatapointValueDeserializer::deserialize(
"SampleCount",
stack,
)?);
}
"Sum" => {
obj.sum = Some(DatapointValueDeserializer::deserialize("Sum", stack)?);
}
"Timestamp" => {
obj.timestamp = Some(TimestampDeserializer::deserialize("Timestamp", stack)?);
}
"Unit" => {
obj.unit = Some(StandardUnitDeserializer::deserialize("Unit", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct DatapointValueDeserializer;
impl DatapointValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<f64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = f64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DatapointValueMapDeserializer;
impl DatapointValueMapDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<::std::collections::HashMap<String, f64>, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ::std::collections::HashMap::new();
while peek_at_name(stack)? == "entry" {
start_element("entry", stack)?;
let key = ExtendedStatisticDeserializer::deserialize("key", stack)?;
let value = DatapointValueDeserializer::deserialize("value", stack)?;
obj.insert(key, value);
end_element("entry", stack)?;
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DatapointValuesDeserializer;
impl DatapointValuesDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<f64>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(DatapointValueDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct DatapointsDeserializer;
impl DatapointsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Datapoint>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(DatapointDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct DatapointsToAlarmDeserializer;
impl DatapointsToAlarmDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<i64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = i64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DeleteAlarmsInput {
pub alarm_names: Vec<String>,
}
struct DeleteAlarmsInputSerializer;
impl DeleteAlarmsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DeleteAlarmsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
AlarmNamesSerializer::serialize(
params,
&format!("{}{}", prefix, "AlarmNames"),
&obj.alarm_names,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DeleteDashboardsInput {
pub dashboard_names: Vec<String>,
}
struct DeleteDashboardsInputSerializer;
impl DeleteDashboardsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DeleteDashboardsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
DashboardNamesSerializer::serialize(
params,
&format!("{}{}", prefix, "DashboardNames"),
&obj.dashboard_names,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DeleteDashboardsOutput {}
struct DeleteDashboardsOutputDeserializer;
impl DeleteDashboardsOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DeleteDashboardsOutput, XmlParseError> {
start_element(tag_name, stack)?;
let obj = DeleteDashboardsOutput::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmHistoryInput {
pub alarm_name: Option<String>,
pub end_date: Option<String>,
pub history_item_type: Option<String>,
pub max_records: Option<i64>,
pub next_token: Option<String>,
pub start_date: Option<String>,
}
struct DescribeAlarmHistoryInputSerializer;
impl DescribeAlarmHistoryInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DescribeAlarmHistoryInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.alarm_name {
params.put(&format!("{}{}", prefix, "AlarmName"), &field_value);
}
if let Some(ref field_value) = obj.end_date {
params.put(&format!("{}{}", prefix, "EndDate"), &field_value);
}
if let Some(ref field_value) = obj.history_item_type {
params.put(&format!("{}{}", prefix, "HistoryItemType"), &field_value);
}
if let Some(ref field_value) = obj.max_records {
params.put(&format!("{}{}", prefix, "MaxRecords"), &field_value);
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
if let Some(ref field_value) = obj.start_date {
params.put(&format!("{}{}", prefix, "StartDate"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmHistoryOutput {
pub alarm_history_items: Option<Vec<AlarmHistoryItem>>,
pub next_token: Option<String>,
}
struct DescribeAlarmHistoryOutputDeserializer;
impl DescribeAlarmHistoryOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DescribeAlarmHistoryOutput, XmlParseError> {
deserialize_elements::<_, DescribeAlarmHistoryOutput, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"AlarmHistoryItems" => {
obj.alarm_history_items.get_or_insert(vec![]).extend(
AlarmHistoryItemsDeserializer::deserialize("AlarmHistoryItems", stack)?,
);
}
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmsForMetricInput {
pub dimensions: Option<Vec<Dimension>>,
pub extended_statistic: Option<String>,
pub metric_name: String,
pub namespace: String,
pub period: Option<i64>,
pub statistic: Option<String>,
pub unit: Option<String>,
}
struct DescribeAlarmsForMetricInputSerializer;
impl DescribeAlarmsForMetricInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DescribeAlarmsForMetricInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.dimensions {
DimensionsSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
if let Some(ref field_value) = obj.extended_statistic {
params.put(&format!("{}{}", prefix, "ExtendedStatistic"), &field_value);
}
params.put(&format!("{}{}", prefix, "MetricName"), &obj.metric_name);
params.put(&format!("{}{}", prefix, "Namespace"), &obj.namespace);
if let Some(ref field_value) = obj.period {
params.put(&format!("{}{}", prefix, "Period"), &field_value);
}
if let Some(ref field_value) = obj.statistic {
params.put(&format!("{}{}", prefix, "Statistic"), &field_value);
}
if let Some(ref field_value) = obj.unit {
params.put(&format!("{}{}", prefix, "Unit"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmsForMetricOutput {
pub metric_alarms: Option<Vec<MetricAlarm>>,
}
struct DescribeAlarmsForMetricOutputDeserializer;
impl DescribeAlarmsForMetricOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DescribeAlarmsForMetricOutput, XmlParseError> {
deserialize_elements::<_, DescribeAlarmsForMetricOutput, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"MetricAlarms" => {
obj.metric_alarms.get_or_insert(vec![]).extend(
MetricAlarmsDeserializer::deserialize("MetricAlarms", stack)?,
);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmsInput {
pub action_prefix: Option<String>,
pub alarm_name_prefix: Option<String>,
pub alarm_names: Option<Vec<String>>,
pub max_records: Option<i64>,
pub next_token: Option<String>,
pub state_value: Option<String>,
}
struct DescribeAlarmsInputSerializer;
impl DescribeAlarmsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DescribeAlarmsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.action_prefix {
params.put(&format!("{}{}", prefix, "ActionPrefix"), &field_value);
}
if let Some(ref field_value) = obj.alarm_name_prefix {
params.put(&format!("{}{}", prefix, "AlarmNamePrefix"), &field_value);
}
if let Some(ref field_value) = obj.alarm_names {
AlarmNamesSerializer::serialize(
params,
&format!("{}{}", prefix, "AlarmNames"),
field_value,
);
}
if let Some(ref field_value) = obj.max_records {
params.put(&format!("{}{}", prefix, "MaxRecords"), &field_value);
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
if let Some(ref field_value) = obj.state_value {
params.put(&format!("{}{}", prefix, "StateValue"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DescribeAlarmsOutput {
pub metric_alarms: Option<Vec<MetricAlarm>>,
pub next_token: Option<String>,
}
struct DescribeAlarmsOutputDeserializer;
impl DescribeAlarmsOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<DescribeAlarmsOutput, XmlParseError> {
deserialize_elements::<_, DescribeAlarmsOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"MetricAlarms" => {
obj.metric_alarms.get_or_insert(vec![]).extend(
MetricAlarmsDeserializer::deserialize("MetricAlarms", stack)?,
);
}
"NextToken" => {
obj.next_token = Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Dimension {
pub name: String,
pub value: String,
}
struct DimensionDeserializer;
impl DimensionDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Dimension, XmlParseError> {
deserialize_elements::<_, Dimension, _>(tag_name, stack, |name, stack, obj| {
match name {
"Name" => {
obj.name = DimensionNameDeserializer::deserialize("Name", stack)?;
}
"Value" => {
obj.value = DimensionValueDeserializer::deserialize("Value", stack)?;
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct DimensionSerializer;
impl DimensionSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Dimension) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Name"), &obj.name);
params.put(&format!("{}{}", prefix, "Value"), &obj.value);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DimensionFilter {
pub name: String,
pub value: Option<String>,
}
struct DimensionFilterSerializer;
impl DimensionFilterSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DimensionFilter) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Name"), &obj.name);
if let Some(ref field_value) = obj.value {
params.put(&format!("{}{}", prefix, "Value"), &field_value);
}
}
}
struct DimensionFiltersSerializer;
impl DimensionFiltersSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<DimensionFilter>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
DimensionFilterSerializer::serialize(params, &key, obj);
}
}
}
struct DimensionNameDeserializer;
impl DimensionNameDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DimensionValueDeserializer;
impl DimensionValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DimensionsDeserializer;
impl DimensionsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Dimension>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(DimensionDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct DimensionsSerializer;
impl DimensionsSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<Dimension>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
DimensionSerializer::serialize(params, &key, obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DisableAlarmActionsInput {
pub alarm_names: Vec<String>,
}
struct DisableAlarmActionsInputSerializer;
impl DisableAlarmActionsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DisableAlarmActionsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
AlarmNamesSerializer::serialize(
params,
&format!("{}{}", prefix, "AlarmNames"),
&obj.alarm_names,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct EnableAlarmActionsInput {
pub alarm_names: Vec<String>,
}
struct EnableAlarmActionsInputSerializer;
impl EnableAlarmActionsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &EnableAlarmActionsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
AlarmNamesSerializer::serialize(
params,
&format!("{}{}", prefix, "AlarmNames"),
&obj.alarm_names,
);
}
}
struct EvaluateLowSampleCountPercentileDeserializer;
impl EvaluateLowSampleCountPercentileDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct EvaluationPeriodsDeserializer;
impl EvaluationPeriodsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<i64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = i64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ExtendedStatisticDeserializer;
impl ExtendedStatisticDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ExtendedStatisticsSerializer;
impl ExtendedStatisticsSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetDashboardInput {
pub dashboard_name: String,
}
struct GetDashboardInputSerializer;
impl GetDashboardInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetDashboardInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "DashboardName"),
&obj.dashboard_name,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetDashboardOutput {
pub dashboard_arn: Option<String>,
pub dashboard_body: Option<String>,
pub dashboard_name: Option<String>,
}
struct GetDashboardOutputDeserializer;
impl GetDashboardOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetDashboardOutput, XmlParseError> {
deserialize_elements::<_, GetDashboardOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"DashboardArn" => {
obj.dashboard_arn = Some(DashboardArnDeserializer::deserialize(
"DashboardArn",
stack,
)?);
}
"DashboardBody" => {
obj.dashboard_body = Some(DashboardBodyDeserializer::deserialize(
"DashboardBody",
stack,
)?);
}
"DashboardName" => {
obj.dashboard_name = Some(DashboardNameDeserializer::deserialize(
"DashboardName",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricDataInput {
pub end_time: String,
pub max_datapoints: Option<i64>,
pub metric_data_queries: Vec<MetricDataQuery>,
pub next_token: Option<String>,
pub scan_by: Option<String>,
pub start_time: String,
}
struct GetMetricDataInputSerializer;
impl GetMetricDataInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetMetricDataInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "EndTime"), &obj.end_time);
if let Some(ref field_value) = obj.max_datapoints {
params.put(&format!("{}{}", prefix, "MaxDatapoints"), &field_value);
}
MetricDataQueriesSerializer::serialize(
params,
&format!("{}{}", prefix, "MetricDataQueries"),
&obj.metric_data_queries,
);
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
if let Some(ref field_value) = obj.scan_by {
params.put(&format!("{}{}", prefix, "ScanBy"), &field_value);
}
params.put(&format!("{}{}", prefix, "StartTime"), &obj.start_time);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricDataOutput {
pub messages: Option<Vec<MessageData>>,
pub metric_data_results: Option<Vec<MetricDataResult>>,
pub next_token: Option<String>,
}
struct GetMetricDataOutputDeserializer;
impl GetMetricDataOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetMetricDataOutput, XmlParseError> {
deserialize_elements::<_, GetMetricDataOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"Messages" => {
obj.messages.get_or_insert(vec![]).extend(
MetricDataResultMessagesDeserializer::deserialize("Messages", stack)?,
);
}
"MetricDataResults" => {
obj.metric_data_results.get_or_insert(vec![]).extend(
MetricDataResultsDeserializer::deserialize("MetricDataResults", stack)?,
);
}
"NextToken" => {
obj.next_token = Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricStatisticsInput {
pub dimensions: Option<Vec<Dimension>>,
pub end_time: String,
pub extended_statistics: Option<Vec<String>>,
pub metric_name: String,
pub namespace: String,
pub period: i64,
pub start_time: String,
pub statistics: Option<Vec<String>>,
pub unit: Option<String>,
}
struct GetMetricStatisticsInputSerializer;
impl GetMetricStatisticsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetMetricStatisticsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.dimensions {
DimensionsSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
params.put(&format!("{}{}", prefix, "EndTime"), &obj.end_time);
if let Some(ref field_value) = obj.extended_statistics {
ExtendedStatisticsSerializer::serialize(
params,
&format!("{}{}", prefix, "ExtendedStatistics"),
field_value,
);
}
params.put(&format!("{}{}", prefix, "MetricName"), &obj.metric_name);
params.put(&format!("{}{}", prefix, "Namespace"), &obj.namespace);
params.put(&format!("{}{}", prefix, "Period"), &obj.period);
params.put(&format!("{}{}", prefix, "StartTime"), &obj.start_time);
if let Some(ref field_value) = obj.statistics {
StatisticsSerializer::serialize(
params,
&format!("{}{}", prefix, "Statistics"),
field_value,
);
}
if let Some(ref field_value) = obj.unit {
params.put(&format!("{}{}", prefix, "Unit"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricStatisticsOutput {
pub datapoints: Option<Vec<Datapoint>>,
pub label: Option<String>,
}
struct GetMetricStatisticsOutputDeserializer;
impl GetMetricStatisticsOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetMetricStatisticsOutput, XmlParseError> {
deserialize_elements::<_, GetMetricStatisticsOutput, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Datapoints" => {
obj.datapoints
.get_or_insert(vec![])
.extend(DatapointsDeserializer::deserialize("Datapoints", stack)?);
}
"Label" => {
obj.label = Some(MetricLabelDeserializer::deserialize("Label", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricWidgetImageInput {
pub metric_widget: String,
pub output_format: Option<String>,
}
struct GetMetricWidgetImageInputSerializer;
impl GetMetricWidgetImageInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetMetricWidgetImageInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "MetricWidget"), &obj.metric_widget);
if let Some(ref field_value) = obj.output_format {
params.put(&format!("{}{}", prefix, "OutputFormat"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetMetricWidgetImageOutput {
pub metric_widget_image: Option<bytes::Bytes>,
}
struct GetMetricWidgetImageOutputDeserializer;
impl GetMetricWidgetImageOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetMetricWidgetImageOutput, XmlParseError> {
deserialize_elements::<_, GetMetricWidgetImageOutput, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"MetricWidgetImage" => {
obj.metric_widget_image = Some(MetricWidgetImageDeserializer::deserialize(
"MetricWidgetImage",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
struct HistoryDataDeserializer;
impl HistoryDataDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct HistoryItemTypeDeserializer;
impl HistoryItemTypeDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct HistorySummaryDeserializer;
impl HistorySummaryDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct LastModifiedDeserializer;
impl LastModifiedDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListDashboardsInput {
pub dashboard_name_prefix: Option<String>,
pub next_token: Option<String>,
}
struct ListDashboardsInputSerializer;
impl ListDashboardsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListDashboardsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.dashboard_name_prefix {
params.put(
&format!("{}{}", prefix, "DashboardNamePrefix"),
&field_value,
);
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListDashboardsOutput {
pub dashboard_entries: Option<Vec<DashboardEntry>>,
pub next_token: Option<String>,
}
struct ListDashboardsOutputDeserializer;
impl ListDashboardsOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListDashboardsOutput, XmlParseError> {
deserialize_elements::<_, ListDashboardsOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"DashboardEntries" => {
obj.dashboard_entries.get_or_insert(vec![]).extend(
DashboardEntriesDeserializer::deserialize("DashboardEntries", stack)?,
);
}
"NextToken" => {
obj.next_token = Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListMetricsInput {
pub dimensions: Option<Vec<DimensionFilter>>,
pub metric_name: Option<String>,
pub namespace: Option<String>,
pub next_token: Option<String>,
}
struct ListMetricsInputSerializer;
impl ListMetricsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListMetricsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.dimensions {
DimensionFiltersSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
if let Some(ref field_value) = obj.metric_name {
params.put(&format!("{}{}", prefix, "MetricName"), &field_value);
}
if let Some(ref field_value) = obj.namespace {
params.put(&format!("{}{}", prefix, "Namespace"), &field_value);
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListMetricsOutput {
pub metrics: Option<Vec<Metric>>,
pub next_token: Option<String>,
}
struct ListMetricsOutputDeserializer;
impl ListMetricsOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListMetricsOutput, XmlParseError> {
deserialize_elements::<_, ListMetricsOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"Metrics" => {
obj.metrics
.get_or_insert(vec![])
.extend(MetricsDeserializer::deserialize("Metrics", stack)?);
}
"NextToken" => {
obj.next_token = Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTagsForResourceInput {
pub resource_arn: String,
}
struct ListTagsForResourceInputSerializer;
impl ListTagsForResourceInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListTagsForResourceInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceARN"), &obj.resource_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTagsForResourceOutput {
pub tags: Option<Vec<Tag>>,
}
struct ListTagsForResourceOutputDeserializer;
impl ListTagsForResourceOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListTagsForResourceOutput, XmlParseError> {
deserialize_elements::<_, ListTagsForResourceOutput, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Tags" => {
obj.tags
.get_or_insert(vec![])
.extend(TagListDeserializer::deserialize("Tags", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
struct MessageDeserializer;
impl MessageDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MessageData {
pub code: Option<String>,
pub value: Option<String>,
}
struct MessageDataDeserializer;
impl MessageDataDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<MessageData, XmlParseError> {
deserialize_elements::<_, MessageData, _>(tag_name, stack, |name, stack, obj| {
match name {
"Code" => {
obj.code = Some(MessageDataCodeDeserializer::deserialize("Code", stack)?);
}
"Value" => {
obj.value = Some(MessageDataValueDeserializer::deserialize("Value", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MessageDataCodeDeserializer;
impl MessageDataCodeDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MessageDataValueDeserializer;
impl MessageDataValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Metric {
pub dimensions: Option<Vec<Dimension>>,
pub metric_name: Option<String>,
pub namespace: Option<String>,
}
struct MetricDeserializer;
impl MetricDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Metric, XmlParseError> {
deserialize_elements::<_, Metric, _>(tag_name, stack, |name, stack, obj| {
match name {
"Dimensions" => {
obj.dimensions
.get_or_insert(vec![])
.extend(DimensionsDeserializer::deserialize("Dimensions", stack)?);
}
"MetricName" => {
obj.metric_name =
Some(MetricNameDeserializer::deserialize("MetricName", stack)?);
}
"Namespace" => {
obj.namespace = Some(NamespaceDeserializer::deserialize("Namespace", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MetricSerializer;
impl MetricSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Metric) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.dimensions {
DimensionsSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
if let Some(ref field_value) = obj.metric_name {
params.put(&format!("{}{}", prefix, "MetricName"), &field_value);
}
if let Some(ref field_value) = obj.namespace {
params.put(&format!("{}{}", prefix, "Namespace"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MetricAlarm {
pub actions_enabled: Option<bool>,
pub alarm_actions: Option<Vec<String>>,
pub alarm_arn: Option<String>,
pub alarm_configuration_updated_timestamp: Option<String>,
pub alarm_description: Option<String>,
pub alarm_name: Option<String>,
pub comparison_operator: Option<String>,
pub datapoints_to_alarm: Option<i64>,
pub dimensions: Option<Vec<Dimension>>,
pub evaluate_low_sample_count_percentile: Option<String>,
pub evaluation_periods: Option<i64>,
pub extended_statistic: Option<String>,
pub insufficient_data_actions: Option<Vec<String>>,
pub metric_name: Option<String>,
pub metrics: Option<Vec<MetricDataQuery>>,
pub namespace: Option<String>,
pub ok_actions: Option<Vec<String>>,
pub period: Option<i64>,
pub state_reason: Option<String>,
pub state_reason_data: Option<String>,
pub state_updated_timestamp: Option<String>,
pub state_value: Option<String>,
pub statistic: Option<String>,
pub threshold: Option<f64>,
pub treat_missing_data: Option<String>,
pub unit: Option<String>,
}
struct MetricAlarmDeserializer;
impl MetricAlarmDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<MetricAlarm, XmlParseError> {
deserialize_elements::<_, MetricAlarm, _>(tag_name, stack, |name, stack, obj| {
match name {
"ActionsEnabled" => {
obj.actions_enabled = Some(ActionsEnabledDeserializer::deserialize(
"ActionsEnabled",
stack,
)?);
}
"AlarmActions" => {
obj.alarm_actions.get_or_insert(vec![]).extend(
ResourceListDeserializer::deserialize("AlarmActions", stack)?,
);
}
"AlarmArn" => {
obj.alarm_arn = Some(AlarmArnDeserializer::deserialize("AlarmArn", stack)?);
}
"AlarmConfigurationUpdatedTimestamp" => {
obj.alarm_configuration_updated_timestamp =
Some(TimestampDeserializer::deserialize(
"AlarmConfigurationUpdatedTimestamp",
stack,
)?);
}
"AlarmDescription" => {
obj.alarm_description = Some(AlarmDescriptionDeserializer::deserialize(
"AlarmDescription",
stack,
)?);
}
"AlarmName" => {
obj.alarm_name = Some(AlarmNameDeserializer::deserialize("AlarmName", stack)?);
}
"ComparisonOperator" => {
obj.comparison_operator = Some(ComparisonOperatorDeserializer::deserialize(
"ComparisonOperator",
stack,
)?);
}
"DatapointsToAlarm" => {
obj.datapoints_to_alarm = Some(DatapointsToAlarmDeserializer::deserialize(
"DatapointsToAlarm",
stack,
)?);
}
"Dimensions" => {
obj.dimensions
.get_or_insert(vec![])
.extend(DimensionsDeserializer::deserialize("Dimensions", stack)?);
}
"EvaluateLowSampleCountPercentile" => {
obj.evaluate_low_sample_count_percentile =
Some(EvaluateLowSampleCountPercentileDeserializer::deserialize(
"EvaluateLowSampleCountPercentile",
stack,
)?);
}
"EvaluationPeriods" => {
obj.evaluation_periods = Some(EvaluationPeriodsDeserializer::deserialize(
"EvaluationPeriods",
stack,
)?);
}
"ExtendedStatistic" => {
obj.extended_statistic = Some(ExtendedStatisticDeserializer::deserialize(
"ExtendedStatistic",
stack,
)?);
}
"InsufficientDataActions" => {
obj.insufficient_data_actions.get_or_insert(vec![]).extend(
ResourceListDeserializer::deserialize("InsufficientDataActions", stack)?,
);
}
"MetricName" => {
obj.metric_name =
Some(MetricNameDeserializer::deserialize("MetricName", stack)?);
}
"Metrics" => {
obj.metrics.get_or_insert(vec![]).extend(
MetricDataQueriesDeserializer::deserialize("Metrics", stack)?,
);
}
"Namespace" => {
obj.namespace = Some(NamespaceDeserializer::deserialize("Namespace", stack)?);
}
"OKActions" => {
obj.ok_actions
.get_or_insert(vec![])
.extend(ResourceListDeserializer::deserialize("OKActions", stack)?);
}
"Period" => {
obj.period = Some(PeriodDeserializer::deserialize("Period", stack)?);
}
"StateReason" => {
obj.state_reason =
Some(StateReasonDeserializer::deserialize("StateReason", stack)?);
}
"StateReasonData" => {
obj.state_reason_data = Some(StateReasonDataDeserializer::deserialize(
"StateReasonData",
stack,
)?);
}
"StateUpdatedTimestamp" => {
obj.state_updated_timestamp = Some(TimestampDeserializer::deserialize(
"StateUpdatedTimestamp",
stack,
)?);
}
"StateValue" => {
obj.state_value =
Some(StateValueDeserializer::deserialize("StateValue", stack)?);
}
"Statistic" => {
obj.statistic = Some(StatisticDeserializer::deserialize("Statistic", stack)?);
}
"Threshold" => {
obj.threshold = Some(ThresholdDeserializer::deserialize("Threshold", stack)?);
}
"TreatMissingData" => {
obj.treat_missing_data = Some(TreatMissingDataDeserializer::deserialize(
"TreatMissingData",
stack,
)?);
}
"Unit" => {
obj.unit = Some(StandardUnitDeserializer::deserialize("Unit", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MetricAlarmsDeserializer;
impl MetricAlarmsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<MetricAlarm>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(MetricAlarmDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct MetricDataSerializer;
impl MetricDataSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<MetricDatum>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
MetricDatumSerializer::serialize(params, &key, obj);
}
}
}
struct MetricDataQueriesDeserializer;
impl MetricDataQueriesDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<MetricDataQuery>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(MetricDataQueryDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct MetricDataQueriesSerializer;
impl MetricDataQueriesSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<MetricDataQuery>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
MetricDataQuerySerializer::serialize(params, &key, obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MetricDataQuery {
pub expression: Option<String>,
pub id: String,
pub label: Option<String>,
pub metric_stat: Option<MetricStat>,
pub return_data: Option<bool>,
}
struct MetricDataQueryDeserializer;
impl MetricDataQueryDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<MetricDataQuery, XmlParseError> {
deserialize_elements::<_, MetricDataQuery, _>(tag_name, stack, |name, stack, obj| {
match name {
"Expression" => {
obj.expression = Some(MetricExpressionDeserializer::deserialize(
"Expression",
stack,
)?);
}
"Id" => {
obj.id = MetricIdDeserializer::deserialize("Id", stack)?;
}
"Label" => {
obj.label = Some(MetricLabelDeserializer::deserialize("Label", stack)?);
}
"MetricStat" => {
obj.metric_stat =
Some(MetricStatDeserializer::deserialize("MetricStat", stack)?);
}
"ReturnData" => {
obj.return_data =
Some(ReturnDataDeserializer::deserialize("ReturnData", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MetricDataQuerySerializer;
impl MetricDataQuerySerializer {
fn serialize(params: &mut Params, name: &str, obj: &MetricDataQuery) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.expression {
params.put(&format!("{}{}", prefix, "Expression"), &field_value);
}
params.put(&format!("{}{}", prefix, "Id"), &obj.id);
if let Some(ref field_value) = obj.label {
params.put(&format!("{}{}", prefix, "Label"), &field_value);
}
if let Some(ref field_value) = obj.metric_stat {
MetricStatSerializer::serialize(
params,
&format!("{}{}", prefix, "MetricStat"),
field_value,
);
}
if let Some(ref field_value) = obj.return_data {
params.put(&format!("{}{}", prefix, "ReturnData"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MetricDataResult {
pub id: Option<String>,
pub label: Option<String>,
pub messages: Option<Vec<MessageData>>,
pub status_code: Option<String>,
pub timestamps: Option<Vec<String>>,
pub values: Option<Vec<f64>>,
}
struct MetricDataResultDeserializer;
impl MetricDataResultDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<MetricDataResult, XmlParseError> {
deserialize_elements::<_, MetricDataResult, _>(tag_name, stack, |name, stack, obj| {
match name {
"Id" => {
obj.id = Some(MetricIdDeserializer::deserialize("Id", stack)?);
}
"Label" => {
obj.label = Some(MetricLabelDeserializer::deserialize("Label", stack)?);
}
"Messages" => {
obj.messages.get_or_insert(vec![]).extend(
MetricDataResultMessagesDeserializer::deserialize("Messages", stack)?,
);
}
"StatusCode" => {
obj.status_code =
Some(StatusCodeDeserializer::deserialize("StatusCode", stack)?);
}
"Timestamps" => {
obj.timestamps
.get_or_insert(vec![])
.extend(TimestampsDeserializer::deserialize("Timestamps", stack)?);
}
"Values" => {
obj.values
.get_or_insert(vec![])
.extend(DatapointValuesDeserializer::deserialize("Values", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MetricDataResultMessagesDeserializer;
impl MetricDataResultMessagesDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<MessageData>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(MessageDataDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct MetricDataResultsDeserializer;
impl MetricDataResultsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<MetricDataResult>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(MetricDataResultDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MetricDatum {
pub counts: Option<Vec<f64>>,
pub dimensions: Option<Vec<Dimension>>,
pub metric_name: String,
pub statistic_values: Option<StatisticSet>,
pub storage_resolution: Option<i64>,
pub timestamp: Option<String>,
pub unit: Option<String>,
pub value: Option<f64>,
pub values: Option<Vec<f64>>,
}
struct MetricDatumSerializer;
impl MetricDatumSerializer {
fn serialize(params: &mut Params, name: &str, obj: &MetricDatum) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.counts {
CountsSerializer::serialize(params, &format!("{}{}", prefix, "Counts"), field_value);
}
if let Some(ref field_value) = obj.dimensions {
DimensionsSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
params.put(&format!("{}{}", prefix, "MetricName"), &obj.metric_name);
if let Some(ref field_value) = obj.statistic_values {
StatisticSetSerializer::serialize(
params,
&format!("{}{}", prefix, "StatisticValues"),
field_value,
);
}
if let Some(ref field_value) = obj.storage_resolution {
params.put(&format!("{}{}", prefix, "StorageResolution"), &field_value);
}
if let Some(ref field_value) = obj.timestamp {
params.put(&format!("{}{}", prefix, "Timestamp"), &field_value);
}
if let Some(ref field_value) = obj.unit {
params.put(&format!("{}{}", prefix, "Unit"), &field_value);
}
if let Some(ref field_value) = obj.value {
params.put(&format!("{}{}", prefix, "Value"), &field_value);
}
if let Some(ref field_value) = obj.values {
ValuesSerializer::serialize(params, &format!("{}{}", prefix, "Values"), field_value);
}
}
}
struct MetricExpressionDeserializer;
impl MetricExpressionDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MetricIdDeserializer;
impl MetricIdDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MetricLabelDeserializer;
impl MetricLabelDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MetricNameDeserializer;
impl MetricNameDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MetricStat {
pub metric: Metric,
pub period: i64,
pub stat: String,
pub unit: Option<String>,
}
struct MetricStatDeserializer;
impl MetricStatDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<MetricStat, XmlParseError> {
deserialize_elements::<_, MetricStat, _>(tag_name, stack, |name, stack, obj| {
match name {
"Metric" => {
obj.metric = MetricDeserializer::deserialize("Metric", stack)?;
}
"Period" => {
obj.period = PeriodDeserializer::deserialize("Period", stack)?;
}
"Stat" => {
obj.stat = StatDeserializer::deserialize("Stat", stack)?;
}
"Unit" => {
obj.unit = Some(StandardUnitDeserializer::deserialize("Unit", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MetricStatSerializer;
impl MetricStatSerializer {
fn serialize(params: &mut Params, name: &str, obj: &MetricStat) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MetricSerializer::serialize(params, &format!("{}{}", prefix, "Metric"), &obj.metric);
params.put(&format!("{}{}", prefix, "Period"), &obj.period);
params.put(&format!("{}{}", prefix, "Stat"), &obj.stat);
if let Some(ref field_value) = obj.unit {
params.put(&format!("{}{}", prefix, "Unit"), &field_value);
}
}
}
struct MetricWidgetImageDeserializer;
impl MetricWidgetImageDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<bytes::Bytes, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?.into();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MetricsDeserializer;
impl MetricsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Metric>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(MetricDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct NamespaceDeserializer;
impl NamespaceDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct NextTokenDeserializer;
impl NextTokenDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct PeriodDeserializer;
impl PeriodDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<i64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = i64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PutDashboardInput {
pub dashboard_body: String,
pub dashboard_name: String,
}
struct PutDashboardInputSerializer;
impl PutDashboardInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &PutDashboardInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "DashboardBody"),
&obj.dashboard_body,
);
params.put(
&format!("{}{}", prefix, "DashboardName"),
&obj.dashboard_name,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PutDashboardOutput {
pub dashboard_validation_messages: Option<Vec<DashboardValidationMessage>>,
}
struct PutDashboardOutputDeserializer;
impl PutDashboardOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<PutDashboardOutput, XmlParseError> {
deserialize_elements::<_, PutDashboardOutput, _>(tag_name, stack, |name, stack, obj| {
match name {
"DashboardValidationMessages" => {
obj.dashboard_validation_messages
.get_or_insert(vec![])
.extend(DashboardValidationMessagesDeserializer::deserialize(
"DashboardValidationMessages",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PutMetricAlarmInput {
pub actions_enabled: Option<bool>,
pub alarm_actions: Option<Vec<String>>,
pub alarm_description: Option<String>,
pub alarm_name: String,
pub comparison_operator: String,
pub datapoints_to_alarm: Option<i64>,
pub dimensions: Option<Vec<Dimension>>,
pub evaluate_low_sample_count_percentile: Option<String>,
pub evaluation_periods: i64,
pub extended_statistic: Option<String>,
pub insufficient_data_actions: Option<Vec<String>>,
pub metric_name: Option<String>,
pub metrics: Option<Vec<MetricDataQuery>>,
pub namespace: Option<String>,
pub ok_actions: Option<Vec<String>>,
pub period: Option<i64>,
pub statistic: Option<String>,
pub tags: Option<Vec<Tag>>,
pub threshold: f64,
pub treat_missing_data: Option<String>,
pub unit: Option<String>,
}
struct PutMetricAlarmInputSerializer;
impl PutMetricAlarmInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &PutMetricAlarmInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.actions_enabled {
params.put(&format!("{}{}", prefix, "ActionsEnabled"), &field_value);
}
if let Some(ref field_value) = obj.alarm_actions {
ResourceListSerializer::serialize(
params,
&format!("{}{}", prefix, "AlarmActions"),
field_value,
);
}
if let Some(ref field_value) = obj.alarm_description {
params.put(&format!("{}{}", prefix, "AlarmDescription"), &field_value);
}
params.put(&format!("{}{}", prefix, "AlarmName"), &obj.alarm_name);
params.put(
&format!("{}{}", prefix, "ComparisonOperator"),
&obj.comparison_operator,
);
if let Some(ref field_value) = obj.datapoints_to_alarm {
params.put(&format!("{}{}", prefix, "DatapointsToAlarm"), &field_value);
}
if let Some(ref field_value) = obj.dimensions {
DimensionsSerializer::serialize(
params,
&format!("{}{}", prefix, "Dimensions"),
field_value,
);
}
if let Some(ref field_value) = obj.evaluate_low_sample_count_percentile {
params.put(
&format!("{}{}", prefix, "EvaluateLowSampleCountPercentile"),
&field_value,
);
}
params.put(
&format!("{}{}", prefix, "EvaluationPeriods"),
&obj.evaluation_periods,
);
if let Some(ref field_value) = obj.extended_statistic {
params.put(&format!("{}{}", prefix, "ExtendedStatistic"), &field_value);
}
if let Some(ref field_value) = obj.insufficient_data_actions {
ResourceListSerializer::serialize(
params,
&format!("{}{}", prefix, "InsufficientDataActions"),
field_value,
);
}
if let Some(ref field_value) = obj.metric_name {
params.put(&format!("{}{}", prefix, "MetricName"), &field_value);
}
if let Some(ref field_value) = obj.metrics {
MetricDataQueriesSerializer::serialize(
params,
&format!("{}{}", prefix, "Metrics"),
field_value,
);
}
if let Some(ref field_value) = obj.namespace {
params.put(&format!("{}{}", prefix, "Namespace"), &field_value);
}
if let Some(ref field_value) = obj.ok_actions {
ResourceListSerializer::serialize(
params,
&format!("{}{}", prefix, "OKActions"),
field_value,
);
}
if let Some(ref field_value) = obj.period {
params.put(&format!("{}{}", prefix, "Period"), &field_value);
}
if let Some(ref field_value) = obj.statistic {
params.put(&format!("{}{}", prefix, "Statistic"), &field_value);
}
if let Some(ref field_value) = obj.tags {
TagListSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), field_value);
}
params.put(&format!("{}{}", prefix, "Threshold"), &obj.threshold);
if let Some(ref field_value) = obj.treat_missing_data {
params.put(&format!("{}{}", prefix, "TreatMissingData"), &field_value);
}
if let Some(ref field_value) = obj.unit {
params.put(&format!("{}{}", prefix, "Unit"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PutMetricDataInput {
pub metric_data: Vec<MetricDatum>,
pub namespace: String,
}
struct PutMetricDataInputSerializer;
impl PutMetricDataInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &PutMetricDataInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MetricDataSerializer::serialize(
params,
&format!("{}{}", prefix, "MetricData"),
&obj.metric_data,
);
params.put(&format!("{}{}", prefix, "Namespace"), &obj.namespace);
}
}
struct ResourceListDeserializer;
impl ResourceListDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(ResourceNameDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct ResourceListSerializer;
impl ResourceListSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct ResourceNameDeserializer;
impl ResourceNameDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ReturnDataDeserializer;
impl ReturnDataDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<bool, XmlParseError> {
start_element(tag_name, stack)?;
let obj = bool::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetAlarmStateInput {
pub alarm_name: String,
pub state_reason: String,
pub state_reason_data: Option<String>,
pub state_value: String,
}
struct SetAlarmStateInputSerializer;
impl SetAlarmStateInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetAlarmStateInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "AlarmName"), &obj.alarm_name);
params.put(&format!("{}{}", prefix, "StateReason"), &obj.state_reason);
if let Some(ref field_value) = obj.state_reason_data {
params.put(&format!("{}{}", prefix, "StateReasonData"), &field_value);
}
params.put(&format!("{}{}", prefix, "StateValue"), &obj.state_value);
}
}
struct SizeDeserializer;
impl SizeDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<i64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = i64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StandardUnitDeserializer;
impl StandardUnitDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StatDeserializer;
impl StatDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StateReasonDeserializer;
impl StateReasonDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StateReasonDataDeserializer;
impl StateReasonDataDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StateValueDeserializer;
impl StateValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct StatisticDeserializer;
impl StatisticDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct StatisticSet {
pub maximum: f64,
pub minimum: f64,
pub sample_count: f64,
pub sum: f64,
}
struct StatisticSetSerializer;
impl StatisticSetSerializer {
fn serialize(params: &mut Params, name: &str, obj: &StatisticSet) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Maximum"), &obj.maximum);
params.put(&format!("{}{}", prefix, "Minimum"), &obj.minimum);
params.put(&format!("{}{}", prefix, "SampleCount"), &obj.sample_count);
params.put(&format!("{}{}", prefix, "Sum"), &obj.sum);
}
}
struct StatisticsSerializer;
impl StatisticsSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct StatusCodeDeserializer;
impl StatusCodeDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Tag {
pub key: String,
pub value: String,
}
struct TagDeserializer;
impl TagDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Tag, XmlParseError> {
deserialize_elements::<_, Tag, _>(tag_name, stack, |name, stack, obj| {
match name {
"Key" => {
obj.key = TagKeyDeserializer::deserialize("Key", stack)?;
}
"Value" => {
obj.value = TagValueDeserializer::deserialize("Value", stack)?;
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct TagSerializer;
impl TagSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Tag) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Key"), &obj.key);
params.put(&format!("{}{}", prefix, "Value"), &obj.value);
}
}
struct TagKeyDeserializer;
impl TagKeyDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TagKeyListSerializer;
impl TagKeyListSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct TagListDeserializer;
impl TagListDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Tag>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(TagDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct TagListSerializer;
impl TagListSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<Tag>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
TagSerializer::serialize(params, &key, obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct TagResourceInput {
pub resource_arn: String,
pub tags: Vec<Tag>,
}
struct TagResourceInputSerializer;
impl TagResourceInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &TagResourceInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceARN"), &obj.resource_arn);
TagListSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), &obj.tags);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct TagResourceOutput {}
struct TagResourceOutputDeserializer;
impl TagResourceOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<TagResourceOutput, XmlParseError> {
start_element(tag_name, stack)?;
let obj = TagResourceOutput::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TagValueDeserializer;
impl TagValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ThresholdDeserializer;
impl ThresholdDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<f64, XmlParseError> {
start_element(tag_name, stack)?;
let obj = f64::from_str(characters(stack)?.as_ref()).unwrap();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TimestampDeserializer;
impl TimestampDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TimestampsDeserializer;
impl TimestampsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(TimestampDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct TreatMissingDataDeserializer;
impl TreatMissingDataDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UntagResourceInput {
pub resource_arn: String,
pub tag_keys: Vec<String>,
}
struct UntagResourceInputSerializer;
impl UntagResourceInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &UntagResourceInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceARN"), &obj.resource_arn);
TagKeyListSerializer::serialize(params, &format!("{}{}", prefix, "TagKeys"), &obj.tag_keys);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UntagResourceOutput {}
struct UntagResourceOutputDeserializer;
impl UntagResourceOutputDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<UntagResourceOutput, XmlParseError> {
start_element(tag_name, stack)?;
let obj = UntagResourceOutput::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ValuesSerializer;
impl ValuesSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<f64>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteAlarmsError {
ResourceNotFound(String),
}
impl DeleteAlarmsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteAlarmsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"ResourceNotFound" => {
return RusotoError::Service(DeleteAlarmsError::ResourceNotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DeleteAlarmsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteAlarmsError {
fn description(&self) -> &str {
match *self {
DeleteAlarmsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteDashboardsError {
DashboardNotFoundError(String),
InternalServiceFault(String),
InvalidParameterValue(String),
}
impl DeleteDashboardsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteDashboardsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"ResourceNotFound" => {
return RusotoError::Service(DeleteDashboardsError::DashboardNotFoundError(
parsed_error.message,
))
}
"InternalServiceError" => {
return RusotoError::Service(DeleteDashboardsError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(DeleteDashboardsError::InvalidParameterValue(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DeleteDashboardsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteDashboardsError {
fn description(&self) -> &str {
match *self {
DeleteDashboardsError::DashboardNotFoundError(ref cause) => cause,
DeleteDashboardsError::InternalServiceFault(ref cause) => cause,
DeleteDashboardsError::InvalidParameterValue(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAlarmHistoryError {
InvalidNextToken(String),
}
impl DescribeAlarmHistoryError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeAlarmHistoryError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InvalidNextToken" => {
return RusotoError::Service(DescribeAlarmHistoryError::InvalidNextToken(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DescribeAlarmHistoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAlarmHistoryError {
fn description(&self) -> &str {
match *self {
DescribeAlarmHistoryError::InvalidNextToken(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAlarmsError {
InvalidNextToken(String),
}
impl DescribeAlarmsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeAlarmsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InvalidNextToken" => {
return RusotoError::Service(DescribeAlarmsError::InvalidNextToken(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DescribeAlarmsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAlarmsError {
fn description(&self) -> &str {
match *self {
DescribeAlarmsError::InvalidNextToken(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeAlarmsForMetricError {}
impl DescribeAlarmsForMetricError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeAlarmsForMetricError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DescribeAlarmsForMetricError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeAlarmsForMetricError {
fn description(&self) -> &str {
match *self {}
}
}
#[derive(Debug, PartialEq)]
pub enum DisableAlarmActionsError {}
impl DisableAlarmActionsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisableAlarmActionsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for DisableAlarmActionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisableAlarmActionsError {
fn description(&self) -> &str {
match *self {}
}
}
#[derive(Debug, PartialEq)]
pub enum EnableAlarmActionsError {}
impl EnableAlarmActionsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<EnableAlarmActionsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for EnableAlarmActionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for EnableAlarmActionsError {
fn description(&self) -> &str {
match *self {}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDashboardError {
DashboardNotFoundError(String),
InternalServiceFault(String),
InvalidParameterValue(String),
}
impl GetDashboardError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetDashboardError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"ResourceNotFound" => {
return RusotoError::Service(GetDashboardError::DashboardNotFoundError(
parsed_error.message,
))
}
"InternalServiceError" => {
return RusotoError::Service(GetDashboardError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(GetDashboardError::InvalidParameterValue(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for GetDashboardError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDashboardError {
fn description(&self) -> &str {
match *self {
GetDashboardError::DashboardNotFoundError(ref cause) => cause,
GetDashboardError::InternalServiceFault(ref cause) => cause,
GetDashboardError::InvalidParameterValue(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMetricDataError {
InvalidNextToken(String),
}
impl GetMetricDataError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetMetricDataError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InvalidNextToken" => {
return RusotoError::Service(GetMetricDataError::InvalidNextToken(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for GetMetricDataError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMetricDataError {
fn description(&self) -> &str {
match *self {
GetMetricDataError::InvalidNextToken(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMetricStatisticsError {
InternalServiceFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
MissingRequiredParameter(String),
}
impl GetMetricStatisticsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetMetricStatisticsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InternalServiceError" => {
return RusotoError::Service(
GetMetricStatisticsError::InternalServiceFault(parsed_error.message),
)
}
"InvalidParameterCombination" => {
return RusotoError::Service(
GetMetricStatisticsError::InvalidParameterCombination(
parsed_error.message,
),
)
}
"InvalidParameterValue" => {
return RusotoError::Service(
GetMetricStatisticsError::InvalidParameterValue(parsed_error.message),
)
}
"MissingParameter" => {
return RusotoError::Service(
GetMetricStatisticsError::MissingRequiredParameter(
parsed_error.message,
),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for GetMetricStatisticsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMetricStatisticsError {
fn description(&self) -> &str {
match *self {
GetMetricStatisticsError::InternalServiceFault(ref cause) => cause,
GetMetricStatisticsError::InvalidParameterCombination(ref cause) => cause,
GetMetricStatisticsError::InvalidParameterValue(ref cause) => cause,
GetMetricStatisticsError::MissingRequiredParameter(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetMetricWidgetImageError {}
impl GetMetricWidgetImageError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetMetricWidgetImageError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for GetMetricWidgetImageError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetMetricWidgetImageError {
fn description(&self) -> &str {
match *self {}
}
}
#[derive(Debug, PartialEq)]
pub enum ListDashboardsError {
InternalServiceFault(String),
InvalidParameterValue(String),
}
impl ListDashboardsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListDashboardsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InternalServiceError" => {
return RusotoError::Service(ListDashboardsError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(ListDashboardsError::InvalidParameterValue(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for ListDashboardsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListDashboardsError {
fn description(&self) -> &str {
match *self {
ListDashboardsError::InternalServiceFault(ref cause) => cause,
ListDashboardsError::InvalidParameterValue(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListMetricsError {
InternalServiceFault(String),
InvalidParameterValue(String),
}
impl ListMetricsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListMetricsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InternalServiceError" => {
return RusotoError::Service(ListMetricsError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(ListMetricsError::InvalidParameterValue(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for ListMetricsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListMetricsError {
fn description(&self) -> &str {
match *self {
ListMetricsError::InternalServiceFault(ref cause) => cause,
ListMetricsError::InvalidParameterValue(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InternalServiceFault(String),
InvalidParameterValue(String),
ResourceNotFound(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InternalServiceError" => {
return RusotoError::Service(
ListTagsForResourceError::InternalServiceFault(parsed_error.message),
)
}
"InvalidParameterValue" => {
return RusotoError::Service(
ListTagsForResourceError::InvalidParameterValue(parsed_error.message),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::InternalServiceFault(ref cause) => cause,
ListTagsForResourceError::InvalidParameterValue(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutDashboardError {
DashboardInvalidInputError(String),
InternalServiceFault(String),
}
impl PutDashboardError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutDashboardError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InvalidParameterInput" => {
return RusotoError::Service(PutDashboardError::DashboardInvalidInputError(
parsed_error.message,
))
}
"InternalServiceError" => {
return RusotoError::Service(PutDashboardError::InternalServiceFault(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for PutDashboardError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutDashboardError {
fn description(&self) -> &str {
match *self {
PutDashboardError::DashboardInvalidInputError(ref cause) => cause,
PutDashboardError::InternalServiceFault(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutMetricAlarmError {
LimitExceededFault(String),
}
impl PutMetricAlarmError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutMetricAlarmError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"LimitExceeded" => {
return RusotoError::Service(PutMetricAlarmError::LimitExceededFault(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for PutMetricAlarmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutMetricAlarmError {
fn description(&self) -> &str {
match *self {
PutMetricAlarmError::LimitExceededFault(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum PutMetricDataError {
InternalServiceFault(String),
InvalidParameterCombination(String),
InvalidParameterValue(String),
MissingRequiredParameter(String),
}
impl PutMetricDataError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PutMetricDataError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InternalServiceError" => {
return RusotoError::Service(PutMetricDataError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterCombination" => {
return RusotoError::Service(
PutMetricDataError::InvalidParameterCombination(parsed_error.message),
)
}
"InvalidParameterValue" => {
return RusotoError::Service(PutMetricDataError::InvalidParameterValue(
parsed_error.message,
))
}
"MissingParameter" => {
return RusotoError::Service(PutMetricDataError::MissingRequiredParameter(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for PutMetricDataError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PutMetricDataError {
fn description(&self) -> &str {
match *self {
PutMetricDataError::InternalServiceFault(ref cause) => cause,
PutMetricDataError::InvalidParameterCombination(ref cause) => cause,
PutMetricDataError::InvalidParameterValue(ref cause) => cause,
PutMetricDataError::MissingRequiredParameter(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetAlarmStateError {
InvalidFormatFault(String),
ResourceNotFound(String),
}
impl SetAlarmStateError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetAlarmStateError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"InvalidFormat" => {
return RusotoError::Service(SetAlarmStateError::InvalidFormatFault(
parsed_error.message,
))
}
"ResourceNotFound" => {
return RusotoError::Service(SetAlarmStateError::ResourceNotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for SetAlarmStateError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetAlarmStateError {
fn description(&self) -> &str {
match *self {
SetAlarmStateError::InvalidFormatFault(ref cause) => cause,
SetAlarmStateError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
ConcurrentModification(String),
InternalServiceFault(String),
InvalidParameterValue(String),
ResourceNotFound(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"ConcurrentModificationException" => {
return RusotoError::Service(TagResourceError::ConcurrentModification(
parsed_error.message,
))
}
"InternalServiceError" => {
return RusotoError::Service(TagResourceError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(TagResourceError::InvalidParameterValue(
parsed_error.message,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::ConcurrentModification(ref cause) => cause,
TagResourceError::InternalServiceFault(ref cause) => cause,
TagResourceError::InvalidParameterValue(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
ConcurrentModification(String),
InternalServiceFault(String),
InvalidParameterValue(String),
ResourceNotFound(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"ConcurrentModificationException" => {
return RusotoError::Service(UntagResourceError::ConcurrentModification(
parsed_error.message,
))
}
"InternalServiceError" => {
return RusotoError::Service(UntagResourceError::InternalServiceFault(
parsed_error.message,
))
}
"InvalidParameterValue" => {
return RusotoError::Service(UntagResourceError::InvalidParameterValue(
parsed_error.message,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::ConcurrentModification(ref cause) => cause,
UntagResourceError::InternalServiceFault(ref cause) => cause,
UntagResourceError::InvalidParameterValue(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
pub trait CloudWatch {
fn delete_alarms(&self, input: DeleteAlarmsInput) -> RusotoFuture<(), DeleteAlarmsError>;
fn delete_dashboards(
&self,
input: DeleteDashboardsInput,
) -> RusotoFuture<DeleteDashboardsOutput, DeleteDashboardsError>;
fn describe_alarm_history(
&self,
input: DescribeAlarmHistoryInput,
) -> RusotoFuture<DescribeAlarmHistoryOutput, DescribeAlarmHistoryError>;
fn describe_alarms(
&self,
input: DescribeAlarmsInput,
) -> RusotoFuture<DescribeAlarmsOutput, DescribeAlarmsError>;
fn describe_alarms_for_metric(
&self,
input: DescribeAlarmsForMetricInput,
) -> RusotoFuture<DescribeAlarmsForMetricOutput, DescribeAlarmsForMetricError>;
fn disable_alarm_actions(
&self,
input: DisableAlarmActionsInput,
) -> RusotoFuture<(), DisableAlarmActionsError>;
fn enable_alarm_actions(
&self,
input: EnableAlarmActionsInput,
) -> RusotoFuture<(), EnableAlarmActionsError>;
fn get_dashboard(
&self,
input: GetDashboardInput,
) -> RusotoFuture<GetDashboardOutput, GetDashboardError>;
fn get_metric_data(
&self,
input: GetMetricDataInput,
) -> RusotoFuture<GetMetricDataOutput, GetMetricDataError>;
fn get_metric_statistics(
&self,
input: GetMetricStatisticsInput,
) -> RusotoFuture<GetMetricStatisticsOutput, GetMetricStatisticsError>;
fn get_metric_widget_image(
&self,
input: GetMetricWidgetImageInput,
) -> RusotoFuture<GetMetricWidgetImageOutput, GetMetricWidgetImageError>;
fn list_dashboards(
&self,
input: ListDashboardsInput,
) -> RusotoFuture<ListDashboardsOutput, ListDashboardsError>;
fn list_metrics(
&self,
input: ListMetricsInput,
) -> RusotoFuture<ListMetricsOutput, ListMetricsError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceInput,
) -> RusotoFuture<ListTagsForResourceOutput, ListTagsForResourceError>;
fn put_dashboard(
&self,
input: PutDashboardInput,
) -> RusotoFuture<PutDashboardOutput, PutDashboardError>;
fn put_metric_alarm(&self, input: PutMetricAlarmInput)
-> RusotoFuture<(), PutMetricAlarmError>;
fn put_metric_data(&self, input: PutMetricDataInput) -> RusotoFuture<(), PutMetricDataError>;
fn set_alarm_state(&self, input: SetAlarmStateInput) -> RusotoFuture<(), SetAlarmStateError>;
fn tag_resource(
&self,
input: TagResourceInput,
) -> RusotoFuture<TagResourceOutput, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceInput,
) -> RusotoFuture<UntagResourceOutput, UntagResourceError>;
}
#[derive(Clone)]
pub struct CloudWatchClient {
client: Client,
region: region::Region,
}
impl CloudWatchClient {
pub fn new(region: region::Region) -> CloudWatchClient {
CloudWatchClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> CloudWatchClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
CloudWatchClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl CloudWatch for CloudWatchClient {
fn delete_alarms(&self, input: DeleteAlarmsInput) -> RusotoFuture<(), DeleteAlarmsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DeleteAlarms");
params.put("Version", "2010-08-01");
DeleteAlarmsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteAlarmsError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn delete_dashboards(
&self,
input: DeleteDashboardsInput,
) -> RusotoFuture<DeleteDashboardsOutput, DeleteDashboardsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DeleteDashboards");
params.put("Version", "2010-08-01");
DeleteDashboardsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteDashboardsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = DeleteDashboardsOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = DeleteDashboardsOutputDeserializer::deserialize(
"DeleteDashboardsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn describe_alarm_history(
&self,
input: DescribeAlarmHistoryInput,
) -> RusotoFuture<DescribeAlarmHistoryOutput, DescribeAlarmHistoryError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DescribeAlarmHistory");
params.put("Version", "2010-08-01");
DescribeAlarmHistoryInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(DescribeAlarmHistoryError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = DescribeAlarmHistoryOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = DescribeAlarmHistoryOutputDeserializer::deserialize(
"DescribeAlarmHistoryResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn describe_alarms(
&self,
input: DescribeAlarmsInput,
) -> RusotoFuture<DescribeAlarmsOutput, DescribeAlarmsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DescribeAlarms");
params.put("Version", "2010-08-01");
DescribeAlarmsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeAlarmsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = DescribeAlarmsOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = DescribeAlarmsOutputDeserializer::deserialize(
"DescribeAlarmsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn describe_alarms_for_metric(
&self,
input: DescribeAlarmsForMetricInput,
) -> RusotoFuture<DescribeAlarmsForMetricOutput, DescribeAlarmsForMetricError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DescribeAlarmsForMetric");
params.put("Version", "2010-08-01");
DescribeAlarmsForMetricInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(response.buffer().from_err().and_then(|response| {
Err(DescribeAlarmsForMetricError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = DescribeAlarmsForMetricOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = DescribeAlarmsForMetricOutputDeserializer::deserialize(
"DescribeAlarmsForMetricResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn disable_alarm_actions(
&self,
input: DisableAlarmActionsInput,
) -> RusotoFuture<(), DisableAlarmActionsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DisableAlarmActions");
params.put("Version", "2010-08-01");
DisableAlarmActionsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(DisableAlarmActionsError::from_response(response))
}),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn enable_alarm_actions(
&self,
input: EnableAlarmActionsInput,
) -> RusotoFuture<(), EnableAlarmActionsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "EnableAlarmActions");
params.put("Version", "2010-08-01");
EnableAlarmActionsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(EnableAlarmActionsError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn get_dashboard(
&self,
input: GetDashboardInput,
) -> RusotoFuture<GetDashboardOutput, GetDashboardError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetDashboard");
params.put("Version", "2010-08-01");
GetDashboardInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetDashboardError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetDashboardOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = GetDashboardOutputDeserializer::deserialize(
"GetDashboardResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_metric_data(
&self,
input: GetMetricDataInput,
) -> RusotoFuture<GetMetricDataOutput, GetMetricDataError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetMetricData");
params.put("Version", "2010-08-01");
GetMetricDataInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetMetricDataError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetMetricDataOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = GetMetricDataOutputDeserializer::deserialize(
"GetMetricDataResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_metric_statistics(
&self,
input: GetMetricStatisticsInput,
) -> RusotoFuture<GetMetricStatisticsOutput, GetMetricStatisticsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetMetricStatistics");
params.put("Version", "2010-08-01");
GetMetricStatisticsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetMetricStatisticsError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetMetricStatisticsOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = GetMetricStatisticsOutputDeserializer::deserialize(
"GetMetricStatisticsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_metric_widget_image(
&self,
input: GetMetricWidgetImageInput,
) -> RusotoFuture<GetMetricWidgetImageOutput, GetMetricWidgetImageError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetMetricWidgetImage");
params.put("Version", "2010-08-01");
GetMetricWidgetImageInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetMetricWidgetImageError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetMetricWidgetImageOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = GetMetricWidgetImageOutputDeserializer::deserialize(
"GetMetricWidgetImageResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_dashboards(
&self,
input: ListDashboardsInput,
) -> RusotoFuture<ListDashboardsOutput, ListDashboardsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListDashboards");
params.put("Version", "2010-08-01");
ListDashboardsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListDashboardsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListDashboardsOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = ListDashboardsOutputDeserializer::deserialize(
"ListDashboardsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_metrics(
&self,
input: ListMetricsInput,
) -> RusotoFuture<ListMetricsOutput, ListMetricsError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListMetrics");
params.put("Version", "2010-08-01");
ListMetricsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListMetricsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListMetricsOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = ListMetricsOutputDeserializer::deserialize(
"ListMetricsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceInput,
) -> RusotoFuture<ListTagsForResourceOutput, ListTagsForResourceError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListTagsForResource");
params.put("Version", "2010-08-01");
ListTagsForResourceInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListTagsForResourceOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = ListTagsForResourceOutputDeserializer::deserialize(
"ListTagsForResourceResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn put_dashboard(
&self,
input: PutDashboardInput,
) -> RusotoFuture<PutDashboardOutput, PutDashboardError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "PutDashboard");
params.put("Version", "2010-08-01");
PutDashboardInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutDashboardError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = PutDashboardOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = PutDashboardOutputDeserializer::deserialize(
"PutDashboardResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn put_metric_alarm(
&self,
input: PutMetricAlarmInput,
) -> RusotoFuture<(), PutMetricAlarmError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "PutMetricAlarm");
params.put("Version", "2010-08-01");
PutMetricAlarmInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutMetricAlarmError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn put_metric_data(&self, input: PutMetricDataInput) -> RusotoFuture<(), PutMetricDataError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "PutMetricData");
params.put("Version", "2010-08-01");
PutMetricDataInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(PutMetricDataError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn set_alarm_state(&self, input: SetAlarmStateInput) -> RusotoFuture<(), SetAlarmStateError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetAlarmState");
params.put("Version", "2010-08-01");
SetAlarmStateInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SetAlarmStateError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn tag_resource(
&self,
input: TagResourceInput,
) -> RusotoFuture<TagResourceOutput, TagResourceError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "TagResource");
params.put("Version", "2010-08-01");
TagResourceInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = TagResourceOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = TagResourceOutputDeserializer::deserialize(
"TagResourceResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn untag_resource(
&self,
input: UntagResourceInput,
) -> RusotoFuture<UntagResourceOutput, UntagResourceError> {
let mut request = SignedRequest::new("POST", "monitoring", &self.region, "/");
let mut params = Params::new();
params.put("Action", "UntagResource");
params.put("Version", "2010-08-01");
UntagResourceInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = UntagResourceOutput::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = UntagResourceOutputDeserializer::deserialize(
"UntagResourceResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
}
#[cfg(test)]
mod protocol_tests {
extern crate rusoto_mock;
use self::rusoto_mock::*;
use super::*;
use rusoto_core::Region as rusoto_region;
#[test]
fn test_parse_error_cloudwatch_describe_alarm_history() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/error",
"cloudwatch-describe-alarm-history.xml",
);
let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response);
let client =
CloudWatchClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeAlarmHistoryInput::default();
let result = client.describe_alarm_history(request).sync();
assert!(!result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_cloudwatch_describe_alarm_history() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudwatch-describe-alarm-history.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudWatchClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeAlarmHistoryInput::default();
let result = client.describe_alarm_history(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_cloudwatch_describe_alarms() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudwatch-describe-alarms.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudWatchClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeAlarmsInput::default();
let result = client.describe_alarms(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_cloudwatch_list_metrics() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudwatch-list-metrics.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudWatchClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListMetricsInput::default();
let result = client.list_metrics(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
}