Skip to main content

aws_sdk_ecs/schema_serde/
shape_service_connect_container_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static SERVICECONNECTCONTAINERCONFIGURATION_MEMBER_LOGLEVEL: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.ecs#ServiceConnectContainerConfiguration$logLevel",
5        "com.amazonaws.ecs",
6        "ServiceConnectContainerConfiguration",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "logLevel",
10    0,
11);
12static SERVICECONNECTCONTAINERCONFIGURATION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.ecs#ServiceConnectContainerConfiguration",
15        "com.amazonaws.ecs",
16        "ServiceConnectContainerConfiguration",
17    ),
18    ::aws_smithy_schema::ShapeType::Union,
19    &[&SERVICECONNECTCONTAINERCONFIGURATION_MEMBER_LOGLEVEL],
20);
21impl crate::types::ServiceConnectContainerConfiguration {
22    /// The schema for this shape.
23    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &SERVICECONNECTCONTAINERCONFIGURATION_SCHEMA;
24}
25impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ServiceConnectContainerConfiguration {
26    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
27        Self::SCHEMA
28    }
29
30    #[allow(unused_variables, clippy::diverging_sub_expression)]
31    fn serialize_members(
32        &self,
33        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
34    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
35        match self {
36            Self::LogLevel(val) => {
37                ser.write_string(&SERVICECONNECTCONTAINERCONFIGURATION_MEMBER_LOGLEVEL, val.as_str())?;
38            }
39            Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
40        }
41        Ok(())
42    }
43}
44impl crate::types::ServiceConnectContainerConfiguration {
45    /// Deserializes this union from a [`ShapeDeserializer`].
46    pub fn deserialize(
47        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
48    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
49        let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
50        #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
51        deserializer.read_struct(&SERVICECONNECTCONTAINERCONFIGURATION_SCHEMA, &mut |member, deser| {
52            // A union holds exactly one member; the deserializer reports every key
53            // (known or not), so a second one is an error whatever it names.
54            if result.is_some() {
55                return Err(::aws_smithy_schema::serde::SerdeError::invalid_input(
56                    "encountered mixed variants in union",
57                ));
58            }
59            result = ::std::option::Option::Some(match member.member_index() {
60                Some(0) => Self::LogLevel(crate::types::ServiceConnectContainerLogLevel::from(deser.read_string(member)?.as_str())),
61                _ => Self::Unknown,
62            });
63            Ok(())
64        })?;
65        result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
66    }
67}