Skip to main content

aws_sdk_glue/schema_serde/
shape_put_asset_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static PUTASSETINPUT_MEMBER_ASSET_TYPE_IDENTIFIER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue.synthetic#PutAssetInput$AssetTypeIdentifier",
5        "com.amazonaws.glue.synthetic",
6        "PutAssetInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "AssetTypeIdentifier",
10    0,
11);
12static PUTASSETINPUT_MEMBER_IDENTIFIER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue.synthetic#PutAssetInput$Identifier",
15        "com.amazonaws.glue.synthetic",
16        "PutAssetInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "Identifier",
20    1,
21);
22static PUTASSETINPUT_MEMBER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue.synthetic#PutAssetInput$Name",
25        "com.amazonaws.glue.synthetic",
26        "PutAssetInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "Name",
30    2,
31);
32static PUTASSETINPUT_MEMBER_DESCRIPTION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue.synthetic#PutAssetInput$Description",
35        "com.amazonaws.glue.synthetic",
36        "PutAssetInput",
37    ),
38    ::aws_smithy_schema::ShapeType::String,
39    "Description",
40    3,
41);
42static PUTASSETINPUT_MEMBER_FORMS_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#AssetFormInputMap$key", "com.amazonaws.glue", "AssetFormInputMap"),
44    ::aws_smithy_schema::ShapeType::String,
45    "key",
46    0,
47);
48static PUTASSETINPUT_MEMBER_FORMS_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
49    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#AssetFormInputMap$value", "com.amazonaws.glue", "AssetFormInputMap"),
50    ::aws_smithy_schema::ShapeType::Structure,
51    "value",
52    1,
53);
54static PUTASSETINPUT_MEMBER_FORMS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
55    ::aws_smithy_schema::ShapeId::from_parts(
56        "com.amazonaws.glue.synthetic#PutAssetInput$Forms",
57        "com.amazonaws.glue.synthetic",
58        "PutAssetInput",
59    ),
60    ::aws_smithy_schema::ShapeType::Map,
61    "Forms",
62    4,
63)
64.with_map_members(&PUTASSETINPUT_MEMBER_FORMS_KEY, &PUTASSETINPUT_MEMBER_FORMS_VALUE);
65static PUTASSETINPUT_MEMBER_CLIENT_TOKEN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
66    ::aws_smithy_schema::ShapeId::from_parts(
67        "com.amazonaws.glue.synthetic#PutAssetInput$ClientToken",
68        "com.amazonaws.glue.synthetic",
69        "PutAssetInput",
70    ),
71    ::aws_smithy_schema::ShapeType::String,
72    "ClientToken",
73    5,
74);
75static PUTASSETINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
76    ::aws_smithy_schema::ShapeId::from_parts(
77        "com.amazonaws.glue.synthetic#PutAssetInput",
78        "com.amazonaws.glue.synthetic",
79        "PutAssetInput",
80    ),
81    ::aws_smithy_schema::ShapeType::Structure,
82    &[
83        &PUTASSETINPUT_MEMBER_ASSET_TYPE_IDENTIFIER,
84        &PUTASSETINPUT_MEMBER_IDENTIFIER,
85        &PUTASSETINPUT_MEMBER_NAME,
86        &PUTASSETINPUT_MEMBER_DESCRIPTION,
87        &PUTASSETINPUT_MEMBER_FORMS,
88        &PUTASSETINPUT_MEMBER_CLIENT_TOKEN,
89    ],
90)
91.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/assets", None))
92.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
93.with_original_name("PutAssetRequest");
94impl crate::operation::put_asset::PutAssetInput {
95    /// The schema for this shape.
96    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &PUTASSETINPUT_SCHEMA;
97}
98impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::put_asset::PutAssetInput {
99    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
100        Self::SCHEMA
101    }
102
103    #[allow(unused_variables, clippy::diverging_sub_expression)]
104    fn serialize_members(
105        &self,
106        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
107    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
108        if let Some(ref val) = self.asset_type_identifier {
109            ser.write_string(&PUTASSETINPUT_MEMBER_ASSET_TYPE_IDENTIFIER, val)?;
110        }
111        if let Some(ref val) = self.identifier {
112            ser.write_string(&PUTASSETINPUT_MEMBER_IDENTIFIER, val)?;
113        }
114        if let Some(ref val) = self.name {
115            ser.write_string(&PUTASSETINPUT_MEMBER_NAME, val)?;
116        }
117        if let Some(ref val) = self.description {
118            ser.write_string(&PUTASSETINPUT_MEMBER_DESCRIPTION, val)?;
119        }
120        if let Some(ref val) = self.forms {
121            ser.write_map(
122                &PUTASSETINPUT_MEMBER_FORMS,
123                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
124                    for (key, value) in val {
125                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
126                        ser.write_struct(crate::types::AssetFormInput::SCHEMA, value)?;
127                    }
128                    Ok(())
129                },
130            )?;
131        }
132        if let Some(ref val) = self.client_token {
133            ser.write_string(&PUTASSETINPUT_MEMBER_CLIENT_TOKEN, val)?;
134        }
135        Ok(())
136    }
137}
138impl crate::operation::put_asset::builders::PutAssetInputBuilder {
139    #[allow(
140        unused_variables,
141        unreachable_code,
142        clippy::single_match,
143        clippy::match_single_binding,
144        clippy::diverging_sub_expression
145    )]
146    pub(crate) fn deserialize_members(
147        &mut self,
148        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
149    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
150        deserializer.read_struct(&PUTASSETINPUT_SCHEMA, &mut |member, deser| {
151            match member.member_index() {
152                Some(0) => {
153                    if deser.is_null() {
154                        deser.read_null()?;
155                    } else {
156                        self.asset_type_identifier = Some(deser.read_string(member)?);
157                    }
158                }
159                Some(1) => {
160                    if deser.is_null() {
161                        deser.read_null()?;
162                    } else {
163                        self.identifier = Some(deser.read_string(member)?);
164                    }
165                }
166                Some(2) => {
167                    if deser.is_null() {
168                        deser.read_null()?;
169                    } else {
170                        self.name = Some(deser.read_string(member)?);
171                    }
172                }
173                Some(3) => {
174                    if deser.is_null() {
175                        deser.read_null()?;
176                    } else {
177                        self.description = Some(deser.read_string(member)?);
178                    }
179                }
180                Some(4) => {
181                    if deser.is_null() {
182                        deser.read_null()?;
183                    } else {
184                        self.forms = Some({
185                            let mut container = std::collections::HashMap::new();
186                            deser.read_map(member, &mut |key, deser| {
187                                container.insert(key, crate::types::AssetFormInput::deserialize(deser)?);
188                                Ok(())
189                            })?;
190                            container
191                        });
192                    }
193                }
194                Some(5) => {
195                    if deser.is_null() {
196                        deser.read_null()?;
197                    } else {
198                        self.client_token = Some(deser.read_string(member)?);
199                    }
200                }
201                _ => {}
202            }
203            Ok(())
204        })
205    }
206}
207
208impl crate::operation::put_asset::PutAssetInput {
209    /// Deserializes this structure from a [`ShapeDeserializer`].
210    pub fn deserialize(
211        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
212    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
213        let mut builder = Self::builder();
214        builder.deserialize_members(deserializer)?;
215        builder.identifier = builder.identifier.or(Some(String::new()));
216        builder.name = builder.name.or(Some(String::new()));
217        builder.forms = builder.forms.or(Some(::std::collections::HashMap::new()));
218        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
219    }
220}