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