aws_sdk_sagemaker/protocol_serde/
shape_inference_component_summary.rs1pub(crate) fn de_inference_component_summary<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::InferenceComponentSummary>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8 match tokens.next().transpose()? {
9 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11 #[allow(unused_mut)]
12 let mut builder = crate::types::builders::InferenceComponentSummaryBuilder::default();
13 loop {
14 match tokens.next().transpose()? {
15 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17 "CreationTime" => {
18 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
19 tokens.next(),
20 ::aws_smithy_types::date_time::Format::EpochSeconds,
21 )?);
22 }
23 "InferenceComponentArn" => {
24 builder = builder.set_inference_component_arn(
25 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
26 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
27 .transpose()?,
28 );
29 }
30 "InferenceComponentName" => {
31 builder = builder.set_inference_component_name(
32 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
33 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
34 .transpose()?,
35 );
36 }
37 "EndpointArn" => {
38 builder = builder.set_endpoint_arn(
39 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
40 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
41 .transpose()?,
42 );
43 }
44 "EndpointName" => {
45 builder = builder.set_endpoint_name(
46 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
47 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
48 .transpose()?,
49 );
50 }
51 "VariantName" => {
52 builder = builder.set_variant_name(
53 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
54 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
55 .transpose()?,
56 );
57 }
58 "InferenceComponentStatus" => {
59 builder = builder.set_inference_component_status(
60 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
61 .map(|s| s.to_unescaped().map(|u| crate::types::InferenceComponentStatus::from(u.as_ref())))
62 .transpose()?,
63 );
64 }
65 "LastModifiedTime" => {
66 builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
67 tokens.next(),
68 ::aws_smithy_types::date_time::Format::EpochSeconds,
69 )?);
70 }
71 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
72 },
73 other => {
74 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
75 "expected object key or end object, found: {:?}",
76 other
77 )))
78 }
79 }
80 }
81 Ok(Some(crate::serde_util::inference_component_summary_correct_errors(builder).build()))
82 }
83 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
84 "expected start object or null",
85 )),
86 }
87}