#[allow(clippy::unnecessary_wraps)]
pub fn de_get_hook_result_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::get_hook_result::GetHookResultOutput, crate::operation::get_hook_result::GetHookResultError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::get_hook_result::GetHookResultError::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::get_hook_result::GetHookResultError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"HookResultNotFound" => crate::operation::get_hook_result::GetHookResultError::HookResultNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::HookResultNotFoundExceptionBuilder::default();
output =
crate::protocol_serde::shape_hook_result_not_found_exception::de_hook_result_not_found_exception_xml_err(_response_body, output)
.map_err(crate::operation::get_hook_result::GetHookResultError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::get_hook_result::GetHookResultError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_get_hook_result_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::get_hook_result::GetHookResultOutput, crate::operation::get_hook_result::GetHookResultError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::get_hook_result::builders::GetHookResultOutputBuilder::default();
output = crate::protocol_serde::shape_get_hook_result::de_get_hook_result(_response_body, output)
.map_err(crate::operation::get_hook_result::GetHookResultError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
#[allow(unused_mut)]
pub fn de_get_hook_result(
inp: &[u8],
mut builder: crate::operation::get_hook_result::builders::GetHookResultOutputBuilder,
) -> std::result::Result<crate::operation::get_hook_result::builders::GetHookResultOutputBuilder, ::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("GetHookResultResponse")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid root, expected GetHookResultResponse got {start_el:?}"
)));
}
if let Some(mut result_tag) = decoder.next_tag() {
let start_el = result_tag.start_el();
if !(start_el.matches("GetHookResultResult")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid result, expected GetHookResultResult got {start_el:?}"
)));
}
while let Some(mut tag) = result_tag.next_tag() {
match tag.start_el() {
s if s.matches("HookResultId") => {
let var_1 =
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_hook_result_id(var_1);
}
,
s if s.matches("InvocationPoint") => {
let var_2 =
Some(
Result::<crate::types::HookInvocationPoint, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::HookInvocationPoint::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_invocation_point(var_2);
}
,
s if s.matches("FailureMode") => {
let var_3 =
Some(
Result::<crate::types::HookFailureMode, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::HookFailureMode::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_failure_mode(var_3);
}
,
s if s.matches("TypeName") => {
let var_4 =
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_type_name(var_4);
}
,
s if s.matches("OriginalTypeName") => {
let var_5 =
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_original_type_name(var_5);
}
,
s if s.matches("TypeVersionId") => {
let var_6 =
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_type_version_id(var_6);
}
,
s if s.matches("TypeConfigurationVersionId") => {
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_type_configuration_version_id(var_7);
}
,
s if s.matches("TypeArn") => {
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_type_arn(var_8);
}
,
s if s.matches("Status") => {
let var_9 =
Some(
Result::<crate::types::HookStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::HookStatus::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_status(var_9);
}
,
s if s.matches("HookStatusReason") => {
let var_10 =
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_hook_status_reason(var_10);
}
,
s if s.matches("InvokedAt") => {
let var_11 =
Some(
::aws_smithy_types::DateTime::from_str(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
, ::aws_smithy_types::date_time::Format::DateTimeWithOffset
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.cloudformation#Timestamp`)"))
?
)
;
builder = builder.set_invoked_at(var_11);
}
,
s if s.matches("Target") => {
let var_12 =
Some(
crate::protocol_serde::shape_hook_target::de_hook_target(&mut tag)
?
)
;
builder = builder.set_target(var_12);
}
,
s if s.matches("Annotations") => {
let var_13 =
Some(
crate::protocol_serde::shape_annotation_list::de_annotation_list(&mut tag)
?
)
;
builder = builder.set_annotations(var_13);
}
,
_ => {}
}
}
} else {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected GetHookResultResult tag"));
};
Ok(builder)
}