Skip to main content

aws_sdk_glue/schema_serde/
shape_configuration_object.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CONFIGURATIONOBJECT_MEMBER_DEFAULT_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#ConfigurationObject$DefaultValue",
5        "com.amazonaws.glue",
6        "ConfigurationObject",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "DefaultValue",
10    0,
11);
12static CONFIGURATIONOBJECT_MEMBER_ALLOWED_VALUES_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#AllowedValuesStringList$member",
15        "com.amazonaws.glue",
16        "AllowedValuesStringList",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "member",
20    0,
21);
22static CONFIGURATIONOBJECT_MEMBER_ALLOWED_VALUES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#ConfigurationObject$AllowedValues",
25        "com.amazonaws.glue",
26        "ConfigurationObject",
27    ),
28    ::aws_smithy_schema::ShapeType::List,
29    "AllowedValues",
30    1,
31)
32.with_list_member(&CONFIGURATIONOBJECT_MEMBER_ALLOWED_VALUES_MEMBER);
33static CONFIGURATIONOBJECT_MEMBER_MIN_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
34    ::aws_smithy_schema::ShapeId::from_parts(
35        "com.amazonaws.glue#ConfigurationObject$MinValue",
36        "com.amazonaws.glue",
37        "ConfigurationObject",
38    ),
39    ::aws_smithy_schema::ShapeType::String,
40    "MinValue",
41    2,
42);
43static CONFIGURATIONOBJECT_MEMBER_MAX_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
44    ::aws_smithy_schema::ShapeId::from_parts(
45        "com.amazonaws.glue#ConfigurationObject$MaxValue",
46        "com.amazonaws.glue",
47        "ConfigurationObject",
48    ),
49    ::aws_smithy_schema::ShapeType::String,
50    "MaxValue",
51    3,
52);
53static CONFIGURATIONOBJECT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
54    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#ConfigurationObject", "com.amazonaws.glue", "ConfigurationObject"),
55    ::aws_smithy_schema::ShapeType::Structure,
56    &[
57        &CONFIGURATIONOBJECT_MEMBER_DEFAULT_VALUE,
58        &CONFIGURATIONOBJECT_MEMBER_ALLOWED_VALUES,
59        &CONFIGURATIONOBJECT_MEMBER_MIN_VALUE,
60        &CONFIGURATIONOBJECT_MEMBER_MAX_VALUE,
61    ],
62);
63impl crate::types::ConfigurationObject {
64    /// The schema for this shape.
65    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CONFIGURATIONOBJECT_SCHEMA;
66}
67impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ConfigurationObject {
68    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
69        Self::SCHEMA
70    }
71
72    #[allow(unused_variables, clippy::diverging_sub_expression)]
73    fn serialize_members(
74        &self,
75        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
76    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
77        if let Some(ref val) = self.default_value {
78            ser.write_string(&CONFIGURATIONOBJECT_MEMBER_DEFAULT_VALUE, val)?;
79        }
80        if let Some(ref val) = self.allowed_values {
81            ser.write_list(
82                &CONFIGURATIONOBJECT_MEMBER_ALLOWED_VALUES,
83                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
84                    for item in val {
85                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
86                    }
87                    Ok(())
88                },
89            )?;
90        }
91        if let Some(ref val) = self.min_value {
92            ser.write_string(&CONFIGURATIONOBJECT_MEMBER_MIN_VALUE, val)?;
93        }
94        if let Some(ref val) = self.max_value {
95            ser.write_string(&CONFIGURATIONOBJECT_MEMBER_MAX_VALUE, val)?;
96        }
97        Ok(())
98    }
99}
100impl crate::types::builders::ConfigurationObjectBuilder {
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(&CONFIGURATIONOBJECT_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.default_value = Some(deser.read_string(member)?);
119                    }
120                }
121                Some(1) => {
122                    if deser.is_null() {
123                        deser.read_null()?;
124                    } else {
125                        self.allowed_values = Some(deser.read_string_list(member)?);
126                    }
127                }
128                Some(2) => {
129                    if deser.is_null() {
130                        deser.read_null()?;
131                    } else {
132                        self.min_value = Some(deser.read_string(member)?);
133                    }
134                }
135                Some(3) => {
136                    if deser.is_null() {
137                        deser.read_null()?;
138                    } else {
139                        self.max_value = Some(deser.read_string(member)?);
140                    }
141                }
142                _ => {}
143            }
144            Ok(())
145        })
146    }
147}
148
149impl crate::types::ConfigurationObject {
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}