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: {:?}",
34                            other
35                        )))
36                    }
37                }
38            }
39            Ok(Some(builder.build()))
40        }
41        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
42            "expected start object or null",
43        )),
44    }
45}
46
47pub fn ser_join_event_configuration(
48    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
49    input: &crate::types::JoinEventConfiguration,
50) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
51    if let Some(var_1) = &input.lo_ra_wan {
52        #[allow(unused_mut)]
53        let mut object_2 = object.key("LoRaWAN").start_object();
54        crate::protocol_serde::shape_lo_ra_wan_join_event_notification_configurations::ser_lo_ra_wan_join_event_notification_configurations(
55            &mut object_2,
56            var_1,
57        )?;
58        object_2.finish();
59    }
60    if let Some(var_3) = &input.wireless_device_id_event_topic {
61        object.key("WirelessDeviceIdEventTopic").string(var_3.as_str());
62    }
63    Ok(())
64}