1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>The request or operation couldn't be performed because the service is throttling requests.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct ThrottlingException {
|
7 + | #[allow(missing_docs)] // documentation missing in model
|
8 + | pub message: ::std::string::String,
|
9 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
10 + | pub quota_code: ::std::option::Option<::std::string::String>,
|
11 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
12 + | pub service_code: ::std::option::Option<::std::string::String>,
|
13 + | pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
|
14 + | }
|
15 + | impl ThrottlingException {
|
16 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
17 + | pub fn quota_code(&self) -> ::std::option::Option<&str> {
|
18 + | self.quota_code.as_deref()
|
19 + | }
|
20 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
21 + | pub fn service_code(&self) -> ::std::option::Option<&str> {
|
22 + | self.service_code.as_deref()
|
23 + | }
|
24 + | }
|
25 + | static THROTTLINGEXCEPTION_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
26 + | ::aws_smithy_schema::ShapeId::from_parts(
|
27 + | "com.amazonaws.ssm#ThrottlingException$Message",
|
28 + | "com.amazonaws.ssm",
|
29 + | "ThrottlingException",
|
30 + | ),
|
31 + | ::aws_smithy_schema::ShapeType::String,
|
32 + | "Message",
|
33 + | 0,
|
34 + | );
|
35 + | static THROTTLINGEXCEPTION_MEMBER_QUOTA_CODE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
36 + | ::aws_smithy_schema::ShapeId::from_parts(
|
37 + | "com.amazonaws.ssm#ThrottlingException$QuotaCode",
|
38 + | "com.amazonaws.ssm",
|
39 + | "ThrottlingException",
|
40 + | ),
|
41 + | ::aws_smithy_schema::ShapeType::String,
|
42 + | "QuotaCode",
|
43 + | 1,
|
44 + | );
|
45 + | static THROTTLINGEXCEPTION_MEMBER_SERVICE_CODE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
|
46 + | ::aws_smithy_schema::ShapeId::from_parts(
|
47 + | "com.amazonaws.ssm#ThrottlingException$ServiceCode",
|
48 + | "com.amazonaws.ssm",
|
49 + | "ThrottlingException",
|
50 + | ),
|
51 + | ::aws_smithy_schema::ShapeType::String,
|
52 + | "ServiceCode",
|
53 + | 2,
|
54 + | );
|
55 + | static THROTTLINGEXCEPTION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
|
56 + | ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#ThrottlingException", "com.amazonaws.ssm", "ThrottlingException"),
|
57 + | ::aws_smithy_schema::ShapeType::Structure,
|
58 + | &[
|
59 + | &THROTTLINGEXCEPTION_MEMBER_MESSAGE,
|
60 + | &THROTTLINGEXCEPTION_MEMBER_QUOTA_CODE,
|
61 + | &THROTTLINGEXCEPTION_MEMBER_SERVICE_CODE,
|
62 + | ],
|
63 + | );
|
64 + | impl ThrottlingException {
|
65 + | /// The schema for this shape.
|
66 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &THROTTLINGEXCEPTION_SCHEMA;
|
67 + | }
|
68 + | impl ::aws_smithy_schema::serde::SerializableStruct for ThrottlingException {
|
69 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
70 + | fn serialize_members(
|
71 + | &self,
|
72 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
73 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
74 + | {
|
75 + | let val = &self.message;
|
76 + | ser.write_string(&THROTTLINGEXCEPTION_MEMBER_MESSAGE, val)?;
|
77 + | }
|
78 + | if let Some(ref val) = self.quota_code {
|
79 + | ser.write_string(&THROTTLINGEXCEPTION_MEMBER_QUOTA_CODE, val)?;
|
80 + | }
|
81 + | if let Some(ref val) = self.service_code {
|
82 + | ser.write_string(&THROTTLINGEXCEPTION_MEMBER_SERVICE_CODE, val)?;
|
83 + | }
|
84 + | Ok(())
|
85 + | }
|
86 + | }
|
87 + | impl ThrottlingException {
|
88 + | /// Deserializes this structure from a [`ShapeDeserializer`].
|
89 + | pub fn deserialize(
|
90 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
91 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
92 + | #[allow(unused_variables, unused_mut)]
|
93 + | let mut builder = Self::builder();
|
94 + | #[allow(
|
95 + | unused_variables,
|
96 + | unreachable_code,
|
97 + | clippy::single_match,
|
98 + | clippy::match_single_binding,
|
99 + | clippy::diverging_sub_expression
|
100 + | )]
|
101 + | deserializer.read_struct(&THROTTLINGEXCEPTION_SCHEMA, &mut |member, deser| {
|
102 + | match member.member_index() {
|
103 + | Some(0) => {
|
104 + | builder.message = Some(deser.read_string(member)?);
|
105 + | }
|
106 + | Some(1) => {
|
107 + | if deser.is_null() {
|
108 + | deser.read_null()?;
|
109 + | } else {
|
110 + | builder.quota_code = Some(deser.read_string(member)?);
|
111 + | }
|
112 + | }
|
113 + | Some(2) => {
|
114 + | if deser.is_null() {
|
115 + | deser.read_null()?;
|
116 + | } else {
|
117 + | builder.service_code = Some(deser.read_string(member)?);
|
118 + | }
|
119 + | }
|
120 + | _ => {}
|
121 + | }
|
122 + | Ok(())
|
123 + | })?;
|
124 + | builder.message = builder.message.or(Some(String::new()));
|
125 + | builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
|
126 + | }
|
127 + | }
|
128 + | impl ThrottlingException {
|
129 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
130 + | pub fn deserialize_with_response(
|
131 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
132 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
133 + | _status: u16,
|
134 + | body: &[u8],
|
135 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
136 + | if body.is_empty() {
|
137 + | return Self::builder()
|
138 + | .build()
|
139 + | .map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()));
|
140 + | }
|
141 + | Self::deserialize(deserializer)
|
142 + | }
|
143 + | }
|
144 + | impl ThrottlingException {
|
145 + | /// Returns the error message.
|
146 + | pub fn message(&self) -> &str {
|
147 + | &self.message
|
148 + | }
|
149 + | }
|
150 + | impl ::std::fmt::Display for ThrottlingException {
|
151 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
152 + | ::std::write!(f, "ThrottlingException")?;
|
153 + | {
|
154 + | ::std::write!(f, ": {}", &self.message)?;
|
155 + | }
|
156 + | Ok(())
|
157 + | }
|
158 + | }
|
159 + | impl ::std::error::Error for ThrottlingException {}
|
160 + | impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
|
161 + | fn request_id(&self) -> Option<&str> {
|
162 + | use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
|
163 + | self.meta().request_id()
|
164 + | }
|
165 + | }
|
166 + | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
|
167 + | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
168 + | &self.meta
|
169 + | }
|
170 + | }
|
171 + | impl ThrottlingException {
|
172 + | /// Creates a new builder-style object to manufacture [`ThrottlingException`](crate::types::error::ThrottlingException).
|
173 + | pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
|
174 + | crate::types::error::builders::ThrottlingExceptionBuilder::default()
|
175 + | }
|
176 + | }
|
177 + |
|
178 + | /// A builder for [`ThrottlingException`](crate::types::error::ThrottlingException).
|
179 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
180 + | #[non_exhaustive]
|
181 + | pub struct ThrottlingExceptionBuilder {
|
182 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
183 + | pub(crate) quota_code: ::std::option::Option<::std::string::String>,
|
184 + | pub(crate) service_code: ::std::option::Option<::std::string::String>,
|
185 + | meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
186 + | }
|
187 + | impl ThrottlingExceptionBuilder {
|
188 + | #[allow(missing_docs)] // documentation missing in model
|
189 + | /// This field is required.
|
190 + | pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
191 + | self.message = ::std::option::Option::Some(input.into());
|
192 + | self
|
193 + | }
|
194 + | #[allow(missing_docs)] // documentation missing in model
|
195 + | pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
196 + | self.message = input;
|
197 + | self
|
198 + | }
|
199 + | #[allow(missing_docs)] // documentation missing in model
|
200 + | pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
|
201 + | &self.message
|
202 + | }
|
203 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
204 + | pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
205 + | self.quota_code = ::std::option::Option::Some(input.into());
|
206 + | self
|
207 + | }
|
208 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
209 + | pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
210 + | self.quota_code = input;
|
211 + | self
|
212 + | }
|
213 + | /// <p>The quota code recognized by the Amazon Web Services Service Quotas service.</p>
|
214 + | pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
|
215 + | &self.quota_code
|
216 + | }
|
217 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
218 + | pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
219 + | self.service_code = ::std::option::Option::Some(input.into());
|
220 + | self
|
221 + | }
|
222 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
223 + | pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
224 + | self.service_code = input;
|
225 + | self
|
226 + | }
|
227 + | /// <p>The code for the Amazon Web Services service that owns the quota.</p>
|
228 + | pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
|
229 + | &self.service_code
|
230 + | }
|
231 + | /// Sets error metadata
|
232 + | pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
233 + | self.meta = Some(meta);
|
234 + | self
|
235 + | }
|
236 + |
|
237 + | /// Sets error metadata
|
238 + | pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
|
239 + | self.meta = meta;
|
240 + | self
|
241 + | }
|
242 + | /// Consumes the builder and constructs a [`ThrottlingException`](crate::types::error::ThrottlingException).
|
243 + | /// This method will fail if any of the following fields are not set:
|
244 + | /// - [`message`](crate::types::error::builders::ThrottlingExceptionBuilder::message)
|
245 + | pub fn build(self) -> ::std::result::Result<crate::types::error::ThrottlingException, ::aws_smithy_types::error::operation::BuildError> {
|
246 + | ::std::result::Result::Ok(crate::types::error::ThrottlingException {
|
247 + | message: self.message.ok_or_else(|| {
|
248 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
249 + | "message",
|
250 + | "message was not specified but it is required when building ThrottlingException",
|
251 + | )
|
252 + | })?,
|
253 + | quota_code: self.quota_code,
|
254 + | service_code: self.service_code,
|
255 + | meta: self.meta.unwrap_or_default(),
|
256 + | })
|
257 + | }
|
258 + | }
|