1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | pub(crate) fn de_kafka_schema_registry_config<'a, I>(
|
3 - | tokens: &mut ::std::iter::Peekable<I>,
|
4 - | _value: &'a [u8],
|
5 - | ) -> ::std::result::Result<Option<crate::types::KafkaSchemaRegistryConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
6 - | where
|
7 - | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
8 - | {
|
9 - | match tokens.next().transpose()? {
|
10 - | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
11 - | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
12 - | #[allow(unused_mut)]
|
13 - | let mut builder = crate::types::builders::KafkaSchemaRegistryConfigBuilder::default();
|
14 - | loop {
|
15 - | match tokens.next().transpose()? {
|
16 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
17 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
18 - | match key.to_unescaped()?.as_ref() {
|
19 - | "SchemaRegistryURI" => {
|
20 - | builder = builder.set_schema_registry_uri(
|
21 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
22 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
23 - | .transpose()?,
|
24 - | );
|
25 - | }
|
26 - | "EventRecordFormat" => {
|
27 - | builder = builder.set_event_record_format(
|
28 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
29 - | .map(|s| s.to_unescaped().map(|u| crate::types::SchemaRegistryEventRecordFormat::from(u.as_ref())))
|
30 - | .transpose()?,
|
31 - | );
|
32 - | }
|
33 - | "AccessConfigs" => {
|
34 - | builder = builder.set_access_configs(
|
35 - | crate::protocol_serde::shape_kafka_schema_registry_access_config_list::de_kafka_schema_registry_access_config_list(tokens, _value)?
|
36 - | );
|
37 - | }
|
38 - | "SchemaValidationConfigs" => {
|
39 - | builder = builder.set_schema_validation_configs(
|
40 - | crate::protocol_serde::shape_kafka_schema_validation_config_list::de_kafka_schema_validation_config_list(
|
41 - | tokens, _value,
|
42 - | )?,
|
43 - | );
|
44 - | }
|
45 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
46 - | }
|
47 - | }
|
48 - | other => {
|
49 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
50 - | "expected object key or end object, found: {other:?}"
|
51 - | )))
|
52 - | }
|
53 - | }
|
54 - | }
|
55 - | Ok(Some(builder.build()))
|
56 - | }
|
57 - | _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
58 - | "expected start object or null",
|
59 - | )),
|
60 - | }
|
61 - | }
|
62 - |
|
63 - | pub fn ser_kafka_schema_registry_config(
|
64 - | object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
|
65 - | input: &crate::types::KafkaSchemaRegistryConfig,
|
66 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
|
67 - | if let Some(var_1) = &input.schema_registry_uri {
|
68 - | object.key("SchemaRegistryURI").string(var_1.as_str());
|
69 - | }
|
70 - | if let Some(var_2) = &input.event_record_format {
|
71 - | object.key("EventRecordFormat").string(var_2.as_str());
|
72 - | }
|
73 - | if let Some(var_3) = &input.access_configs {
|
74 - | let mut array_4 = object.key("AccessConfigs").start_array();
|
75 - | for item_5 in var_3 {
|
76 - | {
|
77 - | #[allow(unused_mut)]
|
78 - | let mut object_6 = array_4.value().start_object();
|
79 - | crate::protocol_serde::shape_kafka_schema_registry_access_config::ser_kafka_schema_registry_access_config(&mut object_6, item_5)?;
|
80 - | object_6.finish();
|
81 - | }
|
82 - | }
|
83 - | array_4.finish();
|
84 - | }
|
85 - | if let Some(var_7) = &input.schema_validation_configs {
|
86 - | let mut array_8 = object.key("SchemaValidationConfigs").start_array();
|
87 - | for item_9 in var_7 {
|
88 - | {
|
89 - | #[allow(unused_mut)]
|
90 - | let mut object_10 = array_8.value().start_object();
|
91 - | crate::protocol_serde::shape_kafka_schema_validation_config::ser_kafka_schema_validation_config(&mut object_10, item_9)?;
|
92 - | object_10.finish();
|
93 - | }
|
94 - | }
|
95 - | array_8.finish();
|
96 - | }
|
97 - | Ok(())
|
98 - | }
|