aws_sdk_kafkaconnect/protocol_serde/
shape_connector_summary.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_connector_summary<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ConnectorSummary>, ::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::ConnectorSummaryBuilder::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                        "capacity" => {
18                            builder = builder.set_capacity(crate::protocol_serde::shape_capacity_description::de_capacity_description(tokens)?);
19                        }
20                        "connectorArn" => {
21                            builder = builder.set_connector_arn(
22                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
23                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
24                                    .transpose()?,
25                            );
26                        }
27                        "connectorDescription" => {
28                            builder = builder.set_connector_description(
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                        "connectorName" => {
35                            builder = builder.set_connector_name(
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                        "connectorState" => {
42                            builder = builder.set_connector_state(
43                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
44                                    .map(|s| s.to_unescaped().map(|u| crate::types::ConnectorState::from(u.as_ref())))
45                                    .transpose()?,
46                            );
47                        }
48                        "creationTime" => {
49                            builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
50                                tokens.next(),
51                                ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
52                            )?);
53                        }
54                        "currentVersion" => {
55                            builder = builder.set_current_version(
56                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
57                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
58                                    .transpose()?,
59                            );
60                        }
61                        "kafkaCluster" => {
62                            builder = builder.set_kafka_cluster(
63                                crate::protocol_serde::shape_kafka_cluster_description::de_kafka_cluster_description(tokens)?,
64                            );
65                        }
66                        "kafkaClusterClientAuthentication" => {
67                            builder = builder.set_kafka_cluster_client_authentication(
68                                    crate::protocol_serde::shape_kafka_cluster_client_authentication_description::de_kafka_cluster_client_authentication_description(tokens)?
69                                );
70                        }
71                        "kafkaClusterEncryptionInTransit" => {
72                            builder = builder.set_kafka_cluster_encryption_in_transit(
73                                    crate::protocol_serde::shape_kafka_cluster_encryption_in_transit_description::de_kafka_cluster_encryption_in_transit_description(tokens)?
74                                );
75                        }
76                        "kafkaConnectVersion" => {
77                            builder = builder.set_kafka_connect_version(
78                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
79                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
80                                    .transpose()?,
81                            );
82                        }
83                        "logDelivery" => {
84                            builder = builder.set_log_delivery(crate::protocol_serde::shape_log_delivery_description::de_log_delivery_description(
85                                tokens,
86                            )?);
87                        }
88                        "plugins" => {
89                            builder = builder.set_plugins(crate::protocol_serde::shape_list_of_plugin_description::de_list_of_plugin_description(
90                                tokens,
91                            )?);
92                        }
93                        "serviceExecutionRoleArn" => {
94                            builder = builder.set_service_execution_role_arn(
95                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
96                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
97                                    .transpose()?,
98                            );
99                        }
100                        "workerConfiguration" => {
101                            builder = builder.set_worker_configuration(
102                                crate::protocol_serde::shape_worker_configuration_description::de_worker_configuration_description(tokens)?,
103                            );
104                        }
105                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
106                    },
107                    other => {
108                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
109                            "expected object key or end object, found: {other:?}"
110                        )))
111                    }
112                }
113            }
114            Ok(Some(builder.build()))
115        }
116        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
117            "expected start object or null",
118        )),
119    }
120}