aws_sdk_s3/protocol_serde/
shape_destination.rspub fn ser_destination(
input: &crate::types::Destination,
writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
{
let mut inner_writer = scope.start_el("Bucket").finish();
inner_writer.data(input.bucket.as_str());
}
if let Some(var_1) = &input.account {
let mut inner_writer = scope.start_el("Account").finish();
inner_writer.data(var_1.as_str());
}
if let Some(var_2) = &input.storage_class {
let mut inner_writer = scope.start_el("StorageClass").finish();
inner_writer.data(var_2.as_str());
}
if let Some(var_3) = &input.access_control_translation {
let inner_writer = scope.start_el("AccessControlTranslation");
crate::protocol_serde::shape_access_control_translation::ser_access_control_translation(var_3, inner_writer)?
}
if let Some(var_4) = &input.encryption_configuration {
let inner_writer = scope.start_el("EncryptionConfiguration");
crate::protocol_serde::shape_encryption_configuration::ser_encryption_configuration(var_4, inner_writer)?
}
if let Some(var_5) = &input.replication_time {
let inner_writer = scope.start_el("ReplicationTime");
crate::protocol_serde::shape_replication_time::ser_replication_time(var_5, inner_writer)?
}
if let Some(var_6) = &input.metrics {
let inner_writer = scope.start_el("Metrics");
crate::protocol_serde::shape_metrics::ser_metrics(var_6, inner_writer)?
}
scope.finish();
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_destination(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::Destination, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::Destination::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Bucket") => {
let var_7 =
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_bucket(var_7);
}
,
s if s.matches("Account") => {
let var_8 =
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_account(var_8);
}
,
s if s.matches("StorageClass") => {
let var_9 =
Some(
Result::<crate::types::StorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::StorageClass::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_storage_class(var_9);
}
,
s if s.matches("AccessControlTranslation") => {
let var_10 =
Some(
crate::protocol_serde::shape_access_control_translation::de_access_control_translation(&mut tag)
?
)
;
builder = builder.set_access_control_translation(var_10);
}
,
s if s.matches("EncryptionConfiguration") => {
let var_11 =
Some(
crate::protocol_serde::shape_encryption_configuration::de_encryption_configuration(&mut tag)
?
)
;
builder = builder.set_encryption_configuration(var_11);
}
,
s if s.matches("ReplicationTime") => {
let var_12 =
Some(
crate::protocol_serde::shape_replication_time::de_replication_time(&mut tag)
?
)
;
builder = builder.set_replication_time(var_12);
}
,
s if s.matches("Metrics") => {
let var_13 =
Some(
crate::protocol_serde::shape_metrics::de_metrics(&mut tag)
?
)
;
builder = builder.set_metrics(var_13);
}
,
_ => {}
}
}
Ok(crate::serde_util::destination_correct_errors(builder)
.build()
.map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}