#[allow(clippy::unnecessary_wraps)]
pub fn de_associate_vpc_with_hosted_zone_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::associate_vpc_with_hosted_zone::AssociateVpcWithHostedZoneOutput,
crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
let generic = generic_builder.build();
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConflictingDomainExists" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::ConflictingDomainExists({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ConflictingDomainExistsBuilder::default();
output = crate::protocol_serde::shape_conflicting_domain_exists::de_conflicting_domain_exists_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidInput" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::InvalidInput({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidInputBuilder::default();
output = crate::protocol_serde::shape_invalid_input::de_invalid_input_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidVPCId" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::InvalidVpcId({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidVpcIdBuilder::default();
output = crate::protocol_serde::shape_invalid_vpc_id::de_invalid_vpc_id_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"LimitsExceeded" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::LimitsExceeded({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::LimitsExceededBuilder::default();
output = crate::protocol_serde::shape_limits_exceeded::de_limits_exceeded_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"NoSuchHostedZone" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::NoSuchHostedZone({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::NoSuchHostedZoneBuilder::default();
output = crate::protocol_serde::shape_no_such_hosted_zone::de_no_such_hosted_zone_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"NotAuthorizedException" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::NotAuthorizedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::NotAuthorizedExceptionBuilder::default();
output = crate::protocol_serde::shape_not_authorized_exception::de_not_authorized_exception_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"PriorRequestNotComplete" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::PriorRequestNotComplete({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::PriorRequestNotCompleteBuilder::default();
output = crate::protocol_serde::shape_prior_request_not_complete::de_prior_request_not_complete_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"PublicZoneVPCAssociation" => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::PublicZoneVpcAssociation({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::PublicZoneVpcAssociationBuilder::default();
output = crate::protocol_serde::shape_public_zone_vpc_association::de_public_zone_vpc_association_xml_err(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_associate_vpc_with_hosted_zone_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::associate_vpc_with_hosted_zone::AssociateVpcWithHostedZoneOutput,
crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::associate_vpc_with_hosted_zone::builders::AssociateVpcWithHostedZoneOutputBuilder::default();
output = crate::protocol_serde::shape_associate_vpc_with_hosted_zone::de_associate_vpc_with_hosted_zone(_response_body, output)
.map_err(crate::operation::associate_vpc_with_hosted_zone::AssociateVPCWithHostedZoneError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
crate::serde_util::associate_vpc_with_hosted_zone_output_output_correct_errors(output).build()
})
}
pub fn ser_associate_vpc_with_hosted_zone_op_input(
input: &crate::operation::associate_vpc_with_hosted_zone::AssociateVpcWithHostedZoneInput,
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
let mut out = String::new();
{
let mut writer = ::aws_smithy_xml::encode::XmlWriter::new(&mut out);
#[allow(unused_mut)]
let mut root = writer
.start_el("AssociateVPCWithHostedZoneRequest")
.write_ns("https://route53.amazonaws.com/doc/2013-04-01/", None);
crate::protocol_serde::shape_associate_vpc_with_hosted_zone_input::ser_associate_vpc_with_hosted_zone_input_input_input(input, root)?
}
Ok(::aws_smithy_types::body::SdkBody::from(out))
}
#[allow(unused_mut)]
pub fn de_associate_vpc_with_hosted_zone(
inp: &[u8],
mut builder: crate::operation::associate_vpc_with_hosted_zone::builders::AssociateVpcWithHostedZoneOutputBuilder,
) -> std::result::Result<
crate::operation::associate_vpc_with_hosted_zone::builders::AssociateVpcWithHostedZoneOutputBuilder,
::aws_smithy_xml::decode::XmlDecodeError,
> {
let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
#[allow(unused_mut)]
let mut decoder = doc.root_element()?;
#[allow(unused_variables)]
let start_el = decoder.start_el();
if !start_el.matches("AssociateVPCWithHostedZoneResponse") {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"encountered invalid XML root: expected AssociateVPCWithHostedZoneResponse but got {start_el:?}. This is likely a bug in the SDK."
)));
}
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("ChangeInfo") => {
let var_1 =
Some(
crate::protocol_serde::shape_change_info::de_change_info(&mut tag)
?
)
;
builder = builder.set_change_info(var_1);
}
,
_ => {}
}
}
Ok(builder)
}