use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto::xml::error::*;
use rusoto_core::proto::xml::util::{
characters, deserialize_elements, end_element, find_start_element, peek_at_name, skip_tree,
start_element,
};
use rusoto_core::proto::xml::util::{Next, Peek, XmlParseError, XmlResponse};
use rusoto_core::signature::SignedRequest;
use serde_urlencoded;
use std::str::FromStr;
use xml::reader::ParserConfig;
use xml::EventReader;
struct AccountDeserializer;
impl AccountDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct 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<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<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<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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CheckIfPhoneNumberIsOptedOutResponse, XmlParseError> {
deserialize_elements::<_, CheckIfPhoneNumberIsOptedOutResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"isOptedOut" => {
obj.is_opted_out =
Some(BooleanDeserializer::deserialize("isOptedOut", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ConfirmSubscriptionResponse, XmlParseError> {
deserialize_elements::<_, ConfirmSubscriptionResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"SubscriptionArn" => {
obj.subscription_arn = Some(SubscriptionARNDeserializer::deserialize(
"SubscriptionArn",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateEndpointResponse {
pub endpoint_arn: Option<String>,
}
struct CreateEndpointResponseDeserializer;
impl CreateEndpointResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreateEndpointResponse, XmlParseError> {
deserialize_elements::<_, CreateEndpointResponse, _>(tag_name, stack, |name, stack, obj| {
match name {
"EndpointArn" => {
obj.endpoint_arn = Some(StringDeserializer::deserialize("EndpointArn", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreatePlatformApplicationResponse, XmlParseError> {
deserialize_elements::<_, CreatePlatformApplicationResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"PlatformApplicationArn" => {
obj.platform_application_arn = Some(StringDeserializer::deserialize(
"PlatformApplicationArn",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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,
pub tags: Option<Vec<Tag>>,
}
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);
if let Some(ref field_value) = obj.tags {
TagListSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), field_value);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct CreateTopicResponse {
pub topic_arn: Option<String>,
}
struct CreateTopicResponseDeserializer;
impl CreateTopicResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<CreateTopicResponse, XmlParseError> {
deserialize_elements::<_, CreateTopicResponse, _>(tag_name, stack, |name, stack, obj| {
match name {
"TopicArn" => {
obj.topic_arn = Some(TopicARNDeserializer::deserialize("TopicArn", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
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<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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetEndpointAttributesResponse, XmlParseError> {
deserialize_elements::<_, GetEndpointAttributesResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetPlatformApplicationAttributesResponse, XmlParseError> {
deserialize_elements::<_, GetPlatformApplicationAttributesResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetSMSAttributesResponse, XmlParseError> {
deserialize_elements::<_, GetSMSAttributesResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"attributes",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetSubscriptionAttributesResponse, XmlParseError> {
deserialize_elements::<_, GetSubscriptionAttributesResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Attributes" => {
obj.attributes = Some(SubscriptionAttributesMapDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<GetTopicAttributesResponse, XmlParseError> {
deserialize_elements::<_, GetTopicAttributesResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Attributes" => {
obj.attributes = Some(TopicAttributesMapDeserializer::deserialize(
"Attributes",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListEndpointsByPlatformApplicationResponse, XmlParseError> {
deserialize_elements::<_, ListEndpointsByPlatformApplicationResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Endpoints" => {
obj.endpoints.get_or_insert(vec![]).extend(
ListOfEndpointsDeserializer::deserialize("Endpoints", stack)?,
);
}
"NextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("NextToken", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
struct ListOfEndpointsDeserializer;
impl ListOfEndpointsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(EndpointDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct ListOfPlatformApplicationsDeserializer;
impl ListOfPlatformApplicationsDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<PlatformApplication>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(PlatformApplicationDeserializer::deserialize(
"member", stack,
)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListPhoneNumbersOptedOutResponse, XmlParseError> {
deserialize_elements::<_, ListPhoneNumbersOptedOutResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"nextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("nextToken", stack)?);
}
"phoneNumbers" => {
obj.phone_numbers.get_or_insert(vec![]).extend(
PhoneNumberListDeserializer::deserialize("phoneNumbers", stack)?,
);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListPlatformApplicationsResponse, XmlParseError> {
deserialize_elements::<_, ListPlatformApplicationsResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"NextToken" => {
obj.next_token = Some(StringDeserializer::deserialize("NextToken", stack)?);
}
"PlatformApplications" => {
obj.platform_applications.get_or_insert(vec![]).extend(
ListOfPlatformApplicationsDeserializer::deserialize(
"PlatformApplications",
stack,
)?,
);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListSubscriptionsByTopicResponse, XmlParseError> {
deserialize_elements::<_, ListSubscriptionsByTopicResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Subscriptions" => {
obj.subscriptions.get_or_insert(vec![]).extend(
SubscriptionsListDeserializer::deserialize("Subscriptions", stack)?,
);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListSubscriptionsResponse, XmlParseError> {
deserialize_elements::<_, ListSubscriptionsResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"NextToken" => {
obj.next_token =
Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Subscriptions" => {
obj.subscriptions.get_or_insert(vec![]).extend(
SubscriptionsListDeserializer::deserialize("Subscriptions", stack)?,
);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTagsForResourceRequest {
pub resource_arn: String,
}
struct ListTagsForResourceRequestSerializer;
impl ListTagsForResourceRequestSerializer {
fn serialize(params: &mut Params, name: &str, obj: &ListTagsForResourceRequest) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceArn"), &obj.resource_arn);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct ListTagsForResourceResponse {
pub tags: Option<Vec<Tag>>,
}
struct ListTagsForResourceResponseDeserializer;
impl ListTagsForResourceResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListTagsForResourceResponse, XmlParseError> {
deserialize_elements::<_, ListTagsForResourceResponse, _>(
tag_name,
stack,
|name, stack, obj| {
match name {
"Tags" => {
obj.tags
.get_or_insert(vec![])
.extend(TagListDeserializer::deserialize("Tags", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
},
)
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<ListTopicsResponse, XmlParseError> {
deserialize_elements::<_, ListTopicsResponse, _>(tag_name, stack, |name, stack, obj| {
match name {
"NextToken" => {
obj.next_token = Some(NextTokenDeserializer::deserialize("NextToken", stack)?);
}
"Topics" => {
obj.topics
.get_or_insert(vec![])
.extend(TopicsListDeserializer::deserialize("Topics", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct MapStringToStringDeserializer;
impl MapStringToStringDeserializer {
#[allow(unused_variables)]
fn deserialize<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<bytes::Bytes>,
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<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct NextTokenDeserializer;
impl NextTokenDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[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<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<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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<String>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(PhoneNumberDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<PlatformApplication, XmlParseError> {
deserialize_elements::<_, PlatformApplication, _>(tag_name, stack, |name, stack, obj| {
match name {
"Attributes" => {
obj.attributes = Some(MapStringToStringDeserializer::deserialize(
"Attributes",
stack,
)?);
}
"PlatformApplicationArn" => {
obj.platform_application_arn = Some(StringDeserializer::deserialize(
"PlatformApplicationArn",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct ProtocolDeserializer;
impl ProtocolDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct 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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<PublishResponse, XmlParseError> {
deserialize_elements::<_, PublishResponse, _>(tag_name, stack, |name, stack, obj| {
match name {
"MessageId" => {
obj.message_id = Some(MessageIdDeserializer::deserialize("MessageId", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[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<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<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,
);
}
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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<SubscribeResponse, XmlParseError> {
deserialize_elements::<_, SubscribeResponse, _>(tag_name, stack, |name, stack, obj| {
match name {
"SubscriptionArn" => {
obj.subscription_arn = Some(SubscriptionARNDeserializer::deserialize(
"SubscriptionArn",
stack,
)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
#[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<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Subscription, XmlParseError> {
deserialize_elements::<_, Subscription, _>(tag_name, stack, |name, stack, obj| {
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),
}
Ok(())
})
}
}
struct SubscriptionARNDeserializer;
impl SubscriptionARNDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct SubscriptionAttributesMapDeserializer;
impl SubscriptionAttributesMapDeserializer {
#[allow(unused_variables)]
fn deserialize<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!("{}.entry.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "key"), &key);
params.put(&format!("{}.{}", prefix, "Value"), &value);
}
}
}
struct SubscriptionsListDeserializer;
impl SubscriptionsListDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Subscription>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(SubscriptionDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Tag {
pub key: String,
pub value: String,
}
struct TagDeserializer;
impl TagDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Tag, XmlParseError> {
deserialize_elements::<_, Tag, _>(tag_name, stack, |name, stack, obj| {
match name {
"Key" => {
obj.key = TagKeyDeserializer::deserialize("Key", stack)?;
}
"Value" => {
obj.value = TagValueDeserializer::deserialize("Value", stack)?;
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct TagSerializer;
impl TagSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Tag) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "Key"), &obj.key);
params.put(&format!("{}{}", prefix, "Value"), &obj.value);
}
}
struct TagKeyDeserializer;
impl TagKeyDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TagKeyListSerializer;
impl TagKeyListSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<String>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
params.put(&key, &obj);
}
}
}
struct TagListDeserializer;
impl TagListDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Tag>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(TagDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
struct TagListSerializer;
impl TagListSerializer {
fn serialize(params: &mut Params, name: &str, obj: &Vec<Tag>) {
for (index, obj) in obj.iter().enumerate() {
let key = format!("{}.member.{}", name, index + 1);
TagSerializer::serialize(params, &key, obj);
}
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct TagResourceRequest {
pub resource_arn: String,
pub tags: Vec<Tag>,
}
struct TagResourceRequestSerializer;
impl TagResourceRequestSerializer {
fn serialize(params: &mut Params, name: &str, obj: &TagResourceRequest) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceArn"), &obj.resource_arn);
TagListSerializer::serialize(params, &format!("{}{}", prefix, "Tags"), &obj.tags);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct TagResourceResponse {}
struct TagResourceResponseDeserializer;
impl TagResourceResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<TagResourceResponse, XmlParseError> {
start_element(tag_name, stack)?;
let obj = TagResourceResponse::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TagValueDeserializer;
impl TagValueDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Topic {
pub topic_arn: Option<String>,
}
struct TopicDeserializer;
impl TopicDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<Topic, XmlParseError> {
deserialize_elements::<_, Topic, _>(tag_name, stack, |name, stack, obj| {
match name {
"TopicArn" => {
obj.topic_arn = Some(TopicARNDeserializer::deserialize("TopicArn", stack)?);
}
_ => skip_tree(stack),
}
Ok(())
})
}
}
struct TopicARNDeserializer;
impl TopicARNDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(tag_name: &str, stack: &mut T) -> Result<String, XmlParseError> {
start_element(tag_name, stack)?;
let obj = characters(stack)?;
end_element(tag_name, stack)?;
Ok(obj)
}
}
struct TopicAttributesMapDeserializer;
impl TopicAttributesMapDeserializer {
#[allow(unused_variables)]
fn deserialize<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!("{}.entry.{}", name, index + 1);
params.put(&format!("{}.{}", prefix, "key"), &key);
params.put(&format!("{}.{}", prefix, "Value"), &value);
}
}
}
struct TopicsListDeserializer;
impl TopicsListDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<Vec<Topic>, XmlParseError> {
deserialize_elements::<_, Vec<_>, _>(tag_name, stack, |name, stack, obj| {
if name == "member" {
obj.push(TopicDeserializer::deserialize("member", stack)?);
} else {
skip_tree(stack);
}
Ok(())
})
}
}
#[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(Default, Debug, Clone, PartialEq)]
pub struct UntagResourceRequest {
pub resource_arn: String,
pub tag_keys: Vec<String>,
}
struct UntagResourceRequestSerializer;
impl UntagResourceRequestSerializer {
fn serialize(params: &mut Params, name: &str, obj: &UntagResourceRequest) {
let mut prefix = name.to_string();
if prefix != "" {
prefix.push_str(".");
}
params.put(&format!("{}{}", prefix, "ResourceArn"), &obj.resource_arn);
TagKeyListSerializer::serialize(params, &format!("{}{}", prefix, "TagKeys"), &obj.tag_keys);
}
}
#[derive(Default, Debug, Clone, PartialEq)]
pub struct UntagResourceResponse {}
struct UntagResourceResponseDeserializer;
impl UntagResourceResponseDeserializer {
#[allow(unused_variables)]
fn deserialize<T: Peek + Next>(
tag_name: &str,
stack: &mut T,
) -> Result<UntagResourceResponse, XmlParseError> {
start_element(tag_name, stack)?;
let obj = UntagResourceResponse::default();
end_element(tag_name, stack)?;
Ok(obj)
}
}
#[derive(Debug, PartialEq)]
pub enum AddPermissionError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl AddPermissionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AddPermissionError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(AddPermissionError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(AddPermissionError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(AddPermissionError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(AddPermissionError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CheckIfPhoneNumberIsOptedOutError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
}
impl CheckIfPhoneNumberIsOptedOutError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<CheckIfPhoneNumberIsOptedOutError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
CheckIfPhoneNumberIsOptedOutError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(
CheckIfPhoneNumberIsOptedOutError::InternalError(parsed_error.message),
)
}
"InvalidParameter" => {
return RusotoError::Service(
CheckIfPhoneNumberIsOptedOutError::InvalidParameter(
parsed_error.message,
),
)
}
"Throttled" => {
return RusotoError::Service(CheckIfPhoneNumberIsOptedOutError::Throttled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ConfirmSubscriptionError {
AuthorizationError(String),
FilterPolicyLimitExceeded(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
SubscriptionLimitExceeded(String),
}
impl ConfirmSubscriptionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ConfirmSubscriptionError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(ConfirmSubscriptionError::AuthorizationError(
parsed_error.message,
))
}
"FilterPolicyLimitExceeded" => {
return RusotoError::Service(
ConfirmSubscriptionError::FilterPolicyLimitExceeded(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(ConfirmSubscriptionError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(ConfirmSubscriptionError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(ConfirmSubscriptionError::NotFound(
parsed_error.message,
))
}
"SubscriptionLimitExceeded" => {
return RusotoError::Service(
ConfirmSubscriptionError::SubscriptionLimitExceeded(
parsed_error.message,
),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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::FilterPolicyLimitExceeded(ref cause) => cause,
ConfirmSubscriptionError::InternalError(ref cause) => cause,
ConfirmSubscriptionError::InvalidParameter(ref cause) => cause,
ConfirmSubscriptionError::NotFound(ref cause) => cause,
ConfirmSubscriptionError::SubscriptionLimitExceeded(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl CreatePlatformApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreatePlatformApplicationError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
CreatePlatformApplicationError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(CreatePlatformApplicationError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
CreatePlatformApplicationError::InvalidParameter(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePlatformEndpointError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl CreatePlatformEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreatePlatformEndpointError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
CreatePlatformEndpointError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(CreatePlatformEndpointError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(CreatePlatformEndpointError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(CreatePlatformEndpointError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateTopicError {
AuthorizationError(String),
ConcurrentAccess(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
StaleTag(String),
TagLimitExceeded(String),
TagPolicy(String),
TopicLimitExceeded(String),
}
impl CreateTopicError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateTopicError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(CreateTopicError::AuthorizationError(
parsed_error.message,
))
}
"ConcurrentAccess" => {
return RusotoError::Service(CreateTopicError::ConcurrentAccess(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(CreateTopicError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(CreateTopicError::InvalidParameter(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(CreateTopicError::InvalidSecurity(
parsed_error.message,
))
}
"StaleTag" => {
return RusotoError::Service(CreateTopicError::StaleTag(
parsed_error.message,
))
}
"TagLimitExceeded" => {
return RusotoError::Service(CreateTopicError::TagLimitExceeded(
parsed_error.message,
))
}
"TagPolicy" => {
return RusotoError::Service(CreateTopicError::TagPolicy(
parsed_error.message,
))
}
"TopicLimitExceeded" => {
return RusotoError::Service(CreateTopicError::TopicLimitExceeded(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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::ConcurrentAccess(ref cause) => cause,
CreateTopicError::InternalError(ref cause) => cause,
CreateTopicError::InvalidParameter(ref cause) => cause,
CreateTopicError::InvalidSecurity(ref cause) => cause,
CreateTopicError::StaleTag(ref cause) => cause,
CreateTopicError::TagLimitExceeded(ref cause) => cause,
CreateTopicError::TagPolicy(ref cause) => cause,
CreateTopicError::TopicLimitExceeded(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteEndpointError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl DeleteEndpointError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteEndpointError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(DeleteEndpointError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(DeleteEndpointError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(DeleteEndpointError::InvalidParameter(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl DeletePlatformApplicationError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeletePlatformApplicationError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
DeletePlatformApplicationError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(DeletePlatformApplicationError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
DeletePlatformApplicationError::InvalidParameter(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteTopicError {
AuthorizationError(String),
ConcurrentAccess(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
StaleTag(String),
TagPolicy(String),
}
impl DeleteTopicError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteTopicError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(DeleteTopicError::AuthorizationError(
parsed_error.message,
))
}
"ConcurrentAccess" => {
return RusotoError::Service(DeleteTopicError::ConcurrentAccess(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(DeleteTopicError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(DeleteTopicError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(DeleteTopicError::NotFound(
parsed_error.message,
))
}
"StaleTag" => {
return RusotoError::Service(DeleteTopicError::StaleTag(
parsed_error.message,
))
}
"TagPolicy" => {
return RusotoError::Service(DeleteTopicError::TagPolicy(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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::ConcurrentAccess(ref cause) => cause,
DeleteTopicError::InternalError(ref cause) => cause,
DeleteTopicError::InvalidParameter(ref cause) => cause,
DeleteTopicError::NotFound(ref cause) => cause,
DeleteTopicError::StaleTag(ref cause) => cause,
DeleteTopicError::TagPolicy(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetEndpointAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl GetEndpointAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetEndpointAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
GetEndpointAttributesError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(GetEndpointAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(GetEndpointAttributesError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(GetEndpointAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetPlatformApplicationAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl GetPlatformApplicationAttributesError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<GetPlatformApplicationAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
GetPlatformApplicationAttributesError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(
GetPlatformApplicationAttributesError::InternalError(
parsed_error.message,
),
)
}
"InvalidParameter" => {
return RusotoError::Service(
GetPlatformApplicationAttributesError::InvalidParameter(
parsed_error.message,
),
)
}
"NotFound" => {
return RusotoError::Service(
GetPlatformApplicationAttributesError::NotFound(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSMSAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
}
impl GetSMSAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetSMSAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(GetSMSAttributesError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(GetSMSAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(GetSMSAttributesError::InvalidParameter(
parsed_error.message,
))
}
"Throttled" => {
return RusotoError::Service(GetSMSAttributesError::Throttled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetSubscriptionAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl GetSubscriptionAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetSubscriptionAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
GetSubscriptionAttributesError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(GetSubscriptionAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
GetSubscriptionAttributesError::InvalidParameter(parsed_error.message),
)
}
"NotFound" => {
return RusotoError::Service(GetSubscriptionAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetTopicAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
}
impl GetTopicAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetTopicAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(GetTopicAttributesError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(GetTopicAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(GetTopicAttributesError::InvalidParameter(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(GetTopicAttributesError::InvalidSecurity(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(GetTopicAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListEndpointsByPlatformApplicationError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl ListEndpointsByPlatformApplicationError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<ListEndpointsByPlatformApplicationError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
ListEndpointsByPlatformApplicationError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(
ListEndpointsByPlatformApplicationError::InternalError(
parsed_error.message,
),
)
}
"InvalidParameter" => {
return RusotoError::Service(
ListEndpointsByPlatformApplicationError::InvalidParameter(
parsed_error.message,
),
)
}
"NotFound" => {
return RusotoError::Service(
ListEndpointsByPlatformApplicationError::NotFound(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPhoneNumbersOptedOutError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
}
impl ListPhoneNumbersOptedOutError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListPhoneNumbersOptedOutError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
ListPhoneNumbersOptedOutError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(ListPhoneNumbersOptedOutError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
ListPhoneNumbersOptedOutError::InvalidParameter(parsed_error.message),
)
}
"Throttled" => {
return RusotoError::Service(ListPhoneNumbersOptedOutError::Throttled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPlatformApplicationsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl ListPlatformApplicationsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListPlatformApplicationsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
ListPlatformApplicationsError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(ListPlatformApplicationsError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
ListPlatformApplicationsError::InvalidParameter(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSubscriptionsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl ListSubscriptionsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListSubscriptionsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(ListSubscriptionsError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(ListSubscriptionsError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(ListSubscriptionsError::InvalidParameter(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListSubscriptionsByTopicError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl ListSubscriptionsByTopicError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListSubscriptionsByTopicError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
ListSubscriptionsByTopicError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(ListSubscriptionsByTopicError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
ListSubscriptionsByTopicError::InvalidParameter(parsed_error.message),
)
}
"NotFound" => {
return RusotoError::Service(ListSubscriptionsByTopicError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
AuthorizationError(String),
ConcurrentAccess(String),
InvalidParameter(String),
ResourceNotFound(String),
TagPolicy(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(ListTagsForResourceError::AuthorizationError(
parsed_error.message,
))
}
"ConcurrentAccess" => {
return RusotoError::Service(ListTagsForResourceError::ConcurrentAccess(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(ListTagsForResourceError::InvalidParameter(
parsed_error.message,
))
}
"ResourceNotFound" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
parsed_error.message,
))
}
"TagPolicy" => {
return RusotoError::Service(ListTagsForResourceError::TagPolicy(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::AuthorizationError(ref cause) => cause,
ListTagsForResourceError::ConcurrentAccess(ref cause) => cause,
ListTagsForResourceError::InvalidParameter(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
ListTagsForResourceError::TagPolicy(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTopicsError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
}
impl ListTopicsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTopicsError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(ListTopicsError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(ListTopicsError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(ListTopicsError::InvalidParameter(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum OptInPhoneNumberError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
}
impl OptInPhoneNumberError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<OptInPhoneNumberError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(OptInPhoneNumberError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(OptInPhoneNumberError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(OptInPhoneNumberError::InvalidParameter(
parsed_error.message,
))
}
"Throttled" => {
return RusotoError::Service(OptInPhoneNumberError::Throttled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[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),
}
impl PublishError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<PublishError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(PublishError::AuthorizationError(
parsed_error.message,
))
}
"EndpointDisabled" => {
return RusotoError::Service(PublishError::EndpointDisabled(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(PublishError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(PublishError::InvalidParameter(
parsed_error.message,
))
}
"ParameterValueInvalid" => {
return RusotoError::Service(PublishError::InvalidParameterValue(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(PublishError::InvalidSecurity(
parsed_error.message,
))
}
"KMSAccessDenied" => {
return RusotoError::Service(PublishError::KMSAccessDenied(
parsed_error.message,
))
}
"KMSDisabled" => {
return RusotoError::Service(PublishError::KMSDisabled(
parsed_error.message,
))
}
"KMSInvalidState" => {
return RusotoError::Service(PublishError::KMSInvalidState(
parsed_error.message,
))
}
"KMSNotFound" => {
return RusotoError::Service(PublishError::KMSNotFound(
parsed_error.message,
))
}
"KMSOptInRequired" => {
return RusotoError::Service(PublishError::KMSOptInRequired(
parsed_error.message,
))
}
"KMSThrottling" => {
return RusotoError::Service(PublishError::KMSThrottling(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(PublishError::NotFound(parsed_error.message))
}
"PlatformApplicationDisabled" => {
return RusotoError::Service(PublishError::PlatformApplicationDisabled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum RemovePermissionError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl RemovePermissionError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<RemovePermissionError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(RemovePermissionError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(RemovePermissionError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(RemovePermissionError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(RemovePermissionError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetEndpointAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl SetEndpointAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetEndpointAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
SetEndpointAttributesError::AuthorizationError(parsed_error.message),
)
}
"InternalError" => {
return RusotoError::Service(SetEndpointAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(SetEndpointAttributesError::InvalidParameter(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(SetEndpointAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetPlatformApplicationAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl SetPlatformApplicationAttributesError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<SetPlatformApplicationAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
SetPlatformApplicationAttributesError::AuthorizationError(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(
SetPlatformApplicationAttributesError::InternalError(
parsed_error.message,
),
)
}
"InvalidParameter" => {
return RusotoError::Service(
SetPlatformApplicationAttributesError::InvalidParameter(
parsed_error.message,
),
)
}
"NotFound" => {
return RusotoError::Service(
SetPlatformApplicationAttributesError::NotFound(parsed_error.message),
)
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetSMSAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
Throttled(String),
}
impl SetSMSAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetSMSAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(SetSMSAttributesError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(SetSMSAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(SetSMSAttributesError::InvalidParameter(
parsed_error.message,
))
}
"Throttled" => {
return RusotoError::Service(SetSMSAttributesError::Throttled(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetSubscriptionAttributesError {
AuthorizationError(String),
FilterPolicyLimitExceeded(String),
InternalError(String),
InvalidParameter(String),
NotFound(String),
}
impl SetSubscriptionAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetSubscriptionAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(
SetSubscriptionAttributesError::AuthorizationError(
parsed_error.message,
),
)
}
"FilterPolicyLimitExceeded" => {
return RusotoError::Service(
SetSubscriptionAttributesError::FilterPolicyLimitExceeded(
parsed_error.message,
),
)
}
"InternalError" => {
return RusotoError::Service(SetSubscriptionAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(
SetSubscriptionAttributesError::InvalidParameter(parsed_error.message),
)
}
"NotFound" => {
return RusotoError::Service(SetSubscriptionAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SetTopicAttributesError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
}
impl SetTopicAttributesError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SetTopicAttributesError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(SetTopicAttributesError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(SetTopicAttributesError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(SetTopicAttributesError::InvalidParameter(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(SetTopicAttributesError::InvalidSecurity(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(SetTopicAttributesError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum SubscribeError {
AuthorizationError(String),
FilterPolicyLimitExceeded(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
SubscriptionLimitExceeded(String),
}
impl SubscribeError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<SubscribeError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(SubscribeError::AuthorizationError(
parsed_error.message,
))
}
"FilterPolicyLimitExceeded" => {
return RusotoError::Service(SubscribeError::FilterPolicyLimitExceeded(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(SubscribeError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(SubscribeError::InvalidParameter(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(SubscribeError::InvalidSecurity(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(SubscribeError::NotFound(parsed_error.message))
}
"SubscriptionLimitExceeded" => {
return RusotoError::Service(SubscribeError::SubscriptionLimitExceeded(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
AuthorizationError(String),
ConcurrentAccess(String),
InvalidParameter(String),
ResourceNotFound(String),
StaleTag(String),
TagLimitExceeded(String),
TagPolicy(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(TagResourceError::AuthorizationError(
parsed_error.message,
))
}
"ConcurrentAccess" => {
return RusotoError::Service(TagResourceError::ConcurrentAccess(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(TagResourceError::InvalidParameter(
parsed_error.message,
))
}
"ResourceNotFound" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(
parsed_error.message,
))
}
"StaleTag" => {
return RusotoError::Service(TagResourceError::StaleTag(
parsed_error.message,
))
}
"TagLimitExceeded" => {
return RusotoError::Service(TagResourceError::TagLimitExceeded(
parsed_error.message,
))
}
"TagPolicy" => {
return RusotoError::Service(TagResourceError::TagPolicy(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::AuthorizationError(ref cause) => cause,
TagResourceError::ConcurrentAccess(ref cause) => cause,
TagResourceError::InvalidParameter(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
TagResourceError::StaleTag(ref cause) => cause,
TagResourceError::TagLimitExceeded(ref cause) => cause,
TagResourceError::TagPolicy(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UnsubscribeError {
AuthorizationError(String),
InternalError(String),
InvalidParameter(String),
InvalidSecurity(String),
NotFound(String),
}
impl UnsubscribeError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UnsubscribeError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(UnsubscribeError::AuthorizationError(
parsed_error.message,
))
}
"InternalError" => {
return RusotoError::Service(UnsubscribeError::InternalError(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(UnsubscribeError::InvalidParameter(
parsed_error.message,
))
}
"InvalidSecurity" => {
return RusotoError::Service(UnsubscribeError::InvalidSecurity(
parsed_error.message,
))
}
"NotFound" => {
return RusotoError::Service(UnsubscribeError::NotFound(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for 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,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
AuthorizationError(String),
ConcurrentAccess(String),
InvalidParameter(String),
ResourceNotFound(String),
StaleTag(String),
TagLimitExceeded(String),
TagPolicy(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
{
let reader = EventReader::new(res.body.as_ref());
let mut stack = XmlResponse::new(reader.into_iter().peekable());
find_start_element(&mut stack);
if let Ok(parsed_error) = Self::deserialize(&mut stack) {
match &parsed_error.code[..] {
"AuthorizationError" => {
return RusotoError::Service(UntagResourceError::AuthorizationError(
parsed_error.message,
))
}
"ConcurrentAccess" => {
return RusotoError::Service(UntagResourceError::ConcurrentAccess(
parsed_error.message,
))
}
"InvalidParameter" => {
return RusotoError::Service(UntagResourceError::InvalidParameter(
parsed_error.message,
))
}
"ResourceNotFound" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(
parsed_error.message,
))
}
"StaleTag" => {
return RusotoError::Service(UntagResourceError::StaleTag(
parsed_error.message,
))
}
"TagLimitExceeded" => {
return RusotoError::Service(UntagResourceError::TagLimitExceeded(
parsed_error.message,
))
}
"TagPolicy" => {
return RusotoError::Service(UntagResourceError::TagPolicy(
parsed_error.message,
))
}
_ => {}
}
}
}
RusotoError::Unknown(res)
}
fn deserialize<T>(stack: &mut T) -> Result<XmlError, XmlParseError>
where
T: Peek + Next,
{
start_element("ErrorResponse", stack)?;
XmlErrorDeserializer::deserialize("Error", stack)
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::AuthorizationError(ref cause) => cause,
UntagResourceError::ConcurrentAccess(ref cause) => cause,
UntagResourceError::InvalidParameter(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
UntagResourceError::StaleTag(ref cause) => cause,
UntagResourceError::TagLimitExceeded(ref cause) => cause,
UntagResourceError::TagPolicy(ref cause) => cause,
}
}
}
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_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError>;
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 tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn unsubscribe(&self, input: UnsubscribeInput) -> RusotoFuture<(), UnsubscribeError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
}
#[derive(Clone)]
pub struct SnsClient {
client: Client,
region: region::Region,
}
impl SnsClient {
pub fn new(region: region::Region) -> SnsClient {
SnsClient {
client: Client::shared(),
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,
}
}
}
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()));
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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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()));
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()));
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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = ListSubscriptionsByTopicResponseDeserializer::deserialize(
"ListSubscriptionsByTopicResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "ListTagsForResource");
params.put("Version", "2010-03-31");
ListTagsForResourceRequestSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = ListTagsForResourceResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = ListTagsForResourceResponseDeserializer::deserialize(
"ListTagsForResourceResult",
&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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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()));
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()));
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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = 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()));
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()));
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()));
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_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result =
SubscribeResponseDeserializer::deserialize("SubscribeResult", &mut stack)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "TagResource");
params.put("Version", "2010-03-31");
TagResourceRequestSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = TagResourceResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = TagResourceResponseDeserializer::deserialize(
"TagResourceResult",
&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()));
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)))
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let mut request = SignedRequest::new("POST", "sns", &self.region, "/");
let mut params = Params::new();
params.put("Action", "UntagResource");
params.put("Version", "2010-03-31");
UntagResourceRequestSerializer::serialize(&mut params, "", &input);
request.set_payload(Some(serde_urlencoded::to_string(¶ms).unwrap()));
request.set_content_type("application/x-www-form-urlencoded".to_owned());
self.client.sign_and_dispatch(request, |response| {
if !response.status.is_success() {
return Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
);
}
Box::new(response.buffer().from_err().and_then(move |response| {
let result;
if response.body.is_empty() {
result = UntagResourceResponse::default();
} else {
let reader = EventReader::new_with_config(
response.body.as_ref(),
ParserConfig::new().trim_whitespace(true),
);
let mut stack = XmlResponse::new(reader.into_iter().peekable());
let _start_document = stack.next();
let actual_tag_name = peek_at_name(&mut stack)?;
start_element(&actual_tag_name, &mut stack)?;
result = UntagResourceResponseDeserializer::deserialize(
"UntagResourceResult",
&mut stack,
)?;
skip_tree(&mut stack);
end_element(&actual_tag_name, &mut stack)?;
}
Ok(result)
}))
})
}
}
#[cfg(test)]
mod protocol_tests {
extern crate rusoto_mock;
use self::rusoto_mock::*;
use super::*;
use rusoto_core::Region as rusoto_region;
#[test]
fn test_parse_error_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);
}
}