aws_sdk_sagemaker/protocol_serde/
shape_inference_component_container_specification_summary.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_inference_component_container_specification_summary<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<
5    Option<crate::types::InferenceComponentContainerSpecificationSummary>,
6    ::aws_smithy_json::deserialize::error::DeserializeError,
7>
8where
9    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
10{
11    match tokens.next().transpose()? {
12        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
13        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
14            #[allow(unused_mut)]
15            let mut builder = crate::types::builders::InferenceComponentContainerSpecificationSummaryBuilder::default();
16            loop {
17                match tokens.next().transpose()? {
18                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
19                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
20                        "DeployedImage" => {
21                            builder = builder.set_deployed_image(crate::protocol_serde::shape_deployed_image::de_deployed_image(tokens)?);
22                        }
23                        "ArtifactUrl" => {
24                            builder = builder.set_artifact_url(
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                        "Environment" => {
31                            builder = builder.set_environment(crate::protocol_serde::shape_environment_map::de_environment_map(tokens)?);
32                        }
33                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
34                    },
35                    other => {
36                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
37                            "expected object key or end object, found: {:?}",
38                            other
39                        )))
40                    }
41                }
42            }
43            Ok(Some(builder.build()))
44        }
45        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
46            "expected start object or null",
47        )),
48    }
49}