aws_sdk_backup/protocol_serde/
shape_recovery_point_by_backup_vault.rs1pub(crate) fn de_recovery_point_by_backup_vault<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::RecoveryPointByBackupVault>, ::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::RecoveryPointByBackupVaultBuilder::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 "RecoveryPointArn" => {
18 builder = builder.set_recovery_point_arn(
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 "BackupVaultName" => {
25 builder = builder.set_backup_vault_name(
26 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28 .transpose()?,
29 );
30 }
31 "BackupVaultArn" => {
32 builder = builder.set_backup_vault_arn(
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 "SourceBackupVaultArn" => {
39 builder = builder.set_source_backup_vault_arn(
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 "ResourceArn" => {
46 builder = builder.set_resource_arn(
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 "ResourceType" => {
53 builder = builder.set_resource_type(
54 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
55 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
56 .transpose()?,
57 );
58 }
59 "CreatedBy" => {
60 builder = builder.set_created_by(crate::protocol_serde::shape_recovery_point_creator::de_recovery_point_creator(tokens)?);
61 }
62 "IamRoleArn" => {
63 builder = builder.set_iam_role_arn(
64 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
65 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
66 .transpose()?,
67 );
68 }
69 "Status" => {
70 builder = builder.set_status(
71 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72 .map(|s| s.to_unescaped().map(|u| crate::types::RecoveryPointStatus::from(u.as_ref())))
73 .transpose()?,
74 );
75 }
76 "StatusMessage" => {
77 builder = builder.set_status_message(
78 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
79 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
80 .transpose()?,
81 );
82 }
83 "CreationDate" => {
84 builder = builder.set_creation_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
85 tokens.next(),
86 ::aws_smithy_types::date_time::Format::EpochSeconds,
87 )?);
88 }
89 "InitiationDate" => {
90 builder = builder.set_initiation_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
91 tokens.next(),
92 ::aws_smithy_types::date_time::Format::EpochSeconds,
93 )?);
94 }
95 "CompletionDate" => {
96 builder = builder.set_completion_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
97 tokens.next(),
98 ::aws_smithy_types::date_time::Format::EpochSeconds,
99 )?);
100 }
101 "BackupSizeInBytes" => {
102 builder = builder.set_backup_size_in_bytes(
103 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
104 .map(i64::try_from)
105 .transpose()?,
106 );
107 }
108 "CalculatedLifecycle" => {
109 builder =
110 builder.set_calculated_lifecycle(crate::protocol_serde::shape_calculated_lifecycle::de_calculated_lifecycle(tokens)?);
111 }
112 "Lifecycle" => {
113 builder = builder.set_lifecycle(crate::protocol_serde::shape_lifecycle::de_lifecycle(tokens)?);
114 }
115 "EncryptionKeyArn" => {
116 builder = builder.set_encryption_key_arn(
117 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
118 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
119 .transpose()?,
120 );
121 }
122 "IsEncrypted" => {
123 builder = builder.set_is_encrypted(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
124 }
125 "LastRestoreTime" => {
126 builder = builder.set_last_restore_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
127 tokens.next(),
128 ::aws_smithy_types::date_time::Format::EpochSeconds,
129 )?);
130 }
131 "ParentRecoveryPointArn" => {
132 builder = builder.set_parent_recovery_point_arn(
133 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
134 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
135 .transpose()?,
136 );
137 }
138 "CompositeMemberIdentifier" => {
139 builder = builder.set_composite_member_identifier(
140 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
141 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
142 .transpose()?,
143 );
144 }
145 "IsParent" => {
146 builder = builder.set_is_parent(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
147 }
148 "ResourceName" => {
149 builder = builder.set_resource_name(
150 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
151 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
152 .transpose()?,
153 );
154 }
155 "VaultType" => {
156 builder = builder.set_vault_type(
157 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
158 .map(|s| s.to_unescaped().map(|u| crate::types::VaultType::from(u.as_ref())))
159 .transpose()?,
160 );
161 }
162 "IndexStatus" => {
163 builder = builder.set_index_status(
164 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
165 .map(|s| s.to_unescaped().map(|u| crate::types::IndexStatus::from(u.as_ref())))
166 .transpose()?,
167 );
168 }
169 "IndexStatusMessage" => {
170 builder = builder.set_index_status_message(
171 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
172 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
173 .transpose()?,
174 );
175 }
176 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
177 },
178 other => {
179 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
180 "expected object key or end object, found: {:?}",
181 other
182 )))
183 }
184 }
185 }
186 Ok(Some(builder.build()))
187 }
188 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
189 "expected start object or null",
190 )),
191 }
192}