aws_sdk_quicksight/protocol_serde/
shape_custom_values_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_custom_values_configuration(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::CustomValuesConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.include_null_value {
7        object.key("IncludeNullValue").boolean(*var_1);
8    }
9    if let Some(var_2) = &input.custom_values {
10        #[allow(unused_mut)]
11        let mut object_3 = object.key("CustomValues").start_object();
12        crate::protocol_serde::shape_custom_parameter_values::ser_custom_parameter_values(&mut object_3, var_2)?;
13        object_3.finish();
14    }
15    Ok(())
16}
17
18pub(crate) fn de_custom_values_configuration<'a, I>(
19    tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::CustomValuesConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
21where
22    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
23{
24    match tokens.next().transpose()? {
25        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
26        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
27            #[allow(unused_mut)]
28            let mut builder = crate::types::builders::CustomValuesConfigurationBuilder::default();
29            loop {
30                match tokens.next().transpose()? {
31                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
32                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
33                        "IncludeNullValue" => {
34                            builder = builder.set_include_null_value(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
35                        }
36                        "CustomValues" => {
37                            builder =
38                                builder.set_custom_values(crate::protocol_serde::shape_custom_parameter_values::de_custom_parameter_values(tokens)?);
39                        }
40                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
41                    },
42                    other => {
43                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
44                            "expected object key or end object, found: {other:?}"
45                        )))
46                    }
47                }
48            }
49            Ok(Some(crate::serde_util::custom_values_configuration_correct_errors(builder).build()))
50        }
51        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
52            "expected start object or null",
53        )),
54    }
55}