Skip to main content

aws_sdk_glue/schema_serde/
shape_iceberg_retention_configuration.rs

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