aws_sdk_apprunner/protocol_serde/
shape_code_configuration.rs1pub fn ser_code_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::CodeConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("ConfigurationSource").string(input.configuration_source.as_str());
8 }
9 if let Some(var_1) = &input.code_configuration_values {
10 #[allow(unused_mut)]
11 let mut object_2 = object.key("CodeConfigurationValues").start_object();
12 crate::protocol_serde::shape_code_configuration_values::ser_code_configuration_values(&mut object_2, var_1)?;
13 object_2.finish();
14 }
15 Ok(())
16}
17
18pub(crate) fn de_code_configuration<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::CodeConfiguration>, ::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::CodeConfigurationBuilder::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 "ConfigurationSource" => {
34 builder = builder.set_configuration_source(
35 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
36 .map(|s| s.to_unescaped().map(|u| crate::types::ConfigurationSource::from(u.as_ref())))
37 .transpose()?,
38 );
39 }
40 "CodeConfigurationValues" => {
41 builder = builder.set_code_configuration_values(
42 crate::protocol_serde::shape_code_configuration_values::de_code_configuration_values(tokens)?,
43 );
44 }
45 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
46 },
47 other => {
48 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
49 "expected object key or end object, found: {:?}",
50 other
51 )))
52 }
53 }
54 }
55 Ok(Some(crate::serde_util::code_configuration_correct_errors(builder).build().map_err(
56 |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
57 )?))
58 }
59 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
60 "expected start object or null",
61 )),
62 }
63}