#[allow(clippy::unnecessary_wraps)]
pub fn de_get_insight_selectors_http_error(
_response_status: u16,
_response_headers: &::http::header::HeaderMap,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::get_insight_selectors::GetInsightSelectorsOutput,
crate::operation::get_insight_selectors::GetInsightSelectorsError,
> {
#[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_insight_selectors::GetInsightSelectorsError::unhandled)?;
generic_builder = ::aws_http::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_insight_selectors::GetInsightSelectorsError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"CloudTrailARNInvalidException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::CloudTrailArnInvalidException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::CloudTrailArnInvalidExceptionBuilder::default();
output = crate::protocol_serde::shape_cloud_trail_arn_invalid_exception::de_cloud_trail_arn_invalid_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InsightNotEnabledException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::InsightNotEnabledException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InsightNotEnabledExceptionBuilder::default();
output =
crate::protocol_serde::shape_insight_not_enabled_exception::de_insight_not_enabled_exception_json_err(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidTrailNameException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::InvalidTrailNameException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidTrailNameExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_trail_name_exception::de_invalid_trail_name_exception_json_err(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"NoManagementAccountSLRExistsException" => {
crate::operation::get_insight_selectors::GetInsightSelectorsError::NoManagementAccountSlrExistsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::NoManagementAccountSlrExistsExceptionBuilder::default();
output = crate::protocol_serde::shape_no_management_account_slr_exists_exception::de_no_management_account_slr_exists_exception_json_err(_response_body, output).map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"OperationNotPermittedException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::OperationNotPermittedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::OperationNotPermittedExceptionBuilder::default();
output = crate::protocol_serde::shape_operation_not_permitted_exception::de_operation_not_permitted_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ThrottlingException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"TrailNotFoundException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::TrailNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::TrailNotFoundExceptionBuilder::default();
output = crate::protocol_serde::shape_trail_not_found_exception::de_trail_not_found_exception_json_err(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedOperationException" => crate::operation::get_insight_selectors::GetInsightSelectorsError::UnsupportedOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnsupportedOperationExceptionBuilder::default();
output =
crate::protocol_serde::shape_unsupported_operation_exception::de_unsupported_operation_exception_json_err(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::get_insight_selectors::GetInsightSelectorsError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_get_insight_selectors_http_response(
_response_status: u16,
_response_headers: &::http::header::HeaderMap,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::get_insight_selectors::GetInsightSelectorsOutput,
crate::operation::get_insight_selectors::GetInsightSelectorsError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::get_insight_selectors::builders::GetInsightSelectorsOutputBuilder::default();
output = crate::protocol_serde::shape_get_insight_selectors::de_get_insight_selectors(_response_body, output)
.map_err(crate::operation::get_insight_selectors::GetInsightSelectorsError::unhandled)?;
output._set_request_id(::aws_http::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_get_insight_selectors_input(
input: &crate::operation::get_insight_selectors::GetInsightSelectorsInput,
) -> Result<::aws_smithy_http::body::SdkBody, ::aws_smithy_http::operation::error::SerializationError> {
let mut out = String::new();
let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::protocol_serde::shape_get_insight_selectors_input::ser_get_insight_selectors_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_http::body::SdkBody::from(out))
}
pub(crate) fn de_get_insight_selectors(
value: &[u8],
mut builder: crate::operation::get_insight_selectors::builders::GetInsightSelectorsOutputBuilder,
) -> Result<
crate::operation::get_insight_selectors::builders::GetInsightSelectorsOutputBuilder,
::aws_smithy_json::deserialize::error::DeserializeError,
> {
let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
let tokens = &mut tokens_owned;
::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"TrailARN" => {
builder = builder.set_trail_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"InsightSelectors" => {
builder = builder.set_insight_selectors(crate::protocol_serde::shape_insight_selectors::de_insight_selectors(tokens)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {:?}",
other
)))
}
}
}
if tokens.next().is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"found more JSON tokens after completing parsing",
));
}
Ok(builder)
}