1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | pub fn ser_parse_key_value(
|
3 - | object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
|
4 - | input: &crate::types::ParseKeyValue,
|
5 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
|
6 - | if let Some(var_1) = &input.source {
|
7 - | object.key("source").string(var_1.as_str());
|
8 - | }
|
9 - | if let Some(var_2) = &input.destination {
|
10 - | object.key("destination").string(var_2.as_str());
|
11 - | }
|
12 - | if let Some(var_3) = &input.field_delimiter {
|
13 - | object.key("fieldDelimiter").string(var_3.as_str());
|
14 - | }
|
15 - | if let Some(var_4) = &input.key_value_delimiter {
|
16 - | object.key("keyValueDelimiter").string(var_4.as_str());
|
17 - | }
|
18 - | if let Some(var_5) = &input.key_prefix {
|
19 - | object.key("keyPrefix").string(var_5.as_str());
|
20 - | }
|
21 - | if let Some(var_6) = &input.non_match_value {
|
22 - | object.key("nonMatchValue").string(var_6.as_str());
|
23 - | }
|
24 - | if input.overwrite_if_exists {
|
25 - | object.key("overwriteIfExists").boolean(input.overwrite_if_exists);
|
26 - | }
|
27 - | Ok(())
|
28 - | }
|
29 - |
|
30 - | pub(crate) fn de_parse_key_value<'a, I>(
|
31 - | tokens: &mut ::std::iter::Peekable<I>,
|
32 - | _value: &'a [u8],
|
33 - | ) -> ::std::result::Result<Option<crate::types::ParseKeyValue>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
34 - | where
|
35 - | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
36 - | {
|
37 - | match tokens.next().transpose()? {
|
38 - | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
39 - | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
40 - | #[allow(unused_mut)]
|
41 - | let mut builder = crate::types::builders::ParseKeyValueBuilder::default();
|
42 - | loop {
|
43 - | match tokens.next().transpose()? {
|
44 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
45 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
46 - | "source" => {
|
47 - | builder = builder.set_source(
|
48 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
49 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
50 - | .transpose()?,
|
51 - | );
|
52 - | }
|
53 - | "destination" => {
|
54 - | builder = builder.set_destination(
|
55 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
56 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
57 - | .transpose()?,
|
58 - | );
|
59 - | }
|
60 - | "fieldDelimiter" => {
|
61 - | builder = builder.set_field_delimiter(
|
62 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
63 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
64 - | .transpose()?,
|
65 - | );
|
66 - | }
|
67 - | "keyValueDelimiter" => {
|
68 - | builder = builder.set_key_value_delimiter(
|
69 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
70 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
71 - | .transpose()?,
|
72 - | );
|
73 - | }
|
74 - | "keyPrefix" => {
|
75 - | builder = builder.set_key_prefix(
|
76 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
77 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
78 - | .transpose()?,
|
79 - | );
|
80 - | }
|
81 - | "nonMatchValue" => {
|
82 - | builder = builder.set_non_match_value(
|
83 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
84 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
85 - | .transpose()?,
|
86 - | );
|
87 - | }
|
88 - | "overwriteIfExists" => {
|
89 - | builder = builder.set_overwrite_if_exists(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
90 - | }
|
91 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
92 - | },
|
93 - | other => {
|
94 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
95 - | "expected object key or end object, found: {other:?}"
|
96 - | )))
|
97 - | }
|
98 - | }
|
99 - | }
|
100 - | Ok(Some(builder.build()))
|
101 - | }
|
102 - | _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
103 - | "expected start object or null",
|
104 - | )),
|
105 - | }
|
106 - | }
|