aws-sdk-appconfigcloudextension 1.0.0

AWS SDK for AWS AppConfig Cloud Extension
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
static THROTTLINGEXCEPTION_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.appconfigcloudextension#ThrottlingException$message",
        "com.amazonaws.appconfigcloudextension",
        "ThrottlingException",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "message",
    0,
);
static THROTTLINGEXCEPTION_MEMBER_REASON: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.appconfigcloudextension#ThrottlingException$reason",
        "com.amazonaws.appconfigcloudextension",
        "ThrottlingException",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "reason",
    1,
);
static THROTTLINGEXCEPTION_MEMBER_RETRY_AFTER_SECONDS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.appconfigcloudextension#ThrottlingException$retryAfterSeconds",
        "com.amazonaws.appconfigcloudextension",
        "ThrottlingException",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "retryAfterSeconds",
    2,
)
.with_http_header("Retry-After");
static THROTTLINGEXCEPTION_MEMBER_EXTENSION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.appconfigcloudextension#ThrottlingException$extension",
        "com.amazonaws.appconfigcloudextension",
        "ThrottlingException",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "extension",
    3,
);
static THROTTLINGEXCEPTION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.appconfigcloudextension#ThrottlingException",
        "com.amazonaws.appconfigcloudextension",
        "ThrottlingException",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &THROTTLINGEXCEPTION_MEMBER_MESSAGE,
        &THROTTLINGEXCEPTION_MEMBER_REASON,
        &THROTTLINGEXCEPTION_MEMBER_RETRY_AFTER_SECONDS,
        &THROTTLINGEXCEPTION_MEMBER_EXTENSION,
    ],
);
impl crate::types::error::ThrottlingException {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &THROTTLINGEXCEPTION_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::error::ThrottlingException {
    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
        Self::SCHEMA
    }

    #[allow(unused_variables, clippy::diverging_sub_expression)]
    fn serialize_members(
        &self,
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        {
            let val = &self.message;
            ser.write_string(&THROTTLINGEXCEPTION_MEMBER_MESSAGE, val)?;
        }
        {
            let val = &self.reason;
            ser.write_string(&THROTTLINGEXCEPTION_MEMBER_REASON, val.as_str())?;
        }
        if let Some(ref val) = self.retry_after_seconds {
            ser.write_integer(&THROTTLINGEXCEPTION_MEMBER_RETRY_AFTER_SECONDS, *val)?;
        }
        {
            let val = &self.extension;
            ser.write_string(&THROTTLINGEXCEPTION_MEMBER_EXTENSION, val)?;
        }
        Ok(())
    }
}
impl crate::types::error::builders::ThrottlingExceptionBuilder {
    #[allow(
        unused_variables,
        unreachable_code,
        clippy::single_match,
        clippy::match_single_binding,
        clippy::diverging_sub_expression
    )]
    pub(crate) fn deserialize_members(
        &mut self,
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        deserializer.read_struct(&THROTTLINGEXCEPTION_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    self.message = Some(deser.read_string(member)?);
                }
                Some(1) => {
                    self.reason = Some(crate::types::ThrottlingReason::from(deser.read_string(member)?.as_str()));
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.retry_after_seconds = Some(deser.read_integer(member)?);
                    }
                }
                Some(3) => {
                    self.extension = Some(deser.read_string(member)?);
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl crate::types::error::ThrottlingException {
    /// Deserializes this structure from a [`ShapeDeserializer`].
    pub fn deserialize(
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
        let mut builder = Self::builder();
        builder.deserialize_members(deserializer)?;
        builder.message = builder.message.or(Some(String::new()));
        builder.extension = builder.extension.or(Some(String::new()));
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
    }
}