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                        "NodeLogicalId" => {
32                            builder = builder.set_node_logical_id(
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                        "InstanceStatus" => {
39                            builder = builder.set_instance_status(
40                                crate::protocol_serde::shape_cluster_instance_status_details::de_cluster_instance_status_details(tokens)?,
41                            );
42                        }
43                        "InstanceType" => {
44                            builder = builder.set_instance_type(
45                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
46                                    .map(|s| s.to_unescaped().map(|u| crate::types::ClusterInstanceType::from(u.as_ref())))
47                                    .transpose()?,
48                            );
49                        }
50                        "LaunchTime" => {
51                            builder = builder.set_launch_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
52                                tokens.next(),
53                                ::aws_smithy_types::date_time::Format::EpochSeconds,
54                            )?);
55                        }
56                        "LastSoftwareUpdateTime" => {
57                            builder = builder.set_last_software_update_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
58                                tokens.next(),
59                                ::aws_smithy_types::date_time::Format::EpochSeconds,
60                            )?);
61                        }
62                        "LifeCycleConfig" => {
63                            builder = builder.set_life_cycle_config(
64                                crate::protocol_serde::shape_cluster_life_cycle_config::de_cluster_life_cycle_config(tokens)?,
65                            );
66                        }
67                        "OverrideVpcConfig" => {
68                            builder = builder.set_override_vpc_config(crate::protocol_serde::shape_vpc_config::de_vpc_config(tokens)?);
69                        }
70                        "ThreadsPerCore" => {
71                            builder = builder.set_threads_per_core(
72                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
73                                    .map(i32::try_from)
74                                    .transpose()?,
75                            );
76                        }
77                        "InstanceStorageConfigs" => {
78                            builder = builder.set_instance_storage_configs(
79                                crate::protocol_serde::shape_cluster_instance_storage_configs::de_cluster_instance_storage_configs(tokens)?,
80                            );
81                        }
82                        "PrivatePrimaryIp" => {
83                            builder = builder.set_private_primary_ip(
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                        "PrivatePrimaryIpv6" => {
90                            builder = builder.set_private_primary_ipv6(
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                        "PrivateDnsHostname" => {
97                            builder = builder.set_private_dns_hostname(
98                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
99                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
100                                    .transpose()?,
101                            );
102                        }
103                        "Placement" => {
104                            builder = builder.set_placement(crate::protocol_serde::shape_cluster_instance_placement::de_cluster_instance_placement(
105                                tokens,
106                            )?);
107                        }
108                        "CurrentImageId" => {
109                            builder = builder.set_current_image_id(
110                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
111                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
112                                    .transpose()?,
113                            );
114                        }
115                        "DesiredImageId" => {
116                            builder = builder.set_desired_image_id(
117                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
118                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
119                                    .transpose()?,
120                            );
121                        }
122                        "UltraServerInfo" => {
123                            builder = builder.set_ultra_server_info(crate::protocol_serde::shape_ultra_server_info::de_ultra_server_info(tokens)?);
124                        }
125                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
126                    },
127                    other => {
128                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
129                            "expected object key or end object, found: {:?}",
130                            other
131                        )))
132                    }
133                }
134            }
135            Ok(Some(builder.build()))
136        }
137        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
138            "expected start object or null",
139        )),
140    }
141}