aws_sdk_grafana/protocol_serde/
shape_workspace_summary.rs1pub(crate) fn de_workspace_summary<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::WorkspaceSummary>, ::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::WorkspaceSummaryBuilder::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 "created" => {
18 builder = builder.set_created(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
19 tokens.next(),
20 ::aws_smithy_types::date_time::Format::EpochSeconds,
21 )?);
22 }
23 "description" => {
24 builder = builder.set_description(
25 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
26 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
27 .transpose()?,
28 );
29 }
30 "endpoint" => {
31 builder = builder.set_endpoint(
32 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
33 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
34 .transpose()?,
35 );
36 }
37 "grafanaVersion" => {
38 builder = builder.set_grafana_version(
39 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
40 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
41 .transpose()?,
42 );
43 }
44 "id" => {
45 builder = builder.set_id(
46 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
47 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
48 .transpose()?,
49 );
50 }
51 "modified" => {
52 builder = builder.set_modified(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
53 tokens.next(),
54 ::aws_smithy_types::date_time::Format::EpochSeconds,
55 )?);
56 }
57 "name" => {
58 builder = builder.set_name(
59 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
60 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
61 .transpose()?,
62 );
63 }
64 "notificationDestinations" => {
65 builder = builder.set_notification_destinations(
66 crate::protocol_serde::shape_notification_destinations_list::de_notification_destinations_list(tokens)?,
67 );
68 }
69 "status" => {
70 builder = builder.set_status(
71 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72 .map(|s| s.to_unescaped().map(|u| crate::types::WorkspaceStatus::from(u.as_ref())))
73 .transpose()?,
74 );
75 }
76 "authentication" => {
77 builder =
78 builder.set_authentication(crate::protocol_serde::shape_authentication_summary::de_authentication_summary(tokens)?);
79 }
80 "tags" => {
81 builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
82 }
83 "licenseType" => {
84 builder = builder.set_license_type(
85 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
86 .map(|s| s.to_unescaped().map(|u| crate::types::LicenseType::from(u.as_ref())))
87 .transpose()?,
88 );
89 }
90 "grafanaToken" => {
91 builder = builder.set_grafana_token(
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 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
98 },
99 other => {
100 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
101 "expected object key or end object, found: {:?}",
102 other
103 )))
104 }
105 }
106 }
107 Ok(Some(crate::serde_util::workspace_summary_correct_errors(builder).build().map_err(
108 |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
109 )?))
110 }
111 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
112 "expected start object or null",
113 )),
114 }
115}