pub fn ser_batch_get_deployment_groups_input(
input: &crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsInput,
) -> 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_batch_get_deployment_groups_input::ser_batch_get_deployment_groups_input(&mut object, input)?;
object.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_batch_get_deployment_groups_http_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsOutput,
crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(response).map_err(
crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::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::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled(
generic,
),
),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ApplicationDoesNotExistException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::ApplicationDoesNotExistException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ApplicationDoesNotExistExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_application_does_not_exist_exception::de_application_does_not_exist_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ApplicationNameRequiredException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::ApplicationNameRequiredException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ApplicationNameRequiredExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_application_name_required_exception::de_application_name_required_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"BatchLimitExceededException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::BatchLimitExceededException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::BatchLimitExceededExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_batch_limit_exceeded_exception::de_batch_limit_exceeded_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"DeploymentConfigDoesNotExistException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::DeploymentConfigDoesNotExistException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::DeploymentConfigDoesNotExistExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_deployment_config_does_not_exist_exception::de_deployment_config_does_not_exist_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"DeploymentGroupNameRequiredException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::DeploymentGroupNameRequiredException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::DeploymentGroupNameRequiredExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_deployment_group_name_required_exception::de_deployment_group_name_required_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidApplicationNameException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::InvalidApplicationNameException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidApplicationNameExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_invalid_application_name_exception::de_invalid_application_name_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidDeploymentGroupNameException" => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::InvalidDeploymentGroupNameException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidDeploymentGroupNameExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_invalid_deployment_group_name_exception::de_invalid_deployment_group_name_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::generic(generic)
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_batch_get_deployment_groups_http_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsOutput,
crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::batch_get_deployment_groups::builders::BatchGetDeploymentGroupsOutputBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_batch_get_deployment_groups::de_batch_get_deployment_groups(response.body().as_ref(), output).map_err(crate::operation::batch_get_deployment_groups::BatchGetDeploymentGroupsError::unhandled)?;
output._set_request_id(
aws_http::request_id::RequestId::request_id(response).map(str::to_string),
);
output.build()
})
}
pub(crate) fn de_batch_get_deployment_groups(
value: &[u8],
mut builder: crate::operation::batch_get_deployment_groups::builders::BatchGetDeploymentGroupsOutputBuilder,
) -> Result<
crate::operation::batch_get_deployment_groups::builders::BatchGetDeploymentGroupsOutputBuilder,
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() {
"deploymentGroupsInfo" => {
builder = builder.set_deployment_groups_info(
crate::protocol_serde::shape_deployment_group_info_list::de_deployment_group_info_list(tokens)?
);
}
"errorMessage" => {
builder = builder.set_error_message(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
_ => 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)
}