aws_sdk_sagemaker/protocol_serde/
shape_async_inference_notification_config.rs1pub fn ser_async_inference_notification_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::AsyncInferenceNotificationConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.success_topic {
7 object.key("SuccessTopic").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.error_topic {
10 object.key("ErrorTopic").string(var_2.as_str());
11 }
12 if let Some(var_3) = &input.include_inference_response_in {
13 let mut array_4 = object.key("IncludeInferenceResponseIn").start_array();
14 for item_5 in var_3 {
15 {
16 array_4.value().string(item_5.as_str());
17 }
18 }
19 array_4.finish();
20 }
21 Ok(())
22}
23
24pub(crate) fn de_async_inference_notification_config<'a, I>(
25 tokens: &mut ::std::iter::Peekable<I>,
26) -> ::std::result::Result<Option<crate::types::AsyncInferenceNotificationConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
27where
28 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
29{
30 match tokens.next().transpose()? {
31 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
32 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
33 #[allow(unused_mut)]
34 let mut builder = crate::types::builders::AsyncInferenceNotificationConfigBuilder::default();
35 loop {
36 match tokens.next().transpose()? {
37 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
38 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
39 "SuccessTopic" => {
40 builder = builder.set_success_topic(
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 "ErrorTopic" => {
47 builder = builder.set_error_topic(
48 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
49 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
50 .transpose()?,
51 );
52 }
53 "IncludeInferenceResponseIn" => {
54 builder = builder.set_include_inference_response_in(
55 crate::protocol_serde::shape_async_notification_topic_type_list::de_async_notification_topic_type_list(tokens)?,
56 );
57 }
58 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
59 },
60 other => {
61 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
62 "expected object key or end object, found: {:?}",
63 other
64 )))
65 }
66 }
67 }
68 Ok(Some(builder.build()))
69 }
70 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
71 "expected start object or null",
72 )),
73 }
74}