aws_sdk_proton/protocol_serde/
shape_environment_summary.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_environment_summary<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::EnvironmentSummary>, ::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::EnvironmentSummaryBuilder::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                        "name" => {
18                            builder = builder.set_name(
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                        "description" => {
25                            builder = builder.set_description(
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                        "createdAt" => {
32                            builder = builder.set_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
33                                tokens.next(),
34                                ::aws_smithy_types::date_time::Format::EpochSeconds,
35                            )?);
36                        }
37                        "lastDeploymentAttemptedAt" => {
38                            builder = builder.set_last_deployment_attempted_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
39                                tokens.next(),
40                                ::aws_smithy_types::date_time::Format::EpochSeconds,
41                            )?);
42                        }
43                        "lastDeploymentSucceededAt" => {
44                            builder = builder.set_last_deployment_succeeded_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
45                                tokens.next(),
46                                ::aws_smithy_types::date_time::Format::EpochSeconds,
47                            )?);
48                        }
49                        "arn" => {
50                            builder = builder.set_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                        "templateName" => {
57                            builder = builder.set_template_name(
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                        "templateMajorVersion" => {
64                            builder = builder.set_template_major_version(
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                        "templateMinorVersion" => {
71                            builder = builder.set_template_minor_version(
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                        "deploymentStatus" => {
78                            builder = builder.set_deployment_status(
79                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
80                                    .map(|s| s.to_unescaped().map(|u| crate::types::DeploymentStatus::from(u.as_ref())))
81                                    .transpose()?,
82                            );
83                        }
84                        "deploymentStatusMessage" => {
85                            builder = builder.set_deployment_status_message(
86                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
87                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
88                                    .transpose()?,
89                            );
90                        }
91                        "protonServiceRoleArn" => {
92                            builder = builder.set_proton_service_role_arn(
93                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
94                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
95                                    .transpose()?,
96                            );
97                        }
98                        "environmentAccountConnectionId" => {
99                            builder = builder.set_environment_account_connection_id(
100                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
101                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
102                                    .transpose()?,
103                            );
104                        }
105                        "environmentAccountId" => {
106                            builder = builder.set_environment_account_id(
107                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
108                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
109                                    .transpose()?,
110                            );
111                        }
112                        "provisioning" => {
113                            builder = builder.set_provisioning(
114                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
115                                    .map(|s| s.to_unescaped().map(|u| crate::types::Provisioning::from(u.as_ref())))
116                                    .transpose()?,
117                            );
118                        }
119                        "componentRoleArn" => {
120                            builder = builder.set_component_role_arn(
121                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
122                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
123                                    .transpose()?,
124                            );
125                        }
126                        "lastAttemptedDeploymentId" => {
127                            builder = builder.set_last_attempted_deployment_id(
128                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
129                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
130                                    .transpose()?,
131                            );
132                        }
133                        "lastSucceededDeploymentId" => {
134                            builder = builder.set_last_succeeded_deployment_id(
135                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
136                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
137                                    .transpose()?,
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(crate::serde_util::environment_summary_correct_errors(builder).build().map_err(
151                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
152            )?))
153        }
154        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
155            "expected start object or null",
156        )),
157    }
158}