Skip to main content

aws_sdk_signer/types/error/
_throttling_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The request was denied due to request throttling.</p>
4/// <p>Instead of this error, <code>TooManyRequestsException</code> should be used.</p>
5#[deprecated(note = "Instead of this error, TooManyRequestsException should be used.")]
6#[non_exhaustive]
7#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
8pub struct ThrottlingException {
9    #[allow(missing_docs)] // documentation missing in model
10    pub message: ::std::option::Option<::std::string::String>,
11    #[allow(missing_docs)] // documentation missing in model
12    pub code: ::std::option::Option<::std::string::String>,
13    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
14}
15impl ThrottlingException {
16    #[allow(missing_docs)] // documentation missing in model
17    pub fn code(&self) -> ::std::option::Option<&str> {
18        self.code.as_deref()
19    }
20}
21impl ThrottlingException {
22    /// Returns the error message.
23    pub fn message(&self) -> ::std::option::Option<&str> {
24        self.message.as_deref()
25    }
26}
27impl ::std::fmt::Display for ThrottlingException {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        ::std::write!(f, "ThrottlingException")?;
30        if let ::std::option::Option::Some(inner_1) = &self.message {
31            {
32                ::std::write!(f, ": {inner_1}")?;
33            }
34        }
35        Ok(())
36    }
37}
38impl ::std::error::Error for ThrottlingException {}
39impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
40    fn request_id(&self) -> Option<&str> {
41        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
42        self.meta().request_id()
43    }
44}
45impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
46    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
47        &self.meta
48    }
49}
50impl ThrottlingException {
51    /// Creates a new builder-style object to manufacture [`ThrottlingException`](crate::types::error::ThrottlingException).
52    pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
53        crate::types::error::builders::ThrottlingExceptionBuilder::default()
54    }
55}
56
57/// A builder for [`ThrottlingException`](crate::types::error::ThrottlingException).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct ThrottlingExceptionBuilder {
61    pub(crate) message: ::std::option::Option<::std::string::String>,
62    pub(crate) code: ::std::option::Option<::std::string::String>,
63    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
64}
65impl ThrottlingExceptionBuilder {
66    #[allow(missing_docs)] // documentation missing in model
67    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.message = ::std::option::Option::Some(input.into());
69        self
70    }
71    #[allow(missing_docs)] // documentation missing in model
72    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.message = input;
74        self
75    }
76    #[allow(missing_docs)] // documentation missing in model
77    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
78        &self.message
79    }
80    #[allow(missing_docs)] // documentation missing in model
81    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.code = ::std::option::Option::Some(input.into());
83        self
84    }
85    #[allow(missing_docs)] // documentation missing in model
86    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87        self.code = input;
88        self
89    }
90    #[allow(missing_docs)] // documentation missing in model
91    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
92        &self.code
93    }
94    /// Sets error metadata
95    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
96        self.meta = Some(meta);
97        self
98    }
99
100    /// Sets error metadata
101    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
102        self.meta = meta;
103        self
104    }
105    /// Consumes the builder and constructs a [`ThrottlingException`](crate::types::error::ThrottlingException).
106    pub fn build(self) -> crate::types::error::ThrottlingException {
107        crate::types::error::ThrottlingException {
108            message: self.message,
109            code: self.code,
110            meta: self.meta.unwrap_or_default(),
111        }
112    }
113}