#[allow(unused_mut)]
pub fn ser_event_destination(
mut writer: ::aws_smithy_query::QueryValueWriter,
input: &crate::types::EventDestination,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope_1 = writer.prefix("Name");
{
scope_1.string(&input.name);
}
#[allow(unused_mut)]
let mut scope_2 = writer.prefix("Enabled");
if input.enabled {
scope_2.boolean(input.enabled);
}
#[allow(unused_mut)]
let mut scope_3 = writer.prefix("MatchingEventTypes");
{
let mut list_5 = scope_3.start_list(false, None);
for item_4 in &input.matching_event_types {
#[allow(unused_mut)]
let mut entry_6 = list_5.entry();
entry_6.string(item_4.as_str());
}
list_5.finish();
}
#[allow(unused_mut)]
let mut scope_7 = writer.prefix("KinesisFirehoseDestination");
if let Some(var_8) = &input.kinesis_firehose_destination {
crate::protocol_serde::shape_kinesis_firehose_destination::ser_kinesis_firehose_destination(scope_7, var_8)?;
}
#[allow(unused_mut)]
let mut scope_9 = writer.prefix("CloudWatchDestination");
if let Some(var_10) = &input.cloud_watch_destination {
crate::protocol_serde::shape_cloud_watch_destination::ser_cloud_watch_destination(scope_9, var_10)?;
}
#[allow(unused_mut)]
let mut scope_11 = writer.prefix("SNSDestination");
if let Some(var_12) = &input.sns_destination {
crate::protocol_serde::shape_sns_destination::ser_sns_destination(scope_11, var_12)?;
}
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_event_destination(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::EventDestination, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::EventDestination::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Name") => {
let var_13 =
Some(
Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_name(var_13);
}
,
s if s.matches("Enabled") => {
let var_14 =
Some(
{
<bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ses#Enabled`)"))
}
?
)
;
builder = builder.set_enabled(var_14);
}
,
s if s.matches("MatchingEventTypes") => {
let var_15 =
Some(
crate::protocol_serde::shape_event_types::de_event_types(&mut tag)
?
)
;
builder = builder.set_matching_event_types(var_15);
}
,
s if s.matches("KinesisFirehoseDestination") => {
let var_16 =
Some(
crate::protocol_serde::shape_kinesis_firehose_destination::de_kinesis_firehose_destination(&mut tag)
?
)
;
builder = builder.set_kinesis_firehose_destination(var_16);
}
,
s if s.matches("CloudWatchDestination") => {
let var_17 =
Some(
crate::protocol_serde::shape_cloud_watch_destination::de_cloud_watch_destination(&mut tag)
?
)
;
builder = builder.set_cloud_watch_destination(var_17);
}
,
s if s.matches("SNSDestination") => {
let var_18 =
Some(
crate::protocol_serde::shape_sns_destination::de_sns_destination(&mut tag)
?
)
;
builder = builder.set_sns_destination(var_18);
}
,
_ => {}
}
}
Ok(crate::serde_util::event_destination_correct_errors(builder)
.build()
.map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}