Skip to main content

aws_sdk_glue/schema_serde/
shape_statistic_annotation.rs

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