aws_sdk_iotwireless/protocol_serde/
shape_join_event_configuration.rs1pub(crate) fn de_join_event_configuration<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::JoinEventConfiguration>, ::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::JoinEventConfigurationBuilder::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 "LoRaWAN" => {
18 builder = builder.set_lo_ra_wan(
19 crate::protocol_serde::shape_lo_ra_wan_join_event_notification_configurations::de_lo_ra_wan_join_event_notification_configurations(tokens)?
20 );
21 }
22 "WirelessDeviceIdEventTopic" => {
23 builder = builder.set_wireless_device_id_event_topic(
24 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
25 .map(|s| s.to_unescaped().map(|u| crate::types::EventNotificationTopicStatus::from(u.as_ref())))
26 .transpose()?,
27 );
28 }
29 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
30 },
31 other => {
32 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
33 "expected object key or end object, found: {other:?}"
34 )))
35 }
36 }
37 }
38 Ok(Some(builder.build()))
39 }
40 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
41 "expected start object or null",
42 )),
43 }
44}
45
46pub fn ser_join_event_configuration(
47 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
48 input: &crate::types::JoinEventConfiguration,
49) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
50 if let Some(var_1) = &input.lo_ra_wan {
51 #[allow(unused_mut)]
52 let mut object_2 = object.key("LoRaWAN").start_object();
53 crate::protocol_serde::shape_lo_ra_wan_join_event_notification_configurations::ser_lo_ra_wan_join_event_notification_configurations(
54 &mut object_2,
55 var_1,
56 )?;
57 object_2.finish();
58 }
59 if let Some(var_3) = &input.wireless_device_id_event_topic {
60 object.key("WirelessDeviceIdEventTopic").string(var_3.as_str());
61 }
62 Ok(())
63}