aws_sdk_timestreamquery/protocol_serde/
shape_target_configuration.rs1pub fn ser_target_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::TargetConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.timestream_configuration {
7 #[allow(unused_mut)]
8 let mut object_2 = object.key("TimestreamConfiguration").start_object();
9 crate::protocol_serde::shape_timestream_configuration::ser_timestream_configuration(&mut object_2, var_1)?;
10 object_2.finish();
11 }
12 Ok(())
13}
14
15pub(crate) fn de_target_configuration<'a, I>(
16 tokens: &mut ::std::iter::Peekable<I>,
17) -> ::std::result::Result<Option<crate::types::TargetConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
18where
19 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
20{
21 match tokens.next().transpose()? {
22 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
23 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
24 #[allow(unused_mut)]
25 let mut builder = crate::types::builders::TargetConfigurationBuilder::default();
26 loop {
27 match tokens.next().transpose()? {
28 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
29 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
30 "TimestreamConfiguration" => {
31 builder = builder.set_timestream_configuration(
32 crate::protocol_serde::shape_timestream_configuration::de_timestream_configuration(tokens)?,
33 );
34 }
35 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
36 },
37 other => {
38 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
39 "expected object key or end object, found: {other:?}"
40 )))
41 }
42 }
43 }
44 Ok(Some(crate::serde_util::target_configuration_correct_errors(builder).build()))
45 }
46 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
47 "expected start object or null",
48 )),
49 }
50}