aws_sdk_iottwinmaker/protocol_serde/
shape_iot_twin_maker_source_configuration.rs1pub fn ser_iot_twin_maker_source_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::IotTwinMakerSourceConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("workspace").string(input.workspace.as_str());
8 }
9 if let Some(var_1) = &input.filters {
10 let mut array_2 = object.key("filters").start_array();
11 for item_3 in var_1 {
12 {
13 #[allow(unused_mut)]
14 let mut object_4 = array_2.value().start_object();
15 crate::protocol_serde::shape_iot_twin_maker_source_configuration_filter::ser_iot_twin_maker_source_configuration_filter(
16 &mut object_4,
17 item_3,
18 )?;
19 object_4.finish();
20 }
21 }
22 array_2.finish();
23 }
24 Ok(())
25}
26
27pub(crate) fn de_iot_twin_maker_source_configuration<'a, I>(
28 tokens: &mut ::std::iter::Peekable<I>,
29) -> ::std::result::Result<Option<crate::types::IotTwinMakerSourceConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
30where
31 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
32{
33 match tokens.next().transpose()? {
34 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
35 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
36 #[allow(unused_mut)]
37 let mut builder = crate::types::builders::IotTwinMakerSourceConfigurationBuilder::default();
38 loop {
39 match tokens.next().transpose()? {
40 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
41 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
42 "workspace" => {
43 builder = builder.set_workspace(
44 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
45 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
46 .transpose()?,
47 );
48 }
49 "filters" => {
50 builder = builder.set_filters(
51 crate::protocol_serde::shape_iot_twin_maker_source_configuration_filters::de_iot_twin_maker_source_configuration_filters(tokens)?
52 );
53 }
54 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
55 },
56 other => {
57 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
58 "expected object key or end object, found: {other:?}"
59 )))
60 }
61 }
62 }
63 Ok(Some(
64 crate::serde_util::iot_twin_maker_source_configuration_correct_errors(builder)
65 .build()
66 .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
67 ))
68 }
69 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
70 "expected start object or null",
71 )),
72 }
73}