aws_sdk_proton/protocol_serde/
shape_deployment_summary.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_deployment_summary<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::DeploymentSummary>, ::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::DeploymentSummaryBuilder::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                        "id" => {
18                            builder = builder.set_id(
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                        "arn" => {
25                            builder = builder.set_arn(
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                        "targetArn" => {
32                            builder = builder.set_target_arn(
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                        "targetResourceCreatedAt" => {
39                            builder = builder.set_target_resource_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
40                                tokens.next(),
41                                ::aws_smithy_types::date_time::Format::EpochSeconds,
42                            )?);
43                        }
44                        "targetResourceType" => {
45                            builder = builder.set_target_resource_type(
46                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
47                                    .map(|s| s.to_unescaped().map(|u| crate::types::DeploymentTargetResourceType::from(u.as_ref())))
48                                    .transpose()?,
49                            );
50                        }
51                        "createdAt" => {
52                            builder = builder.set_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
53                                tokens.next(),
54                                ::aws_smithy_types::date_time::Format::EpochSeconds,
55                            )?);
56                        }
57                        "lastModifiedAt" => {
58                            builder = builder.set_last_modified_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
59                                tokens.next(),
60                                ::aws_smithy_types::date_time::Format::EpochSeconds,
61                            )?);
62                        }
63                        "completedAt" => {
64                            builder = builder.set_completed_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
65                                tokens.next(),
66                                ::aws_smithy_types::date_time::Format::EpochSeconds,
67                            )?);
68                        }
69                        "environmentName" => {
70                            builder = builder.set_environment_name(
71                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
73                                    .transpose()?,
74                            );
75                        }
76                        "serviceName" => {
77                            builder = builder.set_service_name(
78                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
79                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
80                                    .transpose()?,
81                            );
82                        }
83                        "serviceInstanceName" => {
84                            builder = builder.set_service_instance_name(
85                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
86                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
87                                    .transpose()?,
88                            );
89                        }
90                        "componentName" => {
91                            builder = builder.set_component_name(
92                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
93                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
94                                    .transpose()?,
95                            );
96                        }
97                        "lastAttemptedDeploymentId" => {
98                            builder = builder.set_last_attempted_deployment_id(
99                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
100                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
101                                    .transpose()?,
102                            );
103                        }
104                        "lastSucceededDeploymentId" => {
105                            builder = builder.set_last_succeeded_deployment_id(
106                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
107                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
108                                    .transpose()?,
109                            );
110                        }
111                        "deploymentStatus" => {
112                            builder = builder.set_deployment_status(
113                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
114                                    .map(|s| s.to_unescaped().map(|u| crate::types::DeploymentStatus::from(u.as_ref())))
115                                    .transpose()?,
116                            );
117                        }
118                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
119                    },
120                    other => {
121                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
122                            "expected object key or end object, found: {:?}",
123                            other
124                        )))
125                    }
126                }
127            }
128            Ok(Some(crate::serde_util::deployment_summary_correct_errors(builder).build().map_err(
129                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
130            )?))
131        }
132        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
133            "expected start object or null",
134        )),
135    }
136}