Skip to main content

aws_sdk_glue/schema_serde/
shape_condition.rs

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