aws_sdk_databasemigration/protocol_serde/
shape_source_data_setting.rs1pub fn ser_source_data_setting(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::SourceDataSetting,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.cdc_start_position {
7 object.key("CDCStartPosition").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.cdc_start_time {
10 object
11 .key("CDCStartTime")
12 .date_time(var_2, ::aws_smithy_types::date_time::Format::DateTime)?;
13 }
14 if let Some(var_3) = &input.cdc_stop_time {
15 object
16 .key("CDCStopTime")
17 .date_time(var_3, ::aws_smithy_types::date_time::Format::DateTime)?;
18 }
19 if let Some(var_4) = &input.slot_name {
20 object.key("SlotName").string(var_4.as_str());
21 }
22 Ok(())
23}
24
25pub(crate) fn de_source_data_setting<'a, I>(
26 tokens: &mut ::std::iter::Peekable<I>,
27) -> ::std::result::Result<Option<crate::types::SourceDataSetting>, ::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::SourceDataSettingBuilder::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 "CDCStartPosition" => {
41 builder = builder.set_cdc_start_position(
42 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
43 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
44 .transpose()?,
45 );
46 }
47 "CDCStartTime" => {
48 builder = builder.set_cdc_start_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
49 tokens.next(),
50 ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
51 )?);
52 }
53 "CDCStopTime" => {
54 builder = builder.set_cdc_stop_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
55 tokens.next(),
56 ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
57 )?);
58 }
59 "SlotName" => {
60 builder = builder.set_slot_name(
61 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
62 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
63 .transpose()?,
64 );
65 }
66 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
67 },
68 other => {
69 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
70 "expected object key or end object, found: {:?}",
71 other
72 )))
73 }
74 }
75 }
76 Ok(Some(builder.build()))
77 }
78 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
79 "expected start object or null",
80 )),
81 }
82}