Skip to main content

aws_sdk_glue/schema_serde/
shape_create_usage_profile_input_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CREATEUSAGEPROFILEINPUT_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#CreateUsageProfileInput$Name",
5        "com.amazonaws.glue.synthetic",
6        "CreateUsageProfileInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "Name",
10    0,
11);
12static CREATEUSAGEPROFILEINPUT_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#CreateUsageProfileInput$Description",
15        "com.amazonaws.glue.synthetic",
16        "CreateUsageProfileInput",
17    ),
18    ::aws_smithy_schema::ShapeType::String,
19    "Description",
20    1,
21);
22static CREATEUSAGEPROFILEINPUT_MEMBER_CONFIGURATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue.synthetic#CreateUsageProfileInput$Configuration",
25        "com.amazonaws.glue.synthetic",
26        "CreateUsageProfileInput",
27    ),
28    ::aws_smithy_schema::ShapeType::Structure,
29    "Configuration",
30    2,
31);
32static CREATEUSAGEPROFILEINPUT_MEMBER_TAGS_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#TagsMap$key", "com.amazonaws.glue", "TagsMap"),
34    ::aws_smithy_schema::ShapeType::String,
35    "key",
36    0,
37);
38static CREATEUSAGEPROFILEINPUT_MEMBER_TAGS_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
39    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#TagsMap$value", "com.amazonaws.glue", "TagsMap"),
40    ::aws_smithy_schema::ShapeType::String,
41    "value",
42    1,
43);
44static CREATEUSAGEPROFILEINPUT_MEMBER_TAGS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
45    ::aws_smithy_schema::ShapeId::from_parts(
46        "com.amazonaws.glue.synthetic#CreateUsageProfileInput$Tags",
47        "com.amazonaws.glue.synthetic",
48        "CreateUsageProfileInput",
49    ),
50    ::aws_smithy_schema::ShapeType::Map,
51    "Tags",
52    3,
53)
54.with_map_members(&CREATEUSAGEPROFILEINPUT_MEMBER_TAGS_KEY, &CREATEUSAGEPROFILEINPUT_MEMBER_TAGS_VALUE);
55static CREATEUSAGEPROFILEINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
56    ::aws_smithy_schema::ShapeId::from_parts(
57        "com.amazonaws.glue.synthetic#CreateUsageProfileInput",
58        "com.amazonaws.glue.synthetic",
59        "CreateUsageProfileInput",
60    ),
61    ::aws_smithy_schema::ShapeType::Structure,
62    &[
63        &CREATEUSAGEPROFILEINPUT_MEMBER_NAME,
64        &CREATEUSAGEPROFILEINPUT_MEMBER_DESCRIPTION,
65        &CREATEUSAGEPROFILEINPUT_MEMBER_CONFIGURATION,
66        &CREATEUSAGEPROFILEINPUT_MEMBER_TAGS,
67    ],
68)
69.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
70.with_original_name("CreateUsageProfileRequest");
71impl crate::operation::create_usage_profile::CreateUsageProfileInput {
72    /// The schema for this shape.
73    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CREATEUSAGEPROFILEINPUT_SCHEMA;
74}
75impl ::aws_smithy_schema::serde::SerializableStruct for crate::operation::create_usage_profile::CreateUsageProfileInput {
76    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
77        Self::SCHEMA
78    }
79
80    #[allow(unused_variables, clippy::diverging_sub_expression)]
81    fn serialize_members(
82        &self,
83        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
84    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
85        if let Some(ref val) = self.name {
86            ser.write_string(&CREATEUSAGEPROFILEINPUT_MEMBER_NAME, val)?;
87        }
88        if let Some(ref val) = self.description {
89            ser.write_string(&CREATEUSAGEPROFILEINPUT_MEMBER_DESCRIPTION, val)?;
90        }
91        if let Some(ref val) = self.configuration {
92            ser.write_struct(&CREATEUSAGEPROFILEINPUT_MEMBER_CONFIGURATION, val)?;
93        }
94        if let Some(ref val) = self.tags {
95            ser.write_map(
96                &CREATEUSAGEPROFILEINPUT_MEMBER_TAGS,
97                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
98                    for (key, value) in val {
99                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
100                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
101                    }
102                    Ok(())
103                },
104            )?;
105        }
106        Ok(())
107    }
108}
109impl crate::operation::create_usage_profile::builders::CreateUsageProfileInputBuilder {
110    #[allow(
111        unused_variables,
112        unreachable_code,
113        clippy::single_match,
114        clippy::match_single_binding,
115        clippy::diverging_sub_expression
116    )]
117    pub(crate) fn deserialize_members(
118        &mut self,
119        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
120    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
121        deserializer.read_struct(&CREATEUSAGEPROFILEINPUT_SCHEMA, &mut |member, deser| {
122            match member.member_index() {
123                Some(0) => {
124                    if deser.is_null() {
125                        deser.read_null()?;
126                    } else {
127                        self.name = Some(deser.read_string(member)?);
128                    }
129                }
130                Some(1) => {
131                    if deser.is_null() {
132                        deser.read_null()?;
133                    } else {
134                        self.description = Some(deser.read_string(member)?);
135                    }
136                }
137                Some(2) => {
138                    if deser.is_null() {
139                        deser.read_null()?;
140                    } else {
141                        self.configuration = Some(crate::types::ProfileConfiguration::deserialize(deser)?);
142                    }
143                }
144                Some(3) => {
145                    if deser.is_null() {
146                        deser.read_null()?;
147                    } else {
148                        self.tags = Some(deser.read_string_string_map(member)?);
149                    }
150                }
151                _ => {}
152            }
153            Ok(())
154        })
155    }
156}
157
158impl crate::operation::create_usage_profile::CreateUsageProfileInput {
159    /// Deserializes this structure from a [`ShapeDeserializer`].
160    pub fn deserialize(
161        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
162    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
163        let mut builder = Self::builder();
164        builder.deserialize_members(deserializer)?;
165        builder.name = builder.name.or(Some(String::new()));
166        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
167    }
168}