aws_sdk_sagemaker/protocol_serde/
shape_data_quality_app_specification.rs1pub fn ser_data_quality_app_specification(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::DataQualityAppSpecification,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.image_uri {
7 object.key("ImageUri").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.container_entrypoint {
10 let mut array_3 = object.key("ContainerEntrypoint").start_array();
11 for item_4 in var_2 {
12 {
13 array_3.value().string(item_4.as_str());
14 }
15 }
16 array_3.finish();
17 }
18 if let Some(var_5) = &input.container_arguments {
19 let mut array_6 = object.key("ContainerArguments").start_array();
20 for item_7 in var_5 {
21 {
22 array_6.value().string(item_7.as_str());
23 }
24 }
25 array_6.finish();
26 }
27 if let Some(var_8) = &input.record_preprocessor_source_uri {
28 object.key("RecordPreprocessorSourceUri").string(var_8.as_str());
29 }
30 if let Some(var_9) = &input.post_analytics_processor_source_uri {
31 object.key("PostAnalyticsProcessorSourceUri").string(var_9.as_str());
32 }
33 if let Some(var_10) = &input.environment {
34 #[allow(unused_mut)]
35 let mut object_11 = object.key("Environment").start_object();
36 for (key_12, value_13) in var_10 {
37 {
38 object_11.key(key_12.as_str()).string(value_13.as_str());
39 }
40 }
41 object_11.finish();
42 }
43 Ok(())
44}
45
46pub(crate) fn de_data_quality_app_specification<'a, I>(
47 tokens: &mut ::std::iter::Peekable<I>,
48) -> ::std::result::Result<Option<crate::types::DataQualityAppSpecification>, ::aws_smithy_json::deserialize::error::DeserializeError>
49where
50 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
51{
52 match tokens.next().transpose()? {
53 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
54 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
55 #[allow(unused_mut)]
56 let mut builder = crate::types::builders::DataQualityAppSpecificationBuilder::default();
57 loop {
58 match tokens.next().transpose()? {
59 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
60 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
61 "ImageUri" => {
62 builder = builder.set_image_uri(
63 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
64 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
65 .transpose()?,
66 );
67 }
68 "ContainerEntrypoint" => {
69 builder =
70 builder.set_container_entrypoint(crate::protocol_serde::shape_container_entrypoint::de_container_entrypoint(tokens)?);
71 }
72 "ContainerArguments" => {
73 builder = builder.set_container_arguments(
74 crate::protocol_serde::shape_monitoring_container_arguments::de_monitoring_container_arguments(tokens)?,
75 );
76 }
77 "RecordPreprocessorSourceUri" => {
78 builder = builder.set_record_preprocessor_source_uri(
79 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
80 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
81 .transpose()?,
82 );
83 }
84 "PostAnalyticsProcessorSourceUri" => {
85 builder = builder.set_post_analytics_processor_source_uri(
86 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
87 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
88 .transpose()?,
89 );
90 }
91 "Environment" => {
92 builder = builder.set_environment(
93 crate::protocol_serde::shape_monitoring_environment_map::de_monitoring_environment_map(tokens)?,
94 );
95 }
96 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
97 },
98 other => {
99 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
100 "expected object key or end object, found: {:?}",
101 other
102 )))
103 }
104 }
105 }
106 Ok(Some(crate::serde_util::data_quality_app_specification_correct_errors(builder).build()))
107 }
108 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
109 "expected start object or null",
110 )),
111 }
112}