aws_sdk_s3/protocol_serde/
shape_public_access_block_configuration.rspub fn ser_public_access_block_configuration(
input: &crate::types::PublicAccessBlockConfiguration,
writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
if let Some(var_1) = &input.block_public_acls {
let mut inner_writer = scope.start_el("BlockPublicAcls").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_1).encode());
}
if let Some(var_2) = &input.ignore_public_acls {
let mut inner_writer = scope.start_el("IgnorePublicAcls").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_2).encode());
}
if let Some(var_3) = &input.block_public_policy {
let mut inner_writer = scope.start_el("BlockPublicPolicy").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_3).encode());
}
if let Some(var_4) = &input.restrict_public_buckets {
let mut inner_writer = scope.start_el("RestrictPublicBuckets").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_4).encode());
}
scope.finish();
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_public_access_block_configuration(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::PublicAccessBlockConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::PublicAccessBlockConfiguration::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("BlockPublicAcls") => {
let var_5 =
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.s3#Setting`)"))
}
?
)
;
builder = builder.set_block_public_acls(var_5);
}
,
s if s.matches("IgnorePublicAcls") => {
let var_6 =
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.s3#Setting`)"))
}
?
)
;
builder = builder.set_ignore_public_acls(var_6);
}
,
s if s.matches("BlockPublicPolicy") => {
let var_7 =
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.s3#Setting`)"))
}
?
)
;
builder = builder.set_block_public_policy(var_7);
}
,
s if s.matches("RestrictPublicBuckets") => {
let var_8 =
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.s3#Setting`)"))
}
?
)
;
builder = builder.set_restrict_public_buckets(var_8);
}
,
_ => {}
}
}
Ok(builder.build())
}