aws_sdk_organizations/types/error/
_too_many_requests_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>You have sent too many requests in too short a period of time. The quota helps protect against denial-of-service attacks. Try again later.</p>
4/// <p>For information about quotas that affect Organizations, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html">Quotas for Organizations</a> in the <i>Organizations User Guide</i>.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct TooManyRequestsException {
8    #[allow(missing_docs)] // documentation missing in model
9    pub r#type: ::std::option::Option<::std::string::String>,
10    #[allow(missing_docs)] // documentation missing in model
11    pub message: ::std::option::Option<::std::string::String>,
12    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
13}
14impl TooManyRequestsException {
15    #[allow(missing_docs)] // documentation missing in model
16    pub fn r#type(&self) -> ::std::option::Option<&str> {
17        self.r#type.as_deref()
18    }
19}
20impl TooManyRequestsException {
21    /// Returns the error message.
22    pub fn message(&self) -> ::std::option::Option<&str> {
23        self.message.as_deref()
24    }
25}
26impl ::std::fmt::Display for TooManyRequestsException {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28        ::std::write!(f, "TooManyRequestsException")?;
29        if let ::std::option::Option::Some(inner_1) = &self.message {
30            {
31                ::std::write!(f, ": {}", inner_1)?;
32            }
33        }
34        Ok(())
35    }
36}
37impl ::std::error::Error for TooManyRequestsException {}
38impl ::aws_types::request_id::RequestId for crate::types::error::TooManyRequestsException {
39    fn request_id(&self) -> Option<&str> {
40        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
41        self.meta().request_id()
42    }
43}
44impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for TooManyRequestsException {
45    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
46        &self.meta
47    }
48}
49impl TooManyRequestsException {
50    /// Creates a new builder-style object to manufacture [`TooManyRequestsException`](crate::types::error::TooManyRequestsException).
51    pub fn builder() -> crate::types::error::builders::TooManyRequestsExceptionBuilder {
52        crate::types::error::builders::TooManyRequestsExceptionBuilder::default()
53    }
54}
55
56/// A builder for [`TooManyRequestsException`](crate::types::error::TooManyRequestsException).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct TooManyRequestsExceptionBuilder {
60    pub(crate) r#type: ::std::option::Option<::std::string::String>,
61    pub(crate) message: ::std::option::Option<::std::string::String>,
62    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
63}
64impl TooManyRequestsExceptionBuilder {
65    #[allow(missing_docs)] // documentation missing in model
66    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.r#type = ::std::option::Option::Some(input.into());
68        self
69    }
70    #[allow(missing_docs)] // documentation missing in model
71    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.r#type = input;
73        self
74    }
75    #[allow(missing_docs)] // documentation missing in model
76    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
77        &self.r#type
78    }
79    #[allow(missing_docs)] // documentation missing in model
80    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.message = ::std::option::Option::Some(input.into());
82        self
83    }
84    #[allow(missing_docs)] // documentation missing in model
85    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.message = input;
87        self
88    }
89    #[allow(missing_docs)] // documentation missing in model
90    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
91        &self.message
92    }
93    /// Sets error metadata
94    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
95        self.meta = Some(meta);
96        self
97    }
98
99    /// Sets error metadata
100    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
101        self.meta = meta;
102        self
103    }
104    /// Consumes the builder and constructs a [`TooManyRequestsException`](crate::types::error::TooManyRequestsException).
105    pub fn build(self) -> crate::types::error::TooManyRequestsException {
106        crate::types::error::TooManyRequestsException {
107            r#type: self.r#type,
108            message: self.message,
109            meta: self.meta.unwrap_or_default(),
110        }
111    }
112}