aws_sdk_glue/protocol_serde/
shape_drop_fields.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_drop_fields(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::DropFields,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    {
7        object.key("Name").string(input.name.as_str());
8    }
9    {
10        let mut array_1 = object.key("Inputs").start_array();
11        for item_2 in &input.inputs {
12            {
13                array_1.value().string(item_2.as_str());
14            }
15        }
16        array_1.finish();
17    }
18    {
19        let mut array_3 = object.key("Paths").start_array();
20        for item_4 in &input.paths {
21            {
22                let mut array_5 = array_3.value().start_array();
23                for item_6 in item_4 {
24                    {
25                        array_5.value().string(item_6.as_str());
26                    }
27                }
28                array_5.finish();
29            }
30        }
31        array_3.finish();
32    }
33    Ok(())
34}
35
36pub(crate) fn de_drop_fields<'a, I>(
37    tokens: &mut ::std::iter::Peekable<I>,
38) -> ::std::result::Result<Option<crate::types::DropFields>, ::aws_smithy_json::deserialize::error::DeserializeError>
39where
40    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
41{
42    match tokens.next().transpose()? {
43        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
44        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
45            #[allow(unused_mut)]
46            let mut builder = crate::types::builders::DropFieldsBuilder::default();
47            loop {
48                match tokens.next().transpose()? {
49                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
50                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
51                        "Name" => {
52                            builder = builder.set_name(
53                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
54                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
55                                    .transpose()?,
56                            );
57                        }
58                        "Inputs" => {
59                            builder = builder.set_inputs(crate::protocol_serde::shape_one_input::de_one_input(tokens)?);
60                        }
61                        "Paths" => {
62                            builder = builder.set_paths(crate::protocol_serde::shape_glue_studio_path_list::de_glue_studio_path_list(tokens)?);
63                        }
64                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
65                    },
66                    other => {
67                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
68                            "expected object key or end object, found: {:?}",
69                            other
70                        )))
71                    }
72                }
73            }
74            Ok(Some(crate::serde_util::drop_fields_correct_errors(builder).build().map_err(|err| {
75                ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
76            })?))
77        }
78        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
79            "expected start object or null",
80        )),
81    }
82}