Skip to main content

aws_sdk_glue/schema_serde/
shape_create_glossary_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CREATEGLOSSARYINPUT_MEMBER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue.synthetic#CreateGlossaryInput$Name",
5        "com.amazonaws.glue.synthetic",
6        "CreateGlossaryInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "Name",
10    0,
11);
12static CREATEGLOSSARYINPUT_MEMBER_DESCRIPTION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue.synthetic#CreateGlossaryInput$Description",
15        "com.amazonaws.glue.synthetic",
16        "CreateGlossaryInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "Description",
20    1,
21);
22static CREATEGLOSSARYINPUT_MEMBER_CLIENT_TOKEN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue.synthetic#CreateGlossaryInput$ClientToken",
25        "com.amazonaws.glue.synthetic",
26        "CreateGlossaryInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "ClientToken",
30    2,
31);
32static CREATEGLOSSARYINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue.synthetic#CreateGlossaryInput",
35        "com.amazonaws.glue.synthetic",
36        "CreateGlossaryInput",
37    ),
38    ::aws_smithy_schema::ShapeType::Structure,
39    &[
40        &CREATEGLOSSARYINPUT_MEMBER_NAME,
41        &CREATEGLOSSARYINPUT_MEMBER_DESCRIPTION,
42        &CREATEGLOSSARYINPUT_MEMBER_CLIENT_TOKEN,
43    ],
44)
45.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/glossaries", None))
46.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
47.with_original_name("CreateGlossaryRequest");
48impl crate::operation::create_glossary::CreateGlossaryInput {
49    /// The schema for this shape.
50    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CREATEGLOSSARYINPUT_SCHEMA;
51}
52impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::create_glossary::CreateGlossaryInput {
53    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
54        Self::SCHEMA
55    }
56
57    #[allow(unused_variables, clippy::diverging_sub_expression)]
58    fn serialize_members(
59        &self,
60        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
61    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
62        if let Some(ref val) = self.name {
63            ser.write_string(&CREATEGLOSSARYINPUT_MEMBER_NAME, val)?;
64        }
65        if let Some(ref val) = self.description {
66            ser.write_string(&CREATEGLOSSARYINPUT_MEMBER_DESCRIPTION, val)?;
67        }
68        if let Some(ref val) = self.client_token {
69            ser.write_string(&CREATEGLOSSARYINPUT_MEMBER_CLIENT_TOKEN, val)?;
70        }
71        Ok(())
72    }
73}
74impl crate::operation::create_glossary::builders::CreateGlossaryInputBuilder {
75    #[allow(
76        unused_variables,
77        unreachable_code,
78        clippy::single_match,
79        clippy::match_single_binding,
80        clippy::diverging_sub_expression
81    )]
82    pub(crate) fn deserialize_members(
83        &mut self,
84        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
85    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
86        deserializer.read_struct(&CREATEGLOSSARYINPUT_SCHEMA, &mut |member, deser| {
87            match member.member_index() {
88                Some(0) => {
89                    if deser.is_null() {
90                        deser.read_null()?;
91                    } else {
92                        self.name = Some(deser.read_string(member)?);
93                    }
94                }
95                Some(1) => {
96                    if deser.is_null() {
97                        deser.read_null()?;
98                    } else {
99                        self.description = Some(deser.read_string(member)?);
100                    }
101                }
102                Some(2) => {
103                    if deser.is_null() {
104                        deser.read_null()?;
105                    } else {
106                        self.client_token = Some(deser.read_string(member)?);
107                    }
108                }
109                _ => {}
110            }
111            Ok(())
112        })
113    }
114}
115
116impl crate::operation::create_glossary::CreateGlossaryInput {
117    /// Deserializes this structure from a [`ShapeDeserializer`].
118    pub fn deserialize(
119        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
120    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
121        let mut builder = Self::builder();
122        builder.deserialize_members(deserializer)?;
123        builder.name = builder.name.or(Some(String::new()));
124        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
125    }
126}