Skip to main content

aws_sdk_glue/schema_serde/
shape_delete_partition_input_input.rs

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