aws_sdk_datazone/protocol_serde/
shape_subscription_summary.rs1pub(crate) fn de_subscription_summary<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<Option<crate::types::SubscriptionSummary>, ::aws_smithy_json::deserialize::error::DeserializeError>
6where
7 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
8{
9 match tokens.next().transpose()? {
10 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
11 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
12 #[allow(unused_mut)]
13 let mut builder = crate::types::builders::SubscriptionSummaryBuilder::default();
14 loop {
15 match tokens.next().transpose()? {
16 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
17 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
18 "id" => {
19 builder = builder.set_id(
20 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
21 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
22 .transpose()?,
23 );
24 }
25 "createdBy" => {
26 builder = builder.set_created_by(
27 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
28 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
29 .transpose()?,
30 );
31 }
32 "updatedBy" => {
33 builder = builder.set_updated_by(
34 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
35 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
36 .transpose()?,
37 );
38 }
39 "domainId" => {
40 builder = builder.set_domain_id(
41 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
42 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
43 .transpose()?,
44 );
45 }
46 "status" => {
47 builder = builder.set_status(
48 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
49 .map(|s| s.to_unescaped().map(|u| crate::types::SubscriptionStatus::from(u.as_ref())))
50 .transpose()?,
51 );
52 }
53 "createdAt" => {
54 builder = builder.set_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
55 tokens.next(),
56 ::aws_smithy_types::date_time::Format::EpochSeconds,
57 )?);
58 }
59 "updatedAt" => {
60 builder = builder.set_updated_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
61 tokens.next(),
62 ::aws_smithy_types::date_time::Format::EpochSeconds,
63 )?);
64 }
65 "subscribedPrincipal" => {
66 builder = builder.set_subscribed_principal(crate::protocol_serde::shape_subscribed_principal::de_subscribed_principal(
67 tokens, _value,
68 )?);
69 }
70 "subscribedListing" => {
71 builder = builder
72 .set_subscribed_listing(crate::protocol_serde::shape_subscribed_listing::de_subscribed_listing(tokens, _value)?);
73 }
74 "subscriptionRequestId" => {
75 builder = builder.set_subscription_request_id(
76 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
77 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
78 .transpose()?,
79 );
80 }
81 "retainPermissions" => {
82 builder = builder.set_retain_permissions(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
83 }
84 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
85 },
86 other => {
87 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
88 "expected object key or end object, found: {other:?}"
89 )))
90 }
91 }
92 }
93 Ok(Some(crate::serde_util::subscription_summary_correct_errors(builder).build().map_err(
94 |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
95 )?))
96 }
97 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
98 "expected start object or null",
99 )),
100 }
101}