Skip to main content

aws_sdk_glue/schema_serde/
shape_batch_get_partition_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static BATCHGETPARTITIONINPUT_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#BatchGetPartitionInput$CatalogId",
5        "com.amazonaws.glue.synthetic",
6        "BatchGetPartitionInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "CatalogId",
10    0,
11);
12static BATCHGETPARTITIONINPUT_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#BatchGetPartitionInput$DatabaseName",
15        "com.amazonaws.glue.synthetic",
16        "BatchGetPartitionInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "DatabaseName",
20    1,
21);
22static BATCHGETPARTITIONINPUT_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#BatchGetPartitionInput$TableName",
25        "com.amazonaws.glue.synthetic",
26        "BatchGetPartitionInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "TableName",
30    2,
31);
32static BATCHGETPARTITIONINPUT_MEMBER_PARTITIONS_TO_GET_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#BatchGetPartitionValueList$member",
35        "com.amazonaws.glue",
36        "BatchGetPartitionValueList",
37    ),
38    ::aws_smithy_schema::ShapeType::Structure,
39    "member",
40    0,
41);
42static BATCHGETPARTITIONINPUT_MEMBER_PARTITIONS_TO_GET: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.glue.synthetic#BatchGetPartitionInput$PartitionsToGet",
45        "com.amazonaws.glue.synthetic",
46        "BatchGetPartitionInput",
47    ),
48    ::aws_smithy_schema::ShapeType::List,
49    "PartitionsToGet",
50    3,
51)
52.with_list_member(&BATCHGETPARTITIONINPUT_MEMBER_PARTITIONS_TO_GET_MEMBER);
53static BATCHGETPARTITIONINPUT_MEMBER_AUDIT_CONTEXT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
54    ::aws_smithy_schema::ShapeId::from_parts(
55        "com.amazonaws.glue.synthetic#BatchGetPartitionInput$AuditContext",
56        "com.amazonaws.glue.synthetic",
57        "BatchGetPartitionInput",
58    ),
59    ::aws_smithy_schema::ShapeType::Structure,
60    "AuditContext",
61    4,
62);
63static BATCHGETPARTITIONINPUT_MEMBER_QUERY_SESSION_CONTEXT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
64    ::aws_smithy_schema::ShapeId::from_parts(
65        "com.amazonaws.glue.synthetic#BatchGetPartitionInput$QuerySessionContext",
66        "com.amazonaws.glue.synthetic",
67        "BatchGetPartitionInput",
68    ),
69    ::aws_smithy_schema::ShapeType::Structure,
70    "QuerySessionContext",
71    5,
72);
73static BATCHGETPARTITIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
74    ::aws_smithy_schema::ShapeId::from_parts(
75        "com.amazonaws.glue.synthetic#BatchGetPartitionInput",
76        "com.amazonaws.glue.synthetic",
77        "BatchGetPartitionInput",
78    ),
79    ::aws_smithy_schema::ShapeType::Structure,
80    &[
81        &BATCHGETPARTITIONINPUT_MEMBER_CATALOG_ID,
82        &BATCHGETPARTITIONINPUT_MEMBER_DATABASE_NAME,
83        &BATCHGETPARTITIONINPUT_MEMBER_TABLE_NAME,
84        &BATCHGETPARTITIONINPUT_MEMBER_PARTITIONS_TO_GET,
85        &BATCHGETPARTITIONINPUT_MEMBER_AUDIT_CONTEXT,
86        &BATCHGETPARTITIONINPUT_MEMBER_QUERY_SESSION_CONTEXT,
87    ],
88)
89.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
90.with_original_name("BatchGetPartitionRequest");
91impl crate::operation::batch_get_partition::BatchGetPartitionInput {
92    /// The schema for this shape.
93    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &BATCHGETPARTITIONINPUT_SCHEMA;
94}
95impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::batch_get_partition::BatchGetPartitionInput {
96    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
97        Self::SCHEMA
98    }
99
100    #[allow(unused_variables, clippy::diverging_sub_expression)]
101    fn serialize_members(
102        &self,
103        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
104    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
105        if let Some(ref val) = self.catalog_id {
106            ser.write_string(&BATCHGETPARTITIONINPUT_MEMBER_CATALOG_ID, val)?;
107        }
108        if let Some(ref val) = self.database_name {
109            ser.write_string(&BATCHGETPARTITIONINPUT_MEMBER_DATABASE_NAME, val)?;
110        }
111        if let Some(ref val) = self.table_name {
112            ser.write_string(&BATCHGETPARTITIONINPUT_MEMBER_TABLE_NAME, val)?;
113        }
114        if let Some(ref val) = self.partitions_to_get {
115            ser.write_list(
116                &BATCHGETPARTITIONINPUT_MEMBER_PARTITIONS_TO_GET,
117                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
118                    for item in val {
119                        ser.write_struct(crate::types::PartitionValueList::SCHEMA, item)?;
120                    }
121                    Ok(())
122                },
123            )?;
124        }
125        if let Some(ref val) = self.audit_context {
126            ser.write_struct(&BATCHGETPARTITIONINPUT_MEMBER_AUDIT_CONTEXT, val)?;
127        }
128        if let Some(ref val) = self.query_session_context {
129            ser.write_struct(&BATCHGETPARTITIONINPUT_MEMBER_QUERY_SESSION_CONTEXT, val)?;
130        }
131        Ok(())
132    }
133}
134impl crate::operation::batch_get_partition::builders::BatchGetPartitionInputBuilder {
135    #[allow(
136        unused_variables,
137        unreachable_code,
138        clippy::single_match,
139        clippy::match_single_binding,
140        clippy::diverging_sub_expression
141    )]
142    pub(crate) fn deserialize_members(
143        &mut self,
144        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
145    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
146        deserializer.read_struct(&BATCHGETPARTITIONINPUT_SCHEMA, &mut |member, deser| {
147            match member.member_index() {
148                Some(0) => {
149                    if deser.is_null() {
150                        deser.read_null()?;
151                    } else {
152                        self.catalog_id = Some(deser.read_string(member)?);
153                    }
154                }
155                Some(1) => {
156                    if deser.is_null() {
157                        deser.read_null()?;
158                    } else {
159                        self.database_name = Some(deser.read_string(member)?);
160                    }
161                }
162                Some(2) => {
163                    if deser.is_null() {
164                        deser.read_null()?;
165                    } else {
166                        self.table_name = Some(deser.read_string(member)?);
167                    }
168                }
169                Some(3) => {
170                    if deser.is_null() {
171                        deser.read_null()?;
172                    } else {
173                        self.partitions_to_get = Some({
174                            let mut container = Vec::new();
175                            deser.read_list(member, &mut |deser| {
176                                container.push(crate::types::PartitionValueList::deserialize(deser)?);
177                                Ok(())
178                            })?;
179                            container
180                        });
181                    }
182                }
183                Some(4) => {
184                    if deser.is_null() {
185                        deser.read_null()?;
186                    } else {
187                        self.audit_context = Some(crate::types::AuditContext::deserialize(deser)?);
188                    }
189                }
190                Some(5) => {
191                    if deser.is_null() {
192                        deser.read_null()?;
193                    } else {
194                        self.query_session_context = Some(crate::types::QuerySessionContext::deserialize(deser)?);
195                    }
196                }
197                _ => {}
198            }
199            Ok(())
200        })
201    }
202}
203
204impl crate::operation::batch_get_partition::BatchGetPartitionInput {
205    /// Deserializes this structure from a [`ShapeDeserializer`].
206    pub fn deserialize(
207        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
208    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
209        let mut builder = Self::builder();
210        builder.deserialize_members(deserializer)?;
211        builder.database_name = builder.database_name.or(Some(String::new()));
212        builder.table_name = builder.table_name.or(Some(String::new()));
213        builder.partitions_to_get = builder.partitions_to_get.or(Some(Vec::new()));
214        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
215    }
216}