Skip to main content

aws_sdk_glue/schema_serde/
shape_usage_profile_definition.rs

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