#[allow(clippy::unnecessary_wraps)]
pub fn de_describe_resize_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::describe_resize::DescribeResizeOutput, crate::operation::describe_resize::DescribeResizeError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::describe_resize::DescribeResizeError::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::describe_resize::DescribeResizeError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ClusterNotFound" => crate::operation::describe_resize::DescribeResizeError::ClusterNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ClusterNotFoundFaultBuilder::default();
output = crate::protocol_serde::shape_cluster_not_found_fault::de_cluster_not_found_fault_xml_err(_response_body, output)
.map_err(crate::operation::describe_resize::DescribeResizeError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResizeNotFound" => crate::operation::describe_resize::DescribeResizeError::ResizeNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ResizeNotFoundFaultBuilder::default();
output = crate::protocol_serde::shape_resize_not_found_fault::de_resize_not_found_fault_xml_err(_response_body, output)
.map_err(crate::operation::describe_resize::DescribeResizeError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedOperation" => crate::operation::describe_resize::DescribeResizeError::UnsupportedOperationFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnsupportedOperationFaultBuilder::default();
output = crate::protocol_serde::shape_unsupported_operation_fault::de_unsupported_operation_fault_xml_err(_response_body, output)
.map_err(crate::operation::describe_resize::DescribeResizeError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::describe_resize::DescribeResizeError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_describe_resize_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::describe_resize::DescribeResizeOutput, crate::operation::describe_resize::DescribeResizeError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::describe_resize::builders::DescribeResizeOutputBuilder::default();
output = crate::protocol_serde::shape_describe_resize::de_describe_resize(_response_body, output)
.map_err(crate::operation::describe_resize::DescribeResizeError::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_describe_resize(
inp: &[u8],
mut builder: crate::operation::describe_resize::builders::DescribeResizeOutputBuilder,
) -> std::result::Result<crate::operation::describe_resize::builders::DescribeResizeOutputBuilder, ::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("DescribeResizeResponse")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid root, expected DescribeResizeResponse got {start_el:?}"
)));
}
if let Some(mut result_tag) = decoder.next_tag() {
let start_el = result_tag.start_el();
if !(start_el.matches("DescribeResizeResult")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid result, expected DescribeResizeResult got {start_el:?}"
)));
}
while let Some(mut tag) = result_tag.next_tag() {
match tag.start_el() {
s if s.matches("TargetNodeType") => {
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_target_node_type(var_1);
}
,
s if s.matches("TargetNumberOfNodes") => {
let var_2 =
Some(
{
<i32 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 (integer: `com.amazonaws.redshift#IntegerOptional`)"))
}
?
)
;
builder = builder.set_target_number_of_nodes(var_2);
}
,
s if s.matches("TargetClusterType") => {
let var_3 =
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_target_cluster_type(var_3);
}
,
s if s.matches("Status") => {
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_status(var_4);
}
,
s if s.matches("ImportTablesCompleted") => {
let var_5 =
Some(
crate::protocol_serde::shape_import_tables_completed::de_import_tables_completed(&mut tag)
?
)
;
builder = builder.set_import_tables_completed(var_5);
}
,
s if s.matches("ImportTablesInProgress") => {
let var_6 =
Some(
crate::protocol_serde::shape_import_tables_in_progress::de_import_tables_in_progress(&mut tag)
?
)
;
builder = builder.set_import_tables_in_progress(var_6);
}
,
s if s.matches("ImportTablesNotStarted") => {
let var_7 =
Some(
crate::protocol_serde::shape_import_tables_not_started::de_import_tables_not_started(&mut tag)
?
)
;
builder = builder.set_import_tables_not_started(var_7);
}
,
s if s.matches("AvgResizeRateInMegaBytesPerSecond") => {
let var_8 =
Some(
{
<f64 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 (double: `com.amazonaws.redshift#DoubleOptional`)"))
}
?
)
;
builder = builder.set_avg_resize_rate_in_mega_bytes_per_second(var_8);
}
,
s if s.matches("TotalResizeDataInMegaBytes") => {
let var_9 =
Some(
{
<i64 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 (long: `com.amazonaws.redshift#LongOptional`)"))
}
?
)
;
builder = builder.set_total_resize_data_in_mega_bytes(var_9);
}
,
s if s.matches("ProgressInMegaBytes") => {
let var_10 =
Some(
{
<i64 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 (long: `com.amazonaws.redshift#LongOptional`)"))
}
?
)
;
builder = builder.set_progress_in_mega_bytes(var_10);
}
,
s if s.matches("ElapsedTimeInSeconds") => {
let var_11 =
Some(
{
<i64 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 (long: `com.amazonaws.redshift#LongOptional`)"))
}
?
)
;
builder = builder.set_elapsed_time_in_seconds(var_11);
}
,
s if s.matches("EstimatedTimeToCompletionInSeconds") => {
let var_12 =
Some(
{
<i64 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 (long: `com.amazonaws.redshift#LongOptional`)"))
}
?
)
;
builder = builder.set_estimated_time_to_completion_in_seconds(var_12);
}
,
s if s.matches("ResizeType") => {
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_resize_type(var_13);
}
,
s if s.matches("Message") => {
let var_14 =
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_message(var_14);
}
,
s if s.matches("TargetEncryptionType") => {
let var_15 =
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_target_encryption_type(var_15);
}
,
s if s.matches("DataTransferProgressPercent") => {
let var_16 =
Some(
{
<f64 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 (double: `com.amazonaws.redshift#DoubleOptional`)"))
}
?
)
;
builder = builder.set_data_transfer_progress_percent(var_16);
}
,
_ => {}
}
}
} else {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected DescribeResizeResult tag"));
};
Ok(builder)
}