#[allow(clippy::unnecessary_wraps)]
pub fn de_disable_logging_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::disable_logging::DisableLoggingOutput, crate::operation::disable_logging::DisableLoggingError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::disable_logging::DisableLoggingError::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::disable_logging::DisableLoggingError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ClusterNotFound" => crate::operation::disable_logging::DisableLoggingError::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::disable_logging::DisableLoggingError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidClusterState" => crate::operation::disable_logging::DisableLoggingError::InvalidClusterStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidClusterStateFaultBuilder::default();
output = crate::protocol_serde::shape_invalid_cluster_state_fault::de_invalid_cluster_state_fault_xml_err(_response_body, output)
.map_err(crate::operation::disable_logging::DisableLoggingError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedOperation" => crate::operation::disable_logging::DisableLoggingError::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::disable_logging::DisableLoggingError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::disable_logging::DisableLoggingError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_disable_logging_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::disable_logging::DisableLoggingOutput, crate::operation::disable_logging::DisableLoggingError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::disable_logging::builders::DisableLoggingOutputBuilder::default();
output = crate::protocol_serde::shape_disable_logging::de_disable_logging(_response_body, output)
.map_err(crate::operation::disable_logging::DisableLoggingError::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_disable_logging(
inp: &[u8],
mut builder: crate::operation::disable_logging::builders::DisableLoggingOutputBuilder,
) -> Result<crate::operation::disable_logging::builders::DisableLoggingOutputBuilder, ::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("DisableLoggingResponse")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid root, expected DisableLoggingResponse got {:?}",
start_el
)));
}
if let Some(mut result_tag) = decoder.next_tag() {
let start_el = result_tag.start_el();
if !(start_el.matches("DisableLoggingResult")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid result, expected DisableLoggingResult got {:?}",
start_el
)));
}
while let Some(mut tag) = result_tag.next_tag() {
match tag.start_el() {
s if s.matches("LoggingEnabled") => {
let var_1 =
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.redshift#Boolean`)"))
}
?
)
;
builder = builder.set_logging_enabled(var_1);
}
,
s if s.matches("BucketName") => {
let var_2 =
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_name(var_2);
}
,
s if s.matches("S3KeyPrefix") => {
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_s3_key_prefix(var_3);
}
,
s if s.matches("LastSuccessfulDeliveryTime") => {
let var_4 =
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.redshift#TStamp`)"))
?
)
;
builder = builder.set_last_successful_delivery_time(var_4);
}
,
s if s.matches("LastFailureTime") => {
let var_5 =
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.redshift#TStamp`)"))
?
)
;
builder = builder.set_last_failure_time(var_5);
}
,
s if s.matches("LastFailureMessage") => {
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_last_failure_message(var_6);
}
,
s if s.matches("LogDestinationType") => {
let var_7 =
Some(
Result::<crate::types::LogDestinationType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::LogDestinationType::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_log_destination_type(var_7);
}
,
s if s.matches("LogExports") => {
let var_8 =
Some(
crate::protocol_serde::shape_log_type_list::de_log_type_list(&mut tag)
?
)
;
builder = builder.set_log_exports(var_8);
}
,
_ => {}
}
}
} else {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected DisableLoggingResult tag"));
};
Ok(builder)
}