aws_sdk_sagemaker/protocol_serde/
shape_cluster_node_details.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_cluster_node_details<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ClusterNodeDetails>, ::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::ClusterNodeDetailsBuilder::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                        "InstanceGroupName" => {
18                            builder = builder.set_instance_group_name(
19                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21                                    .transpose()?,
22                            );
23                        }
24                        "InstanceId" => {
25                            builder = builder.set_instance_id(
26                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28                                    .transpose()?,
29                            );
30                        }
31                        "InstanceStatus" => {
32                            builder = builder.set_instance_status(
33                                crate::protocol_serde::shape_cluster_instance_status_details::de_cluster_instance_status_details(tokens)?,
34                            );
35                        }
36                        "InstanceType" => {
37                            builder = builder.set_instance_type(
38                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
39                                    .map(|s| s.to_unescaped().map(|u| crate::types::ClusterInstanceType::from(u.as_ref())))
40                                    .transpose()?,
41                            );
42                        }
43                        "LaunchTime" => {
44                            builder = builder.set_launch_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
45                                tokens.next(),
46                                ::aws_smithy_types::date_time::Format::EpochSeconds,
47                            )?);
48                        }
49                        "LastSoftwareUpdateTime" => {
50                            builder = builder.set_last_software_update_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
51                                tokens.next(),
52                                ::aws_smithy_types::date_time::Format::EpochSeconds,
53                            )?);
54                        }
55                        "LifeCycleConfig" => {
56                            builder = builder.set_life_cycle_config(
57                                crate::protocol_serde::shape_cluster_life_cycle_config::de_cluster_life_cycle_config(tokens)?,
58                            );
59                        }
60                        "OverrideVpcConfig" => {
61                            builder = builder.set_override_vpc_config(crate::protocol_serde::shape_vpc_config::de_vpc_config(tokens)?);
62                        }
63                        "ThreadsPerCore" => {
64                            builder = builder.set_threads_per_core(
65                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
66                                    .map(i32::try_from)
67                                    .transpose()?,
68                            );
69                        }
70                        "InstanceStorageConfigs" => {
71                            builder = builder.set_instance_storage_configs(
72                                crate::protocol_serde::shape_cluster_instance_storage_configs::de_cluster_instance_storage_configs(tokens)?,
73                            );
74                        }
75                        "PrivatePrimaryIp" => {
76                            builder = builder.set_private_primary_ip(
77                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
78                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
79                                    .transpose()?,
80                            );
81                        }
82                        "PrivatePrimaryIpv6" => {
83                            builder = builder.set_private_primary_ipv6(
84                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
85                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
86                                    .transpose()?,
87                            );
88                        }
89                        "PrivateDnsHostname" => {
90                            builder = builder.set_private_dns_hostname(
91                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
92                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
93                                    .transpose()?,
94                            );
95                        }
96                        "Placement" => {
97                            builder = builder.set_placement(crate::protocol_serde::shape_cluster_instance_placement::de_cluster_instance_placement(
98                                tokens,
99                            )?);
100                        }
101                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
102                    },
103                    other => {
104                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
105                            "expected object key or end object, found: {:?}",
106                            other
107                        )))
108                    }
109                }
110            }
111            Ok(Some(builder.build()))
112        }
113        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
114            "expected start object or null",
115        )),
116    }
117}