aws_sdk_sagemaker/protocol_serde/
shape_batch_transform_input.rs1pub fn ser_batch_transform_input(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::BatchTransformInput,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.data_captured_destination_s3_uri {
7 object.key("DataCapturedDestinationS3Uri").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.dataset_format {
10 #[allow(unused_mut)]
11 let mut object_3 = object.key("DatasetFormat").start_object();
12 crate::protocol_serde::shape_monitoring_dataset_format::ser_monitoring_dataset_format(&mut object_3, var_2)?;
13 object_3.finish();
14 }
15 if let Some(var_4) = &input.local_path {
16 object.key("LocalPath").string(var_4.as_str());
17 }
18 if let Some(var_5) = &input.s3_input_mode {
19 object.key("S3InputMode").string(var_5.as_str());
20 }
21 if let Some(var_6) = &input.s3_data_distribution_type {
22 object.key("S3DataDistributionType").string(var_6.as_str());
23 }
24 if let Some(var_7) = &input.features_attribute {
25 object.key("FeaturesAttribute").string(var_7.as_str());
26 }
27 if let Some(var_8) = &input.inference_attribute {
28 object.key("InferenceAttribute").string(var_8.as_str());
29 }
30 if let Some(var_9) = &input.probability_attribute {
31 object.key("ProbabilityAttribute").string(var_9.as_str());
32 }
33 if let Some(var_10) = &input.probability_threshold_attribute {
34 object.key("ProbabilityThresholdAttribute").number(
35 #[allow(clippy::useless_conversion)]
36 ::aws_smithy_types::Number::Float((*var_10).into()),
37 );
38 }
39 if let Some(var_11) = &input.start_time_offset {
40 object.key("StartTimeOffset").string(var_11.as_str());
41 }
42 if let Some(var_12) = &input.end_time_offset {
43 object.key("EndTimeOffset").string(var_12.as_str());
44 }
45 if let Some(var_13) = &input.exclude_features_attribute {
46 object.key("ExcludeFeaturesAttribute").string(var_13.as_str());
47 }
48 Ok(())
49}
50
51pub(crate) fn de_batch_transform_input<'a, I>(
52 tokens: &mut ::std::iter::Peekable<I>,
53) -> ::std::result::Result<Option<crate::types::BatchTransformInput>, ::aws_smithy_json::deserialize::error::DeserializeError>
54where
55 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
56{
57 match tokens.next().transpose()? {
58 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
59 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
60 #[allow(unused_mut)]
61 let mut builder = crate::types::builders::BatchTransformInputBuilder::default();
62 loop {
63 match tokens.next().transpose()? {
64 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
65 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
66 "DataCapturedDestinationS3Uri" => {
67 builder = builder.set_data_captured_destination_s3_uri(
68 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
69 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
70 .transpose()?,
71 );
72 }
73 "DatasetFormat" => {
74 builder = builder.set_dataset_format(
75 crate::protocol_serde::shape_monitoring_dataset_format::de_monitoring_dataset_format(tokens)?,
76 );
77 }
78 "LocalPath" => {
79 builder = builder.set_local_path(
80 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
81 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
82 .transpose()?,
83 );
84 }
85 "S3InputMode" => {
86 builder = builder.set_s3_input_mode(
87 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
88 .map(|s| s.to_unescaped().map(|u| crate::types::ProcessingS3InputMode::from(u.as_ref())))
89 .transpose()?,
90 );
91 }
92 "S3DataDistributionType" => {
93 builder = builder.set_s3_data_distribution_type(
94 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
95 .map(|s| s.to_unescaped().map(|u| crate::types::ProcessingS3DataDistributionType::from(u.as_ref())))
96 .transpose()?,
97 );
98 }
99 "FeaturesAttribute" => {
100 builder = builder.set_features_attribute(
101 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
102 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
103 .transpose()?,
104 );
105 }
106 "InferenceAttribute" => {
107 builder = builder.set_inference_attribute(
108 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
109 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
110 .transpose()?,
111 );
112 }
113 "ProbabilityAttribute" => {
114 builder = builder.set_probability_attribute(
115 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
116 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
117 .transpose()?,
118 );
119 }
120 "ProbabilityThresholdAttribute" => {
121 builder = builder.set_probability_threshold_attribute(
122 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()),
123 );
124 }
125 "StartTimeOffset" => {
126 builder = builder.set_start_time_offset(
127 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
128 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
129 .transpose()?,
130 );
131 }
132 "EndTimeOffset" => {
133 builder = builder.set_end_time_offset(
134 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
135 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
136 .transpose()?,
137 );
138 }
139 "ExcludeFeaturesAttribute" => {
140 builder = builder.set_exclude_features_attribute(
141 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
142 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
143 .transpose()?,
144 );
145 }
146 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
147 },
148 other => {
149 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
150 "expected object key or end object, found: {:?}",
151 other
152 )))
153 }
154 }
155 }
156 Ok(Some(crate::serde_util::batch_transform_input_correct_errors(builder).build()))
157 }
158 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
159 "expected start object or null",
160 )),
161 }
162}