aws_sdk_imagebuilder/protocol_serde/
shape_image_pipeline.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_image_pipeline<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ImagePipeline>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8    match tokens.next().transpose()? {
9        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11            #[allow(unused_mut)]
12            let mut builder = crate::types::builders::ImagePipelineBuilder::default();
13            loop {
14                match tokens.next().transpose()? {
15                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17                        "arn" => {
18                            builder = builder.set_arn(
19                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21                                    .transpose()?,
22                            );
23                        }
24                        "name" => {
25                            builder = builder.set_name(
26                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28                                    .transpose()?,
29                            );
30                        }
31                        "description" => {
32                            builder = builder.set_description(
33                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
35                                    .transpose()?,
36                            );
37                        }
38                        "platform" => {
39                            builder = builder.set_platform(
40                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41                                    .map(|s| s.to_unescaped().map(|u| crate::types::Platform::from(u.as_ref())))
42                                    .transpose()?,
43                            );
44                        }
45                        "enhancedImageMetadataEnabled" => {
46                            builder = builder
47                                .set_enhanced_image_metadata_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
48                        }
49                        "imageRecipeArn" => {
50                            builder = builder.set_image_recipe_arn(
51                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
52                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
53                                    .transpose()?,
54                            );
55                        }
56                        "containerRecipeArn" => {
57                            builder = builder.set_container_recipe_arn(
58                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
59                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
60                                    .transpose()?,
61                            );
62                        }
63                        "infrastructureConfigurationArn" => {
64                            builder = builder.set_infrastructure_configuration_arn(
65                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
66                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
67                                    .transpose()?,
68                            );
69                        }
70                        "distributionConfigurationArn" => {
71                            builder = builder.set_distribution_configuration_arn(
72                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
73                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
74                                    .transpose()?,
75                            );
76                        }
77                        "imageTestsConfiguration" => {
78                            builder = builder.set_image_tests_configuration(
79                                crate::protocol_serde::shape_image_tests_configuration::de_image_tests_configuration(tokens)?,
80                            );
81                        }
82                        "schedule" => {
83                            builder = builder.set_schedule(crate::protocol_serde::shape_schedule::de_schedule(tokens)?);
84                        }
85                        "status" => {
86                            builder = builder.set_status(
87                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
88                                    .map(|s| s.to_unescaped().map(|u| crate::types::PipelineStatus::from(u.as_ref())))
89                                    .transpose()?,
90                            );
91                        }
92                        "dateCreated" => {
93                            builder = builder.set_date_created(
94                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
95                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
96                                    .transpose()?,
97                            );
98                        }
99                        "dateUpdated" => {
100                            builder = builder.set_date_updated(
101                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
102                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
103                                    .transpose()?,
104                            );
105                        }
106                        "dateLastRun" => {
107                            builder = builder.set_date_last_run(
108                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
109                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
110                                    .transpose()?,
111                            );
112                        }
113                        "dateNextRun" => {
114                            builder = builder.set_date_next_run(
115                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
116                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
117                                    .transpose()?,
118                            );
119                        }
120                        "tags" => {
121                            builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
122                        }
123                        "imageScanningConfiguration" => {
124                            builder = builder.set_image_scanning_configuration(
125                                crate::protocol_serde::shape_image_scanning_configuration::de_image_scanning_configuration(tokens)?,
126                            );
127                        }
128                        "executionRole" => {
129                            builder = builder.set_execution_role(
130                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
131                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
132                                    .transpose()?,
133                            );
134                        }
135                        "workflows" => {
136                            builder = builder.set_workflows(
137                                crate::protocol_serde::shape_workflow_configuration_list::de_workflow_configuration_list(tokens)?,
138                            );
139                        }
140                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
141                    },
142                    other => {
143                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
144                            "expected object key or end object, found: {:?}",
145                            other
146                        )))
147                    }
148                }
149            }
150            Ok(Some(builder.build()))
151        }
152        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
153            "expected start object or null",
154        )),
155    }
156}