aws_sdk_grafana/protocol_serde/
shape_workspace_description.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_workspace_description<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::WorkspaceDescription>, ::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::WorkspaceDescriptionBuilder::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                        "accountAccessType" => {
18                            builder = builder.set_account_access_type(
19                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                                    .map(|s| s.to_unescaped().map(|u| crate::types::AccountAccessType::from(u.as_ref())))
21                                    .transpose()?,
22                            );
23                        }
24                        "created" => {
25                            builder = builder.set_created(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
26                                tokens.next(),
27                                ::aws_smithy_types::date_time::Format::EpochSeconds,
28                            )?);
29                        }
30                        "dataSources" => {
31                            builder =
32                                builder.set_data_sources(crate::protocol_serde::shape_data_source_types_list::de_data_source_types_list(tokens)?);
33                        }
34                        "description" => {
35                            builder = builder.set_description(
36                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38                                    .transpose()?,
39                            );
40                        }
41                        "endpoint" => {
42                            builder = builder.set_endpoint(
43                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
44                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
45                                    .transpose()?,
46                            );
47                        }
48                        "grafanaVersion" => {
49                            builder = builder.set_grafana_version(
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                        "id" => {
56                            builder = builder.set_id(
57                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
58                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
59                                    .transpose()?,
60                            );
61                        }
62                        "modified" => {
63                            builder = builder.set_modified(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
64                                tokens.next(),
65                                ::aws_smithy_types::date_time::Format::EpochSeconds,
66                            )?);
67                        }
68                        "name" => {
69                            builder = builder.set_name(
70                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
71                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
72                                    .transpose()?,
73                            );
74                        }
75                        "organizationRoleName" => {
76                            builder = builder.set_organization_role_name(
77                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
78                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
79                                    .transpose()?,
80                            );
81                        }
82                        "notificationDestinations" => {
83                            builder = builder.set_notification_destinations(
84                                crate::protocol_serde::shape_notification_destinations_list::de_notification_destinations_list(tokens)?,
85                            );
86                        }
87                        "organizationalUnits" => {
88                            builder = builder.set_organizational_units(
89                                crate::protocol_serde::shape_organizational_unit_list::de_organizational_unit_list(tokens)?,
90                            );
91                        }
92                        "permissionType" => {
93                            builder = builder.set_permission_type(
94                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
95                                    .map(|s| s.to_unescaped().map(|u| crate::types::PermissionType::from(u.as_ref())))
96                                    .transpose()?,
97                            );
98                        }
99                        "stackSetName" => {
100                            builder = builder.set_stack_set_name(
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                        "status" => {
107                            builder = builder.set_status(
108                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
109                                    .map(|s| s.to_unescaped().map(|u| crate::types::WorkspaceStatus::from(u.as_ref())))
110                                    .transpose()?,
111                            );
112                        }
113                        "workspaceRoleArn" => {
114                            builder = builder.set_workspace_role_arn(
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                        "licenseType" => {
121                            builder = builder.set_license_type(
122                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
123                                    .map(|s| s.to_unescaped().map(|u| crate::types::LicenseType::from(u.as_ref())))
124                                    .transpose()?,
125                            );
126                        }
127                        "freeTrialConsumed" => {
128                            builder = builder.set_free_trial_consumed(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
129                        }
130                        "licenseExpiration" => {
131                            builder = builder.set_license_expiration(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
132                                tokens.next(),
133                                ::aws_smithy_types::date_time::Format::EpochSeconds,
134                            )?);
135                        }
136                        "freeTrialExpiration" => {
137                            builder = builder.set_free_trial_expiration(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
138                                tokens.next(),
139                                ::aws_smithy_types::date_time::Format::EpochSeconds,
140                            )?);
141                        }
142                        "authentication" => {
143                            builder =
144                                builder.set_authentication(crate::protocol_serde::shape_authentication_summary::de_authentication_summary(tokens)?);
145                        }
146                        "tags" => {
147                            builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
148                        }
149                        "vpcConfiguration" => {
150                            builder = builder.set_vpc_configuration(crate::protocol_serde::shape_vpc_configuration::de_vpc_configuration(tokens)?);
151                        }
152                        "networkAccessControl" => {
153                            builder = builder.set_network_access_control(
154                                crate::protocol_serde::shape_network_access_configuration::de_network_access_configuration(tokens)?,
155                            );
156                        }
157                        "grafanaToken" => {
158                            builder = builder.set_grafana_token(
159                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
160                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
161                                    .transpose()?,
162                            );
163                        }
164                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
165                    },
166                    other => {
167                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
168                            "expected object key or end object, found: {:?}",
169                            other
170                        )))
171                    }
172                }
173            }
174            Ok(Some(crate::serde_util::workspace_description_correct_errors(builder).build().map_err(
175                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
176            )?))
177        }
178        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
179            "expected start object or null",
180        )),
181    }
182}