aws_sdk_quicksight/protocol_serde/
shape_sheet_visual_scoping_configuration.rs1pub fn ser_sheet_visual_scoping_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::SheetVisualScopingConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("SheetId").string(input.sheet_id.as_str());
8 }
9 {
10 object.key("Scope").string(input.scope.as_str());
11 }
12 if let Some(var_1) = &input.visual_ids {
13 let mut array_2 = object.key("VisualIds").start_array();
14 for item_3 in var_1 {
15 {
16 array_2.value().string(item_3.as_str());
17 }
18 }
19 array_2.finish();
20 }
21 Ok(())
22}
23
24pub(crate) fn de_sheet_visual_scoping_configuration<'a, I>(
25 tokens: &mut ::std::iter::Peekable<I>,
26 _value: &'a [u8],
27) -> ::std::result::Result<Option<crate::types::SheetVisualScopingConfiguration>, ::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::SheetVisualScopingConfigurationBuilder::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 "SheetId" => {
41 builder = builder.set_sheet_id(
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 "Scope" => {
48 builder = builder.set_scope(
49 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
50 .map(|s| s.to_unescaped().map(|u| crate::types::FilterVisualScope::from(u.as_ref())))
51 .transpose()?,
52 );
53 }
54 "VisualIds" => {
55 builder = builder.set_visual_ids(crate::protocol_serde::shape_filtered_visuals_list::de_filtered_visuals_list(
56 tokens, _value,
57 )?);
58 }
59 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
60 },
61 other => {
62 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
63 "expected object key or end object, found: {other:?}"
64 )))
65 }
66 }
67 }
68 Ok(Some(
69 crate::serde_util::sheet_visual_scoping_configuration_correct_errors(builder)
70 .build()
71 .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
72 ))
73 }
74 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
75 "expected start object or null",
76 )),
77 }
78}