aws_sdk_pinpointsmsvoicev2/types/error/
_throttling_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ThrottlingException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::option::Option<::std::string::String>,
9    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
10}
11impl ThrottlingException {
12    /// Returns `Some(ErrorKind)` if the error is retryable. Otherwise, returns `None`.
13    pub fn retryable_error_kind(&self) -> ::aws_smithy_types::retry::ErrorKind {
14        ::aws_smithy_types::retry::ErrorKind::ThrottlingError
15    }
16    /// Returns the error message.
17    pub fn message(&self) -> ::std::option::Option<&str> {
18        self.message.as_deref()
19    }
20}
21impl ::std::fmt::Display for ThrottlingException {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        ::std::write!(f, "ThrottlingException")?;
24        if let ::std::option::Option::Some(inner_1) = &self.message {
25            {
26                ::std::write!(f, ": {inner_1}")?;
27            }
28        }
29        Ok(())
30    }
31}
32impl ::std::error::Error for ThrottlingException {}
33impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
34    fn request_id(&self) -> Option<&str> {
35        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
36        self.meta().request_id()
37    }
38}
39impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
40    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
41        &self.meta
42    }
43}
44impl ThrottlingException {
45    /// Creates a new builder-style object to manufacture [`ThrottlingException`](crate::types::error::ThrottlingException).
46    pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
47        crate::types::error::builders::ThrottlingExceptionBuilder::default()
48    }
49}
50
51/// A builder for [`ThrottlingException`](crate::types::error::ThrottlingException).
52#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
53#[non_exhaustive]
54pub struct ThrottlingExceptionBuilder {
55    pub(crate) message: ::std::option::Option<::std::string::String>,
56    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
57}
58impl ThrottlingExceptionBuilder {
59    #[allow(missing_docs)] // documentation missing in model
60    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.message = ::std::option::Option::Some(input.into());
62        self
63    }
64    #[allow(missing_docs)] // documentation missing in model
65    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.message = input;
67        self
68    }
69    #[allow(missing_docs)] // documentation missing in model
70    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
71        &self.message
72    }
73    /// Sets error metadata
74    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
75        self.meta = Some(meta);
76        self
77    }
78
79    /// Sets error metadata
80    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
81        self.meta = meta;
82        self
83    }
84    /// Consumes the builder and constructs a [`ThrottlingException`](crate::types::error::ThrottlingException).
85    pub fn build(self) -> crate::types::error::ThrottlingException {
86        crate::types::error::ThrottlingException {
87            message: self.message,
88            meta: self.meta.unwrap_or_default(),
89        }
90    }
91}