aws_sdk_appstream/protocol_serde/
shape_image.rs1pub(crate) fn de_image<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Image>, ::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::ImageBuilder::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 "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 "BaseImageArn" => {
32 builder = builder.set_base_image_arn(
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 "DisplayName" => {
39 builder = builder.set_display_name(
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 "State" => {
46 builder = builder.set_state(
47 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
48 .map(|s| s.to_unescaped().map(|u| crate::types::ImageState::from(u.as_ref())))
49 .transpose()?,
50 );
51 }
52 "Visibility" => {
53 builder = builder.set_visibility(
54 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
55 .map(|s| s.to_unescaped().map(|u| crate::types::VisibilityType::from(u.as_ref())))
56 .transpose()?,
57 );
58 }
59 "ImageBuilderSupported" => {
60 builder = builder.set_image_builder_supported(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
61 }
62 "ImageBuilderName" => {
63 builder = builder.set_image_builder_name(
64 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
65 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
66 .transpose()?,
67 );
68 }
69 "Platform" => {
70 builder = builder.set_platform(
71 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72 .map(|s| s.to_unescaped().map(|u| crate::types::PlatformType::from(u.as_ref())))
73 .transpose()?,
74 );
75 }
76 "Description" => {
77 builder = builder.set_description(
78 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
79 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
80 .transpose()?,
81 );
82 }
83 "StateChangeReason" => {
84 builder = builder.set_state_change_reason(
85 crate::protocol_serde::shape_image_state_change_reason::de_image_state_change_reason(tokens)?,
86 );
87 }
88 "Applications" => {
89 builder = builder.set_applications(crate::protocol_serde::shape_applications::de_applications(tokens)?);
90 }
91 "CreatedTime" => {
92 builder = builder.set_created_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
93 tokens.next(),
94 ::aws_smithy_types::date_time::Format::EpochSeconds,
95 )?);
96 }
97 "PublicBaseImageReleasedDate" => {
98 builder = builder.set_public_base_image_released_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
99 tokens.next(),
100 ::aws_smithy_types::date_time::Format::EpochSeconds,
101 )?);
102 }
103 "AppstreamAgentVersion" => {
104 builder = builder.set_appstream_agent_version(
105 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
106 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
107 .transpose()?,
108 );
109 }
110 "ImagePermissions" => {
111 builder = builder.set_image_permissions(crate::protocol_serde::shape_image_permissions::de_image_permissions(tokens)?);
112 }
113 "ImageErrors" => {
114 builder = builder.set_image_errors(crate::protocol_serde::shape_resource_errors::de_resource_errors(tokens)?);
115 }
116 "LatestAppstreamAgentVersion" => {
117 builder = builder.set_latest_appstream_agent_version(
118 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
119 .map(|s| s.to_unescaped().map(|u| crate::types::LatestAppstreamAgentVersion::from(u.as_ref())))
120 .transpose()?,
121 );
122 }
123 "SupportedInstanceFamilies" => {
124 builder = builder.set_supported_instance_families(crate::protocol_serde::shape_string_list::de_string_list(tokens)?);
125 }
126 "DynamicAppProvidersEnabled" => {
127 builder = builder.set_dynamic_app_providers_enabled(
128 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
129 .map(|s| s.to_unescaped().map(|u| crate::types::DynamicAppProvidersEnabled::from(u.as_ref())))
130 .transpose()?,
131 );
132 }
133 "ImageSharedWithOthers" => {
134 builder = builder.set_image_shared_with_others(
135 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
136 .map(|s| s.to_unescaped().map(|u| crate::types::ImageSharedWithOthers::from(u.as_ref())))
137 .transpose()?,
138 );
139 }
140 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
141 },
142 other => {
143 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
144 "expected object key or end object, found: {:?}",
145 other
146 )))
147 }
148 }
149 }
150 Ok(Some(crate::serde_util::image_correct_errors(builder).build()))
151 }
152 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
153 "expected start object or null",
154 )),
155 }
156}