Skip to main content

aws_sdk_glue/schema_serde/
shape_rest_configuration.rs

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