1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// Error type for the `CapturePokemon` operation.
|
4 + | /// Each variant represents an error that can occur for the `CapturePokemon` operation.
|
5 + | #[derive(::std::fmt::Debug)]
|
6 + | pub enum CapturePokemonError {
|
7 + | #[allow(missing_docs)] // documentation missing in model
|
8 + | UnsupportedRegionError(crate::error::UnsupportedRegionError),
|
9 + | #[allow(missing_docs)] // documentation missing in model
|
10 + | ThrottlingError(crate::error::ThrottlingError),
|
11 + | /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
|
12 + | ValidationException(crate::error::ValidationException),
|
13 + | #[allow(missing_docs)] // documentation missing in model
|
14 + | MasterBallUnsuccessful(crate::error::MasterBallUnsuccessful),
|
15 + | #[allow(missing_docs)] // documentation missing in model
|
16 + | InvalidPokeballError(crate::error::InvalidPokeballError),
|
17 + | }
|
18 + | impl ::std::fmt::Display for CapturePokemonError {
|
19 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
20 + | match &self {
|
21 + | CapturePokemonError::UnsupportedRegionError(_inner) => _inner.fmt(f),
|
22 + | CapturePokemonError::ThrottlingError(_inner) => _inner.fmt(f),
|
23 + | CapturePokemonError::ValidationException(_inner) => _inner.fmt(f),
|
24 + | CapturePokemonError::MasterBallUnsuccessful(_inner) => _inner.fmt(f),
|
25 + | CapturePokemonError::InvalidPokeballError(_inner) => _inner.fmt(f),
|
26 + | }
|
27 + | }
|
28 + | }
|
29 + | impl CapturePokemonError {
|
30 + | /// Returns `true` if the error kind is `CapturePokemonError::UnsupportedRegionError`.
|
31 + | pub fn is_unsupported_region_error(&self) -> bool {
|
32 + | matches!(&self, CapturePokemonError::UnsupportedRegionError(_))
|
33 + | }
|
34 + | /// Returns `true` if the error kind is `CapturePokemonError::ThrottlingError`.
|
35 + | pub fn is_throttling_error(&self) -> bool {
|
36 + | matches!(&self, CapturePokemonError::ThrottlingError(_))
|
37 + | }
|
38 + | /// Returns `true` if the error kind is `CapturePokemonError::ValidationException`.
|
39 + | pub fn is_validation_exception(&self) -> bool {
|
40 + | matches!(&self, CapturePokemonError::ValidationException(_))
|
41 + | }
|
42 + | /// Returns `true` if the error kind is `CapturePokemonError::MasterBallUnsuccessful`.
|
43 + | pub fn is_master_ball_unsuccessful(&self) -> bool {
|
44 + | matches!(&self, CapturePokemonError::MasterBallUnsuccessful(_))
|
45 + | }
|
46 + | /// Returns `true` if the error kind is `CapturePokemonError::InvalidPokeballError`.
|
47 + | pub fn is_invalid_pokeball_error(&self) -> bool {
|
48 + | matches!(&self, CapturePokemonError::InvalidPokeballError(_))
|
49 + | }
|
50 + | /// Returns the error name string by matching the correct variant.
|
51 + | pub fn name(&self) -> &'static str {
|
52 + | match &self {
|
53 + | CapturePokemonError::UnsupportedRegionError(_inner) => _inner.name(),
|
54 + | CapturePokemonError::ThrottlingError(_inner) => _inner.name(),
|
55 + | CapturePokemonError::ValidationException(_inner) => _inner.name(),
|
56 + | CapturePokemonError::MasterBallUnsuccessful(_inner) => _inner.name(),
|
57 + | CapturePokemonError::InvalidPokeballError(_inner) => _inner.name(),
|
58 + | }
|
59 + | }
|
60 + | }
|
61 + | impl ::std::error::Error for CapturePokemonError {
|
62 + | fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
63 + | match &self {
|
64 + | CapturePokemonError::UnsupportedRegionError(_inner) => Some(_inner),
|
65 + | CapturePokemonError::ThrottlingError(_inner) => Some(_inner),
|
66 + | CapturePokemonError::ValidationException(_inner) => Some(_inner),
|
67 + | CapturePokemonError::MasterBallUnsuccessful(_inner) => Some(_inner),
|
68 + | CapturePokemonError::InvalidPokeballError(_inner) => Some(_inner),
|
69 + | }
|
70 + | }
|
71 + | }
|
72 + | impl ::std::convert::From<crate::error::UnsupportedRegionError>
|
73 + | for crate::error::CapturePokemonError
|
74 + | {
|
75 + | fn from(variant: crate::error::UnsupportedRegionError) -> crate::error::CapturePokemonError {
|
76 + | Self::UnsupportedRegionError(variant)
|
77 + | }
|
78 + | }
|
79 + | impl ::std::convert::From<crate::error::ThrottlingError> for crate::error::CapturePokemonError {
|
80 + | fn from(variant: crate::error::ThrottlingError) -> crate::error::CapturePokemonError {
|
81 + | Self::ThrottlingError(variant)
|
82 + | }
|
83 + | }
|
84 + | impl ::std::convert::From<crate::error::ValidationException> for crate::error::CapturePokemonError {
|
85 + | fn from(variant: crate::error::ValidationException) -> crate::error::CapturePokemonError {
|
86 + | Self::ValidationException(variant)
|
87 + | }
|
88 + | }
|
89 + | impl ::std::convert::From<crate::error::MasterBallUnsuccessful>
|
90 + | for crate::error::CapturePokemonError
|
91 + | {
|
92 + | fn from(variant: crate::error::MasterBallUnsuccessful) -> crate::error::CapturePokemonError {
|
93 + | Self::MasterBallUnsuccessful(variant)
|
94 + | }
|
95 + | }
|
96 + | impl ::std::convert::From<crate::error::InvalidPokeballError>
|
97 + | for crate::error::CapturePokemonError
|
98 + | {
|
99 + | fn from(variant: crate::error::InvalidPokeballError) -> crate::error::CapturePokemonError {
|
100 + | Self::InvalidPokeballError(variant)
|
101 + | }
|
102 + | }
|
103 + |
|
104 + | #[allow(missing_docs)] // documentation missing in model
|
105 + | #[derive(
|
106 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
107 + | )]
|
108 + | pub struct InvalidPokeballError {
|
109 + | #[allow(missing_docs)] // documentation missing in model
|
110 + | pub pokeball: ::std::string::String,
|
111 + | }
|
112 + | impl InvalidPokeballError {
|
113 + | #[allow(missing_docs)] // documentation missing in model
|
114 + | pub fn pokeball(&self) -> &str {
|
115 + | use std::ops::Deref;
|
116 + | self.pokeball.deref()
|
117 + | }
|
118 + | }
|
119 + | impl InvalidPokeballError {
|
120 + | #[doc(hidden)]
|
121 + | /// Returns the error name.
|
122 + | pub fn name(&self) -> &'static str {
|
123 + | "InvalidPokeballError"
|
124 + | }
|
125 + | }
|
126 + | impl ::std::fmt::Display for InvalidPokeballError {
|
127 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
128 + | ::std::write!(f, "InvalidPokeballError")?;
|
129 + | Ok(())
|
130 + | }
|
131 + | }
|
132 + | impl ::std::error::Error for InvalidPokeballError {}
|
133 + | impl InvalidPokeballError {
|
134 + | /// Creates a new builder-style object to manufacture [`InvalidPokeballError`](crate::error::InvalidPokeballError).
|
135 + | pub fn builder() -> crate::error::invalid_pokeball_error::Builder {
|
136 + | crate::error::invalid_pokeball_error::Builder::default()
|
137 + | }
|
138 + | }
|
139 + |
|
140 + | #[allow(missing_docs)] // documentation missing in model
|
141 + | #[derive(
|
142 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
143 + | )]
|
144 + | pub struct MasterBallUnsuccessful {
|
145 + | #[allow(missing_docs)] // documentation missing in model
|
146 + | pub message: ::std::option::Option<::std::string::String>,
|
147 + | }
|
148 + | impl MasterBallUnsuccessful {
|
149 + | /// Returns the error message.
|
150 + | pub fn message(&self) -> ::std::option::Option<&str> {
|
151 + | self.message.as_deref()
|
152 + | }
|
153 + | #[doc(hidden)]
|
154 + | /// Returns the error name.
|
155 + | pub fn name(&self) -> &'static str {
|
156 + | "MasterBallUnsuccessful"
|
157 + | }
|
158 + | }
|
159 + | impl ::std::fmt::Display for MasterBallUnsuccessful {
|
160 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
161 + | ::std::write!(f, "MasterBallUnsuccessful")?;
|
162 + | if let ::std::option::Option::Some(inner_1) = &self.message {
|
163 + | {
|
164 + | ::std::write!(f, ": {inner_1}")?;
|
165 + | }
|
166 + | }
|
167 + | Ok(())
|
168 + | }
|
169 + | }
|
170 + | impl ::std::error::Error for MasterBallUnsuccessful {}
|
171 + | impl MasterBallUnsuccessful {
|
172 + | /// Creates a new builder-style object to manufacture [`MasterBallUnsuccessful`](crate::error::MasterBallUnsuccessful).
|
173 + | pub fn builder() -> crate::error::master_ball_unsuccessful::Builder {
|
174 + | crate::error::master_ball_unsuccessful::Builder::default()
|
175 + | }
|
176 + | }
|
177 + | impl crate::constrained::Constrained for crate::error::MasterBallUnsuccessful {
|
178 + | type Unconstrained = crate::error::master_ball_unsuccessful::Builder;
|
179 + | }
|
180 + |
|
181 + | /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
|
182 + | #[derive(
|
183 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
184 + | )]
|
185 + | pub struct ValidationException {
|
186 + | /// A summary of the validation failure.
|
187 + | pub message: ::std::string::String,
|
188 + | /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
|
189 + | pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
|
190 + | }
|
191 + | impl ValidationException {
|
192 + | /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
|
193 + | pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
|
194 + | self.field_list.as_deref()
|
195 + | }
|
196 + | }
|
197 + | impl ValidationException {
|
198 + | /// Returns the error message.
|
199 + | pub fn message(&self) -> &str {
|
200 + | &self.message
|
201 + | }
|
202 + | #[doc(hidden)]
|
203 + | /// Returns the error name.
|
204 + | pub fn name(&self) -> &'static str {
|
205 + | "ValidationException"
|
206 + | }
|
207 + | }
|
208 + | impl ::std::fmt::Display for ValidationException {
|
209 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
210 + | ::std::write!(f, "ValidationException")?;
|
211 + | {
|
212 + | ::std::write!(f, ": {}", &self.message)?;
|
213 + | }
|
214 + | Ok(())
|
215 + | }
|
216 + | }
|
217 + | impl ::std::error::Error for ValidationException {}
|
218 + | impl ValidationException {
|
219 + | /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
|
220 + | pub fn builder() -> crate::error::validation_exception::Builder {
|
221 + | crate::error::validation_exception::Builder::default()
|
222 + | }
|
223 + | }
|
224 + |
|
225 + | #[allow(missing_docs)] // documentation missing in model
|
226 + | #[derive(
|
227 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
228 + | )]
|
229 + | pub struct ThrottlingError {}
|
230 + | impl ThrottlingError {
|
231 + | #[doc(hidden)]
|
232 + | /// Returns the error name.
|
233 + | pub fn name(&self) -> &'static str {
|
234 + | "ThrottlingError"
|
235 + | }
|
236 + | }
|
237 + | impl ::std::fmt::Display for ThrottlingError {
|
238 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
239 + | ::std::write!(f, "ThrottlingError")?;
|
240 + | Ok(())
|
241 + | }
|
242 + | }
|
243 + | impl ::std::error::Error for ThrottlingError {}
|
244 + | impl ThrottlingError {
|
245 + | /// Creates a new builder-style object to manufacture [`ThrottlingError`](crate::error::ThrottlingError).
|
246 + | pub fn builder() -> crate::error::throttling_error::Builder {
|
247 + | crate::error::throttling_error::Builder::default()
|
248 + | }
|
249 + | }
|
250 + |
|
251 + | #[allow(missing_docs)] // documentation missing in model
|
252 + | #[derive(
|
253 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
254 + | )]
|
255 + | pub struct UnsupportedRegionError {
|
256 + | #[allow(missing_docs)] // documentation missing in model
|
257 + | pub region: ::std::string::String,
|
258 + | }
|
259 + | impl UnsupportedRegionError {
|
260 + | #[allow(missing_docs)] // documentation missing in model
|
261 + | pub fn region(&self) -> &str {
|
262 + | use std::ops::Deref;
|
263 + | self.region.deref()
|
264 + | }
|
265 + | }
|
266 + | impl UnsupportedRegionError {
|
267 + | #[doc(hidden)]
|
268 + | /// Returns the error name.
|
269 + | pub fn name(&self) -> &'static str {
|
270 + | "UnsupportedRegionError"
|
271 + | }
|
272 + | }
|
273 + | impl ::std::fmt::Display for UnsupportedRegionError {
|
274 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
275 + | ::std::write!(f, "UnsupportedRegionError")?;
|
276 + | Ok(())
|
277 + | }
|
278 + | }
|
279 + | impl ::std::error::Error for UnsupportedRegionError {}
|
280 + | impl UnsupportedRegionError {
|
281 + | /// Creates a new builder-style object to manufacture [`UnsupportedRegionError`](crate::error::UnsupportedRegionError).
|
282 + | pub fn builder() -> crate::error::unsupported_region_error::Builder {
|
283 + | crate::error::unsupported_region_error::Builder::default()
|
284 + | }
|
285 + | }
|
286 + |
|
287 + | /// Error type for the `CapturePokemonEvents` operation.
|
288 + | /// Each variant represents an error that can occur for the `CapturePokemonEvents` operation.
|
289 + | #[derive(::std::fmt::Debug)]
|
290 + | pub enum CapturePokemonEventsError {
|
291 + | #[allow(missing_docs)] // documentation missing in model
|
292 + | InvalidPokeballError(crate::error::InvalidPokeballError),
|
293 + | #[allow(missing_docs)] // documentation missing in model
|
294 + | ThrottlingError(crate::error::ThrottlingError),
|
295 + | }
|
296 + | impl ::std::fmt::Display for CapturePokemonEventsError {
|
297 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
298 + | match &self {
|
299 + | CapturePokemonEventsError::InvalidPokeballError(_inner) => _inner.fmt(f),
|
300 + | CapturePokemonEventsError::ThrottlingError(_inner) => _inner.fmt(f),
|
301 + | }
|
302 + | }
|
303 + | }
|
304 + | impl CapturePokemonEventsError {
|
305 + | /// Returns `true` if the error kind is `CapturePokemonEventsError::InvalidPokeballError`.
|
306 + | pub fn is_invalid_pokeball_error(&self) -> bool {
|
307 + | matches!(&self, CapturePokemonEventsError::InvalidPokeballError(_))
|
308 + | }
|
309 + | /// Returns `true` if the error kind is `CapturePokemonEventsError::ThrottlingError`.
|
310 + | pub fn is_throttling_error(&self) -> bool {
|
311 + | matches!(&self, CapturePokemonEventsError::ThrottlingError(_))
|
312 + | }
|
313 + | /// Returns the error name string by matching the correct variant.
|
314 + | pub fn name(&self) -> &'static str {
|
315 + | match &self {
|
316 + | CapturePokemonEventsError::InvalidPokeballError(_inner) => _inner.name(),
|
317 + | CapturePokemonEventsError::ThrottlingError(_inner) => _inner.name(),
|
318 + | }
|
319 + | }
|
320 + | }
|
321 + | impl ::std::error::Error for CapturePokemonEventsError {
|
322 + | fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
323 + | match &self {
|
324 + | CapturePokemonEventsError::InvalidPokeballError(_inner) => Some(_inner),
|
325 + | CapturePokemonEventsError::ThrottlingError(_inner) => Some(_inner),
|
326 + | }
|
327 + | }
|
328 + | }
|
329 + | impl ::std::convert::From<crate::error::InvalidPokeballError>
|
330 + | for crate::error::CapturePokemonEventsError
|
331 + | {
|
332 + | fn from(
|
333 + | variant: crate::error::InvalidPokeballError,
|
334 + | ) -> crate::error::CapturePokemonEventsError {
|
335 + | Self::InvalidPokeballError(variant)
|
336 + | }
|
337 + | }
|
338 + | impl ::std::convert::From<crate::error::ThrottlingError>
|
339 + | for crate::error::CapturePokemonEventsError
|
340 + | {
|
341 + | fn from(variant: crate::error::ThrottlingError) -> crate::error::CapturePokemonEventsError {
|
342 + | Self::ThrottlingError(variant)
|
343 + | }
|
344 + | }
|
345 + |
|
346 + | /// Error type for the `AttemptCapturingPokemonEvent` operation.
|
347 + | /// Each variant represents an error that can occur for the `AttemptCapturingPokemonEvent` operation.
|
348 + | #[derive(::std::fmt::Debug)]
|
349 + | pub enum AttemptCapturingPokemonEventError {
|
350 + | #[allow(missing_docs)] // documentation missing in model
|
351 + | MasterBallUnsuccessful(crate::error::MasterBallUnsuccessful),
|
352 + | }
|
353 + | impl ::std::fmt::Display for AttemptCapturingPokemonEventError {
|
354 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
355 + | match &self {
|
356 + | AttemptCapturingPokemonEventError::MasterBallUnsuccessful(_inner) => _inner.fmt(f),
|
357 + | }
|
358 + | }
|
359 + | }
|
360 + | impl AttemptCapturingPokemonEventError {
|
361 + | /// Returns `true` if the error kind is `AttemptCapturingPokemonEventError::MasterBallUnsuccessful`.
|
362 + | pub fn is_master_ball_unsuccessful(&self) -> bool {
|
363 + | matches!(
|
364 + | &self,
|
365 + | AttemptCapturingPokemonEventError::MasterBallUnsuccessful(_)
|
366 + | )
|
367 + | }
|
368 + | /// Returns the error name string by matching the correct variant.
|
369 + | pub fn name(&self) -> &'static str {
|
370 + | match &self {
|
371 + | AttemptCapturingPokemonEventError::MasterBallUnsuccessful(_inner) => _inner.name(),
|
372 + | }
|
373 + | }
|
374 + | }
|
375 + | impl ::std::error::Error for AttemptCapturingPokemonEventError {
|
376 + | fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
377 + | match &self {
|
378 + | AttemptCapturingPokemonEventError::MasterBallUnsuccessful(_inner) => Some(_inner),
|
379 + | }
|
380 + | }
|
381 + | }
|
382 + | impl ::std::convert::From<crate::error::MasterBallUnsuccessful>
|
383 + | for crate::error::AttemptCapturingPokemonEventError
|
384 + | {
|
385 + | fn from(
|
386 + | variant: crate::error::MasterBallUnsuccessful,
|
387 + | ) -> crate::error::AttemptCapturingPokemonEventError {
|
388 + | Self::MasterBallUnsuccessful(variant)
|
389 + | }
|
390 + | }
|
391 + |
|
392 + | /// See [`InvalidPokeballError`](crate::error::InvalidPokeballError).
|
393 + | pub mod invalid_pokeball_error {
|
394 + |
|
395 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
396 + | /// Holds one variant for each of the ways the builder can fail.
|
397 + | #[non_exhaustive]
|
398 + | #[allow(clippy::enum_variant_names)]
|
399 + | pub enum ConstraintViolation {
|
400 + | /// `pokeball` was not provided but it is required when building `InvalidPokeballError`.
|
401 + | MissingPokeball,
|
402 + | }
|
403 + | impl ::std::fmt::Display for ConstraintViolation {
|
404 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
405 + | match self {
|
406 + | ConstraintViolation::MissingPokeball => write!(f, "`pokeball` was not provided but it is required when building `InvalidPokeballError`"),
|
407 + | }
|
408 + | }
|
409 + | }
|
410 + | impl ::std::error::Error for ConstraintViolation {}
|
411 + | impl ::std::convert::TryFrom<Builder> for crate::error::InvalidPokeballError {
|
412 + | type Error = ConstraintViolation;
|
413 + |
|
414 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
415 + | builder.build()
|
416 + | }
|
417 + | }
|
418 + | /// A builder for [`InvalidPokeballError`](crate::error::InvalidPokeballError).
|
419 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
420 + | pub struct Builder {
|
421 + | pub(crate) pokeball: ::std::option::Option<::std::string::String>,
|
422 + | }
|
423 + | impl Builder {
|
424 + | #[allow(missing_docs)] // documentation missing in model
|
425 + | pub fn pokeball(mut self, input: ::std::string::String) -> Self {
|
426 + | self.pokeball = Some(input);
|
427 + | self
|
428 + | }
|
429 + | /// Consumes the builder and constructs a [`InvalidPokeballError`](crate::error::InvalidPokeballError).
|
430 + | ///
|
431 + | /// The builder fails to construct a [`InvalidPokeballError`](crate::error::InvalidPokeballError) if a [`ConstraintViolation`] occurs.
|
432 + | ///
|
433 + | pub fn build(self) -> Result<crate::error::InvalidPokeballError, ConstraintViolation> {
|
434 + | self.build_enforcing_all_constraints()
|
435 + | }
|
436 + | fn build_enforcing_all_constraints(
|
437 + | self,
|
438 + | ) -> Result<crate::error::InvalidPokeballError, ConstraintViolation> {
|
439 + | Ok(crate::error::InvalidPokeballError {
|
440 + | pokeball: self.pokeball.ok_or(ConstraintViolation::MissingPokeball)?,
|
441 + | })
|
442 + | }
|
443 + | }
|
444 + | }
|
445 + | /// See [`MasterBallUnsuccessful`](crate::error::MasterBallUnsuccessful).
|
446 + | pub mod master_ball_unsuccessful {
|
447 + |
|
448 + | impl ::std::convert::From<Builder> for crate::error::MasterBallUnsuccessful {
|
449 + | fn from(builder: Builder) -> Self {
|
450 + | builder.build()
|
451 + | }
|
452 + | }
|
453 + | /// A builder for [`MasterBallUnsuccessful`](crate::error::MasterBallUnsuccessful).
|
454 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
455 + | pub struct Builder {
|
456 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
457 + | }
|
458 + | impl Builder {
|
459 + | #[allow(missing_docs)] // documentation missing in model
|
460 + | pub fn message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
461 + | self.message = input;
|
462 + | self
|
463 + | }
|
464 + | #[allow(missing_docs)] // documentation missing in model
|
465 + | pub(crate) fn set_message(
|
466 + | mut self,
|
467 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
468 + | ) -> Self {
|
469 + | self.message = input.map(|v| v.into());
|
470 + | self
|
471 + | }
|
472 + | /// Consumes the builder and constructs a [`MasterBallUnsuccessful`](crate::error::MasterBallUnsuccessful).
|
473 + | pub fn build(self) -> crate::error::MasterBallUnsuccessful {
|
474 + | self.build_enforcing_all_constraints()
|
475 + | }
|
476 + | fn build_enforcing_all_constraints(self) -> crate::error::MasterBallUnsuccessful {
|
477 + | crate::error::MasterBallUnsuccessful {
|
478 + | message: self.message,
|
479 + | }
|
480 + | }
|
481 + | }
|
482 + | }
|
483 + | /// See [`ValidationException`](crate::error::ValidationException).
|
484 + | pub mod validation_exception {
|
485 + |
|
486 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
487 + | /// Holds one variant for each of the ways the builder can fail.
|
488 + | #[non_exhaustive]
|
489 + | #[allow(clippy::enum_variant_names)]
|
490 + | pub enum ConstraintViolation {
|
491 + | /// `message` was not provided but it is required when building `ValidationException`.
|
492 + | MissingMessage,
|
493 + | }
|
494 + | impl ::std::fmt::Display for ConstraintViolation {
|
495 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
496 + | match self {
|
497 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
|
498 + | }
|
499 + | }
|
500 + | }
|
501 + | impl ::std::error::Error for ConstraintViolation {}
|
502 + | impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
|
503 + | type Error = ConstraintViolation;
|
504 + |
|
505 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
506 + | builder.build()
|
507 + | }
|
508 + | }
|
509 + | /// A builder for [`ValidationException`](crate::error::ValidationException).
|
510 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
511 + | pub struct Builder {
|
512 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
513 + | pub(crate) field_list:
|
514 + | ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
|
515 + | }
|
516 + | impl Builder {
|
517 + | /// A summary of the validation failure.
|
518 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
519 + | self.message = Some(input);
|
520 + | self
|
521 + | }
|
522 + | /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
|
523 + | pub fn field_list(
|
524 + | mut self,
|
525 + | input: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
|
526 + | ) -> Self {
|
527 + | self.field_list = input;
|
528 + | self
|
529 + | }
|
530 + | /// Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
|
531 + | ///
|
532 + | /// The builder fails to construct a [`ValidationException`](crate::error::ValidationException) if a [`ConstraintViolation`] occurs.
|
533 + | ///
|
534 + | pub fn build(self) -> Result<crate::error::ValidationException, ConstraintViolation> {
|
535 + | self.build_enforcing_all_constraints()
|
536 + | }
|
537 + | fn build_enforcing_all_constraints(
|
538 + | self,
|
539 + | ) -> Result<crate::error::ValidationException, ConstraintViolation> {
|
540 + | Ok(crate::error::ValidationException {
|
541 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
542 + | field_list: self.field_list,
|
543 + | })
|
544 + | }
|
545 + | }
|
546 + | }
|
547 + | /// See [`ThrottlingError`](crate::error::ThrottlingError).
|
548 + | pub mod throttling_error {
|
549 + |
|
550 + | impl ::std::convert::From<Builder> for crate::error::ThrottlingError {
|
551 + | fn from(builder: Builder) -> Self {
|
552 + | builder.build()
|
553 + | }
|
554 + | }
|
555 + | /// A builder for [`ThrottlingError`](crate::error::ThrottlingError).
|
556 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
557 + | pub struct Builder {}
|
558 + | impl Builder {
|
559 + | /// Consumes the builder and constructs a [`ThrottlingError`](crate::error::ThrottlingError).
|
560 + | pub fn build(self) -> crate::error::ThrottlingError {
|
561 + | self.build_enforcing_all_constraints()
|
562 + | }
|
563 + | fn build_enforcing_all_constraints(self) -> crate::error::ThrottlingError {
|
564 + | crate::error::ThrottlingError {}
|
565 + | }
|
566 + | }
|
567 + | }
|
568 + | /// See [`UnsupportedRegionError`](crate::error::UnsupportedRegionError).
|
569 + | pub mod unsupported_region_error {
|
570 + |
|
571 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
572 + | /// Holds one variant for each of the ways the builder can fail.
|
573 + | #[non_exhaustive]
|
574 + | #[allow(clippy::enum_variant_names)]
|
575 + | pub enum ConstraintViolation {
|
576 + | /// `region` was not provided but it is required when building `UnsupportedRegionError`.
|
577 + | MissingRegion,
|
578 + | }
|
579 + | impl ::std::fmt::Display for ConstraintViolation {
|
580 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
581 + | match self {
|
582 + | ConstraintViolation::MissingRegion => write!(f, "`region` was not provided but it is required when building `UnsupportedRegionError`"),
|
583 + | }
|
584 + | }
|
585 + | }
|
586 + | impl ::std::error::Error for ConstraintViolation {}
|
587 + | impl ::std::convert::TryFrom<Builder> for crate::error::UnsupportedRegionError {
|
588 + | type Error = ConstraintViolation;
|
589 + |
|
590 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
591 + | builder.build()
|
592 + | }
|
593 + | }
|
594 + | /// A builder for [`UnsupportedRegionError`](crate::error::UnsupportedRegionError).
|
595 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
596 + | pub struct Builder {
|
597 + | pub(crate) region: ::std::option::Option<::std::string::String>,
|
598 + | }
|
599 + | impl Builder {
|
600 + | #[allow(missing_docs)] // documentation missing in model
|
601 + | pub fn region(mut self, input: ::std::string::String) -> Self {
|
602 + | self.region = Some(input);
|
603 + | self
|
604 + | }
|
605 + | /// Consumes the builder and constructs a [`UnsupportedRegionError`](crate::error::UnsupportedRegionError).
|
606 + | ///
|
607 + | /// The builder fails to construct a [`UnsupportedRegionError`](crate::error::UnsupportedRegionError) if a [`ConstraintViolation`] occurs.
|
608 + | ///
|
609 + | pub fn build(self) -> Result<crate::error::UnsupportedRegionError, ConstraintViolation> {
|
610 + | self.build_enforcing_all_constraints()
|
611 + | }
|
612 + | fn build_enforcing_all_constraints(
|
613 + | self,
|
614 + | ) -> Result<crate::error::UnsupportedRegionError, ConstraintViolation> {
|
615 + | Ok(crate::error::UnsupportedRegionError {
|
616 + | region: self.region.ok_or(ConstraintViolation::MissingRegion)?,
|
617 + | })
|
618 + | }
|
619 + | }
|
620 + | }
|