aws-sdk-dynamodb 1.111.0

AWS SDK for Amazon DynamoDB
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_replica_description<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::ReplicaDescription>, ::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::ReplicaDescriptionBuilder::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() {
                        "RegionName" => {
                            builder = builder.set_region_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ReplicaStatus" => {
                            builder = builder.set_replica_status(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::ReplicaStatus::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "ReplicaArn" => {
                            builder = builder.set_replica_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ReplicaStatusDescription" => {
                            builder = builder.set_replica_status_description(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ReplicaStatusPercentProgress" => {
                            builder = builder.set_replica_status_percent_progress(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "KMSMasterKeyId" => {
                            builder = builder.set_kms_master_key_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ProvisionedThroughputOverride" => {
                            builder = builder.set_provisioned_throughput_override(
                                crate::protocol_serde::shape_provisioned_throughput_override::de_provisioned_throughput_override(tokens, _value)?,
                            );
                        }
                        "OnDemandThroughputOverride" => {
                            builder = builder.set_on_demand_throughput_override(
                                crate::protocol_serde::shape_on_demand_throughput_override::de_on_demand_throughput_override(tokens, _value)?,
                            );
                        }
                        "WarmThroughput" => {
                            builder = builder.set_warm_throughput(
                                crate::protocol_serde::shape_table_warm_throughput_description::de_table_warm_throughput_description(tokens, _value)?,
                            );
                        }
                        "GlobalSecondaryIndexes" => {
                            builder = builder.set_global_secondary_indexes(
                                    crate::protocol_serde::shape_replica_global_secondary_index_description_list::de_replica_global_secondary_index_description_list(tokens, _value)?
                                );
                        }
                        "ReplicaInaccessibleDateTime" => {
                            builder = builder.set_replica_inaccessible_date_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                tokens.next(),
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
                            )?);
                        }
                        "ReplicaTableClassSummary" => {
                            builder = builder.set_replica_table_class_summary(
                                crate::protocol_serde::shape_table_class_summary::de_table_class_summary(tokens, _value)?,
                            );
                        }
                        "GlobalTableSettingsReplicationMode" => {
                            builder = builder.set_global_table_settings_replication_mode(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| {
                                        s.to_unescaped()
                                            .map(|u| crate::types::GlobalTableSettingsReplicationMode::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(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}