aws_sdk_glue/schema_serde/
shape_partition_index_descriptor.rs1static PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3 ::aws_smithy_schema::ShapeId::from_parts(
4 "com.amazonaws.glue#PartitionIndexDescriptor$IndexName",
5 "com.amazonaws.glue",
6 "PartitionIndexDescriptor",
7 ),
8 ::aws_smithy_schema::ShapeType::String,
9 "IndexName",
10 0,
11);
12static PARTITIONINDEXDESCRIPTOR_MEMBER_KEYS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13 ::aws_smithy_schema::ShapeId::from_parts(
14 "com.amazonaws.glue#KeySchemaElementList$member",
15 "com.amazonaws.glue",
16 "KeySchemaElementList",
17 ),
18 ::aws_smithy_schema::ShapeType::Structure,
19 "member",
20 0,
21);
22static PARTITIONINDEXDESCRIPTOR_MEMBER_KEYS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23 ::aws_smithy_schema::ShapeId::from_parts(
24 "com.amazonaws.glue#PartitionIndexDescriptor$Keys",
25 "com.amazonaws.glue",
26 "PartitionIndexDescriptor",
27 ),
28 ::aws_smithy_schema::ShapeType::List,
29 "Keys",
30 1,
31)
32.with_list_member(&PARTITIONINDEXDESCRIPTOR_MEMBER_KEYS_MEMBER);
33static PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_STATUS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
34 ::aws_smithy_schema::ShapeId::from_parts(
35 "com.amazonaws.glue#PartitionIndexDescriptor$IndexStatus",
36 "com.amazonaws.glue",
37 "PartitionIndexDescriptor",
38 ),
39 ::aws_smithy_schema::ShapeType::String,
40 "IndexStatus",
41 2,
42);
43static PARTITIONINDEXDESCRIPTOR_MEMBER_BACKFILL_ERRORS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
44 ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#BackfillErrors$member", "com.amazonaws.glue", "BackfillErrors"),
45 ::aws_smithy_schema::ShapeType::Structure,
46 "member",
47 0,
48);
49static PARTITIONINDEXDESCRIPTOR_MEMBER_BACKFILL_ERRORS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
50 ::aws_smithy_schema::ShapeId::from_parts(
51 "com.amazonaws.glue#PartitionIndexDescriptor$BackfillErrors",
52 "com.amazonaws.glue",
53 "PartitionIndexDescriptor",
54 ),
55 ::aws_smithy_schema::ShapeType::List,
56 "BackfillErrors",
57 3,
58)
59.with_list_member(&PARTITIONINDEXDESCRIPTOR_MEMBER_BACKFILL_ERRORS_MEMBER);
60static PARTITIONINDEXDESCRIPTOR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
61 ::aws_smithy_schema::ShapeId::from_parts(
62 "com.amazonaws.glue#PartitionIndexDescriptor",
63 "com.amazonaws.glue",
64 "PartitionIndexDescriptor",
65 ),
66 ::aws_smithy_schema::ShapeType::Structure,
67 &[
68 &PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_NAME,
69 &PARTITIONINDEXDESCRIPTOR_MEMBER_KEYS,
70 &PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_STATUS,
71 &PARTITIONINDEXDESCRIPTOR_MEMBER_BACKFILL_ERRORS,
72 ],
73);
74impl crate::types::PartitionIndexDescriptor {
75 pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &PARTITIONINDEXDESCRIPTOR_SCHEMA;
77}
78impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::PartitionIndexDescriptor {
79 fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
80 Self::SCHEMA
81 }
82
83 #[allow(unused_variables, clippy::diverging_sub_expression)]
84 fn serialize_members(
85 &self,
86 ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
87 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
88 {
89 let val = &self.index_name;
90 ser.write_string(&PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_NAME, val)?;
91 }
92 {
93 let val = &self.keys;
94
95 ser.write_list(
96 &PARTITIONINDEXDESCRIPTOR_MEMBER_KEYS,
97 &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
98 for item in val {
99 ser.write_struct(crate::types::KeySchemaElement::SCHEMA, item)?;
100 }
101 Ok(())
102 },
103 )?;
104 }
105 {
106 let val = &self.index_status;
107 ser.write_string(&PARTITIONINDEXDESCRIPTOR_MEMBER_INDEX_STATUS, val.as_str())?;
108 }
109 if let Some(ref val) = self.backfill_errors {
110 ser.write_list(
111 &PARTITIONINDEXDESCRIPTOR_MEMBER_BACKFILL_ERRORS,
112 &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
113 for item in val {
114 ser.write_struct(crate::types::BackfillError::SCHEMA, item)?;
115 }
116 Ok(())
117 },
118 )?;
119 }
120 Ok(())
121 }
122}
123impl crate::types::builders::PartitionIndexDescriptorBuilder {
124 #[allow(
125 unused_variables,
126 unreachable_code,
127 clippy::single_match,
128 clippy::match_single_binding,
129 clippy::diverging_sub_expression
130 )]
131 pub(crate) fn deserialize_members(
132 &mut self,
133 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
134 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
135 deserializer.read_struct(&PARTITIONINDEXDESCRIPTOR_SCHEMA, &mut |member, deser| {
136 match member.member_index() {
137 Some(0) => {
138 self.index_name = Some(deser.read_string(member)?);
139 }
140 Some(1) => {
141 self.keys = Some({
142 let mut container = Vec::new();
143 deser.read_list(member, &mut |deser| {
144 container.push(crate::types::KeySchemaElement::deserialize(deser)?);
145 Ok(())
146 })?;
147 container
148 });
149 }
150 Some(2) => {
151 self.index_status = Some(crate::types::PartitionIndexStatus::from(deser.read_string(member)?.as_str()));
152 }
153 Some(3) => {
154 if deser.is_null() {
155 deser.read_null()?;
156 } else {
157 self.backfill_errors = Some({
158 let mut container = Vec::new();
159 deser.read_list(member, &mut |deser| {
160 container.push(crate::types::BackfillError::deserialize(deser)?);
161 Ok(())
162 })?;
163 container
164 });
165 }
166 }
167 _ => {}
168 }
169 Ok(())
170 })
171 }
172}
173
174impl crate::types::PartitionIndexDescriptor {
175 pub fn deserialize(
177 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
178 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
179 let mut builder = Self::builder();
180 builder.deserialize_members(deserializer)?;
181 builder.index_name = builder.index_name.or(Some(String::new()));
182 builder.keys = builder.keys.or(Some(Vec::new()));
183 builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
184 }
185}