Skip to main content

aws_sdk_glue/schema_serde/
shape_target_table_config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static TARGETTABLECONFIG_MEMBER_UNNEST_SPEC: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#TargetTableConfig$UnnestSpec",
5        "com.amazonaws.glue",
6        "TargetTableConfig",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "UnnestSpec",
10    0,
11);
12static TARGETTABLECONFIG_MEMBER_PARTITION_SPEC_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#IntegrationPartitionSpecList$member",
15        "com.amazonaws.glue",
16        "IntegrationPartitionSpecList",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "member",
20    0,
21);
22static TARGETTABLECONFIG_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#TargetTableConfig$PartitionSpec",
25        "com.amazonaws.glue",
26        "TargetTableConfig",
27    ),
28    ::aws_smithy_schema::ShapeType::List,
29    "PartitionSpec",
30    1,
31)
32.with_list_member(&TARGETTABLECONFIG_MEMBER_PARTITION_SPEC_MEMBER);
33static TARGETTABLECONFIG_MEMBER_TARGET_TABLE_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
34    ::aws_smithy_schema::ShapeId::from_parts(
35        "com.amazonaws.glue#TargetTableConfig$TargetTableName",
36        "com.amazonaws.glue",
37        "TargetTableConfig",
38    ),
39    ::aws_smithy_schema::ShapeType::String,
40    "TargetTableName",
41    2,
42);
43static TARGETTABLECONFIG_MEMBER_INTEGRATION_ARN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
44    ::aws_smithy_schema::ShapeId::from_parts(
45        "com.amazonaws.glue#TargetTableConfig$IntegrationArn",
46        "com.amazonaws.glue",
47        "TargetTableConfig",
48    ),
49    ::aws_smithy_schema::ShapeType::String,
50    "IntegrationArn",
51    3,
52);
53static TARGETTABLECONFIG_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
54    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#TargetTableConfig", "com.amazonaws.glue", "TargetTableConfig"),
55    ::aws_smithy_schema::ShapeType::Structure,
56    &[
57        &TARGETTABLECONFIG_MEMBER_UNNEST_SPEC,
58        &TARGETTABLECONFIG_MEMBER_PARTITION_SPEC,
59        &TARGETTABLECONFIG_MEMBER_TARGET_TABLE_NAME,
60        &TARGETTABLECONFIG_MEMBER_INTEGRATION_ARN,
61    ],
62);
63impl crate::types::TargetTableConfig {
64    /// The schema for this shape.
65    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &TARGETTABLECONFIG_SCHEMA;
66}
67impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::TargetTableConfig {
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.unnest_spec {
78            ser.write_string(&TARGETTABLECONFIG_MEMBER_UNNEST_SPEC, val.as_str())?;
79        }
80        if let Some(ref val) = self.partition_spec {
81            ser.write_list(
82                &TARGETTABLECONFIG_MEMBER_PARTITION_SPEC,
83                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
84                    for item in val {
85                        ser.write_struct(crate::types::IntegrationPartition::SCHEMA, item)?;
86                    }
87                    Ok(())
88                },
89            )?;
90        }
91        if let Some(ref val) = self.target_table_name {
92            ser.write_string(&TARGETTABLECONFIG_MEMBER_TARGET_TABLE_NAME, val)?;
93        }
94        if let Some(ref val) = self.integration_arn {
95            ser.write_string(&TARGETTABLECONFIG_MEMBER_INTEGRATION_ARN, val)?;
96        }
97        Ok(())
98    }
99}
100impl crate::types::builders::TargetTableConfigBuilder {
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(&TARGETTABLECONFIG_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.unnest_spec = Some(crate::types::UnnestSpec::from(deser.read_string(member)?.as_str()));
119                    }
120                }
121                Some(1) => {
122                    if deser.is_null() {
123                        deser.read_null()?;
124                    } else {
125                        self.partition_spec = Some({
126                            let mut container = Vec::new();
127                            deser.read_list(member, &mut |deser| {
128                                container.push(crate::types::IntegrationPartition::deserialize(deser)?);
129                                Ok(())
130                            })?;
131                            container
132                        });
133                    }
134                }
135                Some(2) => {
136                    if deser.is_null() {
137                        deser.read_null()?;
138                    } else {
139                        self.target_table_name = Some(deser.read_string(member)?);
140                    }
141                }
142                Some(3) => {
143                    if deser.is_null() {
144                        deser.read_null()?;
145                    } else {
146                        self.integration_arn = Some(deser.read_string(member)?);
147                    }
148                }
149                _ => {}
150            }
151            Ok(())
152        })
153    }
154}
155
156impl crate::types::TargetTableConfig {
157    /// Deserializes this structure from a [`ShapeDeserializer`].
158    pub fn deserialize(
159        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
160    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
161        let mut builder = Self::builder();
162        builder.deserialize_members(deserializer)?;
163        Ok(builder.build())
164    }
165}