aws_sdk_frauddetector/protocol_serde/
shape_batch_prediction.rs1pub(crate) fn de_batch_prediction<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<Option<crate::types::BatchPrediction>, ::aws_smithy_json::deserialize::error::DeserializeError>
6where
7 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
8{
9 match tokens.next().transpose()? {
10 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
11 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
12 #[allow(unused_mut)]
13 let mut builder = crate::types::builders::BatchPredictionBuilder::default();
14 loop {
15 match tokens.next().transpose()? {
16 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
17 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
18 "jobId" => {
19 builder = builder.set_job_id(
20 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
21 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
22 .transpose()?,
23 );
24 }
25 "status" => {
26 builder = builder.set_status(
27 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
28 .map(|s| s.to_unescaped().map(|u| crate::types::AsyncJobStatus::from(u.as_ref())))
29 .transpose()?,
30 );
31 }
32 "failureReason" => {
33 builder = builder.set_failure_reason(
34 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
35 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
36 .transpose()?,
37 );
38 }
39 "startTime" => {
40 builder = builder.set_start_time(
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 "completionTime" => {
47 builder = builder.set_completion_time(
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 "lastHeartbeatTime" => {
54 builder = builder.set_last_heartbeat_time(
55 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
56 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
57 .transpose()?,
58 );
59 }
60 "inputPath" => {
61 builder = builder.set_input_path(
62 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
63 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
64 .transpose()?,
65 );
66 }
67 "outputPath" => {
68 builder = builder.set_output_path(
69 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
70 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
71 .transpose()?,
72 );
73 }
74 "eventTypeName" => {
75 builder = builder.set_event_type_name(
76 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
77 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
78 .transpose()?,
79 );
80 }
81 "detectorName" => {
82 builder = builder.set_detector_name(
83 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
84 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
85 .transpose()?,
86 );
87 }
88 "detectorVersion" => {
89 builder = builder.set_detector_version(
90 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
91 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
92 .transpose()?,
93 );
94 }
95 "iamRoleArn" => {
96 builder = builder.set_iam_role_arn(
97 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
98 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
99 .transpose()?,
100 );
101 }
102 "arn" => {
103 builder = builder.set_arn(
104 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
105 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
106 .transpose()?,
107 );
108 }
109 "processedRecordsCount" => {
110 builder = builder.set_processed_records_count(
111 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
112 .map(i32::try_from)
113 .transpose()?,
114 );
115 }
116 "totalRecordsCount" => {
117 builder = builder.set_total_records_count(
118 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
119 .map(i32::try_from)
120 .transpose()?,
121 );
122 }
123 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
124 },
125 other => {
126 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
127 "expected object key or end object, found: {other:?}"
128 )))
129 }
130 }
131 }
132 Ok(Some(builder.build()))
133 }
134 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
135 "expected start object or null",
136 )),
137 }
138}