Skip to main content

aws_sdk_glue/schema_serde/
shape_create_iceberg_table_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CREATEICEBERGTABLEINPUT_MEMBER_LOCATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#CreateIcebergTableInput$Location",
5        "com.amazonaws.glue",
6        "CreateIcebergTableInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "Location",
10    0,
11);
12static CREATEICEBERGTABLEINPUT_MEMBER_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#CreateIcebergTableInput$Schema",
15        "com.amazonaws.glue",
16        "CreateIcebergTableInput",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "Schema",
20    1,
21);
22static CREATEICEBERGTABLEINPUT_MEMBER_PARTITION_SPEC: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#CreateIcebergTableInput$PartitionSpec",
25        "com.amazonaws.glue",
26        "CreateIcebergTableInput",
27    ),
28    ::aws_smithy_schema::ShapeType::Structure,
29    "PartitionSpec",
30    2,
31);
32static CREATEICEBERGTABLEINPUT_MEMBER_WRITE_ORDER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#CreateIcebergTableInput$WriteOrder",
35        "com.amazonaws.glue",
36        "CreateIcebergTableInput",
37    ),
38    ::aws_smithy_schema::ShapeType::Structure,
39    "WriteOrder",
40    3,
41);
42static CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#StringToStringMap$key", "com.amazonaws.glue", "StringToStringMap"),
44    ::aws_smithy_schema::ShapeType::String,
45    "key",
46    0,
47);
48static CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
49    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#StringToStringMap$value", "com.amazonaws.glue", "StringToStringMap"),
50    ::aws_smithy_schema::ShapeType::String,
51    "value",
52    1,
53);
54static CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
55    ::aws_smithy_schema::ShapeId::from_parts(
56        "com.amazonaws.glue#CreateIcebergTableInput$Properties",
57        "com.amazonaws.glue",
58        "CreateIcebergTableInput",
59    ),
60    ::aws_smithy_schema::ShapeType::Map,
61    "Properties",
62    4,
63)
64.with_map_members(
65    &CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES_KEY,
66    &CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES_VALUE,
67);
68static CREATEICEBERGTABLEINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
69    ::aws_smithy_schema::ShapeId::from_parts(
70        "com.amazonaws.glue#CreateIcebergTableInput",
71        "com.amazonaws.glue",
72        "CreateIcebergTableInput",
73    ),
74    ::aws_smithy_schema::ShapeType::Structure,
75    &[
76        &CREATEICEBERGTABLEINPUT_MEMBER_LOCATION,
77        &CREATEICEBERGTABLEINPUT_MEMBER_SCHEMA,
78        &CREATEICEBERGTABLEINPUT_MEMBER_PARTITION_SPEC,
79        &CREATEICEBERGTABLEINPUT_MEMBER_WRITE_ORDER,
80        &CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES,
81    ],
82);
83impl crate::types::CreateIcebergTableInput {
84    /// The schema for this shape.
85    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CREATEICEBERGTABLEINPUT_SCHEMA;
86}
87impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::CreateIcebergTableInput {
88    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
89        Self::SCHEMA
90    }
91
92    #[allow(unused_variables, clippy::diverging_sub_expression)]
93    fn serialize_members(
94        &self,
95        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
96    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
97        {
98            let val = &self.location;
99            ser.write_string(&CREATEICEBERGTABLEINPUT_MEMBER_LOCATION, val)?;
100        }
101        if let Some(ref val) = self.schema {
102            ser.write_struct(&CREATEICEBERGTABLEINPUT_MEMBER_SCHEMA, val)?;
103        }
104        if let Some(ref val) = self.partition_spec {
105            ser.write_struct(&CREATEICEBERGTABLEINPUT_MEMBER_PARTITION_SPEC, val)?;
106        }
107        if let Some(ref val) = self.write_order {
108            ser.write_struct(&CREATEICEBERGTABLEINPUT_MEMBER_WRITE_ORDER, val)?;
109        }
110        if let Some(ref val) = self.properties {
111            ser.write_map(
112                &CREATEICEBERGTABLEINPUT_MEMBER_PROPERTIES,
113                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
114                    for (key, value) in val {
115                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
116                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
117                    }
118                    Ok(())
119                },
120            )?;
121        }
122        Ok(())
123    }
124}
125impl crate::types::builders::CreateIcebergTableInputBuilder {
126    #[allow(
127        unused_variables,
128        unreachable_code,
129        clippy::single_match,
130        clippy::match_single_binding,
131        clippy::diverging_sub_expression
132    )]
133    pub(crate) fn deserialize_members(
134        &mut self,
135        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
136    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
137        deserializer.read_struct(&CREATEICEBERGTABLEINPUT_SCHEMA, &mut |member, deser| {
138            match member.member_index() {
139                Some(0) => {
140                    self.location = Some(deser.read_string(member)?);
141                }
142                Some(1) => {
143                    if deser.is_null() {
144                        deser.read_null()?;
145                    } else {
146                        self.schema = Some(crate::types::IcebergSchema::deserialize(deser)?);
147                    }
148                }
149                Some(2) => {
150                    if deser.is_null() {
151                        deser.read_null()?;
152                    } else {
153                        self.partition_spec = Some(crate::types::IcebergPartitionSpec::deserialize(deser)?);
154                    }
155                }
156                Some(3) => {
157                    if deser.is_null() {
158                        deser.read_null()?;
159                    } else {
160                        self.write_order = Some(crate::types::IcebergSortOrder::deserialize(deser)?);
161                    }
162                }
163                Some(4) => {
164                    if deser.is_null() {
165                        deser.read_null()?;
166                    } else {
167                        self.properties = Some(deser.read_string_string_map(member)?);
168                    }
169                }
170                _ => {}
171            }
172            Ok(())
173        })
174    }
175}
176
177impl crate::types::CreateIcebergTableInput {
178    /// Deserializes this structure from a [`ShapeDeserializer`].
179    pub fn deserialize(
180        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
181    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
182        let mut builder = Self::builder();
183        builder.deserialize_members(deserializer)?;
184        builder.location = builder.location.or(Some(String::new()));
185        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
186    }
187}