aws_sdk_cleanrooms/protocol_serde/
shape_analysis_template.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_analysis_template<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::AnalysisTemplate>, ::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::AnalysisTemplateBuilder::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                        "collaborationId" => {
32                            builder = builder.set_collaboration_id(
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                        "collaborationArn" => {
39                            builder = builder.set_collaboration_arn(
40                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
42                                    .transpose()?,
43                            );
44                        }
45                        "membershipId" => {
46                            builder = builder.set_membership_id(
47                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
48                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
49                                    .transpose()?,
50                            );
51                        }
52                        "membershipArn" => {
53                            builder = builder.set_membership_arn(
54                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
55                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
56                                    .transpose()?,
57                            );
58                        }
59                        "description" => {
60                            builder = builder.set_description(
61                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
62                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
63                                    .transpose()?,
64                            );
65                        }
66                        "name" => {
67                            builder = builder.set_name(
68                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
69                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
70                                    .transpose()?,
71                            );
72                        }
73                        "createTime" => {
74                            builder = builder.set_create_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
75                                tokens.next(),
76                                ::aws_smithy_types::date_time::Format::EpochSeconds,
77                            )?);
78                        }
79                        "updateTime" => {
80                            builder = builder.set_update_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
81                                tokens.next(),
82                                ::aws_smithy_types::date_time::Format::EpochSeconds,
83                            )?);
84                        }
85                        "schema" => {
86                            builder = builder.set_schema(crate::protocol_serde::shape_analysis_schema::de_analysis_schema(tokens)?);
87                        }
88                        "format" => {
89                            builder = builder.set_format(
90                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
91                                    .map(|s| s.to_unescaped().map(|u| crate::types::AnalysisFormat::from(u.as_ref())))
92                                    .transpose()?,
93                            );
94                        }
95                        "source" => {
96                            builder = builder.set_source(crate::protocol_serde::shape_analysis_source::de_analysis_source(tokens)?);
97                        }
98                        "sourceMetadata" => {
99                            builder = builder.set_source_metadata(
100                                crate::protocol_serde::shape_analysis_source_metadata::de_analysis_source_metadata(tokens)?,
101                            );
102                        }
103                        "analysisParameters" => {
104                            builder = builder
105                                .set_analysis_parameters(crate::protocol_serde::shape_analysis_parameter_list::de_analysis_parameter_list(tokens)?);
106                        }
107                        "validations" => {
108                            builder = builder.set_validations(
109                                    crate::protocol_serde::shape_analysis_template_validation_status_detail_list::de_analysis_template_validation_status_detail_list(tokens)?
110                                );
111                        }
112                        "errorMessageConfiguration" => {
113                            builder = builder.set_error_message_configuration(
114                                crate::protocol_serde::shape_error_message_configuration::de_error_message_configuration(tokens)?,
115                            );
116                        }
117                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
118                    },
119                    other => {
120                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
121                            "expected object key or end object, found: {other:?}"
122                        )))
123                    }
124                }
125            }
126            Ok(Some(crate::serde_util::analysis_template_correct_errors(builder).build().map_err(
127                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
128            )?))
129        }
130        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
131            "expected start object or null",
132        )),
133    }
134}