1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>The request exceeds the service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct ServiceQuotaExceededException {
|
7 + | #[allow(missing_docs)] // documentation missing in model
|
8 + | pub message: ::std::string::String,
|
9 + | /// <p>The unique ID of the resource referenced in the failed request.</p>
|
10 + | pub resource_id: ::std::option::Option<::std::string::String>,
|
11 + | /// <p>The resource type of the resource referenced in the failed request.</p>
|
12 + | pub resource_type: ::std::option::Option<::std::string::String>,
|
13 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
14 + | pub quota_code: ::std::string::String,
|
15 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
16 + | pub service_code: ::std::string::String,
|
17 + | pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
|
18 + | }
|
19 + | impl ServiceQuotaExceededException {
|
20 + | /// <p>The unique ID of the resource referenced in the failed request.</p>
|
21 + | pub fn resource_id(&self) -> ::std::option::Option<&str> {
|
22 + | self.resource_id.as_deref()
|
23 + | }
|
24 + | /// <p>The resource type of the resource referenced in the failed request.</p>
|
25 + | pub fn resource_type(&self) -> ::std::option::Option<&str> {
|
26 + | self.resource_type.as_deref()
|
27 + | }
|
28 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
29 + | pub fn quota_code(&self) -> &str {
|
30 + | use std::ops::Deref;
|
31 + | self.quota_code.deref()
|
32 + | }
|
33 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
34 + | pub fn service_code(&self) -> &str {
|
35 + | use std::ops::Deref;
|
36 + | self.service_code.deref()
|
37 + | }
|
38 + | }
|
39 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
40 + | ::aws_smithy_schema::ShapeId::from_parts(
|
41 + | "com.amazonaws.ssm#ServiceQuotaExceededException$Message",
|
42 + | "com.amazonaws.ssm",
|
43 + | "ServiceQuotaExceededException",
|
44 + | ),
|
45 + | ::aws_smithy_schema::ShapeType::String,
|
46 + | "Message",
|
47 + | 0,
|
48 + | );
|
49 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
50 + | ::aws_smithy_schema::ShapeId::from_parts(
|
51 + | "com.amazonaws.ssm#ServiceQuotaExceededException$ResourceId",
|
52 + | "com.amazonaws.ssm",
|
53 + | "ServiceQuotaExceededException",
|
54 + | ),
|
55 + | ::aws_smithy_schema::ShapeType::String,
|
56 + | "ResourceId",
|
57 + | 1,
|
58 + | );
|
59 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
60 + | ::aws_smithy_schema::ShapeId::from_parts(
|
61 + | "com.amazonaws.ssm#ServiceQuotaExceededException$ResourceType",
|
62 + | "com.amazonaws.ssm",
|
63 + | "ServiceQuotaExceededException",
|
64 + | ),
|
65 + | ::aws_smithy_schema::ShapeType::String,
|
66 + | "ResourceType",
|
67 + | 2,
|
68 + | );
|
69 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_QUOTA_CODE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
70 + | ::aws_smithy_schema::ShapeId::from_parts(
|
71 + | "com.amazonaws.ssm#ServiceQuotaExceededException$QuotaCode",
|
72 + | "com.amazonaws.ssm",
|
73 + | "ServiceQuotaExceededException",
|
74 + | ),
|
75 + | ::aws_smithy_schema::ShapeType::String,
|
76 + | "QuotaCode",
|
77 + | 3,
|
78 + | );
|
79 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_SERVICE_CODE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
80 + | ::aws_smithy_schema::ShapeId::from_parts(
|
81 + | "com.amazonaws.ssm#ServiceQuotaExceededException$ServiceCode",
|
82 + | "com.amazonaws.ssm",
|
83 + | "ServiceQuotaExceededException",
|
84 + | ),
|
85 + | ::aws_smithy_schema::ShapeType::String,
|
86 + | "ServiceCode",
|
87 + | 4,
|
88 + | );
|
89 + | static SERVICEQUOTAEXCEEDEDEXCEPTION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
|
90 + | ::aws_smithy_schema::ShapeId::from_parts(
|
91 + | "com.amazonaws.ssm#ServiceQuotaExceededException",
|
92 + | "com.amazonaws.ssm",
|
93 + | "ServiceQuotaExceededException",
|
94 + | ),
|
95 + | ::aws_smithy_schema::ShapeType::Structure,
|
96 + | &[
|
97 + | &SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_MESSAGE,
|
98 + | &SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_ID,
|
99 + | &SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_TYPE,
|
100 + | &SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_QUOTA_CODE,
|
101 + | &SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_SERVICE_CODE,
|
102 + | ],
|
103 + | );
|
104 + | impl ServiceQuotaExceededException {
|
105 + | /// The schema for this shape.
|
106 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &SERVICEQUOTAEXCEEDEDEXCEPTION_SCHEMA;
|
107 + | }
|
108 + | impl ::aws_smithy_schema::serde::SerializableStruct for ServiceQuotaExceededException {
|
109 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
110 + | fn serialize_members(
|
111 + | &self,
|
112 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
113 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
114 + | {
|
115 + | let val = &self.message;
|
116 + | ser.write_string(&SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_MESSAGE, val)?;
|
117 + | }
|
118 + | if let Some(ref val) = self.resource_id {
|
119 + | ser.write_string(&SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_ID, val)?;
|
120 + | }
|
121 + | if let Some(ref val) = self.resource_type {
|
122 + | ser.write_string(&SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_RESOURCE_TYPE, val)?;
|
123 + | }
|
124 + | {
|
125 + | let val = &self.quota_code;
|
126 + | ser.write_string(&SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_QUOTA_CODE, val)?;
|
127 + | }
|
128 + | {
|
129 + | let val = &self.service_code;
|
130 + | ser.write_string(&SERVICEQUOTAEXCEEDEDEXCEPTION_MEMBER_SERVICE_CODE, val)?;
|
131 + | }
|
132 + | Ok(())
|
133 + | }
|
134 + | }
|
135 + | impl ServiceQuotaExceededException {
|
136 + | /// Deserializes this structure from a [`ShapeDeserializer`].
|
137 + | pub fn deserialize(
|
138 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
139 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
140 + | #[allow(unused_variables, unused_mut)]
|
141 + | let mut builder = Self::builder();
|
142 + | #[allow(
|
143 + | unused_variables,
|
144 + | unreachable_code,
|
145 + | clippy::single_match,
|
146 + | clippy::match_single_binding,
|
147 + | clippy::diverging_sub_expression
|
148 + | )]
|
149 + | deserializer.read_struct(&SERVICEQUOTAEXCEEDEDEXCEPTION_SCHEMA, &mut |member, deser| {
|
150 + | match member.member_index() {
|
151 + | Some(0) => {
|
152 + | builder.message = Some(deser.read_string(member)?);
|
153 + | }
|
154 + | Some(1) => {
|
155 + | if deser.is_null() {
|
156 + | deser.read_null()?;
|
157 + | } else {
|
158 + | builder.resource_id = Some(deser.read_string(member)?);
|
159 + | }
|
160 + | }
|
161 + | Some(2) => {
|
162 + | if deser.is_null() {
|
163 + | deser.read_null()?;
|
164 + | } else {
|
165 + | builder.resource_type = Some(deser.read_string(member)?);
|
166 + | }
|
167 + | }
|
168 + | Some(3) => {
|
169 + | builder.quota_code = Some(deser.read_string(member)?);
|
170 + | }
|
171 + | Some(4) => {
|
172 + | builder.service_code = Some(deser.read_string(member)?);
|
173 + | }
|
174 + | _ => {}
|
175 + | }
|
176 + | Ok(())
|
177 + | })?;
|
178 + | builder.message = builder.message.or(Some(String::new()));
|
179 + | builder.quota_code = builder.quota_code.or(Some(String::new()));
|
180 + | builder.service_code = builder.service_code.or(Some(String::new()));
|
181 + | builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
|
182 + | }
|
183 + | }
|
184 + | impl ServiceQuotaExceededException {
|
185 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
186 + | pub fn deserialize_with_response(
|
187 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
188 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
189 + | _status: u16,
|
190 + | body: &[u8],
|
191 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
192 + | if body.is_empty() {
|
193 + | return Self::builder()
|
194 + | .build()
|
195 + | .map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()));
|
196 + | }
|
197 + | Self::deserialize(deserializer)
|
198 + | }
|
199 + | }
|
200 + | impl ServiceQuotaExceededException {
|
201 + | /// Returns the error message.
|
202 + | pub fn message(&self) -> &str {
|
203 + | &self.message
|
204 + | }
|
205 + | }
|
206 + | impl ::std::fmt::Display for ServiceQuotaExceededException {
|
207 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
208 + | ::std::write!(f, "ServiceQuotaExceededException")?;
|
209 + | {
|
210 + | ::std::write!(f, ": {}", &self.message)?;
|
211 + | }
|
212 + | Ok(())
|
213 + | }
|
214 + | }
|
215 + | impl ::std::error::Error for ServiceQuotaExceededException {}
|
216 + | impl ::aws_types::request_id::RequestId for crate::types::error::ServiceQuotaExceededException {
|
217 + | fn request_id(&self) -> Option<&str> {
|
218 + | use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
|
219 + | self.meta().request_id()
|
220 + | }
|
221 + | }
|
222 + | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ServiceQuotaExceededException {
|
223 + | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
224 + | &self.meta
|
225 + | }
|
226 + | }
|
227 + | impl ServiceQuotaExceededException {
|
228 + | /// Creates a new builder-style object to manufacture [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
|
229 + | pub fn builder() -> crate::types::error::builders::ServiceQuotaExceededExceptionBuilder {
|
230 + | crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default()
|
231 + | }
|
232 + | }
|
233 + |
|
234 + | /// A builder for [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
|
235 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
236 + | #[non_exhaustive]
|
237 + | pub struct ServiceQuotaExceededExceptionBuilder {
|
238 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
239 + | pub(crate) resource_id: ::std::option::Option<::std::string::String>,
|
240 + | pub(crate) resource_type: ::std::option::Option<::std::string::String>,
|
241 + | pub(crate) quota_code: ::std::option::Option<::std::string::String>,
|
242 + | pub(crate) service_code: ::std::option::Option<::std::string::String>,
|
243 + | meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
244 + | }
|
245 + | impl ServiceQuotaExceededExceptionBuilder {
|
246 + | #[allow(missing_docs)] // documentation missing in model
|
247 + | /// This field is required.
|
248 + | pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
249 + | self.message = ::std::option::Option::Some(input.into());
|
250 + | self
|
251 + | }
|
252 + | #[allow(missing_docs)] // documentation missing in model
|
253 + | pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
254 + | self.message = input;
|
255 + | self
|
256 + | }
|
257 + | #[allow(missing_docs)] // documentation missing in model
|
258 + | pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
|
259 + | &self.message
|
260 + | }
|
261 + | /// <p>The unique ID of the resource referenced in the failed request.</p>
|
262 + | pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
263 + | self.resource_id = ::std::option::Option::Some(input.into());
|
264 + | self
|
265 + | }
|
266 + | /// <p>The unique ID of the resource referenced in the failed request.</p>
|
267 + | pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
268 + | self.resource_id = input;
|
269 + | self
|
270 + | }
|
271 + | /// <p>The unique ID of the resource referenced in the failed request.</p>
|
272 + | pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
|
273 + | &self.resource_id
|
274 + | }
|
275 + | /// <p>The resource type of the resource referenced in the failed request.</p>
|
276 + | pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
277 + | self.resource_type = ::std::option::Option::Some(input.into());
|
278 + | self
|
279 + | }
|
280 + | /// <p>The resource type of the resource referenced in the failed request.</p>
|
281 + | pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
282 + | self.resource_type = input;
|
283 + | self
|
284 + | }
|
285 + | /// <p>The resource type of the resource referenced in the failed request.</p>
|
286 + | pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
|
287 + | &self.resource_type
|
288 + | }
|
289 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
290 + | /// This field is required.
|
291 + | pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
292 + | self.quota_code = ::std::option::Option::Some(input.into());
|
293 + | self
|
294 + | }
|
295 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
296 + | pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
297 + | self.quota_code = input;
|
298 + | self
|
299 + | }
|
300 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
301 + | pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
|
302 + | &self.quota_code
|
303 + | }
|
304 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
305 + | /// This field is required.
|
306 + | pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
307 + | self.service_code = ::std::option::Option::Some(input.into());
|
308 + | self
|
309 + | }
|
310 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
311 + | pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
312 + | self.service_code = input;
|
313 + | self
|
314 + | }
|
315 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
316 + | pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
|
317 + | &self.service_code
|
318 + | }
|
319 + | /// Sets error metadata
|
320 + | pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
321 + | self.meta = Some(meta);
|
322 + | self
|
323 + | }
|
324 + |
|
325 + | /// Sets error metadata
|
326 + | pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
|
327 + | self.meta = meta;
|
328 + | self
|
329 + | }
|
330 + | /// Consumes the builder and constructs a [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
|
331 + | /// This method will fail if any of the following fields are not set:
|
332 + | /// - [`message`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::message)
|
333 + | /// - [`quota_code`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::quota_code)
|
334 + | /// - [`service_code`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::service_code)
|
335 + | pub fn build(
|
336 + | self,
|
337 + | ) -> ::std::result::Result<crate::types::error::ServiceQuotaExceededException, ::aws_smithy_types::error::operation::BuildError> {
|
338 + | ::std::result::Result::Ok(crate::types::error::ServiceQuotaExceededException {
|
339 + | message: self.message.ok_or_else(|| {
|
340 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
341 + | "message",
|
342 + | "message was not specified but it is required when building ServiceQuotaExceededException",
|
343 + | )
|
344 + | })?,
|
345 + | resource_id: self.resource_id,
|
346 + | resource_type: self.resource_type,
|
347 + | quota_code: self.quota_code.ok_or_else(|| {
|
348 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
349 + | "quota_code",
|
350 + | "quota_code was not specified but it is required when building ServiceQuotaExceededException",
|
351 + | )
|
352 + | })?,
|
353 + | service_code: self.service_code.ok_or_else(|| {
|
354 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
355 + | "service_code",
|
356 + | "service_code was not specified but it is required when building ServiceQuotaExceededException",
|
357 + | )
|
358 + | })?,
|
359 + | meta: self.meta.unwrap_or_default(),
|
360 + | })
|
361 + | }
|
362 + | }
|