aws_sdk_sagemaker/protocol_serde/
shape_cluster_instance_group_details.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_cluster_instance_group_details<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ClusterInstanceGroupDetails>, ::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::ClusterInstanceGroupDetailsBuilder::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                        "CurrentCount" => {
18                            builder = builder.set_current_count(
19                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
20                                    .map(i32::try_from)
21                                    .transpose()?,
22                            );
23                        }
24                        "TargetCount" => {
25                            builder = builder.set_target_count(
26                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
27                                    .map(i32::try_from)
28                                    .transpose()?,
29                            );
30                        }
31                        "InstanceGroupName" => {
32                            builder = builder.set_instance_group_name(
33                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
35                                    .transpose()?,
36                            );
37                        }
38                        "InstanceType" => {
39                            builder = builder.set_instance_type(
40                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41                                    .map(|s| s.to_unescaped().map(|u| crate::types::ClusterInstanceType::from(u.as_ref())))
42                                    .transpose()?,
43                            );
44                        }
45                        "LifeCycleConfig" => {
46                            builder = builder.set_life_cycle_config(
47                                crate::protocol_serde::shape_cluster_life_cycle_config::de_cluster_life_cycle_config(tokens)?,
48                            );
49                        }
50                        "ExecutionRole" => {
51                            builder = builder.set_execution_role(
52                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
53                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
54                                    .transpose()?,
55                            );
56                        }
57                        "ThreadsPerCore" => {
58                            builder = builder.set_threads_per_core(
59                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
60                                    .map(i32::try_from)
61                                    .transpose()?,
62                            );
63                        }
64                        "InstanceStorageConfigs" => {
65                            builder = builder.set_instance_storage_configs(
66                                crate::protocol_serde::shape_cluster_instance_storage_configs::de_cluster_instance_storage_configs(tokens)?,
67                            );
68                        }
69                        "OnStartDeepHealthChecks" => {
70                            builder = builder.set_on_start_deep_health_checks(
71                                crate::protocol_serde::shape_on_start_deep_health_checks::de_on_start_deep_health_checks(tokens)?,
72                            );
73                        }
74                        "Status" => {
75                            builder = builder.set_status(
76                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
77                                    .map(|s| s.to_unescaped().map(|u| crate::types::InstanceGroupStatus::from(u.as_ref())))
78                                    .transpose()?,
79                            );
80                        }
81                        "TrainingPlanArn" => {
82                            builder = builder.set_training_plan_arn(
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                        "TrainingPlanStatus" => {
89                            builder = builder.set_training_plan_status(
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                        "OverrideVpcConfig" => {
96                            builder = builder.set_override_vpc_config(crate::protocol_serde::shape_vpc_config::de_vpc_config(tokens)?);
97                        }
98                        "ScheduledUpdateConfig" => {
99                            builder = builder.set_scheduled_update_config(
100                                crate::protocol_serde::shape_scheduled_update_config::de_scheduled_update_config(tokens)?,
101                            );
102                        }
103                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
104                    },
105                    other => {
106                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
107                            "expected object key or end object, found: {:?}",
108                            other
109                        )))
110                    }
111                }
112            }
113            Ok(Some(builder.build()))
114        }
115        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
116            "expected start object or null",
117        )),
118    }
119}