aws_sdk_apprunner/protocol_serde/
shape_source_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_source_configuration(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::SourceConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.code_repository {
7        #[allow(unused_mut)]
8        let mut object_2 = object.key("CodeRepository").start_object();
9        crate::protocol_serde::shape_code_repository::ser_code_repository(&mut object_2, var_1)?;
10        object_2.finish();
11    }
12    if let Some(var_3) = &input.image_repository {
13        #[allow(unused_mut)]
14        let mut object_4 = object.key("ImageRepository").start_object();
15        crate::protocol_serde::shape_image_repository::ser_image_repository(&mut object_4, var_3)?;
16        object_4.finish();
17    }
18    if let Some(var_5) = &input.auto_deployments_enabled {
19        object.key("AutoDeploymentsEnabled").boolean(*var_5);
20    }
21    if let Some(var_6) = &input.authentication_configuration {
22        #[allow(unused_mut)]
23        let mut object_7 = object.key("AuthenticationConfiguration").start_object();
24        crate::protocol_serde::shape_authentication_configuration::ser_authentication_configuration(&mut object_7, var_6)?;
25        object_7.finish();
26    }
27    Ok(())
28}
29
30pub(crate) fn de_source_configuration<'a, I>(
31    tokens: &mut ::std::iter::Peekable<I>,
32) -> ::std::result::Result<Option<crate::types::SourceConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
33where
34    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
35{
36    match tokens.next().transpose()? {
37        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
38        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
39            #[allow(unused_mut)]
40            let mut builder = crate::types::builders::SourceConfigurationBuilder::default();
41            loop {
42                match tokens.next().transpose()? {
43                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
44                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
45                        "CodeRepository" => {
46                            builder = builder.set_code_repository(crate::protocol_serde::shape_code_repository::de_code_repository(tokens)?);
47                        }
48                        "ImageRepository" => {
49                            builder = builder.set_image_repository(crate::protocol_serde::shape_image_repository::de_image_repository(tokens)?);
50                        }
51                        "AutoDeploymentsEnabled" => {
52                            builder =
53                                builder.set_auto_deployments_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
54                        }
55                        "AuthenticationConfiguration" => {
56                            builder = builder.set_authentication_configuration(
57                                crate::protocol_serde::shape_authentication_configuration::de_authentication_configuration(tokens)?,
58                            );
59                        }
60                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
61                    },
62                    other => {
63                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
64                            "expected object key or end object, found: {:?}",
65                            other
66                        )))
67                    }
68                }
69            }
70            Ok(Some(builder.build()))
71        }
72        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
73            "expected start object or null",
74        )),
75    }
76}