Skip to main content

aws_sdk_glue/schema_serde/
shape_get_partition_input_input.rs

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