Skip to main content

aws_sdk_glue/schema_serde/
shape_batch_delete_table_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static BATCHDELETETABLEINPUT_MEMBER_CATALOG_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue.synthetic#BatchDeleteTableInput$CatalogId",
5        "com.amazonaws.glue.synthetic",
6        "BatchDeleteTableInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "CatalogId",
10    0,
11);
12static BATCHDELETETABLEINPUT_MEMBER_DATABASE_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue.synthetic#BatchDeleteTableInput$DatabaseName",
15        "com.amazonaws.glue.synthetic",
16        "BatchDeleteTableInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "DatabaseName",
20    1,
21);
22static BATCHDELETETABLEINPUT_MEMBER_TABLES_TO_DELETE_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#BatchDeleteTableNameList$member",
25        "com.amazonaws.glue",
26        "BatchDeleteTableNameList",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "member",
30    0,
31);
32static BATCHDELETETABLEINPUT_MEMBER_TABLES_TO_DELETE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue.synthetic#BatchDeleteTableInput$TablesToDelete",
35        "com.amazonaws.glue.synthetic",
36        "BatchDeleteTableInput",
37    ),
38    ::aws_smithy_schema::ShapeType::List,
39    "TablesToDelete",
40    2,
41)
42.with_list_member(&BATCHDELETETABLEINPUT_MEMBER_TABLES_TO_DELETE_MEMBER);
43static BATCHDELETETABLEINPUT_MEMBER_TRANSACTION_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
44    ::aws_smithy_schema::ShapeId::from_parts(
45        "com.amazonaws.glue.synthetic#BatchDeleteTableInput$TransactionId",
46        "com.amazonaws.glue.synthetic",
47        "BatchDeleteTableInput",
48    ),
49    ::aws_smithy_schema::ShapeType::String,
50    "TransactionId",
51    3,
52);
53static BATCHDELETETABLEINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
54    ::aws_smithy_schema::ShapeId::from_parts(
55        "com.amazonaws.glue.synthetic#BatchDeleteTableInput",
56        "com.amazonaws.glue.synthetic",
57        "BatchDeleteTableInput",
58    ),
59    ::aws_smithy_schema::ShapeType::Structure,
60    &[
61        &BATCHDELETETABLEINPUT_MEMBER_CATALOG_ID,
62        &BATCHDELETETABLEINPUT_MEMBER_DATABASE_NAME,
63        &BATCHDELETETABLEINPUT_MEMBER_TABLES_TO_DELETE,
64        &BATCHDELETETABLEINPUT_MEMBER_TRANSACTION_ID,
65    ],
66)
67.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
68.with_original_name("BatchDeleteTableRequest");
69impl crate::operation::batch_delete_table::BatchDeleteTableInput {
70    /// The schema for this shape.
71    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &BATCHDELETETABLEINPUT_SCHEMA;
72}
73impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::batch_delete_table::BatchDeleteTableInput {
74    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
75        Self::SCHEMA
76    }
77
78    #[allow(unused_variables, clippy::diverging_sub_expression)]
79    fn serialize_members(
80        &self,
81        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
82    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
83        if let Some(ref val) = self.catalog_id {
84            ser.write_string(&BATCHDELETETABLEINPUT_MEMBER_CATALOG_ID, val)?;
85        }
86        if let Some(ref val) = self.database_name {
87            ser.write_string(&BATCHDELETETABLEINPUT_MEMBER_DATABASE_NAME, val)?;
88        }
89        if let Some(ref val) = self.tables_to_delete {
90            ser.write_list(
91                &BATCHDELETETABLEINPUT_MEMBER_TABLES_TO_DELETE,
92                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
93                    for item in val {
94                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
95                    }
96                    Ok(())
97                },
98            )?;
99        }
100        if let Some(ref val) = self.transaction_id {
101            ser.write_string(&BATCHDELETETABLEINPUT_MEMBER_TRANSACTION_ID, val)?;
102        }
103        Ok(())
104    }
105}
106impl crate::operation::batch_delete_table::builders::BatchDeleteTableInputBuilder {
107    #[allow(
108        unused_variables,
109        unreachable_code,
110        clippy::single_match,
111        clippy::match_single_binding,
112        clippy::diverging_sub_expression
113    )]
114    pub(crate) fn deserialize_members(
115        &mut self,
116        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
117    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
118        deserializer.read_struct(&BATCHDELETETABLEINPUT_SCHEMA, &mut |member, deser| {
119            match member.member_index() {
120                Some(0) => {
121                    if deser.is_null() {
122                        deser.read_null()?;
123                    } else {
124                        self.catalog_id = Some(deser.read_string(member)?);
125                    }
126                }
127                Some(1) => {
128                    if deser.is_null() {
129                        deser.read_null()?;
130                    } else {
131                        self.database_name = Some(deser.read_string(member)?);
132                    }
133                }
134                Some(2) => {
135                    if deser.is_null() {
136                        deser.read_null()?;
137                    } else {
138                        self.tables_to_delete = Some(deser.read_string_list(member)?);
139                    }
140                }
141                Some(3) => {
142                    if deser.is_null() {
143                        deser.read_null()?;
144                    } else {
145                        self.transaction_id = Some(deser.read_string(member)?);
146                    }
147                }
148                _ => {}
149            }
150            Ok(())
151        })
152    }
153}
154
155impl crate::operation::batch_delete_table::BatchDeleteTableInput {
156    /// Deserializes this structure from a [`ShapeDeserializer`].
157    pub fn deserialize(
158        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
159    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
160        let mut builder = Self::builder();
161        builder.deserialize_members(deserializer)?;
162        builder.database_name = builder.database_name.or(Some(String::new()));
163        builder.tables_to_delete = builder.tables_to_delete.or(Some(Vec::new()));
164        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
165    }
166}