aws_sdk_amp/types/error/
_service_quota_exceeded_exception.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ServiceQuotaExceededException {
7 pub message: ::std::string::String,
9 pub resource_id: ::std::string::String,
11 pub resource_type: ::std::string::String,
13 pub service_code: ::std::string::String,
15 pub quota_code: ::std::string::String,
17 pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
18}
19impl ServiceQuotaExceededException {
20 pub fn resource_id(&self) -> &str {
22 use std::ops::Deref;
23 self.resource_id.deref()
24 }
25 pub fn resource_type(&self) -> &str {
27 use std::ops::Deref;
28 self.resource_type.deref()
29 }
30 pub fn service_code(&self) -> &str {
32 use std::ops::Deref;
33 self.service_code.deref()
34 }
35 pub fn quota_code(&self) -> &str {
37 use std::ops::Deref;
38 self.quota_code.deref()
39 }
40}
41impl ServiceQuotaExceededException {
42 pub fn message(&self) -> &str {
44 &self.message
45 }
46}
47impl ::std::fmt::Display for ServiceQuotaExceededException {
48 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
49 ::std::write!(f, "ServiceQuotaExceededException")?;
50 {
51 ::std::write!(f, ": {}", &self.message)?;
52 }
53 Ok(())
54 }
55}
56impl ::std::error::Error for ServiceQuotaExceededException {}
57impl ::aws_types::request_id::RequestId for crate::types::error::ServiceQuotaExceededException {
58 fn request_id(&self) -> Option<&str> {
59 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
60 self.meta().request_id()
61 }
62}
63impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ServiceQuotaExceededException {
64 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
65 &self.meta
66 }
67}
68impl ServiceQuotaExceededException {
69 pub fn builder() -> crate::types::error::builders::ServiceQuotaExceededExceptionBuilder {
71 crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default()
72 }
73}
74
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
77#[non_exhaustive]
78pub struct ServiceQuotaExceededExceptionBuilder {
79 pub(crate) message: ::std::option::Option<::std::string::String>,
80 pub(crate) resource_id: ::std::option::Option<::std::string::String>,
81 pub(crate) resource_type: ::std::option::Option<::std::string::String>,
82 pub(crate) service_code: ::std::option::Option<::std::string::String>,
83 pub(crate) quota_code: ::std::option::Option<::std::string::String>,
84 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
85}
86impl ServiceQuotaExceededExceptionBuilder {
87 pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90 self.message = ::std::option::Option::Some(input.into());
91 self
92 }
93 pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95 self.message = input;
96 self
97 }
98 pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
100 &self.message
101 }
102 pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105 self.resource_id = ::std::option::Option::Some(input.into());
106 self
107 }
108 pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110 self.resource_id = input;
111 self
112 }
113 pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
115 &self.resource_id
116 }
117 pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.resource_type = ::std::option::Option::Some(input.into());
121 self
122 }
123 pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125 self.resource_type = input;
126 self
127 }
128 pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
130 &self.resource_type
131 }
132 pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135 self.service_code = ::std::option::Option::Some(input.into());
136 self
137 }
138 pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.service_code = input;
141 self
142 }
143 pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
145 &self.service_code
146 }
147 pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150 self.quota_code = ::std::option::Option::Some(input.into());
151 self
152 }
153 pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155 self.quota_code = input;
156 self
157 }
158 pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
160 &self.quota_code
161 }
162 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
164 self.meta = Some(meta);
165 self
166 }
167
168 pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
170 self.meta = meta;
171 self
172 }
173 pub fn build(
181 self,
182 ) -> ::std::result::Result<crate::types::error::ServiceQuotaExceededException, ::aws_smithy_types::error::operation::BuildError> {
183 ::std::result::Result::Ok(crate::types::error::ServiceQuotaExceededException {
184 message: self.message.ok_or_else(|| {
185 ::aws_smithy_types::error::operation::BuildError::missing_field(
186 "message",
187 "message was not specified but it is required when building ServiceQuotaExceededException",
188 )
189 })?,
190 resource_id: self.resource_id.ok_or_else(|| {
191 ::aws_smithy_types::error::operation::BuildError::missing_field(
192 "resource_id",
193 "resource_id was not specified but it is required when building ServiceQuotaExceededException",
194 )
195 })?,
196 resource_type: self.resource_type.ok_or_else(|| {
197 ::aws_smithy_types::error::operation::BuildError::missing_field(
198 "resource_type",
199 "resource_type was not specified but it is required when building ServiceQuotaExceededException",
200 )
201 })?,
202 service_code: self.service_code.ok_or_else(|| {
203 ::aws_smithy_types::error::operation::BuildError::missing_field(
204 "service_code",
205 "service_code was not specified but it is required when building ServiceQuotaExceededException",
206 )
207 })?,
208 quota_code: self.quota_code.ok_or_else(|| {
209 ::aws_smithy_types::error::operation::BuildError::missing_field(
210 "quota_code",
211 "quota_code was not specified but it is required when building ServiceQuotaExceededException",
212 )
213 })?,
214 meta: self.meta.unwrap_or_default(),
215 })
216 }
217}