aws_sdk_sagemaker/protocol_serde/
shape_auto_ml_algorithm_config.rs1pub fn ser_auto_ml_algorithm_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::AutoMlAlgorithmConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.auto_ml_algorithms {
7 let mut array_2 = object.key("AutoMLAlgorithms").start_array();
8 for item_3 in var_1 {
9 {
10 array_2.value().string(item_3.as_str());
11 }
12 }
13 array_2.finish();
14 }
15 Ok(())
16}
17
18pub(crate) fn de_auto_ml_algorithm_config<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::AutoMlAlgorithmConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
21where
22 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
23{
24 match tokens.next().transpose()? {
25 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
26 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
27 #[allow(unused_mut)]
28 let mut builder = crate::types::builders::AutoMlAlgorithmConfigBuilder::default();
29 loop {
30 match tokens.next().transpose()? {
31 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
32 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
33 "AutoMLAlgorithms" => {
34 builder = builder.set_auto_ml_algorithms(crate::protocol_serde::shape_auto_ml_algorithms::de_auto_ml_algorithms(tokens)?);
35 }
36 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
37 },
38 other => {
39 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
40 "expected object key or end object, found: {:?}",
41 other
42 )))
43 }
44 }
45 }
46 Ok(Some(crate::serde_util::auto_ml_algorithm_config_correct_errors(builder).build()))
47 }
48 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
49 "expected start object or null",
50 )),
51 }
52}