pub(crate) fn de_workforce<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::Workforce>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::WorkforceBuilder::default();
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() {
"WorkforceName" => {
builder = builder.set_workforce_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"WorkforceArn" => {
builder = builder.set_workforce_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"LastUpdatedDate" => {
builder = builder.set_last_updated_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"SourceIpConfig" => {
builder =
builder.set_source_ip_config(crate::protocol_serde::shape_source_ip_config::de_source_ip_config(tokens, _value)?);
}
"SubDomain" => {
builder = builder.set_sub_domain(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"CognitoConfig" => {
builder = builder.set_cognito_config(crate::protocol_serde::shape_cognito_config::de_cognito_config(tokens, _value)?);
}
"OidcConfig" => {
builder = builder.set_oidc_config(crate::protocol_serde::shape_oidc_config_for_response::de_oidc_config_for_response(
tokens, _value,
)?);
}
"CreateDate" => {
builder = builder.set_create_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"WorkforceVpcConfig" => {
builder = builder.set_workforce_vpc_config(
crate::protocol_serde::shape_workforce_vpc_config_response::de_workforce_vpc_config_response(tokens, _value)?,
);
}
"Status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::WorkforceStatus::from(u.as_ref())))
.transpose()?,
);
}
"FailureReason" => {
builder = builder.set_failure_reason(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"IpAddressType" => {
builder = builder.set_ip_address_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::WorkforceIpAddressType::from(u.as_ref())))
.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:?}"
)))
}
}
}
Ok(Some(crate::serde_util::workforce_correct_errors(builder).build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}