aws_sdk_accessanalyzer/protocol_serde/
shape_rds_db_snapshot_configuration.rs1pub fn ser_rds_db_snapshot_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::RdsDbSnapshotConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.attributes {
7 #[allow(unused_mut)]
8 let mut object_2 = object.key("attributes").start_object();
9 for (key_3, value_4) in var_1 {
10 {
11 #[allow(unused_mut)]
12 let mut object_5 = object_2.key(key_3.as_str()).start_object();
13 crate::protocol_serde::shape_rds_db_snapshot_attribute_value::ser_rds_db_snapshot_attribute_value(&mut object_5, value_4)?;
14 object_5.finish();
15 }
16 }
17 object_2.finish();
18 }
19 if let Some(var_6) = &input.kms_key_id {
20 object.key("kmsKeyId").string(var_6.as_str());
21 }
22 Ok(())
23}
24
25pub(crate) fn de_rds_db_snapshot_configuration<'a, I>(
26 tokens: &mut ::std::iter::Peekable<I>,
27) -> ::std::result::Result<Option<crate::types::RdsDbSnapshotConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
28where
29 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
30{
31 match tokens.next().transpose()? {
32 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
33 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
34 #[allow(unused_mut)]
35 let mut builder = crate::types::builders::RdsDbSnapshotConfigurationBuilder::default();
36 loop {
37 match tokens.next().transpose()? {
38 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
39 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
40 "attributes" => {
41 builder = builder.set_attributes(
42 crate::protocol_serde::shape_rds_db_snapshot_attributes_map::de_rds_db_snapshot_attributes_map(tokens)?,
43 );
44 }
45 "kmsKeyId" => {
46 builder = builder.set_kms_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 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
53 },
54 other => {
55 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
56 "expected object key or end object, found: {:?}",
57 other
58 )))
59 }
60 }
61 }
62 Ok(Some(builder.build()))
63 }
64 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
65 "expected start object or null",
66 )),
67 }
68}