pub fn ser_put_function_concurrency_input(
input: &crate::operation::put_function_concurrency::PutFunctionConcurrencyInput,
) -> 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_put_function_concurrency_input::ser_put_function_concurrency_input(&mut object, input)?;
object.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_put_function_concurrency_http_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::put_function_concurrency::PutFunctionConcurrencyOutput,
crate::operation::put_function_concurrency::PutFunctionConcurrencyError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(response).map_err(
crate::operation::put_function_concurrency::PutFunctionConcurrencyError::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::put_function_concurrency::PutFunctionConcurrencyError::unhandled(
generic,
),
),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ResourceNotFoundException" => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::ResourceNotFoundException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"TooManyRequestsException" => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::TooManyRequestsException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled)?;
output = output.set_retry_after_seconds(
crate::protocol_serde::shape_too_many_requests_exception::de_retry_after_seconds_header(response.headers())
.map_err(|_|crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After"))?
);
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ServiceException" => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::ServiceException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ServiceExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_service_exception::de_service_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidParameterValueException" => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::InvalidParameterValueException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResourceConflictException" => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::ResourceConflictException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ResourceConflictExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_resource_conflict_exception::de_resource_conflict_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::put_function_concurrency::PutFunctionConcurrencyError::generic(generic)
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_put_function_concurrency_http_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::put_function_concurrency::PutFunctionConcurrencyOutput,
crate::operation::put_function_concurrency::PutFunctionConcurrencyError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::put_function_concurrency::builders::PutFunctionConcurrencyOutputBuilder::default();
let _ = response;
output =
crate::protocol_serde::shape_put_function_concurrency::de_put_function_concurrency(
response.body().as_ref(),
output,
)
.map_err(
crate::operation::put_function_concurrency::PutFunctionConcurrencyError::unhandled,
)?;
output._set_request_id(
aws_http::request_id::RequestId::request_id(response).map(str::to_string),
);
output.build()
})
}
pub(crate) fn de_put_function_concurrency(
value: &[u8],
mut builder: crate::operation::put_function_concurrency::builders::PutFunctionConcurrencyOutputBuilder,
) -> Result<
crate::operation::put_function_concurrency::builders::PutFunctionConcurrencyOutputBuilder,
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() {
"ReservedConcurrentExecutions" => {
builder = builder.set_reserved_concurrent_executions(
aws_smithy_json::deserialize::token::expect_number_or_null(
tokens.next(),
)?
.map(i32::try_from)
.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)
}