Skip to main content

aws_sdk_glue/schema_serde/
shape_user_defined_function_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#UserDefinedFunctionInput$FunctionName",
5        "com.amazonaws.glue",
6        "UserDefinedFunctionInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "FunctionName",
10    0,
11);
12static USERDEFINEDFUNCTIONINPUT_MEMBER_CLASS_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#UserDefinedFunctionInput$ClassName",
15        "com.amazonaws.glue",
16        "UserDefinedFunctionInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "ClassName",
20    1,
21);
22static USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#UserDefinedFunctionInput$OwnerName",
25        "com.amazonaws.glue",
26        "UserDefinedFunctionInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "OwnerName",
30    2,
31);
32static USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#UserDefinedFunctionInput$FunctionType",
35        "com.amazonaws.glue",
36        "UserDefinedFunctionInput",
37    ),
38    ::aws_smithy_schema::ShapeType::String,
39    "FunctionType",
40    3,
41);
42static USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.glue#UserDefinedFunctionInput$OwnerType",
45        "com.amazonaws.glue",
46        "UserDefinedFunctionInput",
47    ),
48    ::aws_smithy_schema::ShapeType::String,
49    "OwnerType",
50    4,
51);
52static USERDEFINEDFUNCTIONINPUT_MEMBER_RESOURCE_URIS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
53    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#ResourceUriList$member", "com.amazonaws.glue", "ResourceUriList"),
54    ::aws_smithy_schema::ShapeType::Structure,
55    "member",
56    0,
57);
58static USERDEFINEDFUNCTIONINPUT_MEMBER_RESOURCE_URIS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
59    ::aws_smithy_schema::ShapeId::from_parts(
60        "com.amazonaws.glue#UserDefinedFunctionInput$ResourceUris",
61        "com.amazonaws.glue",
62        "UserDefinedFunctionInput",
63    ),
64    ::aws_smithy_schema::ShapeType::List,
65    "ResourceUris",
66    5,
67)
68.with_list_member(&USERDEFINEDFUNCTIONINPUT_MEMBER_RESOURCE_URIS_MEMBER);
69static USERDEFINEDFUNCTIONINPUT_MEMBER_ARTIFACT_LOCATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
70    ::aws_smithy_schema::ShapeId::from_parts(
71        "com.amazonaws.glue#UserDefinedFunctionInput$ArtifactLocation",
72        "com.amazonaws.glue",
73        "UserDefinedFunctionInput",
74    ),
75    ::aws_smithy_schema::ShapeType::String,
76    "ArtifactLocation",
77    6,
78);
79static USERDEFINEDFUNCTIONINPUT_MEMBER_GOVERNANCE_MODE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
80    ::aws_smithy_schema::ShapeId::from_parts(
81        "com.amazonaws.glue#UserDefinedFunctionInput$GovernanceMode",
82        "com.amazonaws.glue",
83        "UserDefinedFunctionInput",
84    ),
85    ::aws_smithy_schema::ShapeType::String,
86    "GovernanceMode",
87    7,
88);
89static USERDEFINEDFUNCTIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
90    ::aws_smithy_schema::ShapeId::from_parts(
91        "com.amazonaws.glue#UserDefinedFunctionInput",
92        "com.amazonaws.glue",
93        "UserDefinedFunctionInput",
94    ),
95    ::aws_smithy_schema::ShapeType::Structure,
96    &[
97        &USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_NAME,
98        &USERDEFINEDFUNCTIONINPUT_MEMBER_CLASS_NAME,
99        &USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_NAME,
100        &USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_TYPE,
101        &USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_TYPE,
102        &USERDEFINEDFUNCTIONINPUT_MEMBER_RESOURCE_URIS,
103        &USERDEFINEDFUNCTIONINPUT_MEMBER_ARTIFACT_LOCATION,
104        &USERDEFINEDFUNCTIONINPUT_MEMBER_GOVERNANCE_MODE,
105    ],
106);
107impl crate::types::UserDefinedFunctionInput {
108    /// The schema for this shape.
109    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &USERDEFINEDFUNCTIONINPUT_SCHEMA;
110}
111impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::UserDefinedFunctionInput {
112    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
113        Self::SCHEMA
114    }
115
116    #[allow(unused_variables, clippy::diverging_sub_expression)]
117    fn serialize_members(
118        &self,
119        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
120    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
121        if let Some(ref val) = self.function_name {
122            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_NAME, val)?;
123        }
124        if let Some(ref val) = self.class_name {
125            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_CLASS_NAME, val)?;
126        }
127        if let Some(ref val) = self.owner_name {
128            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_NAME, val)?;
129        }
130        if let Some(ref val) = self.function_type {
131            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_FUNCTION_TYPE, val.as_str())?;
132        }
133        if let Some(ref val) = self.owner_type {
134            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_OWNER_TYPE, val.as_str())?;
135        }
136        if let Some(ref val) = self.resource_uris {
137            ser.write_list(
138                &USERDEFINEDFUNCTIONINPUT_MEMBER_RESOURCE_URIS,
139                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
140                    for item in val {
141                        ser.write_struct(crate::types::ResourceUri::SCHEMA, item)?;
142                    }
143                    Ok(())
144                },
145            )?;
146        }
147        if let Some(ref val) = self.artifact_location {
148            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_ARTIFACT_LOCATION, val)?;
149        }
150        if let Some(ref val) = self.governance_mode {
151            ser.write_string(&USERDEFINEDFUNCTIONINPUT_MEMBER_GOVERNANCE_MODE, val.as_str())?;
152        }
153        Ok(())
154    }
155}
156impl crate::types::builders::UserDefinedFunctionInputBuilder {
157    #[allow(
158        unused_variables,
159        unreachable_code,
160        clippy::single_match,
161        clippy::match_single_binding,
162        clippy::diverging_sub_expression
163    )]
164    pub(crate) fn deserialize_members(
165        &mut self,
166        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
167    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
168        deserializer.read_struct(&USERDEFINEDFUNCTIONINPUT_SCHEMA, &mut |member, deser| {
169            match member.member_index() {
170                Some(0) => {
171                    if deser.is_null() {
172                        deser.read_null()?;
173                    } else {
174                        self.function_name = Some(deser.read_string(member)?);
175                    }
176                }
177                Some(1) => {
178                    if deser.is_null() {
179                        deser.read_null()?;
180                    } else {
181                        self.class_name = Some(deser.read_string(member)?);
182                    }
183                }
184                Some(2) => {
185                    if deser.is_null() {
186                        deser.read_null()?;
187                    } else {
188                        self.owner_name = Some(deser.read_string(member)?);
189                    }
190                }
191                Some(3) => {
192                    if deser.is_null() {
193                        deser.read_null()?;
194                    } else {
195                        self.function_type = Some(crate::types::FunctionType::from(deser.read_string(member)?.as_str()));
196                    }
197                }
198                Some(4) => {
199                    if deser.is_null() {
200                        deser.read_null()?;
201                    } else {
202                        self.owner_type = Some(crate::types::PrincipalType::from(deser.read_string(member)?.as_str()));
203                    }
204                }
205                Some(5) => {
206                    if deser.is_null() {
207                        deser.read_null()?;
208                    } else {
209                        self.resource_uris = Some({
210                            let mut container = Vec::new();
211                            deser.read_list(member, &mut |deser| {
212                                container.push(crate::types::ResourceUri::deserialize(deser)?);
213                                Ok(())
214                            })?;
215                            container
216                        });
217                    }
218                }
219                Some(6) => {
220                    if deser.is_null() {
221                        deser.read_null()?;
222                    } else {
223                        self.artifact_location = Some(deser.read_string(member)?);
224                    }
225                }
226                Some(7) => {
227                    if deser.is_null() {
228                        deser.read_null()?;
229                    } else {
230                        self.governance_mode = Some(crate::types::GovernanceMode::from(deser.read_string(member)?.as_str()));
231                    }
232                }
233                _ => {}
234            }
235            Ok(())
236        })
237    }
238}
239
240impl crate::types::UserDefinedFunctionInput {
241    /// Deserializes this structure from a [`ShapeDeserializer`].
242    pub fn deserialize(
243        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
244    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
245        let mut builder = Self::builder();
246        builder.deserialize_members(deserializer)?;
247        Ok(builder.build())
248    }
249}