pub fn ser_get_compute_auth_token_input(
input: &crate::operation::get_compute_auth_token::GetComputeAuthTokenInput,
) -> 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_compute_auth_token_input::ser_get_compute_auth_token_input(
&mut object,
input,
)?;
object.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_get_compute_auth_token_http_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::get_compute_auth_token::GetComputeAuthTokenOutput,
crate::operation::get_compute_auth_token::GetComputeAuthTokenError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(response)
.map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::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_compute_auth_token::GetComputeAuthTokenError::unhandled(
generic,
),
)
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServiceException" => crate::operation::get_compute_auth_token::GetComputeAuthTokenError::InternalServiceException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InternalServiceExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_internal_service_exception::de_internal_service_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidRequestException" => crate::operation::get_compute_auth_token::GetComputeAuthTokenError::InvalidRequestException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"NotFoundException" => crate::operation::get_compute_auth_token::GetComputeAuthTokenError::NotFoundException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::NotFoundExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_not_found_exception::de_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnauthorizedException" => crate::operation::get_compute_auth_token::GetComputeAuthTokenError::UnauthorizedException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnauthorizedExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_unauthorized_exception::de_unauthorized_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::get_compute_auth_token::GetComputeAuthTokenError::generic(generic)
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_get_compute_auth_token_http_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::get_compute_auth_token::GetComputeAuthTokenOutput,
crate::operation::get_compute_auth_token::GetComputeAuthTokenError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::get_compute_auth_token::builders::GetComputeAuthTokenOutputBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_get_compute_auth_token::de_get_compute_auth_token(
response.body().as_ref(),
output,
)
.map_err(crate::operation::get_compute_auth_token::GetComputeAuthTokenError::unhandled)?;
output._set_request_id(
aws_http::request_id::RequestId::request_id(response).map(str::to_string),
);
output.build()
})
}
pub(crate) fn de_get_compute_auth_token(
value: &[u8],
mut builder: crate::operation::get_compute_auth_token::builders::GetComputeAuthTokenOutputBuilder,
) -> Result<
crate::operation::get_compute_auth_token::builders::GetComputeAuthTokenOutputBuilder,
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() {
"FleetId" => {
builder = builder.set_fleet_id(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"FleetArn" => {
builder = builder.set_fleet_arn(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ComputeName" => {
builder = builder.set_compute_name(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ComputeArn" => {
builder = builder.set_compute_arn(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"AuthToken" => {
builder = builder.set_auth_token(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ExpirationTimestamp" => {
builder = builder.set_expiration_timestamp(
aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
aws_smithy_types::date_time::Format::EpochSeconds,
)?,
);
}
_ => 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)
}