1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | #[derive(
|
4 + | ::std::clone::Clone,
|
5 + | ::std::cmp::Eq,
|
6 + | ::std::cmp::Ord,
|
7 + | ::std::cmp::PartialEq,
|
8 + | ::std::cmp::PartialOrd,
|
9 + | ::std::fmt::Debug,
|
10 + | ::std::hash::Hash,
|
11 + | )]
|
12 + | pub enum RequiredEnum {
|
13 + | #[allow(missing_docs)] // documentation missing in model
|
14 + | Bar,
|
15 + | #[allow(missing_docs)] // documentation missing in model
|
16 + | Baz,
|
17 + | #[allow(missing_docs)] // documentation missing in model
|
18 + | Foo,
|
19 + | }
|
20 + | /// See [`RequiredEnum`](crate::model::RequiredEnum).
|
21 + | pub mod required_enum {
|
22 + | #[derive(Debug, PartialEq)]
|
23 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
24 + |
|
25 + | impl ::std::fmt::Display for ConstraintViolation {
|
26 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
27 + | write!(
|
28 + | f,
|
29 + | r#"Value provided for 'aws.protocoltests.json10#RequiredEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
|
30 + | )
|
31 + | }
|
32 + | }
|
33 + |
|
34 + | impl ::std::error::Error for ConstraintViolation {}
|
35 + | }
|
36 + | impl ::std::convert::TryFrom<&str> for RequiredEnum {
|
37 + | type Error = crate::model::required_enum::ConstraintViolation;
|
38 + | fn try_from(
|
39 + | s: &str,
|
40 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
41 + | match s {
|
42 + | "BAR" => Ok(RequiredEnum::Bar),
|
43 + | "BAZ" => Ok(RequiredEnum::Baz),
|
44 + | "FOO" => Ok(RequiredEnum::Foo),
|
45 + | _ => Err(crate::model::required_enum::ConstraintViolation(
|
46 + | s.to_owned(),
|
47 + | )),
|
48 + | }
|
49 + | }
|
50 + | }
|
51 + | impl ::std::convert::TryFrom<::std::string::String> for RequiredEnum {
|
52 + | type Error = crate::model::required_enum::ConstraintViolation;
|
53 + | fn try_from(
|
54 + | s: ::std::string::String,
|
55 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
56 + | {
|
57 + | s.as_str().try_into()
|
58 + | }
|
59 + | }
|
60 + | impl std::str::FromStr for RequiredEnum {
|
61 + | type Err = crate::model::required_enum::ConstraintViolation;
|
62 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
63 + | Self::try_from(s)
|
64 + | }
|
65 + | }
|
66 + | impl RequiredEnum {
|
67 + | /// Returns the `&str` value of the enum member.
|
68 + | pub fn as_str(&self) -> &str {
|
69 + | match self {
|
70 + | RequiredEnum::Bar => "BAR",
|
71 + | RequiredEnum::Baz => "BAZ",
|
72 + | RequiredEnum::Foo => "FOO",
|
73 + | }
|
74 + | }
|
75 + | /// Returns all the `&str` representations of the enum members.
|
76 + | pub const fn values() -> &'static [&'static str] {
|
77 + | &["BAR", "BAZ", "FOO"]
|
78 + | }
|
79 + | }
|
80 + | impl ::std::convert::AsRef<str> for RequiredEnum {
|
81 + | fn as_ref(&self) -> &str {
|
82 + | self.as_str()
|
83 + | }
|
84 + | }
|
85 + | impl crate::constrained::Constrained for RequiredEnum {
|
86 + | type Unconstrained = ::std::string::String;
|
87 + | }
|
88 + |
|
89 + | impl ::std::convert::From<::std::string::String>
|
90 + | for crate::constrained::MaybeConstrained<crate::model::RequiredEnum>
|
91 + | {
|
92 + | fn from(value: ::std::string::String) -> Self {
|
93 + | Self::Unconstrained(value)
|
94 + | }
|
95 + | }
|
96 + |
|
97 + | /// Describes one specific validation failure for an input member.
|
98 + | #[derive(
|
99 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
100 + | )]
|
101 + | pub struct ValidationExceptionField {
|
102 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
103 + | pub path: ::std::string::String,
|
104 + | /// A detailed description of the validation failure.
|
105 + | pub message: ::std::string::String,
|
106 + | }
|
107 + | impl ValidationExceptionField {
|
108 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
109 + | pub fn path(&self) -> &str {
|
110 + | use std::ops::Deref;
|
111 + | self.path.deref()
|
112 + | }
|
113 + | /// A detailed description of the validation failure.
|
114 + | pub fn message(&self) -> &str {
|
115 + | use std::ops::Deref;
|
116 + | self.message.deref()
|
117 + | }
|
118 + | }
|
119 + | impl ValidationExceptionField {
|
120 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
121 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
122 + | crate::model::validation_exception_field::Builder::default()
|
123 + | }
|
124 + | }
|
125 + |
|
126 + | #[allow(missing_docs)] // documentation missing in model
|
127 + | #[derive(
|
128 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
129 + | )]
|
130 + | pub struct Dialog {
|
131 + | #[allow(missing_docs)] // documentation missing in model
|
132 + | pub language: ::std::option::Option<::std::string::String>,
|
133 + | #[allow(missing_docs)] // documentation missing in model
|
134 + | pub greeting: ::std::string::String,
|
135 + | #[allow(missing_docs)] // documentation missing in model
|
136 + | pub farewell: ::std::option::Option<crate::model::Farewell>,
|
137 + | }
|
138 + | impl Dialog {
|
139 + | #[allow(missing_docs)] // documentation missing in model
|
140 + | pub fn language(&self) -> ::std::option::Option<&str> {
|
141 + | self.language.as_deref()
|
142 + | }
|
143 + | #[allow(missing_docs)] // documentation missing in model
|
144 + | pub fn greeting(&self) -> &str {
|
145 + | use std::ops::Deref;
|
146 + | self.greeting.deref()
|
147 + | }
|
148 + | #[allow(missing_docs)] // documentation missing in model
|
149 + | pub fn farewell(&self) -> ::std::option::Option<&crate::model::Farewell> {
|
150 + | self.farewell.as_ref()
|
151 + | }
|
152 + | }
|
153 + | impl Dialog {
|
154 + | /// Creates a new builder-style object to manufacture [`Dialog`](crate::model::Dialog).
|
155 + | pub fn builder() -> crate::model::dialog::Builder {
|
156 + | crate::model::dialog::Builder::default()
|
157 + | }
|
158 + | }
|
159 + | impl crate::constrained::Constrained for crate::model::Dialog {
|
160 + | type Unconstrained = crate::model::dialog::Builder;
|
161 + | }
|
162 + |
|
163 + | #[allow(missing_docs)] // documentation missing in model
|
164 + | #[derive(
|
165 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
166 + | )]
|
167 + | pub struct Farewell {
|
168 + | #[allow(missing_docs)] // documentation missing in model
|
169 + | pub phrase: ::std::string::String,
|
170 + | }
|
171 + | impl Farewell {
|
172 + | #[allow(missing_docs)] // documentation missing in model
|
173 + | pub fn phrase(&self) -> &str {
|
174 + | use std::ops::Deref;
|
175 + | self.phrase.deref()
|
176 + | }
|
177 + | }
|
178 + | impl Farewell {
|
179 + | /// Creates a new builder-style object to manufacture [`Farewell`](crate::model::Farewell).
|
180 + | pub fn builder() -> crate::model::farewell::Builder {
|
181 + | crate::model::farewell::Builder::default()
|
182 + | }
|
183 + | }
|
184 + | impl crate::constrained::Constrained for crate::model::Farewell {
|
185 + | type Unconstrained = crate::model::farewell::Builder;
|
186 + | }
|
187 + |
|
188 + | #[allow(missing_docs)] // documentation missing in model
|
189 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
190 + | pub struct TopLevel {
|
191 + | #[allow(missing_docs)] // documentation missing in model
|
192 + | pub dialog: crate::model::Dialog,
|
193 + | #[allow(missing_docs)] // documentation missing in model
|
194 + | pub dialog_list: ::std::vec::Vec<crate::model::Dialog>,
|
195 + | #[allow(missing_docs)] // documentation missing in model
|
196 + | pub dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
197 + | }
|
198 + | impl TopLevel {
|
199 + | #[allow(missing_docs)] // documentation missing in model
|
200 + | pub fn dialog(&self) -> &crate::model::Dialog {
|
201 + | &self.dialog
|
202 + | }
|
203 + | #[allow(missing_docs)] // documentation missing in model
|
204 + | pub fn dialog_list(&self) -> &[crate::model::Dialog] {
|
205 + | use std::ops::Deref;
|
206 + | self.dialog_list.deref()
|
207 + | }
|
208 + | #[allow(missing_docs)] // documentation missing in model
|
209 + | pub fn dialog_map(
|
210 + | &self,
|
211 + | ) -> &::std::collections::HashMap<::std::string::String, crate::model::Dialog> {
|
212 + | &self.dialog_map
|
213 + | }
|
214 + | }
|
215 + | impl TopLevel {
|
216 + | /// Creates a new builder-style object to manufacture [`TopLevel`](crate::model::TopLevel).
|
217 + | pub fn builder() -> crate::model::top_level::Builder {
|
218 + | crate::model::top_level::Builder::default()
|
219 + | }
|
220 + | }
|
221 + | impl crate::constrained::Constrained for crate::model::TopLevel {
|
222 + | type Unconstrained = crate::model::top_level::Builder;
|
223 + | }
|
224 + |
|
225 + | #[allow(missing_docs)] // documentation missing in model
|
226 + | #[derive(
|
227 + | ::std::clone::Clone,
|
228 + | ::std::cmp::Eq,
|
229 + | ::std::cmp::Ord,
|
230 + | ::std::cmp::PartialEq,
|
231 + | ::std::cmp::PartialOrd,
|
232 + | ::std::fmt::Debug,
|
233 + | ::std::hash::Hash,
|
234 + | )]
|
235 + | pub enum TestEnum {
|
236 + | #[allow(missing_docs)] // documentation missing in model
|
237 + | Bar,
|
238 + | #[allow(missing_docs)] // documentation missing in model
|
239 + | Baz,
|
240 + | #[allow(missing_docs)] // documentation missing in model
|
241 + | Foo,
|
242 + | }
|
243 + | /// See [`TestEnum`](crate::model::TestEnum).
|
244 + | pub mod test_enum {
|
245 + | #[derive(Debug, PartialEq)]
|
246 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
247 + |
|
248 + | impl ::std::fmt::Display for ConstraintViolation {
|
249 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
250 + | write!(
|
251 + | f,
|
252 + | r#"Value provided for 'aws.protocoltests.json10#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
|
253 + | )
|
254 + | }
|
255 + | }
|
256 + |
|
257 + | impl ::std::error::Error for ConstraintViolation {}
|
258 + | impl ConstraintViolation {
|
259 + | pub(crate) fn as_validation_exception_field(
|
260 + | self,
|
261 + | path: ::std::string::String,
|
262 + | ) -> crate::model::ValidationExceptionField {
|
263 + | crate::model::ValidationExceptionField {
|
264 + | message: format!(
|
265 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
|
266 + | &path
|
267 + | ),
|
268 + | path,
|
269 + | }
|
270 + | }
|
271 + | }
|
272 + | }
|
273 + | impl ::std::convert::TryFrom<&str> for TestEnum {
|
274 + | type Error = crate::model::test_enum::ConstraintViolation;
|
275 + | fn try_from(
|
276 + | s: &str,
|
277 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
278 + | match s {
|
279 + | "BAR" => Ok(TestEnum::Bar),
|
280 + | "BAZ" => Ok(TestEnum::Baz),
|
281 + | "FOO" => Ok(TestEnum::Foo),
|
282 + | _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
|
283 + | }
|
284 + | }
|
285 + | }
|
286 + | impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
|
287 + | type Error = crate::model::test_enum::ConstraintViolation;
|
288 + | fn try_from(
|
289 + | s: ::std::string::String,
|
290 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
291 + | {
|
292 + | s.as_str().try_into()
|
293 + | }
|
294 + | }
|
295 + | impl std::str::FromStr for TestEnum {
|
296 + | type Err = crate::model::test_enum::ConstraintViolation;
|
297 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
298 + | Self::try_from(s)
|
299 + | }
|
300 + | }
|
301 + | impl TestEnum {
|
302 + | /// Returns the `&str` value of the enum member.
|
303 + | pub fn as_str(&self) -> &str {
|
304 + | match self {
|
305 + | TestEnum::Bar => "BAR",
|
306 + | TestEnum::Baz => "BAZ",
|
307 + | TestEnum::Foo => "FOO",
|
308 + | }
|
309 + | }
|
310 + | /// Returns all the `&str` representations of the enum members.
|
311 + | pub const fn values() -> &'static [&'static str] {
|
312 + | &["BAR", "BAZ", "FOO"]
|
313 + | }
|
314 + | }
|
315 + | impl ::std::convert::AsRef<str> for TestEnum {
|
316 + | fn as_ref(&self) -> &str {
|
317 + | self.as_str()
|
318 + | }
|
319 + | }
|
320 + | impl crate::constrained::Constrained for TestEnum {
|
321 + | type Unconstrained = ::std::string::String;
|
322 + | }
|
323 + |
|
324 + | impl ::std::convert::From<::std::string::String>
|
325 + | for crate::constrained::MaybeConstrained<crate::model::TestEnum>
|
326 + | {
|
327 + | fn from(value: ::std::string::String) -> Self {
|
328 + | Self::Unconstrained(value)
|
329 + | }
|
330 + | }
|
331 + |
|
332 + | #[allow(missing_docs)] // documentation missing in model
|
333 + | #[derive(
|
334 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
335 + | )]
|
336 + | pub struct ClientOptionalDefaults {
|
337 + | #[allow(missing_docs)] // documentation missing in model
|
338 + | pub member: i32,
|
339 + | }
|
340 + | impl ClientOptionalDefaults {
|
341 + | #[allow(missing_docs)] // documentation missing in model
|
342 + | pub fn member(&self) -> i32 {
|
343 + | self.member
|
344 + | }
|
345 + | }
|
346 + | impl ClientOptionalDefaults {
|
347 + | /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
348 + | pub fn builder() -> crate::model::client_optional_defaults::Builder {
|
349 + | crate::model::client_optional_defaults::Builder::default()
|
350 + | }
|
351 + | }
|
352 + | impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
|
353 + | type Unconstrained = crate::model::client_optional_defaults::Builder;
|
354 + | }
|
355 + |
|
356 + | #[allow(missing_docs)] // documentation missing in model
|
357 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
358 + | pub struct Defaults {
|
359 + | #[allow(missing_docs)] // documentation missing in model
|
360 + | pub default_string: ::std::string::String,
|
361 + | #[allow(missing_docs)] // documentation missing in model
|
362 + | pub default_boolean: bool,
|
363 + | #[allow(missing_docs)] // documentation missing in model
|
364 + | pub default_list: ::std::vec::Vec<::std::string::String>,
|
365 + | #[allow(missing_docs)] // documentation missing in model
|
366 + | pub default_document_map: ::aws_smithy_types::Document,
|
367 + | #[allow(missing_docs)] // documentation missing in model
|
368 + | pub default_document_string: ::aws_smithy_types::Document,
|
369 + | #[allow(missing_docs)] // documentation missing in model
|
370 + | pub default_document_boolean: ::aws_smithy_types::Document,
|
371 + | #[allow(missing_docs)] // documentation missing in model
|
372 + | pub default_document_list: ::aws_smithy_types::Document,
|
373 + | #[allow(missing_docs)] // documentation missing in model
|
374 + | pub default_null_document: ::std::option::Option<::aws_smithy_types::Document>,
|
375 + | #[allow(missing_docs)] // documentation missing in model
|
376 + | pub default_timestamp: ::aws_smithy_types::DateTime,
|
377 + | #[allow(missing_docs)] // documentation missing in model
|
378 + | pub default_blob: ::aws_smithy_types::Blob,
|
379 + | #[allow(missing_docs)] // documentation missing in model
|
380 + | pub default_byte: i8,
|
381 + | #[allow(missing_docs)] // documentation missing in model
|
382 + | pub default_short: i16,
|
383 + | #[allow(missing_docs)] // documentation missing in model
|
384 + | pub default_integer: i32,
|
385 + | #[allow(missing_docs)] // documentation missing in model
|
386 + | pub default_long: i64,
|
387 + | #[allow(missing_docs)] // documentation missing in model
|
388 + | pub default_float: f32,
|
389 + | #[allow(missing_docs)] // documentation missing in model
|
390 + | pub default_double: f64,
|
391 + | #[allow(missing_docs)] // documentation missing in model
|
392 + | pub default_map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
393 + | #[allow(missing_docs)] // documentation missing in model
|
394 + | pub default_enum: crate::model::TestEnum,
|
395 + | #[allow(missing_docs)] // documentation missing in model
|
396 + | pub default_int_enum: i32,
|
397 + | #[allow(missing_docs)] // documentation missing in model
|
398 + | pub empty_string: ::std::string::String,
|
399 + | #[allow(missing_docs)] // documentation missing in model
|
400 + | pub false_boolean: bool,
|
401 + | #[allow(missing_docs)] // documentation missing in model
|
402 + | pub empty_blob: ::aws_smithy_types::Blob,
|
403 + | #[allow(missing_docs)] // documentation missing in model
|
404 + | pub zero_byte: i8,
|
405 + | #[allow(missing_docs)] // documentation missing in model
|
406 + | pub zero_short: i16,
|
407 + | #[allow(missing_docs)] // documentation missing in model
|
408 + | pub zero_integer: i32,
|
409 + | #[allow(missing_docs)] // documentation missing in model
|
410 + | pub zero_long: i64,
|
411 + | #[allow(missing_docs)] // documentation missing in model
|
412 + | pub zero_float: f32,
|
413 + | #[allow(missing_docs)] // documentation missing in model
|
414 + | pub zero_double: f64,
|
415 + | }
|
416 + | impl Defaults {
|
417 + | #[allow(missing_docs)] // documentation missing in model
|
418 + | pub fn default_string(&self) -> &str {
|
419 + | use std::ops::Deref;
|
420 + | self.default_string.deref()
|
421 + | }
|
422 + | #[allow(missing_docs)] // documentation missing in model
|
423 + | pub fn default_boolean(&self) -> bool {
|
424 + | self.default_boolean
|
425 + | }
|
426 + | #[allow(missing_docs)] // documentation missing in model
|
427 + | pub fn default_list(&self) -> &[::std::string::String] {
|
428 + | use std::ops::Deref;
|
429 + | self.default_list.deref()
|
430 + | }
|
431 + | #[allow(missing_docs)] // documentation missing in model
|
432 + | pub fn default_document_map(&self) -> &::aws_smithy_types::Document {
|
433 + | &self.default_document_map
|
434 + | }
|
435 + | #[allow(missing_docs)] // documentation missing in model
|
436 + | pub fn default_document_string(&self) -> &::aws_smithy_types::Document {
|
437 + | &self.default_document_string
|
438 + | }
|
439 + | #[allow(missing_docs)] // documentation missing in model
|
440 + | pub fn default_document_boolean(&self) -> &::aws_smithy_types::Document {
|
441 + | &self.default_document_boolean
|
442 + | }
|
443 + | #[allow(missing_docs)] // documentation missing in model
|
444 + | pub fn default_document_list(&self) -> &::aws_smithy_types::Document {
|
445 + | &self.default_document_list
|
446 + | }
|
447 + | #[allow(missing_docs)] // documentation missing in model
|
448 + | pub fn default_null_document(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
|
449 + | self.default_null_document.as_ref()
|
450 + | }
|
451 + | #[allow(missing_docs)] // documentation missing in model
|
452 + | pub fn default_timestamp(&self) -> &::aws_smithy_types::DateTime {
|
453 + | &self.default_timestamp
|
454 + | }
|
455 + | #[allow(missing_docs)] // documentation missing in model
|
456 + | pub fn default_blob(&self) -> &::aws_smithy_types::Blob {
|
457 + | &self.default_blob
|
458 + | }
|
459 + | #[allow(missing_docs)] // documentation missing in model
|
460 + | pub fn default_byte(&self) -> i8 {
|
461 + | self.default_byte
|
462 + | }
|
463 + | #[allow(missing_docs)] // documentation missing in model
|
464 + | pub fn default_short(&self) -> i16 {
|
465 + | self.default_short
|
466 + | }
|
467 + | #[allow(missing_docs)] // documentation missing in model
|
468 + | pub fn default_integer(&self) -> i32 {
|
469 + | self.default_integer
|
470 + | }
|
471 + | #[allow(missing_docs)] // documentation missing in model
|
472 + | pub fn default_long(&self) -> i64 {
|
473 + | self.default_long
|
474 + | }
|
475 + | #[allow(missing_docs)] // documentation missing in model
|
476 + | pub fn default_float(&self) -> f32 {
|
477 + | self.default_float
|
478 + | }
|
479 + | #[allow(missing_docs)] // documentation missing in model
|
480 + | pub fn default_double(&self) -> f64 {
|
481 + | self.default_double
|
482 + | }
|
483 + | #[allow(missing_docs)] // documentation missing in model
|
484 + | pub fn default_map(
|
485 + | &self,
|
486 + | ) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
|
487 + | &self.default_map
|
488 + | }
|
489 + | #[allow(missing_docs)] // documentation missing in model
|
490 + | pub fn default_enum(&self) -> &crate::model::TestEnum {
|
491 + | &self.default_enum
|
492 + | }
|
493 + | #[allow(missing_docs)] // documentation missing in model
|
494 + | pub fn default_int_enum(&self) -> i32 {
|
495 + | self.default_int_enum
|
496 + | }
|
497 + | #[allow(missing_docs)] // documentation missing in model
|
498 + | pub fn empty_string(&self) -> &str {
|
499 + | use std::ops::Deref;
|
500 + | self.empty_string.deref()
|
501 + | }
|
502 + | #[allow(missing_docs)] // documentation missing in model
|
503 + | pub fn false_boolean(&self) -> bool {
|
504 + | self.false_boolean
|
505 + | }
|
506 + | #[allow(missing_docs)] // documentation missing in model
|
507 + | pub fn empty_blob(&self) -> &::aws_smithy_types::Blob {
|
508 + | &self.empty_blob
|
509 + | }
|
510 + | #[allow(missing_docs)] // documentation missing in model
|
511 + | pub fn zero_byte(&self) -> i8 {
|
512 + | self.zero_byte
|
513 + | }
|
514 + | #[allow(missing_docs)] // documentation missing in model
|
515 + | pub fn zero_short(&self) -> i16 {
|
516 + | self.zero_short
|
517 + | }
|
518 + | #[allow(missing_docs)] // documentation missing in model
|
519 + | pub fn zero_integer(&self) -> i32 {
|
520 + | self.zero_integer
|
521 + | }
|
522 + | #[allow(missing_docs)] // documentation missing in model
|
523 + | pub fn zero_long(&self) -> i64 {
|
524 + | self.zero_long
|
525 + | }
|
526 + | #[allow(missing_docs)] // documentation missing in model
|
527 + | pub fn zero_float(&self) -> f32 {
|
528 + | self.zero_float
|
529 + | }
|
530 + | #[allow(missing_docs)] // documentation missing in model
|
531 + | pub fn zero_double(&self) -> f64 {
|
532 + | self.zero_double
|
533 + | }
|
534 + | }
|
535 + | impl Defaults {
|
536 + | /// Creates a new builder-style object to manufacture [`Defaults`](crate::model::Defaults).
|
537 + | pub fn builder() -> crate::model::defaults::Builder {
|
538 + | crate::model::defaults::Builder::default()
|
539 + | }
|
540 + | }
|
541 + | impl crate::constrained::Constrained for crate::model::Defaults {
|
542 + | type Unconstrained = crate::model::defaults::Builder;
|
543 + | }
|
544 + |
|
545 + | /// A union with a representative set of types for members.
|
546 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
547 + | pub enum MyUnion {
|
548 + | #[allow(missing_docs)] // documentation missing in model
|
549 + | BlobValue(::aws_smithy_types::Blob),
|
550 + | #[allow(missing_docs)] // documentation missing in model
|
551 + | BooleanValue(bool),
|
552 + | #[allow(missing_docs)] // documentation missing in model
|
553 + | EnumValue(crate::model::FooEnum),
|
554 + | #[allow(missing_docs)] // documentation missing in model
|
555 + | IntEnumValue(i32),
|
556 + | #[allow(missing_docs)] // documentation missing in model
|
557 + | ListValue(::std::vec::Vec<::std::string::String>),
|
558 + | #[allow(missing_docs)] // documentation missing in model
|
559 + | MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
|
560 + | #[allow(missing_docs)] // documentation missing in model
|
561 + | NumberValue(i32),
|
562 + | #[allow(missing_docs)] // documentation missing in model
|
563 + | StringValue(::std::string::String),
|
564 + | #[allow(missing_docs)] // documentation missing in model
|
565 + | StructureValue(crate::model::GreetingStruct),
|
566 + | #[allow(missing_docs)] // documentation missing in model
|
567 + | TimestampValue(::aws_smithy_types::DateTime),
|
568 + | }
|
569 + | impl MyUnion {
|
570 + | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
|
571 + | /// Returns `Err(&Self)` if it can't be converted.
|
572 + | pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
|
573 + | if let MyUnion::BlobValue(val) = &self {
|
574 + | ::std::result::Result::Ok(val)
|
575 + | } else {
|
576 + | ::std::result::Result::Err(self)
|
577 + | }
|
578 + | }
|
579 + | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
580 + | pub fn is_blob_value(&self) -> bool {
|
581 + | self.as_blob_value().is_ok()
|
582 + | }
|
583 + | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
584 + | /// Returns `Err(&Self)` if it can't be converted.
|
585 + | pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
|
586 + | if let MyUnion::BooleanValue(val) = &self {
|
587 + | ::std::result::Result::Ok(val)
|
588 + | } else {
|
589 + | ::std::result::Result::Err(self)
|
590 + | }
|
591 + | }
|
592 + | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
593 + | pub fn is_boolean_value(&self) -> bool {
|
594 + | self.as_boolean_value().is_ok()
|
595 + | }
|
596 + | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
597 + | /// Returns `Err(&Self)` if it can't be converted.
|
598 + | pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
|
599 + | if let MyUnion::EnumValue(val) = &self {
|
600 + | ::std::result::Result::Ok(val)
|
601 + | } else {
|
602 + | ::std::result::Result::Err(self)
|
603 + | }
|
604 + | }
|
605 + | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
606 + | pub fn is_enum_value(&self) -> bool {
|
607 + | self.as_enum_value().is_ok()
|
608 + | }
|
609 + | /// Tries to convert the enum instance into [`IntEnumValue`](crate::model::MyUnion::IntEnumValue), extracting the inner [`i32`](i32).
|
610 + | /// Returns `Err(&Self)` if it can't be converted.
|
611 + | pub fn as_int_enum_value(&self) -> ::std::result::Result<&i32, &Self> {
|
612 + | if let MyUnion::IntEnumValue(val) = &self {
|
613 + | ::std::result::Result::Ok(val)
|
614 + | } else {
|
615 + | ::std::result::Result::Err(self)
|
616 + | }
|
617 + | }
|
618 + | /// Returns true if this is a [`IntEnumValue`](crate::model::MyUnion::IntEnumValue).
|
619 + | pub fn is_int_enum_value(&self) -> bool {
|
620 + | self.as_int_enum_value().is_ok()
|
621 + | }
|
622 + | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
623 + | /// Returns `Err(&Self)` if it can't be converted.
|
624 + | pub fn as_list_value(
|
625 + | &self,
|
626 + | ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
627 + | if let MyUnion::ListValue(val) = &self {
|
628 + | ::std::result::Result::Ok(val)
|
629 + | } else {
|
630 + | ::std::result::Result::Err(self)
|
631 + | }
|
632 + | }
|
633 + | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
634 + | pub fn is_list_value(&self) -> bool {
|
635 + | self.as_list_value().is_ok()
|
636 + | }
|
637 + | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
638 + | /// Returns `Err(&Self)` if it can't be converted.
|
639 + | pub fn as_map_value(
|
640 + | &self,
|
641 + | ) -> ::std::result::Result<
|
642 + | &::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
643 + | &Self,
|
644 + | > {
|
645 + | if let MyUnion::MapValue(val) = &self {
|
646 + | ::std::result::Result::Ok(val)
|
647 + | } else {
|
648 + | ::std::result::Result::Err(self)
|
649 + | }
|
650 + | }
|
651 + | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
652 + | pub fn is_map_value(&self) -> bool {
|
653 + | self.as_map_value().is_ok()
|
654 + | }
|
655 + | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
656 + | /// Returns `Err(&Self)` if it can't be converted.
|
657 + | pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
|
658 + | if let MyUnion::NumberValue(val) = &self {
|
659 + | ::std::result::Result::Ok(val)
|
660 + | } else {
|
661 + | ::std::result::Result::Err(self)
|
662 + | }
|
663 + | }
|
664 + | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
665 + | pub fn is_number_value(&self) -> bool {
|
666 + | self.as_number_value().is_ok()
|
667 + | }
|
668 + | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
669 + | /// Returns `Err(&Self)` if it can't be converted.
|
670 + | pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
671 + | if let MyUnion::StringValue(val) = &self {
|
672 + | ::std::result::Result::Ok(val)
|
673 + | } else {
|
674 + | ::std::result::Result::Err(self)
|
675 + | }
|
676 + | }
|
677 + | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
678 + | pub fn is_string_value(&self) -> bool {
|
679 + | self.as_string_value().is_ok()
|
680 + | }
|
681 + | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
682 + | /// Returns `Err(&Self)` if it can't be converted.
|
683 + | pub fn as_structure_value(
|
684 + | &self,
|
685 + | ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
|
686 + | if let MyUnion::StructureValue(val) = &self {
|
687 + | ::std::result::Result::Ok(val)
|
688 + | } else {
|
689 + | ::std::result::Result::Err(self)
|
690 + | }
|
691 + | }
|
692 + | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
693 + | pub fn is_structure_value(&self) -> bool {
|
694 + | self.as_structure_value().is_ok()
|
695 + | }
|
696 + | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
|
697 + | /// Returns `Err(&Self)` if it can't be converted.
|
698 + | pub fn as_timestamp_value(
|
699 + | &self,
|
700 + | ) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
|
701 + | if let MyUnion::TimestampValue(val) = &self {
|
702 + | ::std::result::Result::Ok(val)
|
703 + | } else {
|
704 + | ::std::result::Result::Err(self)
|
705 + | }
|
706 + | }
|
707 + | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
708 + | pub fn is_timestamp_value(&self) -> bool {
|
709 + | self.as_timestamp_value().is_ok()
|
710 + | }
|
711 + | }
|
712 + |
|
713 + | #[allow(missing_docs)] // documentation missing in model
|
714 + | #[derive(
|
715 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
716 + | )]
|
717 + | pub struct GreetingStruct {
|
718 + | #[allow(missing_docs)] // documentation missing in model
|
719 + | pub hi: ::std::option::Option<::std::string::String>,
|
720 + | }
|
721 + | impl GreetingStruct {
|
722 + | #[allow(missing_docs)] // documentation missing in model
|
723 + | pub fn hi(&self) -> ::std::option::Option<&str> {
|
724 + | self.hi.as_deref()
|
725 + | }
|
726 + | }
|
727 + | impl GreetingStruct {
|
728 + | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
729 + | pub fn builder() -> crate::model::greeting_struct::Builder {
|
730 + | crate::model::greeting_struct::Builder::default()
|
731 + | }
|
732 + | }
|
733 + | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
734 + | type Unconstrained = crate::model::greeting_struct::Builder;
|
735 + | }
|
736 + |
|
737 + | #[allow(missing_docs)] // documentation missing in model
|
738 + | #[derive(
|
739 + | ::std::clone::Clone,
|
740 + | ::std::cmp::Eq,
|
741 + | ::std::cmp::Ord,
|
742 + | ::std::cmp::PartialEq,
|
743 + | ::std::cmp::PartialOrd,
|
744 + | ::std::fmt::Debug,
|
745 + | ::std::hash::Hash,
|
746 + | )]
|
747 + | pub enum FooEnum {
|
748 + | #[allow(missing_docs)] // documentation missing in model
|
749 + | Zero,
|
750 + | #[allow(missing_docs)] // documentation missing in model
|
751 + | One,
|
752 + | #[allow(missing_docs)] // documentation missing in model
|
753 + | Bar,
|
754 + | #[allow(missing_docs)] // documentation missing in model
|
755 + | Baz,
|
756 + | #[allow(missing_docs)] // documentation missing in model
|
757 + | Foo,
|
758 + | }
|
759 + | /// See [`FooEnum`](crate::model::FooEnum).
|
760 + | pub mod foo_enum {
|
761 + | #[derive(Debug, PartialEq)]
|
762 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
763 + |
|
764 + | impl ::std::fmt::Display for ConstraintViolation {
|
765 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
766 + | write!(
|
767 + | f,
|
768 + | r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
|
769 + | )
|
770 + | }
|
771 + | }
|
772 + |
|
773 + | impl ::std::error::Error for ConstraintViolation {}
|
774 + | impl ConstraintViolation {
|
775 + | pub(crate) fn as_validation_exception_field(
|
776 + | self,
|
777 + | path: ::std::string::String,
|
778 + | ) -> crate::model::ValidationExceptionField {
|
779 + | crate::model::ValidationExceptionField {
|
780 + | message: format!(
|
781 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
|
782 + | &path
|
783 + | ),
|
784 + | path,
|
785 + | }
|
786 + | }
|
787 + | }
|
788 + | }
|
789 + | impl ::std::convert::TryFrom<&str> for FooEnum {
|
790 + | type Error = crate::model::foo_enum::ConstraintViolation;
|
791 + | fn try_from(
|
792 + | s: &str,
|
793 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
794 + | match s {
|
795 + | "0" => Ok(FooEnum::Zero),
|
796 + | "1" => Ok(FooEnum::One),
|
797 + | "Bar" => Ok(FooEnum::Bar),
|
798 + | "Baz" => Ok(FooEnum::Baz),
|
799 + | "Foo" => Ok(FooEnum::Foo),
|
800 + | _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
|
801 + | }
|
802 + | }
|
803 + | }
|
804 + | impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
|
805 + | type Error = crate::model::foo_enum::ConstraintViolation;
|
806 + | fn try_from(
|
807 + | s: ::std::string::String,
|
808 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
809 + | {
|
810 + | s.as_str().try_into()
|
811 + | }
|
812 + | }
|
813 + | impl std::str::FromStr for FooEnum {
|
814 + | type Err = crate::model::foo_enum::ConstraintViolation;
|
815 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
816 + | Self::try_from(s)
|
817 + | }
|
818 + | }
|
819 + | impl FooEnum {
|
820 + | /// Returns the `&str` value of the enum member.
|
821 + | pub fn as_str(&self) -> &str {
|
822 + | match self {
|
823 + | FooEnum::Zero => "0",
|
824 + | FooEnum::One => "1",
|
825 + | FooEnum::Bar => "Bar",
|
826 + | FooEnum::Baz => "Baz",
|
827 + | FooEnum::Foo => "Foo",
|
828 + | }
|
829 + | }
|
830 + | /// Returns all the `&str` representations of the enum members.
|
831 + | pub const fn values() -> &'static [&'static str] {
|
832 + | &["0", "1", "Bar", "Baz", "Foo"]
|
833 + | }
|
834 + | }
|
835 + | impl ::std::convert::AsRef<str> for FooEnum {
|
836 + | fn as_ref(&self) -> &str {
|
837 + | self.as_str()
|
838 + | }
|
839 + | }
|
840 + | impl crate::constrained::Constrained for FooEnum {
|
841 + | type Unconstrained = ::std::string::String;
|
842 + | }
|
843 + |
|
844 + | impl ::std::convert::From<::std::string::String>
|
845 + | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
846 + | {
|
847 + | fn from(value: ::std::string::String) -> Self {
|
848 + | Self::Unconstrained(value)
|
849 + | }
|
850 + | }
|
851 + |
|
852 + | #[allow(missing_docs)] // documentation missing in model
|
853 + | #[derive(
|
854 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
855 + | )]
|
856 + | pub struct ComplexNestedErrorData {
|
857 + | #[allow(missing_docs)] // documentation missing in model
|
858 + | pub foo: ::std::option::Option<::std::string::String>,
|
859 + | }
|
860 + | impl ComplexNestedErrorData {
|
861 + | #[allow(missing_docs)] // documentation missing in model
|
862 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
863 + | self.foo.as_deref()
|
864 + | }
|
865 + | }
|
866 + | impl ComplexNestedErrorData {
|
867 + | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
868 + | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
869 + | crate::model::complex_nested_error_data::Builder::default()
|
870 + | }
|
871 + | }
|
872 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
873 + | pub mod validation_exception_field {
|
874 + |
|
875 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
876 + | /// Holds one variant for each of the ways the builder can fail.
|
877 + | #[non_exhaustive]
|
878 + | #[allow(clippy::enum_variant_names)]
|
879 + | pub enum ConstraintViolation {
|
880 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
881 + | MissingPath,
|
882 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
883 + | MissingMessage,
|
884 + | }
|
885 + | impl ::std::fmt::Display for ConstraintViolation {
|
886 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
887 + | match self {
|
888 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
889 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
890 + | }
|
891 + | }
|
892 + | }
|
893 + | impl ::std::error::Error for ConstraintViolation {}
|
894 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
895 + | type Error = ConstraintViolation;
|
896 + |
|
897 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
898 + | builder.build()
|
899 + | }
|
900 + | }
|
901 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
902 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
903 + | pub struct Builder {
|
904 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
905 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
906 + | }
|
907 + | impl Builder {
|
908 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
909 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
910 + | self.path = Some(input);
|
911 + | self
|
912 + | }
|
913 + | /// A detailed description of the validation failure.
|
914 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
915 + | self.message = Some(input);
|
916 + | self
|
917 + | }
|
918 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
919 + | ///
|
920 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
921 + | ///
|
922 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
923 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
924 + | self.build_enforcing_all_constraints()
|
925 + | }
|
926 + | fn build_enforcing_all_constraints(
|
927 + | self,
|
928 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
929 + | Ok(crate::model::ValidationExceptionField {
|
930 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
931 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
932 + | })
|
933 + | }
|
934 + | }
|
935 + | }
|
936 + | /// See [`Dialog`](crate::model::Dialog).
|
937 + | pub mod dialog {
|
938 + |
|
939 + | impl ::std::convert::From<Builder> for crate::model::Dialog {
|
940 + | fn from(builder: Builder) -> Self {
|
941 + | builder.build()
|
942 + | }
|
943 + | }
|
944 + | /// A builder for [`Dialog`](crate::model::Dialog).
|
945 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
946 + | pub struct Builder {
|
947 + | pub(crate) language: ::std::option::Option<::std::string::String>,
|
948 + | pub(crate) greeting: ::std::option::Option<::std::string::String>,
|
949 + | pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
|
950 + | }
|
951 + | impl Builder {
|
952 + | #[allow(missing_docs)] // documentation missing in model
|
953 + | pub fn language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
954 + | self.language = input;
|
955 + | self
|
956 + | }
|
957 + | #[allow(missing_docs)] // documentation missing in model
|
958 + | pub(crate) fn set_language(
|
959 + | mut self,
|
960 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
961 + | ) -> Self {
|
962 + | self.language = input.map(|v| v.into());
|
963 + | self
|
964 + | }
|
965 + | #[allow(missing_docs)] // documentation missing in model
|
966 + | pub fn greeting(mut self, input: ::std::string::String) -> Self {
|
967 + | self.greeting = Some(input);
|
968 + | self
|
969 + | }
|
970 + | #[allow(missing_docs)] // documentation missing in model
|
971 + | pub(crate) fn set_greeting(
|
972 + | mut self,
|
973 + | input: impl ::std::convert::Into<::std::string::String>,
|
974 + | ) -> Self {
|
975 + | self.greeting = Some(input.into());
|
976 + | self
|
977 + | }
|
978 + | #[allow(missing_docs)] // documentation missing in model
|
979 + | pub fn farewell(mut self, input: ::std::option::Option<crate::model::Farewell>) -> Self {
|
980 + | self.farewell = input;
|
981 + | self
|
982 + | }
|
983 + | #[allow(missing_docs)] // documentation missing in model
|
984 + | pub(crate) fn set_farewell(
|
985 + | mut self,
|
986 + | input: Option<impl ::std::convert::Into<crate::model::Farewell>>,
|
987 + | ) -> Self {
|
988 + | self.farewell = input.map(|v| v.into());
|
989 + | self
|
990 + | }
|
991 + | /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
|
992 + | pub fn build(self) -> crate::model::Dialog {
|
993 + | self.build_enforcing_all_constraints()
|
994 + | }
|
995 + | fn build_enforcing_all_constraints(self) -> crate::model::Dialog {
|
996 + | crate::model::Dialog {
|
997 + | language: self.language,
|
998 + | greeting: self.greeting.unwrap_or_else(|| String::from("hi")),
|
999 + | farewell: self.farewell,
|
1000 + | }
|
1001 + | }
|
1002 + | }
|
1003 + | }
|
1004 + | /// See [`Farewell`](crate::model::Farewell).
|
1005 + | pub mod farewell {
|
1006 + |
|
1007 + | impl ::std::convert::From<Builder> for crate::model::Farewell {
|
1008 + | fn from(builder: Builder) -> Self {
|
1009 + | builder.build()
|
1010 + | }
|
1011 + | }
|
1012 + | /// A builder for [`Farewell`](crate::model::Farewell).
|
1013 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1014 + | pub struct Builder {
|
1015 + | pub(crate) phrase: ::std::option::Option<::std::string::String>,
|
1016 + | }
|
1017 + | impl Builder {
|
1018 + | #[allow(missing_docs)] // documentation missing in model
|
1019 + | pub fn phrase(mut self, input: ::std::string::String) -> Self {
|
1020 + | self.phrase = Some(input);
|
1021 + | self
|
1022 + | }
|
1023 + | #[allow(missing_docs)] // documentation missing in model
|
1024 + | pub(crate) fn set_phrase(
|
1025 + | mut self,
|
1026 + | input: impl ::std::convert::Into<::std::string::String>,
|
1027 + | ) -> Self {
|
1028 + | self.phrase = Some(input.into());
|
1029 + | self
|
1030 + | }
|
1031 + | /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
|
1032 + | pub fn build(self) -> crate::model::Farewell {
|
1033 + | self.build_enforcing_all_constraints()
|
1034 + | }
|
1035 + | fn build_enforcing_all_constraints(self) -> crate::model::Farewell {
|
1036 + | crate::model::Farewell {
|
1037 + | phrase: self.phrase.unwrap_or_else(|| String::from("bye")),
|
1038 + | }
|
1039 + | }
|
1040 + | }
|
1041 + | }
|
1042 + | /// See [`TopLevel`](crate::model::TopLevel).
|
1043 + | pub mod top_level {
|
1044 + |
|
1045 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1046 + | /// Holds one variant for each of the ways the builder can fail.
|
1047 + | #[non_exhaustive]
|
1048 + | #[allow(clippy::enum_variant_names)]
|
1049 + | pub enum ConstraintViolation {
|
1050 + | /// `dialog` was not provided but it is required when building `TopLevel`.
|
1051 + | MissingDialog,
|
1052 + | }
|
1053 + | impl ::std::fmt::Display for ConstraintViolation {
|
1054 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1055 + | match self {
|
1056 + | ConstraintViolation::MissingDialog => write!(
|
1057 + | f,
|
1058 + | "`dialog` was not provided but it is required when building `TopLevel`"
|
1059 + | ),
|
1060 + | }
|
1061 + | }
|
1062 + | }
|
1063 + | impl ::std::error::Error for ConstraintViolation {}
|
1064 + | impl ConstraintViolation {
|
1065 + | pub(crate) fn as_validation_exception_field(
|
1066 + | self,
|
1067 + | path: ::std::string::String,
|
1068 + | ) -> crate::model::ValidationExceptionField {
|
1069 + | match self {
|
1070 + | ConstraintViolation::MissingDialog => crate::model::ValidationExceptionField {
|
1071 + | message: format!("Value at '{}/dialog' failed to satisfy constraint: Member must not be null", path),
|
1072 + | path: path + "/dialog",
|
1073 + | },
|
1074 + | }
|
1075 + | }
|
1076 + | }
|
1077 + | impl ::std::convert::From<Builder>
|
1078 + | for crate::constrained::MaybeConstrained<crate::model::TopLevel>
|
1079 + | {
|
1080 + | fn from(builder: Builder) -> Self {
|
1081 + | Self::Unconstrained(builder)
|
1082 + | }
|
1083 + | }
|
1084 + | impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
|
1085 + | type Error = ConstraintViolation;
|
1086 + |
|
1087 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1088 + | builder.build()
|
1089 + | }
|
1090 + | }
|
1091 + | /// A builder for [`TopLevel`](crate::model::TopLevel).
|
1092 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1093 + | pub struct Builder {
|
1094 + | pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
|
1095 + | pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
|
1096 + | pub(crate) dialog_map: ::std::option::Option<
|
1097 + | ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
1098 + | >,
|
1099 + | }
|
1100 + | impl Builder {
|
1101 + | #[allow(missing_docs)] // documentation missing in model
|
1102 + | pub fn dialog(mut self, input: crate::model::Dialog) -> Self {
|
1103 + | self.dialog = Some(input);
|
1104 + | self
|
1105 + | }
|
1106 + | #[allow(missing_docs)] // documentation missing in model
|
1107 + | pub(crate) fn set_dialog(
|
1108 + | mut self,
|
1109 + | input: impl ::std::convert::Into<crate::model::Dialog>,
|
1110 + | ) -> Self {
|
1111 + | self.dialog = Some(input.into());
|
1112 + | self
|
1113 + | }
|
1114 + | #[allow(missing_docs)] // documentation missing in model
|
1115 + | pub fn dialog_list(mut self, input: ::std::vec::Vec<crate::model::Dialog>) -> Self {
|
1116 + | self.dialog_list = Some(input);
|
1117 + | self
|
1118 + | }
|
1119 + | #[allow(missing_docs)] // documentation missing in model
|
1120 + | pub(crate) fn set_dialog_list(
|
1121 + | mut self,
|
1122 + | input: impl ::std::convert::Into<::std::vec::Vec<crate::model::Dialog>>,
|
1123 + | ) -> Self {
|
1124 + | self.dialog_list = Some(input.into());
|
1125 + | self
|
1126 + | }
|
1127 + | #[allow(missing_docs)] // documentation missing in model
|
1128 + | pub fn dialog_map(
|
1129 + | mut self,
|
1130 + | input: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
1131 + | ) -> Self {
|
1132 + | self.dialog_map = Some(input);
|
1133 + | self
|
1134 + | }
|
1135 + | #[allow(missing_docs)] // documentation missing in model
|
1136 + | pub(crate) fn set_dialog_map(
|
1137 + | mut self,
|
1138 + | input: impl ::std::convert::Into<
|
1139 + | ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
1140 + | >,
|
1141 + | ) -> Self {
|
1142 + | self.dialog_map = Some(input.into());
|
1143 + | self
|
1144 + | }
|
1145 + | /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
|
1146 + | ///
|
1147 + | /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
|
1148 + | ///
|
1149 + | pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
1150 + | self.build_enforcing_all_constraints()
|
1151 + | }
|
1152 + | fn build_enforcing_all_constraints(
|
1153 + | self,
|
1154 + | ) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
1155 + | Ok(crate::model::TopLevel {
|
1156 + | dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
|
1157 + | dialog_list: self.dialog_list.unwrap_or_default(),
|
1158 + | dialog_map: self.dialog_map.unwrap_or_default(),
|
1159 + | })
|
1160 + | }
|
1161 + | }
|
1162 + | }
|
1163 + | /// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1164 + | pub mod client_optional_defaults {
|
1165 + |
|
1166 + | impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
|
1167 + | fn from(builder: Builder) -> Self {
|
1168 + | builder.build()
|
1169 + | }
|
1170 + | }
|
1171 + | /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1172 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1173 + | pub struct Builder {
|
1174 + | pub(crate) member: ::std::option::Option<i32>,
|
1175 + | }
|
1176 + | impl Builder {
|
1177 + | #[allow(missing_docs)] // documentation missing in model
|
1178 + | pub fn member(mut self, input: i32) -> Self {
|
1179 + | self.member = Some(input);
|
1180 + | self
|
1181 + | }
|
1182 + | #[allow(missing_docs)] // documentation missing in model
|
1183 + | pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
1184 + | self.member = Some(input.into());
|
1185 + | self
|
1186 + | }
|
1187 + | /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1188 + | pub fn build(self) -> crate::model::ClientOptionalDefaults {
|
1189 + | self.build_enforcing_all_constraints()
|
1190 + | }
|
1191 + | fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
|
1192 + | crate::model::ClientOptionalDefaults {
|
1193 + | member: self.member.unwrap_or(0i32),
|
1194 + | }
|
1195 + | }
|
1196 + | }
|
1197 + | }
|
1198 + | /// See [`Defaults`](crate::model::Defaults).
|
1199 + | pub mod defaults {
|
1200 + |
|
1201 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1202 + | /// Holds one variant for each of the ways the builder can fail.
|
1203 + | #[non_exhaustive]
|
1204 + | #[allow(clippy::enum_variant_names)]
|
1205 + | pub enum ConstraintViolation {
|
1206 + | /// Constraint violation occurred building member `default_enum` when building `Defaults`.
|
1207 + | #[doc(hidden)]
|
1208 + | DefaultEnum(crate::model::test_enum::ConstraintViolation),
|
1209 + | }
|
1210 + | impl ::std::fmt::Display for ConstraintViolation {
|
1211 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1212 + | match self {
|
1213 + | ConstraintViolation::DefaultEnum(_) => write!(f, "constraint violation occurred building member `default_enum` when building `Defaults`"),
|
1214 + | }
|
1215 + | }
|
1216 + | }
|
1217 + | impl ::std::error::Error for ConstraintViolation {}
|
1218 + | impl ConstraintViolation {
|
1219 + | pub(crate) fn as_validation_exception_field(
|
1220 + | self,
|
1221 + | path: ::std::string::String,
|
1222 + | ) -> crate::model::ValidationExceptionField {
|
1223 + | match self {
|
1224 + | ConstraintViolation::DefaultEnum(inner) => {
|
1225 + | inner.as_validation_exception_field(path + "/defaultEnum")
|
1226 + | }
|
1227 + | }
|
1228 + | }
|
1229 + | }
|
1230 + | impl ::std::convert::From<Builder>
|
1231 + | for crate::constrained::MaybeConstrained<crate::model::Defaults>
|
1232 + | {
|
1233 + | fn from(builder: Builder) -> Self {
|
1234 + | Self::Unconstrained(builder)
|
1235 + | }
|
1236 + | }
|
1237 + | impl ::std::convert::TryFrom<Builder> for crate::model::Defaults {
|
1238 + | type Error = ConstraintViolation;
|
1239 + |
|
1240 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1241 + | builder.build()
|
1242 + | }
|
1243 + | }
|
1244 + | /// A builder for [`Defaults`](crate::model::Defaults).
|
1245 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1246 + | pub struct Builder {
|
1247 + | pub(crate) default_string: ::std::option::Option<::std::string::String>,
|
1248 + | pub(crate) default_boolean: ::std::option::Option<bool>,
|
1249 + | pub(crate) default_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
1250 + | pub(crate) default_document_map: ::std::option::Option<::aws_smithy_types::Document>,
|
1251 + | pub(crate) default_document_string: ::std::option::Option<::aws_smithy_types::Document>,
|
1252 + | pub(crate) default_document_boolean: ::std::option::Option<::aws_smithy_types::Document>,
|
1253 + | pub(crate) default_document_list: ::std::option::Option<::aws_smithy_types::Document>,
|
1254 + | pub(crate) default_null_document: ::std::option::Option<::aws_smithy_types::Document>,
|
1255 + | pub(crate) default_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
|
1256 + | pub(crate) default_blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
1257 + | pub(crate) default_byte: ::std::option::Option<i8>,
|
1258 + | pub(crate) default_short: ::std::option::Option<i16>,
|
1259 + | pub(crate) default_integer: ::std::option::Option<i32>,
|
1260 + | pub(crate) default_long: ::std::option::Option<i64>,
|
1261 + | pub(crate) default_float: ::std::option::Option<f32>,
|
1262 + | pub(crate) default_double: ::std::option::Option<f64>,
|
1263 + | pub(crate) default_map: ::std::option::Option<
|
1264 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1265 + | >,
|
1266 + | pub(crate) default_enum:
|
1267 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TestEnum>>,
|
1268 + | pub(crate) default_int_enum: ::std::option::Option<i32>,
|
1269 + | pub(crate) empty_string: ::std::option::Option<::std::string::String>,
|
1270 + | pub(crate) false_boolean: ::std::option::Option<bool>,
|
1271 + | pub(crate) empty_blob: ::std::option::Option<::aws_smithy_types::Blob>,
|
1272 + | pub(crate) zero_byte: ::std::option::Option<i8>,
|
1273 + | pub(crate) zero_short: ::std::option::Option<i16>,
|
1274 + | pub(crate) zero_integer: ::std::option::Option<i32>,
|
1275 + | pub(crate) zero_long: ::std::option::Option<i64>,
|
1276 + | pub(crate) zero_float: ::std::option::Option<f32>,
|
1277 + | pub(crate) zero_double: ::std::option::Option<f64>,
|
1278 + | }
|
1279 + | impl Builder {
|
1280 + | #[allow(missing_docs)] // documentation missing in model
|
1281 + | pub fn default_string(mut self, input: ::std::string::String) -> Self {
|
1282 + | self.default_string = Some(input);
|
1283 + | self
|
1284 + | }
|
1285 + | #[allow(missing_docs)] // documentation missing in model
|
1286 + | pub(crate) fn set_default_string(
|
1287 + | mut self,
|
1288 + | input: impl ::std::convert::Into<::std::string::String>,
|
1289 + | ) -> Self {
|
1290 + | self.default_string = Some(input.into());
|
1291 + | self
|
1292 + | }
|
1293 + | #[allow(missing_docs)] // documentation missing in model
|
1294 + | pub fn default_boolean(mut self, input: bool) -> Self {
|
1295 + | self.default_boolean = Some(input);
|
1296 + | self
|
1297 + | }
|
1298 + | #[allow(missing_docs)] // documentation missing in model
|
1299 + | pub(crate) fn set_default_boolean(
|
1300 + | mut self,
|
1301 + | input: impl ::std::convert::Into<bool>,
|
1302 + | ) -> Self {
|
1303 + | self.default_boolean = Some(input.into());
|
1304 + | self
|
1305 + | }
|
1306 + | #[allow(missing_docs)] // documentation missing in model
|
1307 + | pub fn default_list(mut self, input: ::std::vec::Vec<::std::string::String>) -> Self {
|
1308 + | self.default_list = Some(input);
|
1309 + | self
|
1310 + | }
|
1311 + | #[allow(missing_docs)] // documentation missing in model
|
1312 + | pub(crate) fn set_default_list(
|
1313 + | mut self,
|
1314 + | input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>,
|
1315 + | ) -> Self {
|
1316 + | self.default_list = Some(input.into());
|
1317 + | self
|
1318 + | }
|
1319 + | #[allow(missing_docs)] // documentation missing in model
|
1320 + | pub fn default_document_map(mut self, input: ::aws_smithy_types::Document) -> Self {
|
1321 + | self.default_document_map = Some(input);
|
1322 + | self
|
1323 + | }
|
1324 + | #[allow(missing_docs)] // documentation missing in model
|
1325 + | pub(crate) fn set_default_document_map(
|
1326 + | mut self,
|
1327 + | input: impl ::std::convert::Into<::aws_smithy_types::Document>,
|
1328 + | ) -> Self {
|
1329 + | self.default_document_map = Some(input.into());
|
1330 + | self
|
1331 + | }
|
1332 + | #[allow(missing_docs)] // documentation missing in model
|
1333 + | pub fn default_document_string(mut self, input: ::aws_smithy_types::Document) -> Self {
|
1334 + | self.default_document_string = Some(input);
|
1335 + | self
|
1336 + | }
|
1337 + | #[allow(missing_docs)] // documentation missing in model
|
1338 + | pub(crate) fn set_default_document_string(
|
1339 + | mut self,
|
1340 + | input: impl ::std::convert::Into<::aws_smithy_types::Document>,
|
1341 + | ) -> Self {
|
1342 + | self.default_document_string = Some(input.into());
|
1343 + | self
|
1344 + | }
|
1345 + | #[allow(missing_docs)] // documentation missing in model
|
1346 + | pub fn default_document_boolean(mut self, input: ::aws_smithy_types::Document) -> Self {
|
1347 + | self.default_document_boolean = Some(input);
|
1348 + | self
|
1349 + | }
|
1350 + | #[allow(missing_docs)] // documentation missing in model
|
1351 + | pub(crate) fn set_default_document_boolean(
|
1352 + | mut self,
|
1353 + | input: impl ::std::convert::Into<::aws_smithy_types::Document>,
|
1354 + | ) -> Self {
|
1355 + | self.default_document_boolean = Some(input.into());
|
1356 + | self
|
1357 + | }
|
1358 + | #[allow(missing_docs)] // documentation missing in model
|
1359 + | pub fn default_document_list(mut self, input: ::aws_smithy_types::Document) -> Self {
|
1360 + | self.default_document_list = Some(input);
|
1361 + | self
|
1362 + | }
|
1363 + | #[allow(missing_docs)] // documentation missing in model
|
1364 + | pub(crate) fn set_default_document_list(
|
1365 + | mut self,
|
1366 + | input: impl ::std::convert::Into<::aws_smithy_types::Document>,
|
1367 + | ) -> Self {
|
1368 + | self.default_document_list = Some(input.into());
|
1369 + | self
|
1370 + | }
|
1371 + | #[allow(missing_docs)] // documentation missing in model
|
1372 + | pub fn default_null_document(
|
1373 + | mut self,
|
1374 + | input: ::std::option::Option<::aws_smithy_types::Document>,
|
1375 + | ) -> Self {
|
1376 + | self.default_null_document = input;
|
1377 + | self
|
1378 + | }
|
1379 + | #[allow(missing_docs)] // documentation missing in model
|
1380 + | pub(crate) fn set_default_null_document(
|
1381 + | mut self,
|
1382 + | input: Option<impl ::std::convert::Into<::aws_smithy_types::Document>>,
|
1383 + | ) -> Self {
|
1384 + | self.default_null_document = input.map(|v| v.into());
|
1385 + | self
|
1386 + | }
|
1387 + | #[allow(missing_docs)] // documentation missing in model
|
1388 + | pub fn default_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
|
1389 + | self.default_timestamp = Some(input);
|
1390 + | self
|
1391 + | }
|
1392 + | #[allow(missing_docs)] // documentation missing in model
|
1393 + | pub(crate) fn set_default_timestamp(
|
1394 + | mut self,
|
1395 + | input: impl ::std::convert::Into<::aws_smithy_types::DateTime>,
|
1396 + | ) -> Self {
|
1397 + | self.default_timestamp = Some(input.into());
|
1398 + | self
|
1399 + | }
|
1400 + | #[allow(missing_docs)] // documentation missing in model
|
1401 + | pub fn default_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
|
1402 + | self.default_blob = Some(input);
|
1403 + | self
|
1404 + | }
|
1405 + | #[allow(missing_docs)] // documentation missing in model
|
1406 + | pub(crate) fn set_default_blob(
|
1407 + | mut self,
|
1408 + | input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
|
1409 + | ) -> Self {
|
1410 + | self.default_blob = Some(input.into());
|
1411 + | self
|
1412 + | }
|
1413 + | #[allow(missing_docs)] // documentation missing in model
|
1414 + | pub fn default_byte(mut self, input: i8) -> Self {
|
1415 + | self.default_byte = Some(input);
|
1416 + | self
|
1417 + | }
|
1418 + | #[allow(missing_docs)] // documentation missing in model
|
1419 + | pub(crate) fn set_default_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
1420 + | self.default_byte = Some(input.into());
|
1421 + | self
|
1422 + | }
|
1423 + | #[allow(missing_docs)] // documentation missing in model
|
1424 + | pub fn default_short(mut self, input: i16) -> Self {
|
1425 + | self.default_short = Some(input);
|
1426 + | self
|
1427 + | }
|
1428 + | #[allow(missing_docs)] // documentation missing in model
|
1429 + | pub(crate) fn set_default_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
1430 + | self.default_short = Some(input.into());
|
1431 + | self
|
1432 + | }
|
1433 + | #[allow(missing_docs)] // documentation missing in model
|
1434 + | pub fn default_integer(mut self, input: i32) -> Self {
|
1435 + | self.default_integer = Some(input);
|
1436 + | self
|
1437 + | }
|
1438 + | #[allow(missing_docs)] // documentation missing in model
|
1439 + | pub(crate) fn set_default_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
1440 + | self.default_integer = Some(input.into());
|
1441 + | self
|
1442 + | }
|
1443 + | #[allow(missing_docs)] // documentation missing in model
|
1444 + | pub fn default_long(mut self, input: i64) -> Self {
|
1445 + | self.default_long = Some(input);
|
1446 + | self
|
1447 + | }
|
1448 + | #[allow(missing_docs)] // documentation missing in model
|
1449 + | pub(crate) fn set_default_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
1450 + | self.default_long = Some(input.into());
|
1451 + | self
|
1452 + | }
|
1453 + | #[allow(missing_docs)] // documentation missing in model
|
1454 + | pub fn default_float(mut self, input: f32) -> Self {
|
1455 + | self.default_float = Some(input);
|
1456 + | self
|
1457 + | }
|
1458 + | #[allow(missing_docs)] // documentation missing in model
|
1459 + | pub(crate) fn set_default_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
1460 + | self.default_float = Some(input.into());
|
1461 + | self
|
1462 + | }
|
1463 + | #[allow(missing_docs)] // documentation missing in model
|
1464 + | pub fn default_double(mut self, input: f64) -> Self {
|
1465 + | self.default_double = Some(input);
|
1466 + | self
|
1467 + | }
|
1468 + | #[allow(missing_docs)] // documentation missing in model
|
1469 + | pub(crate) fn set_default_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
1470 + | self.default_double = Some(input.into());
|
1471 + | self
|
1472 + | }
|
1473 + | #[allow(missing_docs)] // documentation missing in model
|
1474 + | pub fn default_map(
|
1475 + | mut self,
|
1476 + | input: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1477 + | ) -> Self {
|
1478 + | self.default_map = Some(input);
|
1479 + | self
|
1480 + | }
|
1481 + | #[allow(missing_docs)] // documentation missing in model
|
1482 + | pub(crate) fn set_default_map(
|
1483 + | mut self,
|
1484 + | input: impl ::std::convert::Into<
|
1485 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1486 + | >,
|
1487 + | ) -> Self {
|
1488 + | self.default_map = Some(input.into());
|
1489 + | self
|
1490 + | }
|
1491 + | #[allow(missing_docs)] // documentation missing in model
|
1492 + | pub fn default_enum(mut self, input: crate::model::TestEnum) -> Self {
|
1493 + | self.default_enum = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
1494 + | self
|
1495 + | }
|
1496 + | #[allow(missing_docs)] // documentation missing in model
|
1497 + | pub(crate) fn set_default_enum(
|
1498 + | mut self,
|
1499 + | input: impl ::std::convert::Into<
|
1500 + | crate::constrained::MaybeConstrained<crate::model::TestEnum>,
|
1501 + | >,
|
1502 + | ) -> Self {
|
1503 + | self.default_enum = Some(input.into());
|
1504 + | self
|
1505 + | }
|
1506 + | #[allow(missing_docs)] // documentation missing in model
|
1507 + | pub fn default_int_enum(mut self, input: i32) -> Self {
|
1508 + | self.default_int_enum = Some(input);
|
1509 + | self
|
1510 + | }
|
1511 + | #[allow(missing_docs)] // documentation missing in model
|
1512 + | pub(crate) fn set_default_int_enum(
|
1513 + | mut self,
|
1514 + | input: impl ::std::convert::Into<i32>,
|
1515 + | ) -> Self {
|
1516 + | self.default_int_enum = Some(input.into());
|
1517 + | self
|
1518 + | }
|
1519 + | #[allow(missing_docs)] // documentation missing in model
|
1520 + | pub fn empty_string(mut self, input: ::std::string::String) -> Self {
|
1521 + | self.empty_string = Some(input);
|
1522 + | self
|
1523 + | }
|
1524 + | #[allow(missing_docs)] // documentation missing in model
|
1525 + | pub(crate) fn set_empty_string(
|
1526 + | mut self,
|
1527 + | input: impl ::std::convert::Into<::std::string::String>,
|
1528 + | ) -> Self {
|
1529 + | self.empty_string = Some(input.into());
|
1530 + | self
|
1531 + | }
|
1532 + | #[allow(missing_docs)] // documentation missing in model
|
1533 + | pub fn false_boolean(mut self, input: bool) -> Self {
|
1534 + | self.false_boolean = Some(input);
|
1535 + | self
|
1536 + | }
|
1537 + | #[allow(missing_docs)] // documentation missing in model
|
1538 + | pub(crate) fn set_false_boolean(mut self, input: impl ::std::convert::Into<bool>) -> Self {
|
1539 + | self.false_boolean = Some(input.into());
|
1540 + | self
|
1541 + | }
|
1542 + | #[allow(missing_docs)] // documentation missing in model
|
1543 + | pub fn empty_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
|
1544 + | self.empty_blob = Some(input);
|
1545 + | self
|
1546 + | }
|
1547 + | #[allow(missing_docs)] // documentation missing in model
|
1548 + | pub(crate) fn set_empty_blob(
|
1549 + | mut self,
|
1550 + | input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
|
1551 + | ) -> Self {
|
1552 + | self.empty_blob = Some(input.into());
|
1553 + | self
|
1554 + | }
|
1555 + | #[allow(missing_docs)] // documentation missing in model
|
1556 + | pub fn zero_byte(mut self, input: i8) -> Self {
|
1557 + | self.zero_byte = Some(input);
|
1558 + | self
|
1559 + | }
|
1560 + | #[allow(missing_docs)] // documentation missing in model
|
1561 + | pub(crate) fn set_zero_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
1562 + | self.zero_byte = Some(input.into());
|
1563 + | self
|
1564 + | }
|
1565 + | #[allow(missing_docs)] // documentation missing in model
|
1566 + | pub fn zero_short(mut self, input: i16) -> Self {
|
1567 + | self.zero_short = Some(input);
|
1568 + | self
|
1569 + | }
|
1570 + | #[allow(missing_docs)] // documentation missing in model
|
1571 + | pub(crate) fn set_zero_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
1572 + | self.zero_short = Some(input.into());
|
1573 + | self
|
1574 + | }
|
1575 + | #[allow(missing_docs)] // documentation missing in model
|
1576 + | pub fn zero_integer(mut self, input: i32) -> Self {
|
1577 + | self.zero_integer = Some(input);
|
1578 + | self
|
1579 + | }
|
1580 + | #[allow(missing_docs)] // documentation missing in model
|
1581 + | pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
1582 + | self.zero_integer = Some(input.into());
|
1583 + | self
|
1584 + | }
|
1585 + | #[allow(missing_docs)] // documentation missing in model
|
1586 + | pub fn zero_long(mut self, input: i64) -> Self {
|
1587 + | self.zero_long = Some(input);
|
1588 + | self
|
1589 + | }
|
1590 + | #[allow(missing_docs)] // documentation missing in model
|
1591 + | pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
1592 + | self.zero_long = Some(input.into());
|
1593 + | self
|
1594 + | }
|
1595 + | #[allow(missing_docs)] // documentation missing in model
|
1596 + | pub fn zero_float(mut self, input: f32) -> Self {
|
1597 + | self.zero_float = Some(input);
|
1598 + | self
|
1599 + | }
|
1600 + | #[allow(missing_docs)] // documentation missing in model
|
1601 + | pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
1602 + | self.zero_float = Some(input.into());
|
1603 + | self
|
1604 + | }
|
1605 + | #[allow(missing_docs)] // documentation missing in model
|
1606 + | pub fn zero_double(mut self, input: f64) -> Self {
|
1607 + | self.zero_double = Some(input);
|
1608 + | self
|
1609 + | }
|
1610 + | #[allow(missing_docs)] // documentation missing in model
|
1611 + | pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
1612 + | self.zero_double = Some(input.into());
|
1613 + | self
|
1614 + | }
|
1615 + | /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
|
1616 + | ///
|
1617 + | /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
|
1618 + | ///
|
1619 + | pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
|
1620 + | self.build_enforcing_all_constraints()
|
1621 + | }
|
1622 + | fn build_enforcing_all_constraints(
|
1623 + | self,
|
1624 + | ) -> Result<crate::model::Defaults, ConstraintViolation> {
|
1625 + | Ok(crate::model::Defaults {
|
1626 + | default_string: self.default_string.unwrap_or_else(|| String::from("hi")),
|
1627 + | default_boolean: self.default_boolean.unwrap_or(true),
|
1628 + | default_list: self.default_list.unwrap_or_default(),
|
1629 + | default_document_map: self.default_document_map.unwrap_or_else(|| {
|
1630 + | ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
|
1631 + | }),
|
1632 + | default_document_string: self.default_document_string.unwrap_or_else(|| {
|
1633 + | ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
|
1634 + | }),
|
1635 + | default_document_boolean: self
|
1636 + | .default_document_boolean
|
1637 + | .unwrap_or(::aws_smithy_types::Document::Bool(true)),
|
1638 + | default_document_list: self
|
1639 + | .default_document_list
|
1640 + | .unwrap_or_else(|| ::aws_smithy_types::Document::Array(::std::vec::Vec::new())),
|
1641 + | default_null_document: self.default_null_document,
|
1642 + | default_timestamp: self.default_timestamp.unwrap_or_else(|| {
|
1643 + | ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)
|
1644 + | }),
|
1645 + | default_blob: self
|
1646 + | .default_blob
|
1647 + | .unwrap_or_else(|| ::aws_smithy_types::Blob::new("YWJj")),
|
1648 + | default_byte: self.default_byte.unwrap_or(1i8),
|
1649 + | default_short: self.default_short.unwrap_or(1i16),
|
1650 + | default_integer: self.default_integer.unwrap_or(10i32),
|
1651 + | default_long: self.default_long.unwrap_or(100i64),
|
1652 + | default_float: self.default_float.unwrap_or(1.0f32),
|
1653 + | default_double: self.default_double.unwrap_or(1.0f64),
|
1654 + | default_map: self.default_map.unwrap_or_default(),
|
1655 + | default_enum: self
|
1656 + | .default_enum
|
1657 + | .map(|v| match v {
|
1658 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1659 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1660 + | })
|
1661 + | .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
|
1662 + | .transpose()?
|
1663 + | .unwrap_or(
|
1664 + | "FOO"
|
1665 + | .parse::<crate::model::TestEnum>()
|
1666 + | .expect("static value validated to member"),
|
1667 + | ),
|
1668 + | default_int_enum: self.default_int_enum.unwrap_or(1i32),
|
1669 + | empty_string: self.empty_string.unwrap_or_else(|| String::from("")),
|
1670 + | false_boolean: self.false_boolean.unwrap_or(false),
|
1671 + | empty_blob: self
|
1672 + | .empty_blob
|
1673 + | .unwrap_or_else(|| ::aws_smithy_types::Blob::new("")),
|
1674 + | zero_byte: self.zero_byte.unwrap_or(0i8),
|
1675 + | zero_short: self.zero_short.unwrap_or(0i16),
|
1676 + | zero_integer: self.zero_integer.unwrap_or(0i32),
|
1677 + | zero_long: self.zero_long.unwrap_or(0i64),
|
1678 + | zero_float: self.zero_float.unwrap_or(0.0f32),
|
1679 + | zero_double: self.zero_double.unwrap_or(0.0f64),
|
1680 + | })
|
1681 + | }
|
1682 + | }
|
1683 + | }
|
1684 + | pub mod my_union {
|
1685 + |
|
1686 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1687 + | #[allow(clippy::enum_variant_names)]
|
1688 + | pub enum ConstraintViolation {
|
1689 + | EnumValue(crate::model::foo_enum::ConstraintViolation),
|
1690 + | }
|
1691 + | impl ::std::fmt::Display for ConstraintViolation {
|
1692 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1693 + | match self {
|
1694 + | Self::EnumValue(inner) => write!(f, "{inner}"),
|
1695 + | }
|
1696 + | }
|
1697 + | }
|
1698 + |
|
1699 + | impl ::std::error::Error for ConstraintViolation {}
|
1700 + | impl ConstraintViolation {
|
1701 + | pub(crate) fn as_validation_exception_field(
|
1702 + | self,
|
1703 + | path: ::std::string::String,
|
1704 + | ) -> crate::model::ValidationExceptionField {
|
1705 + | match self {
|
1706 + | Self::EnumValue(inner) => inner.as_validation_exception_field(path + "/enumValue"),
|
1707 + | }
|
1708 + | }
|
1709 + | }
|
1710 + | }
|
1711 + | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
1712 + | pub mod greeting_struct {
|
1713 + |
|
1714 + | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
1715 + | fn from(builder: Builder) -> Self {
|
1716 + | builder.build()
|
1717 + | }
|
1718 + | }
|
1719 + | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
1720 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1721 + | pub struct Builder {
|
1722 + | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
1723 + | }
|
1724 + | impl Builder {
|
1725 + | #[allow(missing_docs)] // documentation missing in model
|
1726 + | pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1727 + | self.hi = input;
|
1728 + | self
|
1729 + | }
|
1730 + | #[allow(missing_docs)] // documentation missing in model
|
1731 + | pub(crate) fn set_hi(
|
1732 + | mut self,
|
1733 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1734 + | ) -> Self {
|
1735 + | self.hi = input.map(|v| v.into());
|
1736 + | self
|
1737 + | }
|
1738 + | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
1739 + | pub fn build(self) -> crate::model::GreetingStruct {
|
1740 + | self.build_enforcing_all_constraints()
|
1741 + | }
|
1742 + | fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
|
1743 + | crate::model::GreetingStruct { hi: self.hi }
|
1744 + | }
|
1745 + | }
|
1746 + | }
|
1747 + | /// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1748 + | pub mod complex_nested_error_data {
|
1749 + |
|
1750 + | impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
|
1751 + | fn from(builder: Builder) -> Self {
|
1752 + | builder.build()
|
1753 + | }
|
1754 + | }
|
1755 + | /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1756 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1757 + | pub struct Builder {
|
1758 + | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
1759 + | }
|
1760 + | impl Builder {
|
1761 + | #[allow(missing_docs)] // documentation missing in model
|
1762 + | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1763 + | self.foo = input;
|
1764 + | self
|
1765 + | }
|
1766 + | /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1767 + | pub fn build(self) -> crate::model::ComplexNestedErrorData {
|
1768 + | self.build_enforcing_all_constraints()
|
1769 + | }
|
1770 + | fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
|
1771 + | crate::model::ComplexNestedErrorData { foo: self.foo }
|
1772 + | }
|
1773 + | }
|
1774 + | }
|