Skip to main content

aws_sdk_glue/schema_serde/
shape_condition_expression.rs

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