Skip to main content

aws_sdk_glue/schema_serde/
shape_response_configuration.rs

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