Skip to main content

aws_sdk_glue/schema_serde/
shape_get_mapping_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static GETMAPPINGINPUT_MEMBER_SOURCE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue.synthetic#GetMappingInput$Source",
5        "com.amazonaws.glue.synthetic",
6        "GetMappingInput",
7    ),
8    ::aws_smithy_schema::ShapeType::Structure,
9    "Source",
10    0,
11);
12static GETMAPPINGINPUT_MEMBER_SINKS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#CatalogEntries$member", "com.amazonaws.glue", "CatalogEntries"),
14    ::aws_smithy_schema::ShapeType::Structure,
15    "member",
16    0,
17);
18static GETMAPPINGINPUT_MEMBER_SINKS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
19    ::aws_smithy_schema::ShapeId::from_parts(
20        "com.amazonaws.glue.synthetic#GetMappingInput$Sinks",
21        "com.amazonaws.glue.synthetic",
22        "GetMappingInput",
23    ),
24    ::aws_smithy_schema::ShapeType::List,
25    "Sinks",
26    1,
27)
28.with_list_member(&GETMAPPINGINPUT_MEMBER_SINKS_MEMBER);
29static GETMAPPINGINPUT_MEMBER_LOCATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
30    ::aws_smithy_schema::ShapeId::from_parts(
31        "com.amazonaws.glue.synthetic#GetMappingInput$Location",
32        "com.amazonaws.glue.synthetic",
33        "GetMappingInput",
34    ),
35    ::aws_smithy_schema::ShapeType::Structure,
36    "Location",
37    2,
38);
39static GETMAPPINGINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
40    ::aws_smithy_schema::ShapeId::from_parts(
41        "com.amazonaws.glue.synthetic#GetMappingInput",
42        "com.amazonaws.glue.synthetic",
43        "GetMappingInput",
44    ),
45    ::aws_smithy_schema::ShapeType::Structure,
46    &[
47        &GETMAPPINGINPUT_MEMBER_SOURCE,
48        &GETMAPPINGINPUT_MEMBER_SINKS,
49        &GETMAPPINGINPUT_MEMBER_LOCATION,
50    ],
51)
52.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
53.with_original_name("GetMappingRequest");
54impl crate::operation::get_mapping::GetMappingInput {
55    /// The schema for this shape.
56    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &GETMAPPINGINPUT_SCHEMA;
57}
58impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::get_mapping::GetMappingInput {
59    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
60        Self::SCHEMA
61    }
62
63    #[allow(unused_variables, clippy::diverging_sub_expression)]
64    fn serialize_members(
65        &self,
66        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
67    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
68        if let Some(ref val) = self.source {
69            ser.write_struct(&GETMAPPINGINPUT_MEMBER_SOURCE, val)?;
70        }
71        if let Some(ref val) = self.sinks {
72            ser.write_list(
73                &GETMAPPINGINPUT_MEMBER_SINKS,
74                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
75                    for item in val {
76                        ser.write_struct(crate::types::CatalogEntry::SCHEMA, item)?;
77                    }
78                    Ok(())
79                },
80            )?;
81        }
82        if let Some(ref val) = self.location {
83            ser.write_struct(&GETMAPPINGINPUT_MEMBER_LOCATION, val)?;
84        }
85        Ok(())
86    }
87}
88impl crate::operation::get_mapping::builders::GetMappingInputBuilder {
89    #[allow(
90        unused_variables,
91        unreachable_code,
92        clippy::single_match,
93        clippy::match_single_binding,
94        clippy::diverging_sub_expression
95    )]
96    pub(crate) fn deserialize_members(
97        &mut self,
98        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
99    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
100        deserializer.read_struct(&GETMAPPINGINPUT_SCHEMA, &mut |member, deser| {
101            match member.member_index() {
102                Some(0) => {
103                    if deser.is_null() {
104                        deser.read_null()?;
105                    } else {
106                        self.source = Some(crate::types::CatalogEntry::deserialize(deser)?);
107                    }
108                }
109                Some(1) => {
110                    if deser.is_null() {
111                        deser.read_null()?;
112                    } else {
113                        self.sinks = Some({
114                            let mut container = Vec::new();
115                            deser.read_list(member, &mut |deser| {
116                                container.push(crate::types::CatalogEntry::deserialize(deser)?);
117                                Ok(())
118                            })?;
119                            container
120                        });
121                    }
122                }
123                Some(2) => {
124                    if deser.is_null() {
125                        deser.read_null()?;
126                    } else {
127                        self.location = Some(crate::types::Location::deserialize(deser)?);
128                    }
129                }
130                _ => {}
131            }
132            Ok(())
133        })
134    }
135}
136
137impl crate::operation::get_mapping::GetMappingInput {
138    /// Deserializes this structure from a [`ShapeDeserializer`].
139    pub fn deserialize(
140        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
141    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
142        let mut builder = Self::builder();
143        builder.deserialize_members(deserializer)?;
144        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
145    }
146}