aws_sdk_devopsguru/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 quota_code: ::std::option::Option<::std::string::String>,
11 pub service_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 quota_code(&self) -> ::std::option::Option<&str> {
20 self.quota_code.as_deref()
21 }
22 pub fn service_code(&self) -> ::std::option::Option<&str> {
24 self.service_code.as_deref()
25 }
26 pub fn retry_after_seconds(&self) -> i32 {
28 self.retry_after_seconds
29 }
30}
31impl ThrottlingException {
32 pub fn message(&self) -> &str {
34 &self.message
35 }
36}
37impl ::std::fmt::Display for ThrottlingException {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 ::std::write!(f, "ThrottlingException")?;
40 {
41 ::std::write!(f, ": {}", &self.message)?;
42 }
43 Ok(())
44 }
45}
46impl ::std::error::Error for ThrottlingException {}
47impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
48 fn request_id(&self) -> Option<&str> {
49 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
50 self.meta().request_id()
51 }
52}
53impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
54 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
55 &self.meta
56 }
57}
58impl ThrottlingException {
59 pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
61 crate::types::error::builders::ThrottlingExceptionBuilder::default()
62 }
63}
64
65#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
67#[non_exhaustive]
68pub struct ThrottlingExceptionBuilder {
69 pub(crate) message: ::std::option::Option<::std::string::String>,
70 pub(crate) quota_code: ::std::option::Option<::std::string::String>,
71 pub(crate) service_code: ::std::option::Option<::std::string::String>,
72 pub(crate) retry_after_seconds: ::std::option::Option<i32>,
73 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
74}
75impl ThrottlingExceptionBuilder {
76 #[allow(missing_docs)] pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79 self.message = ::std::option::Option::Some(input.into());
80 self
81 }
82 #[allow(missing_docs)] pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84 self.message = input;
85 self
86 }
87 #[allow(missing_docs)] pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
89 &self.message
90 }
91 pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93 self.quota_code = ::std::option::Option::Some(input.into());
94 self
95 }
96 pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98 self.quota_code = input;
99 self
100 }
101 pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
103 &self.quota_code
104 }
105 pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107 self.service_code = ::std::option::Option::Some(input.into());
108 self
109 }
110 pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112 self.service_code = input;
113 self
114 }
115 pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
117 &self.service_code
118 }
119 pub fn retry_after_seconds(mut self, input: i32) -> Self {
121 self.retry_after_seconds = ::std::option::Option::Some(input);
122 self
123 }
124 pub fn set_retry_after_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
126 self.retry_after_seconds = input;
127 self
128 }
129 pub fn get_retry_after_seconds(&self) -> &::std::option::Option<i32> {
131 &self.retry_after_seconds
132 }
133 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
135 self.meta = Some(meta);
136 self
137 }
138
139 pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
141 self.meta = meta;
142 self
143 }
144 pub fn build(self) -> ::std::result::Result<crate::types::error::ThrottlingException, ::aws_smithy_types::error::operation::BuildError> {
148 ::std::result::Result::Ok(crate::types::error::ThrottlingException {
149 message: self.message.ok_or_else(|| {
150 ::aws_smithy_types::error::operation::BuildError::missing_field(
151 "message",
152 "message was not specified but it is required when building ThrottlingException",
153 )
154 })?,
155 quota_code: self.quota_code,
156 service_code: self.service_code,
157 retry_after_seconds: self.retry_after_seconds.unwrap_or_default(),
158 meta: self.meta.unwrap_or_default(),
159 })
160 }
161}