use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::signature::SignedRequest;
use rusoto_core::xmlerror::*;
use rusoto_core::xmlutil::{
characters, end_element, find_start_element, peek_at_name, skip_tree, start_element,
};
use rusoto_core::xmlutil::{Next, Peek, XmlParseError, XmlResponse};
use serde_urlencoded;
use std::str::FromStr;
use xml::reader::ParserConfig;
use xml::reader::XmlEvent;
use xml::EventReader;
enum DeserializerNext {
Close,
Skip,
Element(String),
}
struct AccountDeserializer;
impl AccountDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 ActionsListSerializer;
impl ActionsListSerializer {
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 AddPermissionInput {
pub aws_account_id: Vec<String>,
pub action_name: Vec<String>,
pub label: String,
pub topic_arn: String,
}
struct AddPermissionInputSerializer;
impl AddPermissionInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &AddPermissionInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
DelegatesListSerializer::serialize(
params,
&format!("{}{}", prefix, "AWSAccountId"),
&obj.aws_account_id,
);
ActionsListSerializer::serialize(
params,
&format!("{}{}", prefix, "ActionName"),
&obj.action_name,
);
params.put(&format!("{}{}", prefix, "Label"), &obj.label);
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
struct AttributeNameDeserializer;
impl AttributeNameDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 AttributeValueDeserializer;
impl AttributeValueDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 BooleanDeserializer;
impl BooleanDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 CheckIfPhoneNumberIsOptedOutInput {
pub phone_number: String,
}
struct CheckIfPhoneNumberIsOptedOutInputSerializer;
impl CheckIfPhoneNumberIsOptedOutInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &CheckIfPhoneNumberIsOptedOutInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "phoneNumber"), &obj.phone_number);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CheckIfPhoneNumberIsOptedOutResponse {
pub is_opted_out: Option<bool>,
}
struct CheckIfPhoneNumberIsOptedOutResponseDeserializer;
impl CheckIfPhoneNumberIsOptedOutResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CheckIfPhoneNumberIsOptedOutResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = CheckIfPhoneNumberIsOptedOutResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"isOptedOut" => {
obj.is_opted_out =
Some(BooleanDeserializer::deserialize("isOptedOut", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ConfirmSubscriptionInput {
pub authenticate_on_unsubscribe: Option<String>,
pub token: String,
pub topic_arn: String,
}
struct ConfirmSubscriptionInputSerializer;
impl ConfirmSubscriptionInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ConfirmSubscriptionInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.authenticate_on_unsubscribe {
params.put(
&format!("{}{}", prefix, "AuthenticateOnUnsubscribe"),
&field_value,
);
}
params.put(&format!("{}{}", prefix, "Token"), &obj.token);
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ConfirmSubscriptionResponse {
pub subscription_arn: Option<String>,
}
struct ConfirmSubscriptionResponseDeserializer;
impl ConfirmSubscriptionResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ConfirmSubscriptionResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ConfirmSubscriptionResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"SubscriptionArn" => {
obj.subscription_arn = Some(SubscriptionARNDeserializer::deserialize(
"SubscriptionArn",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateEndpointResponse {
pub endpoint_arn: Option<String>,
}
struct CreateEndpointResponseDeserializer;
impl CreateEndpointResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreateEndpointResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = CreateEndpointResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"EndpointArn" => {
obj.endpoint_arn =
Some(StringDeserializer::deserialize("EndpointArn", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreatePlatformApplicationInput {
pub attributes: ::std::collections::HashMap<String, String>,
pub name: String,
pub platform: String,
}
struct CreatePlatformApplicationInputSerializer;
impl CreatePlatformApplicationInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &CreatePlatformApplicationInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MapStringToStringSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
&obj.attributes,
);
params.put(&format!("{}{}", prefix, "Name"), &obj.name);
params.put(&format!("{}{}", prefix, "Platform"), &obj.platform);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreatePlatformApplicationResponse {
pub platform_application_arn: Option<String>,
}
struct CreatePlatformApplicationResponseDeserializer;
impl CreatePlatformApplicationResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreatePlatformApplicationResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = CreatePlatformApplicationResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"PlatformApplicationArn" => {
obj.platform_application_arn = Some(StringDeserializer::deserialize(
"PlatformApplicationArn",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreatePlatformEndpointInput {
pub attributes: Option<::std::collections::HashMap<String, String>>,
pub custom_user_data: Option<String>,
pub platform_application_arn: String,
pub token: String,
}
struct CreatePlatformEndpointInputSerializer;
impl CreatePlatformEndpointInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &CreatePlatformEndpointInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.attributes {
MapStringToStringSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
field_value,
);
}
if let Some(ref field_value) = obj.custom_user_data {
params.put(&format!("{}{}", prefix, "CustomUserData"), &field_value);
}
params.put(
&format!("{}{}", prefix, "PlatformApplicationArn"),
&obj.platform_application_arn,
);
params.put(&format!("{}{}", prefix, "Token"), &obj.token);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateTopicInput {
pub attributes: Option<::std::collections::HashMap<String, String>>,
pub name: String,
}
struct CreateTopicInputSerializer;
impl CreateTopicInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &CreateTopicInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.attributes {
TopicAttributesMapSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
field_value,
);
}
params.put(&format!("{}{}", prefix, "Name"), &obj.name);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateTopicResponse {
pub topic_arn: Option<String>,
}
struct CreateTopicResponseDeserializer;
impl CreateTopicResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreateTopicResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = CreateTopicResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"TopicArn" => {
obj.topic_arn = Some(TopicARNDeserializer::deserialize("TopicArn", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct DelegatesListSerializer;
impl DelegatesListSerializer {
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 DeleteEndpointInput {
pub endpoint_arn: String,
}
struct DeleteEndpointInputSerializer;
impl DeleteEndpointInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DeleteEndpointInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "EndpointArn"), &obj.endpoint_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DeletePlatformApplicationInput {
pub platform_application_arn: String,
}
struct DeletePlatformApplicationInputSerializer;
impl DeletePlatformApplicationInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DeletePlatformApplicationInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "PlatformApplicationArn"),
&obj.platform_application_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct DeleteTopicInput {
pub topic_arn: String,
}
struct DeleteTopicInputSerializer;
impl DeleteTopicInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &DeleteTopicInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
struct EndpointDeserializer;
impl EndpointDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 GetEndpointAttributesInput {
pub endpoint_arn: String,
}
struct GetEndpointAttributesInputSerializer;
impl GetEndpointAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetEndpointAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "EndpointArn"), &obj.endpoint_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetEndpointAttributesResponse {
pub attributes: Option<::std::collections::HashMap<String, String>>,
}
struct GetEndpointAttributesResponseDeserializer;
impl GetEndpointAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetEndpointAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = GetEndpointAttributesResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetPlatformApplicationAttributesInput {
pub platform_application_arn: String,
}
struct GetPlatformApplicationAttributesInputSerializer;
impl GetPlatformApplicationAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetPlatformApplicationAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "PlatformApplicationArn"),
&obj.platform_application_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetPlatformApplicationAttributesResponse {
pub attributes: Option<::std::collections::HashMap<String, String>>,
}
struct GetPlatformApplicationAttributesResponseDeserializer;
impl GetPlatformApplicationAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetPlatformApplicationAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = GetPlatformApplicationAttributesResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetSMSAttributesInput {
pub attributes: Option<Vec<String>>,
}
struct GetSMSAttributesInputSerializer;
impl GetSMSAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetSMSAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.attributes {
ListStringSerializer::serialize(
params,
&format!("{}{}", prefix, "attributes"),
field_value,
);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetSMSAttributesResponse {
pub attributes: Option<::std::collections::HashMap<String, String>>,
}
struct GetSMSAttributesResponseDeserializer;
impl GetSMSAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetSMSAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = GetSMSAttributesResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"attributes",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetSubscriptionAttributesInput {
pub subscription_arn: String,
}
struct GetSubscriptionAttributesInputSerializer;
impl GetSubscriptionAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetSubscriptionAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "SubscriptionArn"),
&obj.subscription_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetSubscriptionAttributesResponse {
pub attributes: Option<::std::collections::HashMap<String, String>>,
}
struct GetSubscriptionAttributesResponseDeserializer;
impl GetSubscriptionAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetSubscriptionAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = GetSubscriptionAttributesResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Attributes" => {
obj.attributes = Some(SubscriptionAttributesMapDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetTopicAttributesInput {
pub topic_arn: String,
}
struct GetTopicAttributesInputSerializer;
impl GetTopicAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &GetTopicAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct GetTopicAttributesResponse {
pub attributes: Option<::std::collections::HashMap<String, String>>,
}
struct GetTopicAttributesResponseDeserializer;
impl GetTopicAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetTopicAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = GetTopicAttributesResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Attributes" => {
obj.attributes = Some(TopicAttributesMapDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListEndpointsByPlatformApplicationInput {
pub next_token: Option<String>,
pub platform_application_arn: String,
}
struct ListEndpointsByPlatformApplicationInputSerializer;
impl ListEndpointsByPlatformApplicationInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListEndpointsByPlatformApplicationInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
params.put(
&format!("{}{}", prefix, "PlatformApplicationArn"),
&obj.platform_application_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListEndpointsByPlatformApplicationResponse {
pub endpoints: Option<Vec<String>>,
pub next_token: Option<String>,
}
struct ListEndpointsByPlatformApplicationResponseDeserializer;
impl ListEndpointsByPlatformApplicationResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListEndpointsByPlatformApplicationResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListEndpointsByPlatformApplicationResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Endpoints" => {
obj.endpoints = match obj.endpoints {
Some(ref mut existing) => {
existing.extend(ListOfEndpointsDeserializer::deserialize(
"Endpoints",
stack,
)?);
Some(existing.to_vec())
}
None => Some(ListOfEndpointsDeserializer::deserialize(
"Endpoints",
stack,
)?),
};
}
"NextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ListOfEndpointsDeserializer;
impl ListOfEndpointsDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
let mut obj = vec![];
start_element(tag_name, stack)?;
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => {
if name == "member" {
obj.push(EndpointDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
}
DeserializerNext::Close => {
end_element(tag_name, stack)?;
break;
}
DeserializerNext::Skip => {
stack.next();
}
}
}
Ok(obj)
}
}
struct ListOfPlatformApplicationsDeserializer;
impl ListOfPlatformApplicationsDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<PlatformApplication>, XmlParseError> {
let mut obj = vec![];
start_element(tag_name, stack)?;
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => {
if name == "member" {
obj.push(PlatformApplicationDeserializer::deserialize(
"member", stack,
)?);
} else {
skip_tree(stack);
}
}
DeserializerNext::Close => {
end_element(tag_name, stack)?;
break;
}
DeserializerNext::Skip => {
stack.next();
}
}
}
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListPhoneNumbersOptedOutInput {
pub next_token: Option<String>,
}
struct ListPhoneNumbersOptedOutInputSerializer;
impl ListPhoneNumbersOptedOutInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListPhoneNumbersOptedOutInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "nextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListPhoneNumbersOptedOutResponse {
pub next_token: Option<String>,
pub phone_numbers: Option<Vec<String>>,
}
struct ListPhoneNumbersOptedOutResponseDeserializer;
impl ListPhoneNumbersOptedOutResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListPhoneNumbersOptedOutResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListPhoneNumbersOptedOutResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"nextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("nextToken", stack)?);
}
"phoneNumbers" => {
obj.phone_numbers = match obj.phone_numbers {
Some(ref mut existing) => {
existing.extend(PhoneNumberListDeserializer::deserialize(
"phoneNumbers",
stack,
)?);
Some(existing.to_vec())
}
None => Some(PhoneNumberListDeserializer::deserialize(
"phoneNumbers",
stack,
)?),
};
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListPlatformApplicationsInput {
pub next_token: Option<String>,
}
struct ListPlatformApplicationsInputSerializer;
impl ListPlatformApplicationsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListPlatformApplicationsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListPlatformApplicationsResponse {
pub next_token: Option<String>,
pub platform_applications: Option<Vec<PlatformApplication>>,
}
struct ListPlatformApplicationsResponseDeserializer;
impl ListPlatformApplicationsResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListPlatformApplicationsResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListPlatformApplicationsResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"NextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("NextToken", stack)?);
}
"PlatformApplications" => {
obj.platform_applications = match obj.platform_applications {
Some(ref mut existing) => {
existing.extend(
ListOfPlatformApplicationsDeserializer::deserialize(
"PlatformApplications",
stack,
)?,
);
Some(existing.to_vec())
}
None => Some(ListOfPlatformApplicationsDeserializer::deserialize(
"PlatformApplications",
stack,
)?),
};
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ListStringSerializer;
impl ListStringSerializer {
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 ListSubscriptionsByTopicInput {
pub next_token: Option<String>,
pub topic_arn: String,
}
struct ListSubscriptionsByTopicInputSerializer;
impl ListSubscriptionsByTopicInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListSubscriptionsByTopicInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListSubscriptionsByTopicResponse {
pub next_token: Option<String>,
pub subscriptions: Option<Vec<Subscription>>,
}
struct ListSubscriptionsByTopicResponseDeserializer;
impl ListSubscriptionsByTopicResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListSubscriptionsByTopicResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListSubscriptionsByTopicResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Subscriptions" => {
obj.subscriptions = match obj.subscriptions {
Some(ref mut existing) => {
existing.extend(SubscriptionsListDeserializer::deserialize(
"Subscriptions",
stack,
)?);
Some(existing.to_vec())
}
None => Some(SubscriptionsListDeserializer::deserialize(
"Subscriptions",
stack,
)?),
};
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListSubscriptionsInput {
pub next_token: Option<String>,
}
struct ListSubscriptionsInputSerializer;
impl ListSubscriptionsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListSubscriptionsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListSubscriptionsResponse {
pub next_token: Option<String>,
pub subscriptions: Option<Vec<Subscription>>,
}
struct ListSubscriptionsResponseDeserializer;
impl ListSubscriptionsResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListSubscriptionsResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListSubscriptionsResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Subscriptions" => {
obj.subscriptions = match obj.subscriptions {
Some(ref mut existing) => {
existing.extend(SubscriptionsListDeserializer::deserialize(
"Subscriptions",
stack,
)?);
Some(existing.to_vec())
}
None => Some(SubscriptionsListDeserializer::deserialize(
"Subscriptions",
stack,
)?),
};
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTopicsInput {
pub next_token: Option<String>,
}
struct ListTopicsInputSerializer;
impl ListTopicsInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListTopicsInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.next_token {
params.put(&format!("{}{}", prefix, "NextToken"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTopicsResponse {
pub next_token: Option<String>,
pub topics: Option<Vec<Topic>>,
}
struct ListTopicsResponseDeserializer;
impl ListTopicsResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListTopicsResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = ListTopicsResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Topics" => {
obj.topics = match obj.topics {
Some(ref mut existing) => {
existing
.extend(TopicsListDeserializer::deserialize("Topics", stack)?);
Some(existing.to_vec())
}
None => Some(TopicsListDeserializer::deserialize("Topics", stack)?),
};
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MapStringToStringDeserializer;
impl MapStringToStringDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<::std::collections::HashMap<String, String>, 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 = StringDeserializer::deserialize("key", stack)?;
let value = StringDeserializer::deserialize("value", stack)?;
obj.insert(key, value);
end_element("entry", stack)?;
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct MapStringToStringSerializer;
impl MapStringToStringSerializer {
fn serialize(
params: &mut Params,
name: &str,
obj: &::std::collections::HashMap<String, String>,
) {
for (index, (key, value)) in obj.iter().enumerate() {
let prefix = format!("{}.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "key"), &key);
params.put(&format!("{}.{}", prefix, "Value"), &value);
}
}
}
struct MessageAttributeMapSerializer;
impl MessageAttributeMapSerializer {
fn serialize(
params: &mut Params,
name: &str,
obj: &::std::collections::HashMap<String, MessageAttributeValue>,
) {
for (index, (key, value)) in obj.iter().enumerate() {
let prefix = format!("{}.entry.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "Name"), &key);
MessageAttributeValueSerializer::serialize(
params,
&format!("{}.{}", prefix, "Value"),
value,
);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct MessageAttributeValue {
pub binary_value: Option<Vec<u8>>,
pub data_type: String,
pub string_value: Option<String>,
}
struct MessageAttributeValueSerializer;
impl MessageAttributeValueSerializer {
fn serialize(params: &mut Params, name: &str, obj: &MessageAttributeValue) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.binary_value {
params.put(
&format!("{}{}", prefix, "BinaryValue"),
::std::str::from_utf8(&field_value).unwrap(),
);
}
params.put(&format!("{}{}", prefix, "DataType"), &obj.data_type);
if let Some(ref field_value) = obj.string_value {
params.put(&format!("{}{}", prefix, "StringValue"), &field_value);
}
}
}
struct MessageIdDeserializer;
impl MessageIdDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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<'a, 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 OptInPhoneNumberInput {
pub phone_number: String,
}
struct OptInPhoneNumberInputSerializer;
impl OptInPhoneNumberInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &OptInPhoneNumberInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "phoneNumber"), &obj.phone_number);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct OptInPhoneNumberResponse {}
struct OptInPhoneNumberResponseDeserializer;
impl OptInPhoneNumberResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<OptInPhoneNumberResponse, XmlParseError> {
start_element(tag_name, stack)?;
let obj = OptInPhoneNumberResponse::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct PhoneNumberDeserializer;
impl PhoneNumberDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 PhoneNumberListDeserializer;
impl PhoneNumberListDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
let mut obj = vec![];
start_element(tag_name, stack)?;
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => {
if name == "member" {
obj.push(PhoneNumberDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
}
DeserializerNext::Close => {
end_element(tag_name, stack)?;
break;
}
DeserializerNext::Skip => {
stack.next();
}
}
}
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PlatformApplication {
pub attributes: Option<::std::collections::HashMap<String, String>>,
pub platform_application_arn: Option<String>,
}
struct PlatformApplicationDeserializer;
impl PlatformApplicationDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<PlatformApplication, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = PlatformApplication::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
"PlatformApplicationArn" => {
obj.platform_application_arn = Some(StringDeserializer::deserialize(
"PlatformApplicationArn",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct ProtocolDeserializer;
impl ProtocolDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 PublishInput {
pub message: String,
pub message_attributes: Option<::std::collections::HashMap<String, MessageAttributeValue>>,
pub message_structure: Option<String>,
pub phone_number: Option<String>,
pub subject: Option<String>,
pub target_arn: Option<String>,
pub topic_arn: Option<String>,
}
struct PublishInputSerializer;
impl PublishInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &PublishInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Message"), &obj.message);
if let Some(ref field_value) = obj.message_attributes {
MessageAttributeMapSerializer::serialize(
params,
&format!("{}{}", prefix, "MessageAttributes"),
field_value,
);
}
if let Some(ref field_value) = obj.message_structure {
params.put(&format!("{}{}", prefix, "MessageStructure"), &field_value);
}
if let Some(ref field_value) = obj.phone_number {
params.put(&format!("{}{}", prefix, "PhoneNumber"), &field_value);
}
if let Some(ref field_value) = obj.subject {
params.put(&format!("{}{}", prefix, "Subject"), &field_value);
}
if let Some(ref field_value) = obj.target_arn {
params.put(&format!("{}{}", prefix, "TargetArn"), &field_value);
}
if let Some(ref field_value) = obj.topic_arn {
params.put(&format!("{}{}", prefix, "TopicArn"), &field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct PublishResponse {
pub message_id: Option<String>,
}
struct PublishResponseDeserializer;
impl PublishResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<PublishResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = PublishResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"MessageId" => {
obj.message_id =
Some(MessageIdDeserializer::deserialize("MessageId", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct RemovePermissionInput {
pub label: String,
pub topic_arn: String,
}
struct RemovePermissionInputSerializer;
impl RemovePermissionInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &RemovePermissionInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Label"), &obj.label);
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetEndpointAttributesInput {
pub attributes: ::std::collections::HashMap<String, String>,
pub endpoint_arn: String,
}
struct SetEndpointAttributesInputSerializer;
impl SetEndpointAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetEndpointAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MapStringToStringSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
&obj.attributes,
);
params.put(&format!("{}{}", prefix, "EndpointArn"), &obj.endpoint_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetPlatformApplicationAttributesInput {
pub attributes: ::std::collections::HashMap<String, String>,
pub platform_application_arn: String,
}
struct SetPlatformApplicationAttributesInputSerializer;
impl SetPlatformApplicationAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetPlatformApplicationAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MapStringToStringSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
&obj.attributes,
);
params.put(
&format!("{}{}", prefix, "PlatformApplicationArn"),
&obj.platform_application_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetSMSAttributesInput {
pub attributes: ::std::collections::HashMap<String, String>,
}
struct SetSMSAttributesInputSerializer;
impl SetSMSAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetSMSAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
MapStringToStringSerializer::serialize(
params,
&format!("{}{}", prefix, "attributes"),
&obj.attributes,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetSMSAttributesResponse {}
struct SetSMSAttributesResponseDeserializer;
impl SetSMSAttributesResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<SetSMSAttributesResponse, XmlParseError> {
start_element(tag_name, stack)?;
let obj = SetSMSAttributesResponse::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetSubscriptionAttributesInput {
pub attribute_name: String,
pub attribute_value: Option<String>,
pub subscription_arn: String,
}
struct SetSubscriptionAttributesInputSerializer;
impl SetSubscriptionAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetSubscriptionAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "AttributeName"),
&obj.attribute_name,
);
if let Some(ref field_value) = obj.attribute_value {
params.put(&format!("{}{}", prefix, "AttributeValue"), &field_value);
}
params.put(
&format!("{}{}", prefix, "SubscriptionArn"),
&obj.subscription_arn,
);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SetTopicAttributesInput {
pub attribute_name: String,
pub attribute_value: Option<String>,
pub topic_arn: String,
}
struct SetTopicAttributesInputSerializer;
impl SetTopicAttributesInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SetTopicAttributesInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "AttributeName"),
&obj.attribute_name,
);
if let Some(ref field_value) = obj.attribute_value {
params.put(&format!("{}{}", prefix, "AttributeValue"), &field_value);
}
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
struct StringDeserializer;
impl StringDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 SubscribeInput {
pub attributes: Option<::std::collections::HashMap<String, String>>,
pub endpoint: Option<String>,
pub protocol: String,
pub return_subscription_arn: Option<bool>,
pub topic_arn: String,
}
struct SubscribeInputSerializer;
impl SubscribeInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &SubscribeInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
if let Some(ref field_value) = obj.attributes {
SubscriptionAttributesMapSerializer::serialize(
params,
&format!("{}{}", prefix, "Attributes"),
field_value,
);
}
if let Some(ref field_value) = obj.endpoint {
params.put(&format!("{}{}", prefix, "Endpoint"), &field_value);
}
params.put(&format!("{}{}", prefix, "Protocol"), &obj.protocol);
if let Some(ref field_value) = obj.return_subscription_arn {
params.put(
&format!("{}{}", prefix, "ReturnSubscriptionArn"),
&field_value.to_string(),
);
}
params.put(&format!("{}{}", prefix, "TopicArn"), &obj.topic_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct SubscribeResponse {
pub subscription_arn: Option<String>,
}
struct SubscribeResponseDeserializer;
impl SubscribeResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<SubscribeResponse, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = SubscribeResponse::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"SubscriptionArn" => {
obj.subscription_arn = Some(SubscriptionARNDeserializer::deserialize(
"SubscriptionArn",
stack,
)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Subscription {
pub endpoint: Option<String>,
pub owner: Option<String>,
pub protocol: Option<String>,
pub subscription_arn: Option<String>,
pub topic_arn: Option<String>,
}
struct SubscriptionDeserializer;
impl SubscriptionDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Subscription, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = Subscription::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"Endpoint" => {
obj.endpoint = Some(EndpointDeserializer::deserialize("Endpoint", stack)?);
}
"Owner" => {
obj.owner = Some(AccountDeserializer::deserialize("Owner", stack)?);
}
"Protocol" => {
obj.protocol = Some(ProtocolDeserializer::deserialize("Protocol", stack)?);
}
"SubscriptionArn" => {
obj.subscription_arn = Some(SubscriptionARNDeserializer::deserialize(
"SubscriptionArn",
stack,
)?);
}
"TopicArn" => {
obj.topic_arn = Some(TopicARNDeserializer::deserialize("TopicArn", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct SubscriptionARNDeserializer;
impl SubscriptionARNDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 SubscriptionAttributesMapDeserializer;
impl SubscriptionAttributesMapDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<::std::collections::HashMap<String, String>, 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 = AttributeNameDeserializer::deserialize("key", stack)?;
let value = AttributeValueDeserializer::deserialize("value", stack)?;
obj.insert(key, value);
end_element("entry", stack)?;
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct SubscriptionAttributesMapSerializer;
impl SubscriptionAttributesMapSerializer {
fn serialize(
params: &mut Params,
name: &str,
obj: &::std::collections::HashMap<String, String>,
) {
for (index, (key, value)) in obj.iter().enumerate() {
let prefix = format!("{}.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "key"), &key);
params.put(&format!("{}.{}", prefix, "Value"), &value);
}
}
}
struct SubscriptionsListDeserializer;
impl SubscriptionsListDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Subscription>, XmlParseError> {
let mut obj = vec![];
start_element(tag_name, stack)?;
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => {
if name == "member" {
obj.push(SubscriptionDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
}
DeserializerNext::Close => {
end_element(tag_name, stack)?;
break;
}
DeserializerNext::Skip => {
stack.next();
}
}
}
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Topic {
pub topic_arn: Option<String>,
}
struct TopicDeserializer;
impl TopicDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Topic, XmlParseError> {
start_element(tag_name, stack)?;
let mut obj = Topic::default();
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { ref name, .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => match &name[..] {
"TopicArn" => {
obj.topic_arn = Some(TopicARNDeserializer::deserialize("TopicArn", stack)?);
}
_ => skip_tree(stack),
},
DeserializerNext::Close => break,
DeserializerNext::Skip => {
stack.next();
}
}
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TopicARNDeserializer;
impl TopicARNDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, 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 TopicAttributesMapDeserializer;
impl TopicAttributesMapDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<::std::collections::HashMap<String, String>, 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 = AttributeNameDeserializer::deserialize("key", stack)?;
let value = AttributeValueDeserializer::deserialize("value", stack)?;
obj.insert(key, value);
end_element("entry", stack)?;
}
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TopicAttributesMapSerializer;
impl TopicAttributesMapSerializer {
fn serialize(
params: &mut Params,
name: &str,
obj: &::std::collections::HashMap<String, String>,
) {
for (index, (key, value)) in obj.iter().enumerate() {
let prefix = format!("{}.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "key"), &key);
params.put(&format!("{}.{}", prefix, "Value"), &value);
}
}
}
struct TopicsListDeserializer;
impl TopicsListDeserializer {
#[allow(unused_variables)]
fn deserialize<'a, T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Topic>, XmlParseError> {
let mut obj = vec![];
start_element(tag_name, stack)?;
loop {
let next_event = match stack.peek() {
Some(&Ok(XmlEvent::EndElement { .. })) => DeserializerNext::Close,
Some(&Ok(XmlEvent::StartElement { ref name, .. })) => {
DeserializerNext::Element(name.local_name.to_owned())
}
_ => DeserializerNext::Skip,
};
match next_event {
DeserializerNext::Element(name) => {
if name == "member" {
obj.push(TopicDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
}
DeserializerNext::Close => {
end_element(tag_name, stack)?;
break;
}
DeserializerNext::Skip => {
stack.next();
}
}
}
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UnsubscribeInput {
pub subscription_arn: String,
}
struct UnsubscribeInputSerializer;
impl UnsubscribeInputSerializer {
fn serialize(params: &mut Params, name: &str, obj: &UnsubscribeInput) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(
&format!("{}{}", prefix, "SubscriptionArn"),
&obj.subscription_arn,
);
}
}
#[derive(Debug, PartialEq)]
pub enum AddPermissionError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AddPermissionError {
pub fn from_response(res: BufferedHttpResponse) -> AddPermissionError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return AddPermissionError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return AddPermissionError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return AddPermissionError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return AddPermissionError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
AddPermissionError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for AddPermissionError {
fn from(err: XmlParseError) -> AddPermissionError {
let XmlParseError(message) = err;
AddPermissionError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for AddPermissionError {
fn from(err: CredentialsError) -> AddPermissionError {
AddPermissionError::Credentials(err)
}
}
impl From<HttpDispatchError> for AddPermissionError {
fn from(err: HttpDispatchError) -> AddPermissionError {
AddPermissionError::HttpDispatch(err)
}
}
impl From<io::Error> for AddPermissionError {
fn from(err: io::Error) -> AddPermissionError {
AddPermissionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AddPermissionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AddPermissionError {
fn description(&self) -> &str {
match *self {
AddPermissionError::AuthorizationError(ref cause) => cause,
AddPermissionError::InternalError(ref cause) => cause,
AddPermissionError::InvalidParameter(ref cause) => cause,
AddPermissionError::NotFound(ref cause) => cause,
AddPermissionError::Validation(ref cause) => cause,
AddPermissionError::Credentials(ref err) => err.description(),
AddPermissionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
AddPermissionError::ParseError(ref cause) => cause,
AddPermissionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CheckIfPhoneNumberIsOptedOutError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CheckIfPhoneNumberIsOptedOutError {
pub fn from_response(res: BufferedHttpResponse) -> CheckIfPhoneNumberIsOptedOutError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return CheckIfPhoneNumberIsOptedOutError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return CheckIfPhoneNumberIsOptedOutError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return CheckIfPhoneNumberIsOptedOutError::InvalidParameter(String::from(
parsed_error.message,
));
}
"Throttled" => {
return CheckIfPhoneNumberIsOptedOutError::Throttled(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
CheckIfPhoneNumberIsOptedOutError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for CheckIfPhoneNumberIsOptedOutError {
fn from(err: XmlParseError) -> CheckIfPhoneNumberIsOptedOutError {
let XmlParseError(message) = err;
CheckIfPhoneNumberIsOptedOutError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for CheckIfPhoneNumberIsOptedOutError {
fn from(err: CredentialsError) -> CheckIfPhoneNumberIsOptedOutError {
CheckIfPhoneNumberIsOptedOutError::Credentials(err)
}
}
impl From<HttpDispatchError> for CheckIfPhoneNumberIsOptedOutError {
fn from(err: HttpDispatchError) -> CheckIfPhoneNumberIsOptedOutError {
CheckIfPhoneNumberIsOptedOutError::HttpDispatch(err)
}
}
impl From<io::Error> for CheckIfPhoneNumberIsOptedOutError {
fn from(err: io::Error) -> CheckIfPhoneNumberIsOptedOutError {
CheckIfPhoneNumberIsOptedOutError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CheckIfPhoneNumberIsOptedOutError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CheckIfPhoneNumberIsOptedOutError {
fn description(&self) -> &str {
match *self {
CheckIfPhoneNumberIsOptedOutError::AuthorizationError(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::InternalError(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::InvalidParameter(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::Throttled(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::Validation(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::Credentials(ref err) => err.description(),
CheckIfPhoneNumberIsOptedOutError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CheckIfPhoneNumberIsOptedOutError::ParseError(ref cause) => cause,
CheckIfPhoneNumberIsOptedOutError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmSubscriptionError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
SubscriptionLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ConfirmSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> ConfirmSubscriptionError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ConfirmSubscriptionError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ConfirmSubscriptionError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ConfirmSubscriptionError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return ConfirmSubscriptionError::NotFound(String::from(
parsed_error.message,
));
}
"SubscriptionLimitExceeded" => {
return ConfirmSubscriptionError::SubscriptionLimitExceeded(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ConfirmSubscriptionError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ConfirmSubscriptionError {
fn from(err: XmlParseError) -> ConfirmSubscriptionError {
let XmlParseError(message) = err;
ConfirmSubscriptionError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ConfirmSubscriptionError {
fn from(err: CredentialsError) -> ConfirmSubscriptionError {
ConfirmSubscriptionError::Credentials(err)
}
}
impl From<HttpDispatchError> for ConfirmSubscriptionError {
fn from(err: HttpDispatchError) -> ConfirmSubscriptionError {
ConfirmSubscriptionError::HttpDispatch(err)
}
}
impl From<io::Error> for ConfirmSubscriptionError {
fn from(err: io::Error) -> ConfirmSubscriptionError {
ConfirmSubscriptionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ConfirmSubscriptionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ConfirmSubscriptionError {
fn description(&self) -> &str {
match *self {
ConfirmSubscriptionError::AuthorizationError(ref cause) => cause,
ConfirmSubscriptionError::InternalError(ref cause) => cause,
ConfirmSubscriptionError::InvalidParameter(ref cause) => cause,
ConfirmSubscriptionError::NotFound(ref cause) => cause,
ConfirmSubscriptionError::SubscriptionLimitExceeded(ref cause) => cause,
ConfirmSubscriptionError::Validation(ref cause) => cause,
ConfirmSubscriptionError::Credentials(ref err) => err.description(),
ConfirmSubscriptionError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ConfirmSubscriptionError::ParseError(ref cause) => cause,
ConfirmSubscriptionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePlatformApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePlatformApplicationError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return CreatePlatformApplicationError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return CreatePlatformApplicationError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return CreatePlatformApplicationError::InvalidParameter(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
CreatePlatformApplicationError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for CreatePlatformApplicationError {
fn from(err: XmlParseError) -> CreatePlatformApplicationError {
let XmlParseError(message) = err;
CreatePlatformApplicationError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for CreatePlatformApplicationError {
fn from(err: CredentialsError) -> CreatePlatformApplicationError {
CreatePlatformApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePlatformApplicationError {
fn from(err: HttpDispatchError) -> CreatePlatformApplicationError {
CreatePlatformApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePlatformApplicationError {
fn from(err: io::Error) -> CreatePlatformApplicationError {
CreatePlatformApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePlatformApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePlatformApplicationError {
fn description(&self) -> &str {
match *self {
CreatePlatformApplicationError::AuthorizationError(ref cause) => cause,
CreatePlatformApplicationError::InternalError(ref cause) => cause,
CreatePlatformApplicationError::InvalidParameter(ref cause) => cause,
CreatePlatformApplicationError::Validation(ref cause) => cause,
CreatePlatformApplicationError::Credentials(ref err) => err.description(),
CreatePlatformApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePlatformApplicationError::ParseError(ref cause) => cause,
CreatePlatformApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePlatformEndpointError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreatePlatformEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> CreatePlatformEndpointError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return CreatePlatformEndpointError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return CreatePlatformEndpointError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return CreatePlatformEndpointError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return CreatePlatformEndpointError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
CreatePlatformEndpointError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for CreatePlatformEndpointError {
fn from(err: XmlParseError) -> CreatePlatformEndpointError {
let XmlParseError(message) = err;
CreatePlatformEndpointError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for CreatePlatformEndpointError {
fn from(err: CredentialsError) -> CreatePlatformEndpointError {
CreatePlatformEndpointError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreatePlatformEndpointError {
fn from(err: HttpDispatchError) -> CreatePlatformEndpointError {
CreatePlatformEndpointError::HttpDispatch(err)
}
}
impl From<io::Error> for CreatePlatformEndpointError {
fn from(err: io::Error) -> CreatePlatformEndpointError {
CreatePlatformEndpointError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreatePlatformEndpointError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePlatformEndpointError {
fn description(&self) -> &str {
match *self {
CreatePlatformEndpointError::AuthorizationError(ref cause) => cause,
CreatePlatformEndpointError::InternalError(ref cause) => cause,
CreatePlatformEndpointError::InvalidParameter(ref cause) => cause,
CreatePlatformEndpointError::NotFound(ref cause) => cause,
CreatePlatformEndpointError::Validation(ref cause) => cause,
CreatePlatformEndpointError::Credentials(ref err) => err.description(),
CreatePlatformEndpointError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreatePlatformEndpointError::ParseError(ref cause) => cause,
CreatePlatformEndpointError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateTopicError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
TopicLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateTopicError {
pub fn from_response(res: BufferedHttpResponse) -> CreateTopicError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return CreateTopicError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return CreateTopicError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return CreateTopicError::InvalidParameter(String::from(
parsed_error.message,
));
}
"InvalidSecurity" => {
return CreateTopicError::InvalidSecurity(String::from(parsed_error.message));
}
"TopicLimitExceeded" => {
return CreateTopicError::TopicLimitExceeded(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
CreateTopicError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for CreateTopicError {
fn from(err: XmlParseError) -> CreateTopicError {
let XmlParseError(message) = err;
CreateTopicError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for CreateTopicError {
fn from(err: CredentialsError) -> CreateTopicError {
CreateTopicError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateTopicError {
fn from(err: HttpDispatchError) -> CreateTopicError {
CreateTopicError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateTopicError {
fn from(err: io::Error) -> CreateTopicError {
CreateTopicError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateTopicError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateTopicError {
fn description(&self) -> &str {
match *self {
CreateTopicError::AuthorizationError(ref cause) => cause,
CreateTopicError::InternalError(ref cause) => cause,
CreateTopicError::InvalidParameter(ref cause) => cause,
CreateTopicError::InvalidSecurity(ref cause) => cause,
CreateTopicError::TopicLimitExceeded(ref cause) => cause,
CreateTopicError::Validation(ref cause) => cause,
CreateTopicError::Credentials(ref err) => err.description(),
CreateTopicError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateTopicError::ParseError(ref cause) => cause,
CreateTopicError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteEndpointError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteEndpointError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return DeleteEndpointError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return DeleteEndpointError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return DeleteEndpointError::InvalidParameter(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
DeleteEndpointError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for DeleteEndpointError {
fn from(err: XmlParseError) -> DeleteEndpointError {
let XmlParseError(message) = err;
DeleteEndpointError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for DeleteEndpointError {
fn from(err: CredentialsError) -> DeleteEndpointError {
DeleteEndpointError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteEndpointError {
fn from(err: HttpDispatchError) -> DeleteEndpointError {
DeleteEndpointError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteEndpointError {
fn from(err: io::Error) -> DeleteEndpointError {
DeleteEndpointError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteEndpointError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteEndpointError {
fn description(&self) -> &str {
match *self {
DeleteEndpointError::AuthorizationError(ref cause) => cause,
DeleteEndpointError::InternalError(ref cause) => cause,
DeleteEndpointError::InvalidParameter(ref cause) => cause,
DeleteEndpointError::Validation(ref cause) => cause,
DeleteEndpointError::Credentials(ref err) => err.description(),
DeleteEndpointError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteEndpointError::ParseError(ref cause) => cause,
DeleteEndpointError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeletePlatformApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> DeletePlatformApplicationError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return DeletePlatformApplicationError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return DeletePlatformApplicationError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return DeletePlatformApplicationError::InvalidParameter(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
DeletePlatformApplicationError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for DeletePlatformApplicationError {
fn from(err: XmlParseError) -> DeletePlatformApplicationError {
let XmlParseError(message) = err;
DeletePlatformApplicationError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for DeletePlatformApplicationError {
fn from(err: CredentialsError) -> DeletePlatformApplicationError {
DeletePlatformApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeletePlatformApplicationError {
fn from(err: HttpDispatchError) -> DeletePlatformApplicationError {
DeletePlatformApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for DeletePlatformApplicationError {
fn from(err: io::Error) -> DeletePlatformApplicationError {
DeletePlatformApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeletePlatformApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePlatformApplicationError {
fn description(&self) -> &str {
match *self {
DeletePlatformApplicationError::AuthorizationError(ref cause) => cause,
DeletePlatformApplicationError::InternalError(ref cause) => cause,
DeletePlatformApplicationError::InvalidParameter(ref cause) => cause,
DeletePlatformApplicationError::Validation(ref cause) => cause,
DeletePlatformApplicationError::Credentials(ref err) => err.description(),
DeletePlatformApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeletePlatformApplicationError::ParseError(ref cause) => cause,
DeletePlatformApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTopicError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteTopicError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteTopicError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return DeleteTopicError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return DeleteTopicError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return DeleteTopicError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return DeleteTopicError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
DeleteTopicError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for DeleteTopicError {
fn from(err: XmlParseError) -> DeleteTopicError {
let XmlParseError(message) = err;
DeleteTopicError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for DeleteTopicError {
fn from(err: CredentialsError) -> DeleteTopicError {
DeleteTopicError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteTopicError {
fn from(err: HttpDispatchError) -> DeleteTopicError {
DeleteTopicError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteTopicError {
fn from(err: io::Error) -> DeleteTopicError {
DeleteTopicError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteTopicError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteTopicError {
fn description(&self) -> &str {
match *self {
DeleteTopicError::AuthorizationError(ref cause) => cause,
DeleteTopicError::InternalError(ref cause) => cause,
DeleteTopicError::InvalidParameter(ref cause) => cause,
DeleteTopicError::NotFound(ref cause) => cause,
DeleteTopicError::Validation(ref cause) => cause,
DeleteTopicError::Credentials(ref err) => err.description(),
DeleteTopicError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteTopicError::ParseError(ref cause) => cause,
DeleteTopicError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetEndpointAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetEndpointAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetEndpointAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return GetEndpointAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return GetEndpointAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return GetEndpointAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return GetEndpointAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
GetEndpointAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for GetEndpointAttributesError {
fn from(err: XmlParseError) -> GetEndpointAttributesError {
let XmlParseError(message) = err;
GetEndpointAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for GetEndpointAttributesError {
fn from(err: CredentialsError) -> GetEndpointAttributesError {
GetEndpointAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetEndpointAttributesError {
fn from(err: HttpDispatchError) -> GetEndpointAttributesError {
GetEndpointAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetEndpointAttributesError {
fn from(err: io::Error) -> GetEndpointAttributesError {
GetEndpointAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetEndpointAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetEndpointAttributesError {
fn description(&self) -> &str {
match *self {
GetEndpointAttributesError::AuthorizationError(ref cause) => cause,
GetEndpointAttributesError::InternalError(ref cause) => cause,
GetEndpointAttributesError::InvalidParameter(ref cause) => cause,
GetEndpointAttributesError::NotFound(ref cause) => cause,
GetEndpointAttributesError::Validation(ref cause) => cause,
GetEndpointAttributesError::Credentials(ref err) => err.description(),
GetEndpointAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetEndpointAttributesError::ParseError(ref cause) => cause,
GetEndpointAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPlatformApplicationAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetPlatformApplicationAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetPlatformApplicationAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return GetPlatformApplicationAttributesError::AuthorizationError(
String::from(parsed_error.message),
);
}
"InternalError" => {
return GetPlatformApplicationAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return GetPlatformApplicationAttributesError::InvalidParameter(
String::from(parsed_error.message),
);
}
"NotFound" => {
return GetPlatformApplicationAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
GetPlatformApplicationAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for GetPlatformApplicationAttributesError {
fn from(err: XmlParseError) -> GetPlatformApplicationAttributesError {
let XmlParseError(message) = err;
GetPlatformApplicationAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for GetPlatformApplicationAttributesError {
fn from(err: CredentialsError) -> GetPlatformApplicationAttributesError {
GetPlatformApplicationAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetPlatformApplicationAttributesError {
fn from(err: HttpDispatchError) -> GetPlatformApplicationAttributesError {
GetPlatformApplicationAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetPlatformApplicationAttributesError {
fn from(err: io::Error) -> GetPlatformApplicationAttributesError {
GetPlatformApplicationAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetPlatformApplicationAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetPlatformApplicationAttributesError {
fn description(&self) -> &str {
match *self {
GetPlatformApplicationAttributesError::AuthorizationError(ref cause) => cause,
GetPlatformApplicationAttributesError::InternalError(ref cause) => cause,
GetPlatformApplicationAttributesError::InvalidParameter(ref cause) => cause,
GetPlatformApplicationAttributesError::NotFound(ref cause) => cause,
GetPlatformApplicationAttributesError::Validation(ref cause) => cause,
GetPlatformApplicationAttributesError::Credentials(ref err) => err.description(),
GetPlatformApplicationAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetPlatformApplicationAttributesError::ParseError(ref cause) => cause,
GetPlatformApplicationAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSMSAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSMSAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetSMSAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return GetSMSAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return GetSMSAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return GetSMSAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"Throttled" => {
return GetSMSAttributesError::Throttled(String::from(parsed_error.message));
}
_ => {}
}
}
}
GetSMSAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for GetSMSAttributesError {
fn from(err: XmlParseError) -> GetSMSAttributesError {
let XmlParseError(message) = err;
GetSMSAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for GetSMSAttributesError {
fn from(err: CredentialsError) -> GetSMSAttributesError {
GetSMSAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSMSAttributesError {
fn from(err: HttpDispatchError) -> GetSMSAttributesError {
GetSMSAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSMSAttributesError {
fn from(err: io::Error) -> GetSMSAttributesError {
GetSMSAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSMSAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSMSAttributesError {
fn description(&self) -> &str {
match *self {
GetSMSAttributesError::AuthorizationError(ref cause) => cause,
GetSMSAttributesError::InternalError(ref cause) => cause,
GetSMSAttributesError::InvalidParameter(ref cause) => cause,
GetSMSAttributesError::Throttled(ref cause) => cause,
GetSMSAttributesError::Validation(ref cause) => cause,
GetSMSAttributesError::Credentials(ref err) => err.description(),
GetSMSAttributesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetSMSAttributesError::ParseError(ref cause) => cause,
GetSMSAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSubscriptionAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetSubscriptionAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetSubscriptionAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return GetSubscriptionAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return GetSubscriptionAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return GetSubscriptionAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return GetSubscriptionAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
GetSubscriptionAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for GetSubscriptionAttributesError {
fn from(err: XmlParseError) -> GetSubscriptionAttributesError {
let XmlParseError(message) = err;
GetSubscriptionAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for GetSubscriptionAttributesError {
fn from(err: CredentialsError) -> GetSubscriptionAttributesError {
GetSubscriptionAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetSubscriptionAttributesError {
fn from(err: HttpDispatchError) -> GetSubscriptionAttributesError {
GetSubscriptionAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetSubscriptionAttributesError {
fn from(err: io::Error) -> GetSubscriptionAttributesError {
GetSubscriptionAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetSubscriptionAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetSubscriptionAttributesError {
fn description(&self) -> &str {
match *self {
GetSubscriptionAttributesError::AuthorizationError(ref cause) => cause,
GetSubscriptionAttributesError::InternalError(ref cause) => cause,
GetSubscriptionAttributesError::InvalidParameter(ref cause) => cause,
GetSubscriptionAttributesError::NotFound(ref cause) => cause,
GetSubscriptionAttributesError::Validation(ref cause) => cause,
GetSubscriptionAttributesError::Credentials(ref err) => err.description(),
GetSubscriptionAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetSubscriptionAttributesError::ParseError(ref cause) => cause,
GetSubscriptionAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetTopicAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetTopicAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> GetTopicAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return GetTopicAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return GetTopicAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return GetTopicAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"InvalidSecurity" => {
return GetTopicAttributesError::InvalidSecurity(String::from(
parsed_error.message,
));
}
"NotFound" => {
return GetTopicAttributesError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
GetTopicAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for GetTopicAttributesError {
fn from(err: XmlParseError) -> GetTopicAttributesError {
let XmlParseError(message) = err;
GetTopicAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for GetTopicAttributesError {
fn from(err: CredentialsError) -> GetTopicAttributesError {
GetTopicAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetTopicAttributesError {
fn from(err: HttpDispatchError) -> GetTopicAttributesError {
GetTopicAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for GetTopicAttributesError {
fn from(err: io::Error) -> GetTopicAttributesError {
GetTopicAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetTopicAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetTopicAttributesError {
fn description(&self) -> &str {
match *self {
GetTopicAttributesError::AuthorizationError(ref cause) => cause,
GetTopicAttributesError::InternalError(ref cause) => cause,
GetTopicAttributesError::InvalidParameter(ref cause) => cause,
GetTopicAttributesError::InvalidSecurity(ref cause) => cause,
GetTopicAttributesError::NotFound(ref cause) => cause,
GetTopicAttributesError::Validation(ref cause) => cause,
GetTopicAttributesError::Credentials(ref err) => err.description(),
GetTopicAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetTopicAttributesError::ParseError(ref cause) => cause,
GetTopicAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListEndpointsByPlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListEndpointsByPlatformApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> ListEndpointsByPlatformApplicationError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListEndpointsByPlatformApplicationError::AuthorizationError(
String::from(parsed_error.message),
);
}
"InternalError" => {
return ListEndpointsByPlatformApplicationError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ListEndpointsByPlatformApplicationError::InvalidParameter(
String::from(parsed_error.message),
);
}
"NotFound" => {
return ListEndpointsByPlatformApplicationError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ListEndpointsByPlatformApplicationError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListEndpointsByPlatformApplicationError {
fn from(err: XmlParseError) -> ListEndpointsByPlatformApplicationError {
let XmlParseError(message) = err;
ListEndpointsByPlatformApplicationError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListEndpointsByPlatformApplicationError {
fn from(err: CredentialsError) -> ListEndpointsByPlatformApplicationError {
ListEndpointsByPlatformApplicationError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListEndpointsByPlatformApplicationError {
fn from(err: HttpDispatchError) -> ListEndpointsByPlatformApplicationError {
ListEndpointsByPlatformApplicationError::HttpDispatch(err)
}
}
impl From<io::Error> for ListEndpointsByPlatformApplicationError {
fn from(err: io::Error) -> ListEndpointsByPlatformApplicationError {
ListEndpointsByPlatformApplicationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListEndpointsByPlatformApplicationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListEndpointsByPlatformApplicationError {
fn description(&self) -> &str {
match *self {
ListEndpointsByPlatformApplicationError::AuthorizationError(ref cause) => cause,
ListEndpointsByPlatformApplicationError::InternalError(ref cause) => cause,
ListEndpointsByPlatformApplicationError::InvalidParameter(ref cause) => cause,
ListEndpointsByPlatformApplicationError::NotFound(ref cause) => cause,
ListEndpointsByPlatformApplicationError::Validation(ref cause) => cause,
ListEndpointsByPlatformApplicationError::Credentials(ref err) => err.description(),
ListEndpointsByPlatformApplicationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListEndpointsByPlatformApplicationError::ParseError(ref cause) => cause,
ListEndpointsByPlatformApplicationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPhoneNumbersOptedOutError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPhoneNumbersOptedOutError {
pub fn from_response(res: BufferedHttpResponse) -> ListPhoneNumbersOptedOutError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListPhoneNumbersOptedOutError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ListPhoneNumbersOptedOutError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ListPhoneNumbersOptedOutError::InvalidParameter(String::from(
parsed_error.message,
));
}
"Throttled" => {
return ListPhoneNumbersOptedOutError::Throttled(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ListPhoneNumbersOptedOutError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListPhoneNumbersOptedOutError {
fn from(err: XmlParseError) -> ListPhoneNumbersOptedOutError {
let XmlParseError(message) = err;
ListPhoneNumbersOptedOutError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListPhoneNumbersOptedOutError {
fn from(err: CredentialsError) -> ListPhoneNumbersOptedOutError {
ListPhoneNumbersOptedOutError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPhoneNumbersOptedOutError {
fn from(err: HttpDispatchError) -> ListPhoneNumbersOptedOutError {
ListPhoneNumbersOptedOutError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPhoneNumbersOptedOutError {
fn from(err: io::Error) -> ListPhoneNumbersOptedOutError {
ListPhoneNumbersOptedOutError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPhoneNumbersOptedOutError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPhoneNumbersOptedOutError {
fn description(&self) -> &str {
match *self {
ListPhoneNumbersOptedOutError::AuthorizationError(ref cause) => cause,
ListPhoneNumbersOptedOutError::InternalError(ref cause) => cause,
ListPhoneNumbersOptedOutError::InvalidParameter(ref cause) => cause,
ListPhoneNumbersOptedOutError::Throttled(ref cause) => cause,
ListPhoneNumbersOptedOutError::Validation(ref cause) => cause,
ListPhoneNumbersOptedOutError::Credentials(ref err) => err.description(),
ListPhoneNumbersOptedOutError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPhoneNumbersOptedOutError::ParseError(ref cause) => cause,
ListPhoneNumbersOptedOutError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPlatformApplicationsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListPlatformApplicationsError {
pub fn from_response(res: BufferedHttpResponse) -> ListPlatformApplicationsError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListPlatformApplicationsError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ListPlatformApplicationsError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ListPlatformApplicationsError::InvalidParameter(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ListPlatformApplicationsError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListPlatformApplicationsError {
fn from(err: XmlParseError) -> ListPlatformApplicationsError {
let XmlParseError(message) = err;
ListPlatformApplicationsError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListPlatformApplicationsError {
fn from(err: CredentialsError) -> ListPlatformApplicationsError {
ListPlatformApplicationsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListPlatformApplicationsError {
fn from(err: HttpDispatchError) -> ListPlatformApplicationsError {
ListPlatformApplicationsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListPlatformApplicationsError {
fn from(err: io::Error) -> ListPlatformApplicationsError {
ListPlatformApplicationsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListPlatformApplicationsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPlatformApplicationsError {
fn description(&self) -> &str {
match *self {
ListPlatformApplicationsError::AuthorizationError(ref cause) => cause,
ListPlatformApplicationsError::InternalError(ref cause) => cause,
ListPlatformApplicationsError::InvalidParameter(ref cause) => cause,
ListPlatformApplicationsError::Validation(ref cause) => cause,
ListPlatformApplicationsError::Credentials(ref err) => err.description(),
ListPlatformApplicationsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListPlatformApplicationsError::ParseError(ref cause) => cause,
ListPlatformApplicationsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSubscriptionsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSubscriptionsError {
pub fn from_response(res: BufferedHttpResponse) -> ListSubscriptionsError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListSubscriptionsError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ListSubscriptionsError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ListSubscriptionsError::InvalidParameter(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ListSubscriptionsError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListSubscriptionsError {
fn from(err: XmlParseError) -> ListSubscriptionsError {
let XmlParseError(message) = err;
ListSubscriptionsError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListSubscriptionsError {
fn from(err: CredentialsError) -> ListSubscriptionsError {
ListSubscriptionsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSubscriptionsError {
fn from(err: HttpDispatchError) -> ListSubscriptionsError {
ListSubscriptionsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSubscriptionsError {
fn from(err: io::Error) -> ListSubscriptionsError {
ListSubscriptionsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSubscriptionsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSubscriptionsError {
fn description(&self) -> &str {
match *self {
ListSubscriptionsError::AuthorizationError(ref cause) => cause,
ListSubscriptionsError::InternalError(ref cause) => cause,
ListSubscriptionsError::InvalidParameter(ref cause) => cause,
ListSubscriptionsError::Validation(ref cause) => cause,
ListSubscriptionsError::Credentials(ref err) => err.description(),
ListSubscriptionsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSubscriptionsError::ParseError(ref cause) => cause,
ListSubscriptionsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSubscriptionsByTopicError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListSubscriptionsByTopicError {
pub fn from_response(res: BufferedHttpResponse) -> ListSubscriptionsByTopicError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListSubscriptionsByTopicError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ListSubscriptionsByTopicError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return ListSubscriptionsByTopicError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return ListSubscriptionsByTopicError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
ListSubscriptionsByTopicError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListSubscriptionsByTopicError {
fn from(err: XmlParseError) -> ListSubscriptionsByTopicError {
let XmlParseError(message) = err;
ListSubscriptionsByTopicError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListSubscriptionsByTopicError {
fn from(err: CredentialsError) -> ListSubscriptionsByTopicError {
ListSubscriptionsByTopicError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListSubscriptionsByTopicError {
fn from(err: HttpDispatchError) -> ListSubscriptionsByTopicError {
ListSubscriptionsByTopicError::HttpDispatch(err)
}
}
impl From<io::Error> for ListSubscriptionsByTopicError {
fn from(err: io::Error) -> ListSubscriptionsByTopicError {
ListSubscriptionsByTopicError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListSubscriptionsByTopicError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListSubscriptionsByTopicError {
fn description(&self) -> &str {
match *self {
ListSubscriptionsByTopicError::AuthorizationError(ref cause) => cause,
ListSubscriptionsByTopicError::InternalError(ref cause) => cause,
ListSubscriptionsByTopicError::InvalidParameter(ref cause) => cause,
ListSubscriptionsByTopicError::NotFound(ref cause) => cause,
ListSubscriptionsByTopicError::Validation(ref cause) => cause,
ListSubscriptionsByTopicError::Credentials(ref err) => err.description(),
ListSubscriptionsByTopicError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListSubscriptionsByTopicError::ParseError(ref cause) => cause,
ListSubscriptionsByTopicError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTopicsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListTopicsError {
pub fn from_response(res: BufferedHttpResponse) -> ListTopicsError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return ListTopicsError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return ListTopicsError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return ListTopicsError::InvalidParameter(String::from(parsed_error.message));
}
_ => {}
}
}
}
ListTopicsError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for ListTopicsError {
fn from(err: XmlParseError) -> ListTopicsError {
let XmlParseError(message) = err;
ListTopicsError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for ListTopicsError {
fn from(err: CredentialsError) -> ListTopicsError {
ListTopicsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListTopicsError {
fn from(err: HttpDispatchError) -> ListTopicsError {
ListTopicsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListTopicsError {
fn from(err: io::Error) -> ListTopicsError {
ListTopicsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListTopicsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTopicsError {
fn description(&self) -> &str {
match *self {
ListTopicsError::AuthorizationError(ref cause) => cause,
ListTopicsError::InternalError(ref cause) => cause,
ListTopicsError::InvalidParameter(ref cause) => cause,
ListTopicsError::Validation(ref cause) => cause,
ListTopicsError::Credentials(ref err) => err.description(),
ListTopicsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListTopicsError::ParseError(ref cause) => cause,
ListTopicsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum OptInPhoneNumberError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl OptInPhoneNumberError {
pub fn from_response(res: BufferedHttpResponse) -> OptInPhoneNumberError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return OptInPhoneNumberError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return OptInPhoneNumberError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return OptInPhoneNumberError::InvalidParameter(String::from(
parsed_error.message,
));
}
"Throttled" => {
return OptInPhoneNumberError::Throttled(String::from(parsed_error.message));
}
_ => {}
}
}
}
OptInPhoneNumberError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for OptInPhoneNumberError {
fn from(err: XmlParseError) -> OptInPhoneNumberError {
let XmlParseError(message) = err;
OptInPhoneNumberError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for OptInPhoneNumberError {
fn from(err: CredentialsError) -> OptInPhoneNumberError {
OptInPhoneNumberError::Credentials(err)
}
}
impl From<HttpDispatchError> for OptInPhoneNumberError {
fn from(err: HttpDispatchError) -> OptInPhoneNumberError {
OptInPhoneNumberError::HttpDispatch(err)
}
}
impl From<io::Error> for OptInPhoneNumberError {
fn from(err: io::Error) -> OptInPhoneNumberError {
OptInPhoneNumberError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for OptInPhoneNumberError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for OptInPhoneNumberError {
fn description(&self) -> &str {
match *self {
OptInPhoneNumberError::AuthorizationError(ref cause) => cause,
OptInPhoneNumberError::InternalError(ref cause) => cause,
OptInPhoneNumberError::InvalidParameter(ref cause) => cause,
OptInPhoneNumberError::Throttled(ref cause) => cause,
OptInPhoneNumberError::Validation(ref cause) => cause,
OptInPhoneNumberError::Credentials(ref err) => err.description(),
OptInPhoneNumberError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
OptInPhoneNumberError::ParseError(ref cause) => cause,
OptInPhoneNumberError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum PublishError {
AuthorizationError(String),
EndpointDisabled(String),
InternalError(String),
InvalidParameter(String),
InvalidParameterValue(String),
InvalidSecurity(String),
KMSAccessDenied(String),
KMSDisabled(String),
KMSInvalidState(String),
KMSNotFound(String),
KMSOptInRequired(String),
KMSThrottling(String),
NotFound(String),
PlatformApplicationDisabled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl PublishError {
pub fn from_response(res: BufferedHttpResponse) -> PublishError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return PublishError::AuthorizationError(String::from(parsed_error.message));
}
"EndpointDisabled" => {
return PublishError::EndpointDisabled(String::from(parsed_error.message));
}
"InternalError" => {
return PublishError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return PublishError::InvalidParameter(String::from(parsed_error.message));
}
"ParameterValueInvalid" => {
return PublishError::InvalidParameterValue(String::from(
parsed_error.message,
));
}
"InvalidSecurity" => {
return PublishError::InvalidSecurity(String::from(parsed_error.message));
}
"KMSAccessDenied" => {
return PublishError::KMSAccessDenied(String::from(parsed_error.message));
}
"KMSDisabled" => {
return PublishError::KMSDisabled(String::from(parsed_error.message));
}
"KMSInvalidState" => {
return PublishError::KMSInvalidState(String::from(parsed_error.message));
}
"KMSNotFound" => {
return PublishError::KMSNotFound(String::from(parsed_error.message));
}
"KMSOptInRequired" => {
return PublishError::KMSOptInRequired(String::from(parsed_error.message));
}
"KMSThrottling" => {
return PublishError::KMSThrottling(String::from(parsed_error.message));
}
"NotFound" => return PublishError::NotFound(String::from(parsed_error.message)),
"PlatformApplicationDisabled" => {
return PublishError::PlatformApplicationDisabled(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
PublishError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for PublishError {
fn from(err: XmlParseError) -> PublishError {
let XmlParseError(message) = err;
PublishError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for PublishError {
fn from(err: CredentialsError) -> PublishError {
PublishError::Credentials(err)
}
}
impl From<HttpDispatchError> for PublishError {
fn from(err: HttpDispatchError) -> PublishError {
PublishError::HttpDispatch(err)
}
}
impl From<io::Error> for PublishError {
fn from(err: io::Error) -> PublishError {
PublishError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for PublishError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for PublishError {
fn description(&self) -> &str {
match *self {
PublishError::AuthorizationError(ref cause) => cause,
PublishError::EndpointDisabled(ref cause) => cause,
PublishError::InternalError(ref cause) => cause,
PublishError::InvalidParameter(ref cause) => cause,
PublishError::InvalidParameterValue(ref cause) => cause,
PublishError::InvalidSecurity(ref cause) => cause,
PublishError::KMSAccessDenied(ref cause) => cause,
PublishError::KMSDisabled(ref cause) => cause,
PublishError::KMSInvalidState(ref cause) => cause,
PublishError::KMSNotFound(ref cause) => cause,
PublishError::KMSOptInRequired(ref cause) => cause,
PublishError::KMSThrottling(ref cause) => cause,
PublishError::NotFound(ref cause) => cause,
PublishError::PlatformApplicationDisabled(ref cause) => cause,
PublishError::Validation(ref cause) => cause,
PublishError::Credentials(ref err) => err.description(),
PublishError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
PublishError::ParseError(ref cause) => cause,
PublishError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemovePermissionError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RemovePermissionError {
pub fn from_response(res: BufferedHttpResponse) -> RemovePermissionError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return RemovePermissionError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return RemovePermissionError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return RemovePermissionError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return RemovePermissionError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
RemovePermissionError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for RemovePermissionError {
fn from(err: XmlParseError) -> RemovePermissionError {
let XmlParseError(message) = err;
RemovePermissionError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for RemovePermissionError {
fn from(err: CredentialsError) -> RemovePermissionError {
RemovePermissionError::Credentials(err)
}
}
impl From<HttpDispatchError> for RemovePermissionError {
fn from(err: HttpDispatchError) -> RemovePermissionError {
RemovePermissionError::HttpDispatch(err)
}
}
impl From<io::Error> for RemovePermissionError {
fn from(err: io::Error) -> RemovePermissionError {
RemovePermissionError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RemovePermissionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RemovePermissionError {
fn description(&self) -> &str {
match *self {
RemovePermissionError::AuthorizationError(ref cause) => cause,
RemovePermissionError::InternalError(ref cause) => cause,
RemovePermissionError::InvalidParameter(ref cause) => cause,
RemovePermissionError::NotFound(ref cause) => cause,
RemovePermissionError::Validation(ref cause) => cause,
RemovePermissionError::Credentials(ref err) => err.description(),
RemovePermissionError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RemovePermissionError::ParseError(ref cause) => cause,
RemovePermissionError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetEndpointAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetEndpointAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> SetEndpointAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SetEndpointAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return SetEndpointAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return SetEndpointAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return SetEndpointAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
SetEndpointAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SetEndpointAttributesError {
fn from(err: XmlParseError) -> SetEndpointAttributesError {
let XmlParseError(message) = err;
SetEndpointAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SetEndpointAttributesError {
fn from(err: CredentialsError) -> SetEndpointAttributesError {
SetEndpointAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetEndpointAttributesError {
fn from(err: HttpDispatchError) -> SetEndpointAttributesError {
SetEndpointAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for SetEndpointAttributesError {
fn from(err: io::Error) -> SetEndpointAttributesError {
SetEndpointAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetEndpointAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetEndpointAttributesError {
fn description(&self) -> &str {
match *self {
SetEndpointAttributesError::AuthorizationError(ref cause) => cause,
SetEndpointAttributesError::InternalError(ref cause) => cause,
SetEndpointAttributesError::InvalidParameter(ref cause) => cause,
SetEndpointAttributesError::NotFound(ref cause) => cause,
SetEndpointAttributesError::Validation(ref cause) => cause,
SetEndpointAttributesError::Credentials(ref err) => err.description(),
SetEndpointAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetEndpointAttributesError::ParseError(ref cause) => cause,
SetEndpointAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetPlatformApplicationAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetPlatformApplicationAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> SetPlatformApplicationAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SetPlatformApplicationAttributesError::AuthorizationError(
String::from(parsed_error.message),
);
}
"InternalError" => {
return SetPlatformApplicationAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return SetPlatformApplicationAttributesError::InvalidParameter(
String::from(parsed_error.message),
);
}
"NotFound" => {
return SetPlatformApplicationAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
SetPlatformApplicationAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SetPlatformApplicationAttributesError {
fn from(err: XmlParseError) -> SetPlatformApplicationAttributesError {
let XmlParseError(message) = err;
SetPlatformApplicationAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SetPlatformApplicationAttributesError {
fn from(err: CredentialsError) -> SetPlatformApplicationAttributesError {
SetPlatformApplicationAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetPlatformApplicationAttributesError {
fn from(err: HttpDispatchError) -> SetPlatformApplicationAttributesError {
SetPlatformApplicationAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for SetPlatformApplicationAttributesError {
fn from(err: io::Error) -> SetPlatformApplicationAttributesError {
SetPlatformApplicationAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetPlatformApplicationAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetPlatformApplicationAttributesError {
fn description(&self) -> &str {
match *self {
SetPlatformApplicationAttributesError::AuthorizationError(ref cause) => cause,
SetPlatformApplicationAttributesError::InternalError(ref cause) => cause,
SetPlatformApplicationAttributesError::InvalidParameter(ref cause) => cause,
SetPlatformApplicationAttributesError::NotFound(ref cause) => cause,
SetPlatformApplicationAttributesError::Validation(ref cause) => cause,
SetPlatformApplicationAttributesError::Credentials(ref err) => err.description(),
SetPlatformApplicationAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetPlatformApplicationAttributesError::ParseError(ref cause) => cause,
SetPlatformApplicationAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetSMSAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetSMSAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> SetSMSAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SetSMSAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return SetSMSAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return SetSMSAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"Throttled" => {
return SetSMSAttributesError::Throttled(String::from(parsed_error.message));
}
_ => {}
}
}
}
SetSMSAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SetSMSAttributesError {
fn from(err: XmlParseError) -> SetSMSAttributesError {
let XmlParseError(message) = err;
SetSMSAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SetSMSAttributesError {
fn from(err: CredentialsError) -> SetSMSAttributesError {
SetSMSAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetSMSAttributesError {
fn from(err: HttpDispatchError) -> SetSMSAttributesError {
SetSMSAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for SetSMSAttributesError {
fn from(err: io::Error) -> SetSMSAttributesError {
SetSMSAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetSMSAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetSMSAttributesError {
fn description(&self) -> &str {
match *self {
SetSMSAttributesError::AuthorizationError(ref cause) => cause,
SetSMSAttributesError::InternalError(ref cause) => cause,
SetSMSAttributesError::InvalidParameter(ref cause) => cause,
SetSMSAttributesError::Throttled(ref cause) => cause,
SetSMSAttributesError::Validation(ref cause) => cause,
SetSMSAttributesError::Credentials(ref err) => err.description(),
SetSMSAttributesError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SetSMSAttributesError::ParseError(ref cause) => cause,
SetSMSAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetSubscriptionAttributesError {
AuthorizationError(String),
FilterPolicyLimitExceeded(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetSubscriptionAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> SetSubscriptionAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SetSubscriptionAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"FilterPolicyLimitExceeded" => {
return SetSubscriptionAttributesError::FilterPolicyLimitExceeded(
String::from(parsed_error.message),
);
}
"InternalError" => {
return SetSubscriptionAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return SetSubscriptionAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"NotFound" => {
return SetSubscriptionAttributesError::NotFound(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
SetSubscriptionAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SetSubscriptionAttributesError {
fn from(err: XmlParseError) -> SetSubscriptionAttributesError {
let XmlParseError(message) = err;
SetSubscriptionAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SetSubscriptionAttributesError {
fn from(err: CredentialsError) -> SetSubscriptionAttributesError {
SetSubscriptionAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetSubscriptionAttributesError {
fn from(err: HttpDispatchError) -> SetSubscriptionAttributesError {
SetSubscriptionAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for SetSubscriptionAttributesError {
fn from(err: io::Error) -> SetSubscriptionAttributesError {
SetSubscriptionAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetSubscriptionAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetSubscriptionAttributesError {
fn description(&self) -> &str {
match *self {
SetSubscriptionAttributesError::AuthorizationError(ref cause) => cause,
SetSubscriptionAttributesError::FilterPolicyLimitExceeded(ref cause) => cause,
SetSubscriptionAttributesError::InternalError(ref cause) => cause,
SetSubscriptionAttributesError::InvalidParameter(ref cause) => cause,
SetSubscriptionAttributesError::NotFound(ref cause) => cause,
SetSubscriptionAttributesError::Validation(ref cause) => cause,
SetSubscriptionAttributesError::Credentials(ref err) => err.description(),
SetSubscriptionAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetSubscriptionAttributesError::ParseError(ref cause) => cause,
SetSubscriptionAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetTopicAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SetTopicAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> SetTopicAttributesError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SetTopicAttributesError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return SetTopicAttributesError::InternalError(String::from(
parsed_error.message,
));
}
"InvalidParameter" => {
return SetTopicAttributesError::InvalidParameter(String::from(
parsed_error.message,
));
}
"InvalidSecurity" => {
return SetTopicAttributesError::InvalidSecurity(String::from(
parsed_error.message,
));
}
"NotFound" => {
return SetTopicAttributesError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
SetTopicAttributesError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SetTopicAttributesError {
fn from(err: XmlParseError) -> SetTopicAttributesError {
let XmlParseError(message) = err;
SetTopicAttributesError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SetTopicAttributesError {
fn from(err: CredentialsError) -> SetTopicAttributesError {
SetTopicAttributesError::Credentials(err)
}
}
impl From<HttpDispatchError> for SetTopicAttributesError {
fn from(err: HttpDispatchError) -> SetTopicAttributesError {
SetTopicAttributesError::HttpDispatch(err)
}
}
impl From<io::Error> for SetTopicAttributesError {
fn from(err: io::Error) -> SetTopicAttributesError {
SetTopicAttributesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SetTopicAttributesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SetTopicAttributesError {
fn description(&self) -> &str {
match *self {
SetTopicAttributesError::AuthorizationError(ref cause) => cause,
SetTopicAttributesError::InternalError(ref cause) => cause,
SetTopicAttributesError::InvalidParameter(ref cause) => cause,
SetTopicAttributesError::InvalidSecurity(ref cause) => cause,
SetTopicAttributesError::NotFound(ref cause) => cause,
SetTopicAttributesError::Validation(ref cause) => cause,
SetTopicAttributesError::Credentials(ref err) => err.description(),
SetTopicAttributesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SetTopicAttributesError::ParseError(ref cause) => cause,
SetTopicAttributesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SubscribeError {
AuthorizationError(String),
FilterPolicyLimitExceeded(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
SubscriptionLimitExceeded(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SubscribeError {
pub fn from_response(res: BufferedHttpResponse) -> SubscribeError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return SubscribeError::AuthorizationError(String::from(
parsed_error.message,
));
}
"FilterPolicyLimitExceeded" => {
return SubscribeError::FilterPolicyLimitExceeded(String::from(
parsed_error.message,
));
}
"InternalError" => {
return SubscribeError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return SubscribeError::InvalidParameter(String::from(parsed_error.message));
}
"InvalidSecurity" => {
return SubscribeError::InvalidSecurity(String::from(parsed_error.message));
}
"NotFound" => {
return SubscribeError::NotFound(String::from(parsed_error.message));
}
"SubscriptionLimitExceeded" => {
return SubscribeError::SubscriptionLimitExceeded(String::from(
parsed_error.message,
));
}
_ => {}
}
}
}
SubscribeError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for SubscribeError {
fn from(err: XmlParseError) -> SubscribeError {
let XmlParseError(message) = err;
SubscribeError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for SubscribeError {
fn from(err: CredentialsError) -> SubscribeError {
SubscribeError::Credentials(err)
}
}
impl From<HttpDispatchError> for SubscribeError {
fn from(err: HttpDispatchError) -> SubscribeError {
SubscribeError::HttpDispatch(err)
}
}
impl From<io::Error> for SubscribeError {
fn from(err: io::Error) -> SubscribeError {
SubscribeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SubscribeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SubscribeError {
fn description(&self) -> &str {
match *self {
SubscribeError::AuthorizationError(ref cause) => cause,
SubscribeError::FilterPolicyLimitExceeded(ref cause) => cause,
SubscribeError::InternalError(ref cause) => cause,
SubscribeError::InvalidParameter(ref cause) => cause,
SubscribeError::InvalidSecurity(ref cause) => cause,
SubscribeError::NotFound(ref cause) => cause,
SubscribeError::SubscriptionLimitExceeded(ref cause) => cause,
SubscribeError::Validation(ref cause) => cause,
SubscribeError::Credentials(ref err) => err.description(),
SubscribeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SubscribeError::ParseError(ref cause) => cause,
SubscribeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UnsubscribeError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UnsubscribeError {
pub fn from_response(res: BufferedHttpResponse) -> UnsubscribeError {
{
let reader = EventReader::new(res.body.as_slice());
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[..] {
"AuthorizationError" => {
return UnsubscribeError::AuthorizationError(String::from(
parsed_error.message,
));
}
"InternalError" => {
return UnsubscribeError::InternalError(String::from(parsed_error.message));
}
"InvalidParameter" => {
return UnsubscribeError::InvalidParameter(String::from(
parsed_error.message,
));
}
"InvalidSecurity" => {
return UnsubscribeError::InvalidSecurity(String::from(parsed_error.message));
}
"NotFound" => {
return UnsubscribeError::NotFound(String::from(parsed_error.message));
}
_ => {}
}
}
}
UnsubscribeError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl From<XmlParseError> for UnsubscribeError {
fn from(err: XmlParseError) -> UnsubscribeError {
let XmlParseError(message) = err;
UnsubscribeError::ParseError(message.to_string())
}
}
impl From<CredentialsError> for UnsubscribeError {
fn from(err: CredentialsError) -> UnsubscribeError {
UnsubscribeError::Credentials(err)
}
}
impl From<HttpDispatchError> for UnsubscribeError {
fn from(err: HttpDispatchError) -> UnsubscribeError {
UnsubscribeError::HttpDispatch(err)
}
}
impl From<io::Error> for UnsubscribeError {
fn from(err: io::Error) -> UnsubscribeError {
UnsubscribeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UnsubscribeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UnsubscribeError {
fn description(&self) -> &str {
match *self {
UnsubscribeError::AuthorizationError(ref cause) => cause,
UnsubscribeError::InternalError(ref cause) => cause,
UnsubscribeError::InvalidParameter(ref cause) => cause,
UnsubscribeError::InvalidSecurity(ref cause) => cause,
UnsubscribeError::NotFound(ref cause) => cause,
UnsubscribeError::Validation(ref cause) => cause,
UnsubscribeError::Credentials(ref err) => err.description(),
UnsubscribeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
UnsubscribeError::ParseError(ref cause) => cause,
UnsubscribeError::Unknown(_) => "unknown error",
}
}
}
pub trait Sns {
fn add_permission(&self, input: AddPermissionInput) -> RusotoFuture<(), AddPermissionError>;
fn check_if_phone_number_is_opted_out(
&self,
input: CheckIfPhoneNumberIsOptedOutInput,
) -> RusotoFuture<CheckIfPhoneNumberIsOptedOutResponse, CheckIfPhoneNumberIsOptedOutError>;
fn confirm_subscription(
&self,
input: ConfirmSubscriptionInput,
) -> RusotoFuture<ConfirmSubscriptionResponse, ConfirmSubscriptionError>;
fn create_platform_application(
&self,
input: CreatePlatformApplicationInput,
) -> RusotoFuture<CreatePlatformApplicationResponse, CreatePlatformApplicationError>;
fn create_platform_endpoint(
&self,
input: CreatePlatformEndpointInput,
) -> RusotoFuture<CreateEndpointResponse, CreatePlatformEndpointError>;
fn create_topic(
&self,
input: CreateTopicInput,
) -> RusotoFuture<CreateTopicResponse, CreateTopicError>;
fn delete_endpoint(&self, input: DeleteEndpointInput) -> RusotoFuture<(), DeleteEndpointError>;
fn delete_platform_application(
&self,
input: DeletePlatformApplicationInput,
) -> RusotoFuture<(), DeletePlatformApplicationError>;
fn delete_topic(&self, input: DeleteTopicInput) -> RusotoFuture<(), DeleteTopicError>;
fn get_endpoint_attributes(
&self,
input: GetEndpointAttributesInput,
) -> RusotoFuture<GetEndpointAttributesResponse, GetEndpointAttributesError>;
fn get_platform_application_attributes(
&self,
input: GetPlatformApplicationAttributesInput,
) -> RusotoFuture<GetPlatformApplicationAttributesResponse, GetPlatformApplicationAttributesError>;
fn get_sms_attributes(
&self,
input: GetSMSAttributesInput,
) -> RusotoFuture<GetSMSAttributesResponse, GetSMSAttributesError>;
fn get_subscription_attributes(
&self,
input: GetSubscriptionAttributesInput,
) -> RusotoFuture<GetSubscriptionAttributesResponse, GetSubscriptionAttributesError>;
fn get_topic_attributes(
&self,
input: GetTopicAttributesInput,
) -> RusotoFuture<GetTopicAttributesResponse, GetTopicAttributesError>;
fn list_endpoints_by_platform_application(
&self,
input: ListEndpointsByPlatformApplicationInput,
) -> RusotoFuture<
ListEndpointsByPlatformApplicationResponse,
ListEndpointsByPlatformApplicationError,
>;
fn list_phone_numbers_opted_out(
&self,
input: ListPhoneNumbersOptedOutInput,
) -> RusotoFuture<ListPhoneNumbersOptedOutResponse, ListPhoneNumbersOptedOutError>;
fn list_platform_applications(
&self,
input: ListPlatformApplicationsInput,
) -> RusotoFuture<ListPlatformApplicationsResponse, ListPlatformApplicationsError>;
fn list_subscriptions(
&self,
input: ListSubscriptionsInput,
) -> RusotoFuture<ListSubscriptionsResponse, ListSubscriptionsError>;
fn list_subscriptions_by_topic(
&self,
input: ListSubscriptionsByTopicInput,
) -> RusotoFuture<ListSubscriptionsByTopicResponse, ListSubscriptionsByTopicError>;
fn list_topics(
&self,
input: ListTopicsInput,
) -> RusotoFuture<ListTopicsResponse, ListTopicsError>;
fn opt_in_phone_number(
&self,
input: OptInPhoneNumberInput,
) -> RusotoFuture<OptInPhoneNumberResponse, OptInPhoneNumberError>;
fn publish(&self, input: PublishInput) -> RusotoFuture<PublishResponse, PublishError>;
fn remove_permission(
&self,
input: RemovePermissionInput,
) -> RusotoFuture<(), RemovePermissionError>;
fn set_endpoint_attributes(
&self,
input: SetEndpointAttributesInput,
) -> RusotoFuture<(), SetEndpointAttributesError>;
fn set_platform_application_attributes(
&self,
input: SetPlatformApplicationAttributesInput,
) -> RusotoFuture<(), SetPlatformApplicationAttributesError>;
fn set_sms_attributes(
&self,
input: SetSMSAttributesInput,
) -> RusotoFuture<SetSMSAttributesResponse, SetSMSAttributesError>;
fn set_subscription_attributes(
&self,
input: SetSubscriptionAttributesInput,
) -> RusotoFuture<(), SetSubscriptionAttributesError>;
fn set_topic_attributes(
&self,
input: SetTopicAttributesInput,
) -> RusotoFuture<(), SetTopicAttributesError>;
fn subscribe(&self, input: SubscribeInput) -> RusotoFuture<SubscribeResponse, SubscribeError>;
fn unsubscribe(&self, input: UnsubscribeInput) -> RusotoFuture<(), UnsubscribeError>;
}
#[derive(Clone)]
pub struct SnsClient {
client: Client,
region: region::Region,
}
impl SnsClient {
pub fn new(region: region::Region) -> SnsClient {
SnsClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> SnsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
SnsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl Sns for SnsClient {
fn add_permission(&self, input: AddPermissionInput) -> RusotoFuture<(), AddPermissionError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "AddPermission");
params.put("Version", "2010-03-31");
AddPermissionInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(AddPermissionError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn check_if_phone_number_is_opted_out(
&self,
input: CheckIfPhoneNumberIsOptedOutInput,
) -> RusotoFuture<CheckIfPhoneNumberIsOptedOutResponse, CheckIfPhoneNumberIsOptedOutError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "CheckIfPhoneNumberIsOptedOut");
params.put("Version", "2010-03-31");
CheckIfPhoneNumberIsOptedOutInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(CheckIfPhoneNumberIsOptedOutError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = CheckIfPhoneNumberIsOptedOutResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = CheckIfPhoneNumberIsOptedOutResponseDeserializer::deserialize(
"CheckIfPhoneNumberIsOptedOutResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn confirm_subscription(
&self,
input: ConfirmSubscriptionInput,
) -> RusotoFuture<ConfirmSubscriptionResponse, ConfirmSubscriptionError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ConfirmSubscription");
params.put("Version", "2010-03-31");
ConfirmSubscriptionInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ConfirmSubscriptionError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ConfirmSubscriptionResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ConfirmSubscriptionResponseDeserializer::deserialize(
"ConfirmSubscriptionResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn create_platform_application(
&self,
input: CreatePlatformApplicationInput,
) -> RusotoFuture<CreatePlatformApplicationResponse, CreatePlatformApplicationError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "CreatePlatformApplication");
params.put("Version", "2010-03-31");
CreatePlatformApplicationInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(CreatePlatformApplicationError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = CreatePlatformApplicationResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = CreatePlatformApplicationResponseDeserializer::deserialize(
"CreatePlatformApplicationResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn create_platform_endpoint(
&self,
input: CreatePlatformEndpointInput,
) -> RusotoFuture<CreateEndpointResponse, CreatePlatformEndpointError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "CreatePlatformEndpoint");
params.put("Version", "2010-03-31");
CreatePlatformEndpointInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(CreatePlatformEndpointError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = CreateEndpointResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = CreateEndpointResponseDeserializer::deserialize(
"CreatePlatformEndpointResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn create_topic(
&self,
input: CreateTopicInput,
) -> RusotoFuture<CreateTopicResponse, CreateTopicError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "CreateTopic");
params.put("Version", "2010-03-31");
CreateTopicInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(CreateTopicError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = CreateTopicResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = CreateTopicResponseDeserializer::deserialize(
"CreateTopicResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn delete_endpoint(&self, input: DeleteEndpointInput) -> RusotoFuture<(), DeleteEndpointError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DeleteEndpoint");
params.put("Version", "2010-03-31");
DeleteEndpointInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(DeleteEndpointError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn delete_platform_application(
&self,
input: DeletePlatformApplicationInput,
) -> RusotoFuture<(), DeletePlatformApplicationError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DeletePlatformApplication");
params.put("Version", "2010-03-31");
DeletePlatformApplicationInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(DeletePlatformApplicationError::from_response(response))
}));
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn delete_topic(&self, input: DeleteTopicInput) -> RusotoFuture<(), DeleteTopicError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "DeleteTopic");
params.put("Version", "2010-03-31");
DeleteTopicInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(DeleteTopicError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn get_endpoint_attributes(
&self,
input: GetEndpointAttributesInput,
) -> RusotoFuture<GetEndpointAttributesResponse, GetEndpointAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetEndpointAttributes");
params.put("Version", "2010-03-31");
GetEndpointAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(GetEndpointAttributesError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetEndpointAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = GetEndpointAttributesResponseDeserializer::deserialize(
"GetEndpointAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_platform_application_attributes(
&self,
input: GetPlatformApplicationAttributesInput,
) -> RusotoFuture<GetPlatformApplicationAttributesResponse, GetPlatformApplicationAttributesError>
{
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetPlatformApplicationAttributes");
params.put("Version", "2010-03-31");
GetPlatformApplicationAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(GetPlatformApplicationAttributesError::from_response(
response,
))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetPlatformApplicationAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = GetPlatformApplicationAttributesResponseDeserializer::deserialize(
"GetPlatformApplicationAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_sms_attributes(
&self,
input: GetSMSAttributesInput,
) -> RusotoFuture<GetSMSAttributesResponse, GetSMSAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetSMSAttributes");
params.put("Version", "2010-03-31");
GetSMSAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(GetSMSAttributesError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetSMSAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = GetSMSAttributesResponseDeserializer::deserialize(
"GetSMSAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_subscription_attributes(
&self,
input: GetSubscriptionAttributesInput,
) -> RusotoFuture<GetSubscriptionAttributesResponse, GetSubscriptionAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetSubscriptionAttributes");
params.put("Version", "2010-03-31");
GetSubscriptionAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(GetSubscriptionAttributesError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetSubscriptionAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = GetSubscriptionAttributesResponseDeserializer::deserialize(
"GetSubscriptionAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn get_topic_attributes(
&self,
input: GetTopicAttributesInput,
) -> RusotoFuture<GetTopicAttributesResponse, GetTopicAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "GetTopicAttributes");
params.put("Version", "2010-03-31");
GetTopicAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(GetTopicAttributesError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = GetTopicAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = GetTopicAttributesResponseDeserializer::deserialize(
"GetTopicAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_endpoints_by_platform_application(
&self,
input: ListEndpointsByPlatformApplicationInput,
) -> RusotoFuture<
ListEndpointsByPlatformApplicationResponse,
ListEndpointsByPlatformApplicationError,
> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListEndpointsByPlatformApplication");
params.put("Version", "2010-03-31");
ListEndpointsByPlatformApplicationInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListEndpointsByPlatformApplicationError::from_response(
response,
))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListEndpointsByPlatformApplicationResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListEndpointsByPlatformApplicationResponseDeserializer::deserialize(
"ListEndpointsByPlatformApplicationResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_phone_numbers_opted_out(
&self,
input: ListPhoneNumbersOptedOutInput,
) -> RusotoFuture<ListPhoneNumbersOptedOutResponse, ListPhoneNumbersOptedOutError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListPhoneNumbersOptedOut");
params.put("Version", "2010-03-31");
ListPhoneNumbersOptedOutInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListPhoneNumbersOptedOutError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListPhoneNumbersOptedOutResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListPhoneNumbersOptedOutResponseDeserializer::deserialize(
"ListPhoneNumbersOptedOutResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_platform_applications(
&self,
input: ListPlatformApplicationsInput,
) -> RusotoFuture<ListPlatformApplicationsResponse, ListPlatformApplicationsError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListPlatformApplications");
params.put("Version", "2010-03-31");
ListPlatformApplicationsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListPlatformApplicationsError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListPlatformApplicationsResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListPlatformApplicationsResponseDeserializer::deserialize(
"ListPlatformApplicationsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_subscriptions(
&self,
input: ListSubscriptionsInput,
) -> RusotoFuture<ListSubscriptionsResponse, ListSubscriptionsError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListSubscriptions");
params.put("Version", "2010-03-31");
ListSubscriptionsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListSubscriptionsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListSubscriptionsResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListSubscriptionsResponseDeserializer::deserialize(
"ListSubscriptionsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_subscriptions_by_topic(
&self,
input: ListSubscriptionsByTopicInput,
) -> RusotoFuture<ListSubscriptionsByTopicResponse, ListSubscriptionsByTopicError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListSubscriptionsByTopic");
params.put("Version", "2010-03-31");
ListSubscriptionsByTopicInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListSubscriptionsByTopicError::from_response(response))
}));
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListSubscriptionsByTopicResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListSubscriptionsByTopicResponseDeserializer::deserialize(
"ListSubscriptionsByTopicResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_topics(
&self,
input: ListTopicsInput,
) -> RusotoFuture<ListTopicsResponse, ListTopicsError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListTopics");
params.put("Version", "2010-03-31");
ListTopicsInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(ListTopicsError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListTopicsResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = ListTopicsResponseDeserializer::deserialize(
"ListTopicsResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn opt_in_phone_number(
&self,
input: OptInPhoneNumberInput,
) -> RusotoFuture<OptInPhoneNumberResponse, OptInPhoneNumberError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "OptInPhoneNumber");
params.put("Version", "2010-03-31");
OptInPhoneNumberInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(OptInPhoneNumberError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = OptInPhoneNumberResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = OptInPhoneNumberResponseDeserializer::deserialize(
"OptInPhoneNumberResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn publish(&self, input: PublishInput) -> RusotoFuture<PublishResponse, PublishError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "Publish");
params.put("Version", "2010-03-31");
PublishInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(PublishError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = PublishResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = PublishResponseDeserializer::deserialize("PublishResult", &mut stack)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn remove_permission(
&self,
input: RemovePermissionInput,
) -> RusotoFuture<(), RemovePermissionError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "RemovePermission");
params.put("Version", "2010-03-31");
RemovePermissionInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(RemovePermissionError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn set_endpoint_attributes(
&self,
input: SetEndpointAttributesInput,
) -> RusotoFuture<(), SetEndpointAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetEndpointAttributes");
params.put("Version", "2010-03-31");
SetEndpointAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SetEndpointAttributesError::from_response(response))
}),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn set_platform_application_attributes(
&self,
input: SetPlatformApplicationAttributesInput,
) -> RusotoFuture<(), SetPlatformApplicationAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetPlatformApplicationAttributes");
params.put("Version", "2010-03-31");
SetPlatformApplicationAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SetPlatformApplicationAttributesError::from_response(
response,
))
}));
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn set_sms_attributes(
&self,
input: SetSMSAttributesInput,
) -> RusotoFuture<SetSMSAttributesResponse, SetSMSAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetSMSAttributes");
params.put("Version", "2010-03-31");
SetSMSAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SetSMSAttributesError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = SetSMSAttributesResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 = SetSMSAttributesResponseDeserializer::deserialize(
"SetSMSAttributesResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn set_subscription_attributes(
&self,
input: SetSubscriptionAttributesInput,
) -> RusotoFuture<(), SetSubscriptionAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetSubscriptionAttributes");
params.put("Version", "2010-03-31");
SetSubscriptionAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SetSubscriptionAttributesError::from_response(response))
}));
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn set_topic_attributes(
&self,
input: SetTopicAttributesInput,
) -> RusotoFuture<(), SetTopicAttributesError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "SetTopicAttributes");
params.put("Version", "2010-03-31");
SetTopicAttributesInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SetTopicAttributesError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
fn subscribe(&self, input: SubscribeInput) -> RusotoFuture<SubscribeResponse, SubscribeError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "Subscribe");
params.put("Version", "2010-03-31");
SubscribeInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(SubscribeError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = SubscribeResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_slice(),
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 =
SubscribeResponseDeserializer::deserialize("SubscribeResult", &mut stack)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn unsubscribe(&self, input: UnsubscribeInput) -> RusotoFuture<(), UnsubscribeError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "Unsubscribe");
params.put("Version", "2010-03-31");
UnsubscribeInputSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(
serde_urlencoded::to_string(¶ms).unwrap().into_bytes(),
));
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(UnsubscribeError::from_response(response))),
);
}
Box::new(future::ok(::std::mem::drop(response)))
})
}
}
#[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_sns_delete_topic() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/error",
"sns-delete-topic.xml",
);
let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DeleteTopicInput::default();
let result = client.delete_topic(request).sync();
assert!(!result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_add_permission() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-add-permission.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = AddPermissionInput::default();
let result = client.add_permission(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_confirm_subscription() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-confirm-subscription.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ConfirmSubscriptionInput::default();
let result = client.confirm_subscription(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_create_topic() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-create-topic.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = CreateTopicInput::default();
let result = client.create_topic(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_get_subscription_attributes() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-get-subscription-attributes.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetSubscriptionAttributesInput::default();
let result = client.get_subscription_attributes(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_get_topic_attributes() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-get-topic-attributes.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetTopicAttributesInput::default();
let result = client.get_topic_attributes(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_list_subscriptions_by_topic() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-list-subscriptions-by-topic.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListSubscriptionsByTopicInput::default();
let result = client.list_subscriptions_by_topic(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_list_subscriptions() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-list-subscriptions.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListSubscriptionsInput::default();
let result = client.list_subscriptions(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_list_topics() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-list-topics.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListTopicsInput::default();
let result = client.list_topics(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_publish() {
let mock_response =
MockResponseReader::read_response("test_resources/generated/valid", "sns-publish.xml");
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = PublishInput::default();
let result = client.publish(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
#[test]
fn test_parse_valid_sns_subscribe() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sns-subscribe.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SnsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = SubscribeInput::default();
let result = client.subscribe(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
}
}