aws_sdk_sagemaker/protocol_serde/
shape_workteam.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_workteam<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Workteam>, ::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::WorkteamBuilder::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                        "WorkteamName" => {
18                            builder = builder.set_workteam_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                        "MemberDefinitions" => {
25                            builder = builder.set_member_definitions(crate::protocol_serde::shape_member_definitions::de_member_definitions(tokens)?);
26                        }
27                        "WorkteamArn" => {
28                            builder = builder.set_workteam_arn(
29                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
30                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
31                                    .transpose()?,
32                            );
33                        }
34                        "WorkforceArn" => {
35                            builder = builder.set_workforce_arn(
36                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38                                    .transpose()?,
39                            );
40                        }
41                        "ProductListingIds" => {
42                            builder = builder.set_product_listing_ids(crate::protocol_serde::shape_product_listings::de_product_listings(tokens)?);
43                        }
44                        "Description" => {
45                            builder = builder.set_description(
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                        "SubDomain" => {
52                            builder = builder.set_sub_domain(
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                        "CreateDate" => {
59                            builder = builder.set_create_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
60                                tokens.next(),
61                                ::aws_smithy_types::date_time::Format::EpochSeconds,
62                            )?);
63                        }
64                        "LastUpdatedDate" => {
65                            builder = builder.set_last_updated_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
66                                tokens.next(),
67                                ::aws_smithy_types::date_time::Format::EpochSeconds,
68                            )?);
69                        }
70                        "NotificationConfiguration" => {
71                            builder = builder.set_notification_configuration(
72                                crate::protocol_serde::shape_notification_configuration::de_notification_configuration(tokens)?,
73                            );
74                        }
75                        "WorkerAccessConfiguration" => {
76                            builder = builder.set_worker_access_configuration(
77                                crate::protocol_serde::shape_worker_access_configuration::de_worker_access_configuration(tokens)?,
78                            );
79                        }
80                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
81                    },
82                    other => {
83                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
84                            "expected object key or end object, found: {:?}",
85                            other
86                        )))
87                    }
88                }
89            }
90            Ok(Some(crate::serde_util::workteam_correct_errors(builder).build()))
91        }
92        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
93            "expected start object or null",
94        )),
95    }
96}