aws_sdk_workspacesweb/protocol_serde/
shape_portal.rs1pub(crate) fn de_portal<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Portal>, ::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::PortalBuilder::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 "portalArn" => {
18 builder = builder.set_portal_arn(
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 "rendererType" => {
25 builder = builder.set_renderer_type(
26 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27 .map(|s| s.to_unescaped().map(|u| crate::types::RendererType::from(u.as_ref())))
28 .transpose()?,
29 );
30 }
31 "browserType" => {
32 builder = builder.set_browser_type(
33 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34 .map(|s| s.to_unescaped().map(|u| crate::types::BrowserType::from(u.as_ref())))
35 .transpose()?,
36 );
37 }
38 "portalStatus" => {
39 builder = builder.set_portal_status(
40 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41 .map(|s| s.to_unescaped().map(|u| crate::types::PortalStatus::from(u.as_ref())))
42 .transpose()?,
43 );
44 }
45 "portalEndpoint" => {
46 builder = builder.set_portal_endpoint(
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 "displayName" => {
53 builder = builder.set_display_name(
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 "creationDate" => {
60 builder = builder.set_creation_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
61 tokens.next(),
62 ::aws_smithy_types::date_time::Format::EpochSeconds,
63 )?);
64 }
65 "browserSettingsArn" => {
66 builder = builder.set_browser_settings_arn(
67 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
68 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
69 .transpose()?,
70 );
71 }
72 "dataProtectionSettingsArn" => {
73 builder = builder.set_data_protection_settings_arn(
74 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
75 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
76 .transpose()?,
77 );
78 }
79 "userSettingsArn" => {
80 builder = builder.set_user_settings_arn(
81 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
82 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
83 .transpose()?,
84 );
85 }
86 "networkSettingsArn" => {
87 builder = builder.set_network_settings_arn(
88 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
89 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
90 .transpose()?,
91 );
92 }
93 "sessionLoggerArn" => {
94 builder = builder.set_session_logger_arn(
95 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
96 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
97 .transpose()?,
98 );
99 }
100 "trustStoreArn" => {
101 builder = builder.set_trust_store_arn(
102 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
103 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
104 .transpose()?,
105 );
106 }
107 "statusReason" => {
108 builder = builder.set_status_reason(
109 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
110 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
111 .transpose()?,
112 );
113 }
114 "userAccessLoggingSettingsArn" => {
115 builder = builder.set_user_access_logging_settings_arn(
116 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
117 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
118 .transpose()?,
119 );
120 }
121 "authenticationType" => {
122 builder = builder.set_authentication_type(
123 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
124 .map(|s| s.to_unescaped().map(|u| crate::types::AuthenticationType::from(u.as_ref())))
125 .transpose()?,
126 );
127 }
128 "ipAccessSettingsArn" => {
129 builder = builder.set_ip_access_settings_arn(
130 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
131 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
132 .transpose()?,
133 );
134 }
135 "customerManagedKey" => {
136 builder = builder.set_customer_managed_key(
137 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
138 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
139 .transpose()?,
140 );
141 }
142 "additionalEncryptionContext" => {
143 builder = builder.set_additional_encryption_context(
144 crate::protocol_serde::shape_encryption_context_map::de_encryption_context_map(tokens)?,
145 );
146 }
147 "instanceType" => {
148 builder = builder.set_instance_type(
149 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
150 .map(|s| s.to_unescaped().map(|u| crate::types::InstanceType::from(u.as_ref())))
151 .transpose()?,
152 );
153 }
154 "maxConcurrentSessions" => {
155 builder = builder.set_max_concurrent_sessions(
156 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
157 .map(i32::try_from)
158 .transpose()?,
159 );
160 }
161 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
162 },
163 other => {
164 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
165 "expected object key or end object, found: {other:?}"
166 )))
167 }
168 }
169 }
170 Ok(Some(crate::serde_util::portal_correct_errors(builder).build().map_err(|err| {
171 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
172 })?))
173 }
174 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
175 "expected start object or null",
176 )),
177 }
178}