Skip to main content

aws_sdk_glue/schema_serde/
shape_test_connection_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static TESTCONNECTIONINPUT_MEMBER_CONNECTION_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#TestConnectionInput$ConnectionType",
5        "com.amazonaws.glue",
6        "TestConnectionInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "ConnectionType",
10    0,
11);
12static TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#ConnectionProperties$key",
15        "com.amazonaws.glue",
16        "ConnectionProperties",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "key",
20    0,
21);
22static TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#ConnectionProperties$value",
25        "com.amazonaws.glue",
26        "ConnectionProperties",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "value",
30    1,
31);
32static TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#TestConnectionInput$ConnectionProperties",
35        "com.amazonaws.glue",
36        "TestConnectionInput",
37    ),
38    ::aws_smithy_schema::ShapeType::Map,
39    "ConnectionProperties",
40    1,
41)
42.with_map_members(
43    &TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES_KEY,
44    &TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES_VALUE,
45);
46static TESTCONNECTIONINPUT_MEMBER_AUTHENTICATION_CONFIGURATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
47    ::aws_smithy_schema::ShapeId::from_parts(
48        "com.amazonaws.glue#TestConnectionInput$AuthenticationConfiguration",
49        "com.amazonaws.glue",
50        "TestConnectionInput",
51    ),
52    ::aws_smithy_schema::ShapeType::Structure,
53    "AuthenticationConfiguration",
54    2,
55);
56static TESTCONNECTIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
57    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#TestConnectionInput", "com.amazonaws.glue", "TestConnectionInput"),
58    ::aws_smithy_schema::ShapeType::Structure,
59    &[
60        &TESTCONNECTIONINPUT_MEMBER_CONNECTION_TYPE,
61        &TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES,
62        &TESTCONNECTIONINPUT_MEMBER_AUTHENTICATION_CONFIGURATION,
63    ],
64);
65impl crate::types::TestConnectionInput {
66    /// The schema for this shape.
67    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &TESTCONNECTIONINPUT_SCHEMA;
68}
69impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::TestConnectionInput {
70    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
71        Self::SCHEMA
72    }
73
74    #[allow(unused_variables, clippy::diverging_sub_expression)]
75    fn serialize_members(
76        &self,
77        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
78    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
79        {
80            let val = &self.connection_type;
81            ser.write_string(&TESTCONNECTIONINPUT_MEMBER_CONNECTION_TYPE, val.as_str())?;
82        }
83        {
84            let val = &self.connection_properties;
85
86            ser.write_map(
87                &TESTCONNECTIONINPUT_MEMBER_CONNECTION_PROPERTIES,
88                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
89                    for (key, value) in val {
90                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key.as_str())?;
91                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
92                    }
93                    Ok(())
94                },
95            )?;
96        }
97        if let Some(ref val) = self.authentication_configuration {
98            ser.write_struct(&TESTCONNECTIONINPUT_MEMBER_AUTHENTICATION_CONFIGURATION, val)?;
99        }
100        Ok(())
101    }
102}
103impl crate::types::builders::TestConnectionInputBuilder {
104    #[allow(
105        unused_variables,
106        unreachable_code,
107        clippy::single_match,
108        clippy::match_single_binding,
109        clippy::diverging_sub_expression
110    )]
111    pub(crate) fn deserialize_members(
112        &mut self,
113        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
114    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
115        deserializer.read_struct(&TESTCONNECTIONINPUT_SCHEMA, &mut |member, deser| {
116            match member.member_index() {
117                Some(0) => {
118                    self.connection_type = Some(crate::types::ConnectionType::from(deser.read_string(member)?.as_str()));
119                }
120                Some(1) => {
121                    self.connection_properties = Some({
122                        let mut container = std::collections::HashMap::new();
123                        deser.read_map(member, &mut |key, deser| {
124                            container.insert(
125                                crate::types::ConnectionPropertyKey::from(key.as_str()),
126                                deser.read_string(&::aws_smithy_schema::prelude::STRING)?,
127                            );
128                            Ok(())
129                        })?;
130                        container
131                    });
132                }
133                Some(2) => {
134                    if deser.is_null() {
135                        deser.read_null()?;
136                    } else {
137                        self.authentication_configuration = Some(crate::types::AuthenticationConfigurationInput::deserialize(deser)?);
138                    }
139                }
140                _ => {}
141            }
142            Ok(())
143        })
144    }
145}
146
147impl crate::types::TestConnectionInput {
148    /// Deserializes this structure from a [`ShapeDeserializer`].
149    pub fn deserialize(
150        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
151    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
152        let mut builder = Self::builder();
153        builder.deserialize_members(deserializer)?;
154        builder.connection_properties = builder.connection_properties.or(Some(::std::collections::HashMap::new()));
155        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
156    }
157}