Skip to main content

aws_sdk_glue/schema_serde/
shape_batch_delete_partition_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static BATCHDELETEPARTITIONINPUT_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#BatchDeletePartitionInput$CatalogId",
5        "com.amazonaws.glue.synthetic",
6        "BatchDeletePartitionInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "CatalogId",
10    0,
11);
12static BATCHDELETEPARTITIONINPUT_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#BatchDeletePartitionInput$DatabaseName",
15        "com.amazonaws.glue.synthetic",
16        "BatchDeletePartitionInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "DatabaseName",
20    1,
21);
22static BATCHDELETEPARTITIONINPUT_MEMBER_TABLE_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue.synthetic#BatchDeletePartitionInput$TableName",
25        "com.amazonaws.glue.synthetic",
26        "BatchDeletePartitionInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "TableName",
30    2,
31);
32static BATCHDELETEPARTITIONINPUT_MEMBER_PARTITIONS_TO_DELETE_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#BatchDeletePartitionValueList$member",
35        "com.amazonaws.glue",
36        "BatchDeletePartitionValueList",
37    ),
38    ::aws_smithy_schema::ShapeType::Structure,
39    "member",
40    0,
41);
42static BATCHDELETEPARTITIONINPUT_MEMBER_PARTITIONS_TO_DELETE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.glue.synthetic#BatchDeletePartitionInput$PartitionsToDelete",
45        "com.amazonaws.glue.synthetic",
46        "BatchDeletePartitionInput",
47    ),
48    ::aws_smithy_schema::ShapeType::List,
49    "PartitionsToDelete",
50    3,
51)
52.with_list_member(&BATCHDELETEPARTITIONINPUT_MEMBER_PARTITIONS_TO_DELETE_MEMBER);
53static BATCHDELETEPARTITIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
54    ::aws_smithy_schema::ShapeId::from_parts(
55        "com.amazonaws.glue.synthetic#BatchDeletePartitionInput",
56        "com.amazonaws.glue.synthetic",
57        "BatchDeletePartitionInput",
58    ),
59    ::aws_smithy_schema::ShapeType::Structure,
60    &[
61        &BATCHDELETEPARTITIONINPUT_MEMBER_CATALOG_ID,
62        &BATCHDELETEPARTITIONINPUT_MEMBER_DATABASE_NAME,
63        &BATCHDELETEPARTITIONINPUT_MEMBER_TABLE_NAME,
64        &BATCHDELETEPARTITIONINPUT_MEMBER_PARTITIONS_TO_DELETE,
65    ],
66)
67.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
68.with_original_name("BatchDeletePartitionRequest");
69impl crate::operation::batch_delete_partition::BatchDeletePartitionInput {
70    /// The schema for this shape.
71    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &BATCHDELETEPARTITIONINPUT_SCHEMA;
72}
73impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::batch_delete_partition::BatchDeletePartitionInput {
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(&BATCHDELETEPARTITIONINPUT_MEMBER_CATALOG_ID, val)?;
85        }
86        if let Some(ref val) = self.database_name {
87            ser.write_string(&BATCHDELETEPARTITIONINPUT_MEMBER_DATABASE_NAME, val)?;
88        }
89        if let Some(ref val) = self.table_name {
90            ser.write_string(&BATCHDELETEPARTITIONINPUT_MEMBER_TABLE_NAME, val)?;
91        }
92        if let Some(ref val) = self.partitions_to_delete {
93            ser.write_list(
94                &BATCHDELETEPARTITIONINPUT_MEMBER_PARTITIONS_TO_DELETE,
95                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
96                    for item in val {
97                        ser.write_struct(crate::types::PartitionValueList::SCHEMA, item)?;
98                    }
99                    Ok(())
100                },
101            )?;
102        }
103        Ok(())
104    }
105}
106impl crate::operation::batch_delete_partition::builders::BatchDeletePartitionInputBuilder {
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(&BATCHDELETEPARTITIONINPUT_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.table_name = Some(deser.read_string(member)?);
139                    }
140                }
141                Some(3) => {
142                    if deser.is_null() {
143                        deser.read_null()?;
144                    } else {
145                        self.partitions_to_delete = Some({
146                            let mut container = Vec::new();
147                            deser.read_list(member, &mut |deser| {
148                                container.push(crate::types::PartitionValueList::deserialize(deser)?);
149                                Ok(())
150                            })?;
151                            container
152                        });
153                    }
154                }
155                _ => {}
156            }
157            Ok(())
158        })
159    }
160}
161
162impl crate::operation::batch_delete_partition::BatchDeletePartitionInput {
163    /// Deserializes this structure from a [`ShapeDeserializer`].
164    pub fn deserialize(
165        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
166    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
167        let mut builder = Self::builder();
168        builder.deserialize_members(deserializer)?;
169        builder.database_name = builder.database_name.or(Some(String::new()));
170        builder.table_name = builder.table_name.or(Some(String::new()));
171        builder.partitions_to_delete = builder.partitions_to_delete.or(Some(Vec::new()));
172        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
173    }
174}