aws_sdk_appsync/protocol_serde/
shape_graphql_api.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_graphql_api<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::GraphqlApi>, ::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::GraphqlApiBuilder::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                        "apiId" => {
25                            builder = builder.set_api_id(
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                        "authenticationType" => {
32                            builder = builder.set_authentication_type(
33                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34                                    .map(|s| s.to_unescaped().map(|u| crate::types::AuthenticationType::from(u.as_ref())))
35                                    .transpose()?,
36                            );
37                        }
38                        "logConfig" => {
39                            builder = builder.set_log_config(crate::protocol_serde::shape_log_config::de_log_config(tokens)?);
40                        }
41                        "userPoolConfig" => {
42                            builder = builder.set_user_pool_config(crate::protocol_serde::shape_user_pool_config::de_user_pool_config(tokens)?);
43                        }
44                        "openIDConnectConfig" => {
45                            builder = builder
46                                .set_open_id_connect_config(crate::protocol_serde::shape_open_id_connect_config::de_open_id_connect_config(tokens)?);
47                        }
48                        "arn" => {
49                            builder = builder.set_arn(
50                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
51                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
52                                    .transpose()?,
53                            );
54                        }
55                        "uris" => {
56                            builder = builder.set_uris(crate::protocol_serde::shape_map_of_string_to_string::de_map_of_string_to_string(tokens)?);
57                        }
58                        "tags" => {
59                            builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
60                        }
61                        "additionalAuthenticationProviders" => {
62                            builder = builder.set_additional_authentication_providers(
63                                crate::protocol_serde::shape_additional_authentication_providers::de_additional_authentication_providers(tokens)?,
64                            );
65                        }
66                        "xrayEnabled" => {
67                            builder = builder.set_xray_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
68                        }
69                        "wafWebAclArn" => {
70                            builder = builder.set_waf_web_acl_arn(
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                        "lambdaAuthorizerConfig" => {
77                            builder = builder.set_lambda_authorizer_config(
78                                crate::protocol_serde::shape_lambda_authorizer_config::de_lambda_authorizer_config(tokens)?,
79                            );
80                        }
81                        "dns" => {
82                            builder = builder.set_dns(crate::protocol_serde::shape_map_of_string_to_string::de_map_of_string_to_string(tokens)?);
83                        }
84                        "visibility" => {
85                            builder = builder.set_visibility(
86                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
87                                    .map(|s| s.to_unescaped().map(|u| crate::types::GraphQlApiVisibility::from(u.as_ref())))
88                                    .transpose()?,
89                            );
90                        }
91                        "apiType" => {
92                            builder = builder.set_api_type(
93                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
94                                    .map(|s| s.to_unescaped().map(|u| crate::types::GraphQlApiType::from(u.as_ref())))
95                                    .transpose()?,
96                            );
97                        }
98                        "mergedApiExecutionRoleArn" => {
99                            builder = builder.set_merged_api_execution_role_arn(
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                        "owner" => {
106                            builder = builder.set_owner(
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                        "ownerContact" => {
113                            builder = builder.set_owner_contact(
114                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
115                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
116                                    .transpose()?,
117                            );
118                        }
119                        "introspectionConfig" => {
120                            builder = builder.set_introspection_config(
121                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
122                                    .map(|s| s.to_unescaped().map(|u| crate::types::GraphQlApiIntrospectionConfig::from(u.as_ref())))
123                                    .transpose()?,
124                            );
125                        }
126                        "queryDepthLimit" => {
127                            builder = builder.set_query_depth_limit(
128                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
129                                    .map(i32::try_from)
130                                    .transpose()?,
131                            );
132                        }
133                        "resolverCountLimit" => {
134                            builder = builder.set_resolver_count_limit(
135                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
136                                    .map(i32::try_from)
137                                    .transpose()?,
138                            );
139                        }
140                        "enhancedMetricsConfig" => {
141                            builder = builder.set_enhanced_metrics_config(
142                                crate::protocol_serde::shape_enhanced_metrics_config::de_enhanced_metrics_config(tokens)?,
143                            );
144                        }
145                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
146                    },
147                    other => {
148                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
149                            "expected object key or end object, found: {:?}",
150                            other
151                        )))
152                    }
153                }
154            }
155            Ok(Some(builder.build()))
156        }
157        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
158            "expected start object or null",
159        )),
160    }
161}