pub(crate) fn de_replication_configuration_template<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::ReplicationConfigurationTemplate>, ::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::ReplicationConfigurationTemplateBuilder::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() {
"replicationConfigurationTemplateID" => {
builder = builder.set_replication_configuration_template_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"arn" => {
builder = builder.set_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"stagingAreaSubnetId" => {
builder = builder.set_staging_area_subnet_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"associateDefaultSecurityGroup" => {
builder = builder
.set_associate_default_security_group(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"replicationServersSecurityGroupsIDs" => {
builder = builder.set_replication_servers_security_groups_ids(
crate::protocol_serde::shape_replication_servers_security_groups_ids::de_replication_servers_security_groups_ids(
tokens, _value,
)?,
);
}
"replicationServerInstanceType" => {
builder = builder.set_replication_server_instance_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"useDedicatedReplicationServer" => {
builder = builder
.set_use_dedicated_replication_server(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"defaultLargeStagingDiskType" => {
builder = builder.set_default_large_staging_disk_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::ReplicationConfigurationDefaultLargeStagingDiskType::from(u.as_ref()))
})
.transpose()?,
);
}
"ebsEncryption" => {
builder = builder.set_ebs_encryption(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::ReplicationConfigurationEbsEncryption::from(u.as_ref()))
})
.transpose()?,
);
}
"ebsEncryptionKeyArn" => {
builder = builder.set_ebs_encryption_key_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"bandwidthThrottling" => {
builder = builder.set_bandwidth_throttling(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i64::try_from)
.transpose()?,
);
}
"dataPlaneRouting" => {
builder = builder.set_data_plane_routing(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::ReplicationConfigurationDataPlaneRouting::from(u.as_ref()))
})
.transpose()?,
);
}
"createPublicIP" => {
builder = builder.set_create_public_ip(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"stagingAreaTags" => {
builder = builder.set_staging_area_tags(crate::protocol_serde::shape_tags_map::de_tags_map(tokens, _value)?);
}
"useFipsEndpoint" => {
builder = builder.set_use_fips_endpoint(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"tags" => {
builder = builder.set_tags(crate::protocol_serde::shape_tags_map::de_tags_map(tokens, _value)?);
}
"internetProtocol" => {
builder = builder.set_internet_protocol(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::InternetProtocol::from(u.as_ref())))
.transpose()?,
);
}
"storeSnapshotOnLocalZone" => {
builder =
builder.set_store_snapshot_on_local_zone(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
_ => ::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::replication_configuration_template_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}