aws_sdk_m2/types/error/
_throttling_exception.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ThrottlingException {
7 #[allow(missing_docs)] pub message: ::std::string::String,
9 pub service_code: ::std::option::Option<::std::string::String>,
11 pub quota_code: ::std::option::Option<::std::string::String>,
13 pub retry_after_seconds: i32,
15 pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
16}
17impl ThrottlingException {
18 pub fn service_code(&self) -> ::std::option::Option<&str> {
20 self.service_code.as_deref()
21 }
22 pub fn quota_code(&self) -> ::std::option::Option<&str> {
24 self.quota_code.as_deref()
25 }
26 pub fn retry_after_seconds(&self) -> i32 {
28 self.retry_after_seconds
29 }
30}
31impl ThrottlingException {
32 pub fn retryable_error_kind(&self) -> ::aws_smithy_types::retry::ErrorKind {
34 ::aws_smithy_types::retry::ErrorKind::ThrottlingError
35 }
36 pub fn message(&self) -> &str {
38 &self.message
39 }
40}
41impl ::std::fmt::Display for ThrottlingException {
42 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43 ::std::write!(f, "ThrottlingException")?;
44 {
45 ::std::write!(f, ": {}", &self.message)?;
46 }
47 Ok(())
48 }
49}
50impl ::std::error::Error for ThrottlingException {}
51impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
52 fn request_id(&self) -> Option<&str> {
53 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
54 self.meta().request_id()
55 }
56}
57impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
58 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
59 &self.meta
60 }
61}
62impl ThrottlingException {
63 pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
65 crate::types::error::builders::ThrottlingExceptionBuilder::default()
66 }
67}
68
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
71#[non_exhaustive]
72pub struct ThrottlingExceptionBuilder {
73 pub(crate) message: ::std::option::Option<::std::string::String>,
74 pub(crate) service_code: ::std::option::Option<::std::string::String>,
75 pub(crate) quota_code: ::std::option::Option<::std::string::String>,
76 pub(crate) retry_after_seconds: ::std::option::Option<i32>,
77 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
78}
79impl ThrottlingExceptionBuilder {
80 #[allow(missing_docs)] pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83 self.message = ::std::option::Option::Some(input.into());
84 self
85 }
86 #[allow(missing_docs)] pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88 self.message = input;
89 self
90 }
91 #[allow(missing_docs)] pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
93 &self.message
94 }
95 pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97 self.service_code = ::std::option::Option::Some(input.into());
98 self
99 }
100 pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102 self.service_code = input;
103 self
104 }
105 pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
107 &self.service_code
108 }
109 pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111 self.quota_code = ::std::option::Option::Some(input.into());
112 self
113 }
114 pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116 self.quota_code = input;
117 self
118 }
119 pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
121 &self.quota_code
122 }
123 pub fn retry_after_seconds(mut self, input: i32) -> Self {
125 self.retry_after_seconds = ::std::option::Option::Some(input);
126 self
127 }
128 pub fn set_retry_after_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
130 self.retry_after_seconds = input;
131 self
132 }
133 pub fn get_retry_after_seconds(&self) -> &::std::option::Option<i32> {
135 &self.retry_after_seconds
136 }
137 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
139 self.meta = Some(meta);
140 self
141 }
142
143 pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
145 self.meta = meta;
146 self
147 }
148 pub fn build(self) -> ::std::result::Result<crate::types::error::ThrottlingException, ::aws_smithy_types::error::operation::BuildError> {
152 ::std::result::Result::Ok(crate::types::error::ThrottlingException {
153 message: self.message.ok_or_else(|| {
154 ::aws_smithy_types::error::operation::BuildError::missing_field(
155 "message",
156 "message was not specified but it is required when building ThrottlingException",
157 )
158 })?,
159 service_code: self.service_code,
160 quota_code: self.quota_code,
161 retry_after_seconds: self.retry_after_seconds.unwrap_or_default(),
162 meta: self.meta.unwrap_or_default(),
163 })
164 }
165}