aws_sdk_dynamodb/protocol_serde/
shape_replica_description.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_replica_description<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ReplicaDescription>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8    match tokens.next().transpose()? {
9        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11            #[allow(unused_mut)]
12            let mut builder = crate::types::builders::ReplicaDescriptionBuilder::default();
13            loop {
14                match tokens.next().transpose()? {
15                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17                        "RegionName" => {
18                            builder = builder.set_region_name(
19                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21                                    .transpose()?,
22                            );
23                        }
24                        "ReplicaStatus" => {
25                            builder = builder.set_replica_status(
26                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27                                    .map(|s| s.to_unescaped().map(|u| crate::types::ReplicaStatus::from(u.as_ref())))
28                                    .transpose()?,
29                            );
30                        }
31                        "ReplicaStatusDescription" => {
32                            builder = builder.set_replica_status_description(
33                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
35                                    .transpose()?,
36                            );
37                        }
38                        "ReplicaStatusPercentProgress" => {
39                            builder = builder.set_replica_status_percent_progress(
40                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
42                                    .transpose()?,
43                            );
44                        }
45                        "KMSMasterKeyId" => {
46                            builder = builder.set_kms_master_key_id(
47                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
48                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
49                                    .transpose()?,
50                            );
51                        }
52                        "ProvisionedThroughputOverride" => {
53                            builder = builder.set_provisioned_throughput_override(
54                                crate::protocol_serde::shape_provisioned_throughput_override::de_provisioned_throughput_override(tokens)?,
55                            );
56                        }
57                        "OnDemandThroughputOverride" => {
58                            builder = builder.set_on_demand_throughput_override(
59                                crate::protocol_serde::shape_on_demand_throughput_override::de_on_demand_throughput_override(tokens)?,
60                            );
61                        }
62                        "WarmThroughput" => {
63                            builder = builder.set_warm_throughput(
64                                crate::protocol_serde::shape_table_warm_throughput_description::de_table_warm_throughput_description(tokens)?,
65                            );
66                        }
67                        "GlobalSecondaryIndexes" => {
68                            builder = builder.set_global_secondary_indexes(
69                                    crate::protocol_serde::shape_replica_global_secondary_index_description_list::de_replica_global_secondary_index_description_list(tokens)?
70                                );
71                        }
72                        "ReplicaInaccessibleDateTime" => {
73                            builder = builder.set_replica_inaccessible_date_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
74                                tokens.next(),
75                                ::aws_smithy_types::date_time::Format::EpochSeconds,
76                            )?);
77                        }
78                        "ReplicaTableClassSummary" => {
79                            builder = builder
80                                .set_replica_table_class_summary(crate::protocol_serde::shape_table_class_summary::de_table_class_summary(tokens)?);
81                        }
82                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
83                    },
84                    other => {
85                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
86                            "expected object key or end object, found: {:?}",
87                            other
88                        )))
89                    }
90                }
91            }
92            Ok(Some(builder.build()))
93        }
94        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
95            "expected start object or null",
96        )),
97    }
98}