#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_integration_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::delete_integration::DeleteIntegrationOutput, crate::operation::delete_integration::DeleteIntegrationError>
{
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::delete_integration::DeleteIntegrationError::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::delete_integration::DeleteIntegrationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"IntegrationConflictOperationFault" => crate::operation::delete_integration::DeleteIntegrationError::IntegrationConflictOperationFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::IntegrationConflictOperationFaultBuilder::default();
output = crate::protocol_serde::shape_integration_conflict_operation_fault::de_integration_conflict_operation_fault_xml_err(
_response_body,
output,
)
.map_err(crate::operation::delete_integration::DeleteIntegrationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"IntegrationConflictStateFault" => crate::operation::delete_integration::DeleteIntegrationError::IntegrationConflictStateFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::IntegrationConflictStateFaultBuilder::default();
output = crate::protocol_serde::shape_integration_conflict_state_fault::de_integration_conflict_state_fault_xml_err(
_response_body,
output,
)
.map_err(crate::operation::delete_integration::DeleteIntegrationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"IntegrationNotFoundFault" => crate::operation::delete_integration::DeleteIntegrationError::IntegrationNotFoundFault({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::IntegrationNotFoundFaultBuilder::default();
output = crate::protocol_serde::shape_integration_not_found_fault::de_integration_not_found_fault_xml_err(_response_body, output)
.map_err(crate::operation::delete_integration::DeleteIntegrationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedOperation" => crate::operation::delete_integration::DeleteIntegrationError::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::delete_integration::DeleteIntegrationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::delete_integration::DeleteIntegrationError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_integration_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::delete_integration::DeleteIntegrationOutput, crate::operation::delete_integration::DeleteIntegrationError>
{
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::delete_integration::builders::DeleteIntegrationOutputBuilder::default();
output = crate::protocol_serde::shape_delete_integration::de_delete_integration(_response_body, output)
.map_err(crate::operation::delete_integration::DeleteIntegrationError::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_delete_integration(
inp: &[u8],
mut builder: crate::operation::delete_integration::builders::DeleteIntegrationOutputBuilder,
) -> std::result::Result<crate::operation::delete_integration::builders::DeleteIntegrationOutputBuilder, ::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("DeleteIntegrationResponse")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid root, expected DeleteIntegrationResponse got {start_el:?}"
)));
}
if let Some(mut result_tag) = decoder.next_tag() {
let start_el = result_tag.start_el();
if !(start_el.matches("DeleteIntegrationResult")) {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"invalid result, expected DeleteIntegrationResult got {start_el:?}"
)));
}
while let Some(mut tag) = result_tag.next_tag() {
match tag.start_el() {
s if s.matches("IntegrationArn") => {
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_integration_arn(var_1);
}
,
s if s.matches("IntegrationName") => {
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_integration_name(var_2);
}
,
s if s.matches("SourceArn") => {
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_source_arn(var_3);
}
,
s if s.matches("TargetArn") => {
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_target_arn(var_4);
}
,
s if s.matches("Status") => {
let var_5 =
Some(
Result::<crate::types::ZeroEtlIntegrationStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::ZeroEtlIntegrationStatus::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_status(var_5);
}
,
s if s.matches("Errors") => {
let var_6 =
Some(
crate::protocol_serde::shape_integration_error_list::de_integration_error_list(&mut tag)
?
)
;
builder = builder.set_errors(var_6);
}
,
s if s.matches("CreateTime") => {
let var_7 =
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_create_time(var_7);
}
,
s if s.matches("Description") => {
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_description(var_8);
}
,
s if s.matches("KMSKeyId") => {
let var_9 =
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_kms_key_id(var_9);
}
,
s if s.matches("AdditionalEncryptionContext") => {
let var_10 =
Some(
crate::protocol_serde::shape_encryption_context_map::de_encryption_context_map(&mut tag)
?
)
;
builder = builder.set_additional_encryption_context(var_10);
}
,
s if s.matches("Tags") => {
let var_11 =
Some(
crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
?
)
;
builder = builder.set_tags(var_11);
}
,
_ => {}
}
}
} else {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected DeleteIntegrationResult tag"));
};
Ok(builder)
}