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