1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[::pyo3::pyclass]
|
3 - | /// :param data typing.Optional\[int\]:
|
3 + | /// :param path str:
|
4 + | /// :param message str:
|
4 5 | /// :rtype None:
|
5 - | #[allow(missing_docs)] // documentation missing in model
|
6 + | /// Describes one specific validation failure for an input member.
|
6 7 | #[derive(
|
7 8 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
8 9 | )]
|
9 - | pub struct PayloadConfig {
|
10 + | pub struct ValidationExceptionField {
|
10 11 | #[pyo3(get, set)]
|
11 - | /// :type typing.Optional\[int\]:
|
12 - | #[allow(missing_docs)] // documentation missing in model
|
13 - | pub data: ::std::option::Option<i32>,
|
12 + | /// :type str:
|
13 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
14 + | pub path: ::std::string::String,
|
15 + | #[pyo3(get, set)]
|
16 + | /// :type str:
|
17 + | /// A detailed description of the validation failure.
|
18 + | pub message: ::std::string::String,
|
14 19 | }
|
15 - | impl PayloadConfig {
|
16 - | #[allow(missing_docs)] // documentation missing in model
|
17 - | pub fn data(&self) -> ::std::option::Option<i32> {
|
18 - | self.data
|
20 + | impl ValidationExceptionField {
|
21 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
22 + | pub fn path(&self) -> &str {
|
23 + | use std::ops::Deref;
|
24 + | self.path.deref()
|
25 + | }
|
26 + | /// A detailed description of the validation failure.
|
27 + | pub fn message(&self) -> &str {
|
28 + | use std::ops::Deref;
|
29 + | self.message.deref()
|
19 30 | }
|
20 31 | }
|
21 32 | #[allow(clippy::new_without_default)]
|
22 33 | #[allow(clippy::too_many_arguments)]
|
23 34 | #[::pyo3::pymethods]
|
24 - | impl PayloadConfig {
|
35 + | impl ValidationExceptionField {
|
25 36 | #[new]
|
26 - | pub fn new(data: ::std::option::Option<i32>) -> Self {
|
27 - | Self { data }
|
37 + | pub fn new(path: ::std::string::String, message: ::std::string::String) -> Self {
|
38 + | Self { path, message }
|
28 39 | }
|
29 40 | fn __repr__(&self) -> String {
|
30 41 | format!("{self:?}")
|
31 42 | }
|
32 43 | fn __str__(&self) -> String {
|
33 44 | format!("{self:?}")
|
34 45 | }
|
35 46 | }
|
36 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<PayloadConfig> {
|
47 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ValidationExceptionField> {
|
37 48 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
38 - | ob.extract::<PayloadConfig>().map(Box::new)
|
49 + | ob.extract::<ValidationExceptionField>().map(Box::new)
|
39 50 | }
|
40 51 | }
|
41 52 |
|
42 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<PayloadConfig> {
|
53 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ValidationExceptionField> {
|
43 54 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
44 55 | (*self).into_py(py)
|
45 56 | }
|
46 57 | }
|
47 - | impl crate::constrained::Constrained for crate::model::PayloadConfig {
|
48 - | type Unconstrained = crate::model::payload_config_internal::Builder;
|
49 - | }
|
50 - | impl PayloadConfig {
|
51 - | /// Creates a new builder-style object to manufacture [`PayloadConfig`](crate::model::PayloadConfig).
|
52 - | pub fn builder() -> crate::model::payload_config::Builder {
|
53 - | crate::model::payload_config::Builder::default()
|
58 + | impl ValidationExceptionField {
|
59 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
60 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
61 + | crate::model::validation_exception_field::Builder::default()
|
54 62 | }
|
55 63 | }
|
56 64 |
|
57 65 | #[::pyo3::pyclass]
|
58 - | /// :param timeout typing.Optional\[int\]:
|
66 + | /// :param language typing.Optional\[str\]:
|
67 + | /// :param greeting str:
|
68 + | /// :param farewell typing.Optional\[rest_json.model.Farewell\]:
|
59 69 | /// :rtype None:
|
60 70 | #[allow(missing_docs)] // documentation missing in model
|
61 71 | #[derive(
|
62 72 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
63 73 | )]
|
64 - | pub struct TestConfig {
|
74 + | pub struct Dialog {
|
65 75 | #[pyo3(get, set)]
|
66 - | /// :type typing.Optional\[int\]:
|
76 + | /// :type typing.Optional\[str\]:
|
67 77 | #[allow(missing_docs)] // documentation missing in model
|
68 - | pub timeout: ::std::option::Option<i32>,
|
78 + | pub language: ::std::option::Option<::std::string::String>,
|
79 + | #[pyo3(get, set)]
|
80 + | /// :type str:
|
81 + | #[allow(missing_docs)] // documentation missing in model
|
82 + | pub greeting: ::std::string::String,
|
83 + | #[pyo3(get, set)]
|
84 + | /// :type typing.Optional\[rest_json.model.Farewell\]:
|
85 + | #[allow(missing_docs)] // documentation missing in model
|
86 + | pub farewell: ::std::option::Option<crate::model::Farewell>,
|
69 87 | }
|
70 - | impl TestConfig {
|
88 + | impl Dialog {
|
71 89 | #[allow(missing_docs)] // documentation missing in model
|
72 - | pub fn timeout(&self) -> ::std::option::Option<i32> {
|
73 - | self.timeout
|
90 + | pub fn language(&self) -> ::std::option::Option<&str> {
|
91 + | self.language.as_deref()
|
92 + | }
|
93 + | #[allow(missing_docs)] // documentation missing in model
|
94 + | pub fn greeting(&self) -> &str {
|
95 + | use std::ops::Deref;
|
96 + | self.greeting.deref()
|
97 + | }
|
98 + | #[allow(missing_docs)] // documentation missing in model
|
99 + | pub fn farewell(&self) -> ::std::option::Option<&crate::model::Farewell> {
|
100 + | self.farewell.as_ref()
|
74 101 | }
|
75 102 | }
|
76 103 | #[allow(clippy::new_without_default)]
|
77 104 | #[allow(clippy::too_many_arguments)]
|
78 105 | #[::pyo3::pymethods]
|
79 - | impl TestConfig {
|
106 + | impl Dialog {
|
80 107 | #[new]
|
81 - | pub fn new(timeout: ::std::option::Option<i32>) -> Self {
|
82 - | Self { timeout }
|
108 + | pub fn new(
|
109 + | language: ::std::option::Option<::std::string::String>,
|
110 + | greeting: ::std::string::String,
|
111 + | farewell: ::std::option::Option<crate::model::Farewell>,
|
112 + | ) -> Self {
|
113 + | Self {
|
114 + | language,
|
115 + | greeting,
|
116 + | farewell,
|
117 + | }
|
83 118 | }
|
84 119 | fn __repr__(&self) -> String {
|
85 120 | format!("{self:?}")
|
86 121 | }
|
87 122 | fn __str__(&self) -> String {
|
88 123 | format!("{self:?}")
|
89 124 | }
|
90 125 | }
|
91 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<TestConfig> {
|
126 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<Dialog> {
|
92 127 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
93 - | ob.extract::<TestConfig>().map(Box::new)
|
128 + | ob.extract::<Dialog>().map(Box::new)
|
94 129 | }
|
95 130 | }
|
96 131 |
|
97 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<TestConfig> {
|
132 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<Dialog> {
|
98 133 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
99 134 | (*self).into_py(py)
|
100 135 | }
|
101 136 | }
|
102 - | impl crate::constrained::Constrained for crate::model::TestConfig {
|
103 - | type Unconstrained = crate::model::test_config_internal::Builder;
|
137 + | impl crate::constrained::Constrained for crate::model::Dialog {
|
138 + | type Unconstrained = crate::model::dialog_internal::Builder;
|
104 139 | }
|
105 - | impl TestConfig {
|
106 - | /// Creates a new builder-style object to manufacture [`TestConfig`](crate::model::TestConfig).
|
107 - | pub fn builder() -> crate::model::test_config::Builder {
|
108 - | crate::model::test_config::Builder::default()
|
140 + | impl Dialog {
|
141 + | /// Creates a new builder-style object to manufacture [`Dialog`](crate::model::Dialog).
|
142 + | pub fn builder() -> crate::model::dialog::Builder {
|
143 + | crate::model::dialog::Builder::default()
|
109 144 | }
|
110 145 | }
|
111 146 |
|
112 147 | #[::pyo3::pyclass]
|
113 - | /// :param path str:
|
114 - | /// :param message str:
|
148 + | /// :param phrase str:
|
115 149 | /// :rtype None:
|
116 - | /// Describes one specific validation failure for an input member.
|
150 + | #[allow(missing_docs)] // documentation missing in model
|
117 151 | #[derive(
|
118 152 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
119 153 | )]
|
120 - | pub struct ValidationExceptionField {
|
121 - | #[pyo3(get, set)]
|
122 - | /// :type str:
|
123 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
124 - | pub path: ::std::string::String,
|
154 + | pub struct Farewell {
|
125 155 | #[pyo3(get, set)]
|
126 156 | /// :type str:
|
127 - | /// A detailed description of the validation failure.
|
128 - | pub message: ::std::string::String,
|
157 + | #[allow(missing_docs)] // documentation missing in model
|
158 + | pub phrase: ::std::string::String,
|
129 159 | }
|
130 - | impl ValidationExceptionField {
|
131 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
132 - | pub fn path(&self) -> &str {
|
133 - | use std::ops::Deref;
|
134 - | self.path.deref()
|
135 - | }
|
136 - | /// A detailed description of the validation failure.
|
137 - | pub fn message(&self) -> &str {
|
160 + | impl Farewell {
|
161 + | #[allow(missing_docs)] // documentation missing in model
|
162 + | pub fn phrase(&self) -> &str {
|
138 163 | use std::ops::Deref;
|
139 - | self.message.deref()
|
164 + | self.phrase.deref()
|
140 165 | }
|
141 166 | }
|
142 167 | #[allow(clippy::new_without_default)]
|
143 168 | #[allow(clippy::too_many_arguments)]
|
144 169 | #[::pyo3::pymethods]
|
145 - | impl ValidationExceptionField {
|
170 + | impl Farewell {
|
146 171 | #[new]
|
147 - | pub fn new(path: ::std::string::String, message: ::std::string::String) -> Self {
|
148 - | Self { path, message }
|
172 + | pub fn new(phrase: ::std::string::String) -> Self {
|
173 + | Self { phrase }
|
149 174 | }
|
150 175 | fn __repr__(&self) -> String {
|
151 176 | format!("{self:?}")
|
152 177 | }
|
153 178 | fn __str__(&self) -> String {
|
154 179 | format!("{self:?}")
|
155 180 | }
|
156 181 | }
|
157 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ValidationExceptionField> {
|
182 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<Farewell> {
|
158 183 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
159 - | ob.extract::<ValidationExceptionField>().map(Box::new)
|
184 + | ob.extract::<Farewell>().map(Box::new)
|
160 185 | }
|
161 186 | }
|
162 187 |
|
163 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ValidationExceptionField> {
|
188 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<Farewell> {
|
164 189 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
165 190 | (*self).into_py(py)
|
166 191 | }
|
167 192 | }
|
168 - | impl ValidationExceptionField {
|
169 - | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
170 - | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
171 - | crate::model::validation_exception_field::Builder::default()
|
193 + | impl crate::constrained::Constrained for crate::model::Farewell {
|
194 + | type Unconstrained = crate::model::farewell_internal::Builder;
|
195 + | }
|
196 + | impl Farewell {
|
197 + | /// Creates a new builder-style object to manufacture [`Farewell`](crate::model::Farewell).
|
198 + | pub fn builder() -> crate::model::farewell::Builder {
|
199 + | crate::model::farewell::Builder::default()
|
172 200 | }
|
173 201 | }
|
174 202 |
|
203 + | #[::pyo3::pyclass]
|
204 + | /// :param dialog rest_json.model.Dialog:
|
205 + | /// :param dialog_list typing.List\[rest_json.model.Dialog\]:
|
206 + | /// :param dialog_map typing.Dict\[str, rest_json.model.Dialog\]:
|
207 + | /// :rtype None:
|
175 208 | #[allow(missing_docs)] // documentation missing in model
|
176 - | #[derive(
|
177 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
178 - | )]
|
179 - | pub enum SimpleUnion {
|
209 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
210 + | pub struct TopLevel {
|
211 + | #[pyo3(get, set)]
|
212 + | /// :type rest_json.model.Dialog:
|
180 213 | #[allow(missing_docs)] // documentation missing in model
|
181 - | Int(i32),
|
214 + | pub dialog: crate::model::Dialog,
|
215 + | #[pyo3(get, set)]
|
216 + | /// :type typing.List\[rest_json.model.Dialog\]:
|
182 217 | #[allow(missing_docs)] // documentation missing in model
|
183 - | String(::std::string::String),
|
218 + | pub dialog_list: ::std::vec::Vec<crate::model::Dialog>,
|
219 + | #[pyo3(get, set)]
|
220 + | /// :type typing.Dict\[str, rest_json.model.Dialog\]:
|
221 + | #[allow(missing_docs)] // documentation missing in model
|
222 + | pub dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
184 223 | }
|
185 - | impl SimpleUnion {
|
186 - | /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
|
187 - | /// Returns `Err(&Self)` if it can't be converted.
|
188 - | pub fn as_int(&self) -> ::std::result::Result<&i32, &Self> {
|
189 - | if let SimpleUnion::Int(val) = &self {
|
190 - | ::std::result::Result::Ok(val)
|
191 - | } else {
|
192 - | ::std::result::Result::Err(self)
|
193 - | }
|
194 - | }
|
195 - | /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
|
196 - | pub fn is_int(&self) -> bool {
|
197 - | self.as_int().is_ok()
|
198 - | }
|
199 - | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
200 - | /// Returns `Err(&Self)` if it can't be converted.
|
201 - | pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
202 - | if let SimpleUnion::String(val) = &self {
|
203 - | ::std::result::Result::Ok(val)
|
204 - | } else {
|
205 - | ::std::result::Result::Err(self)
|
224 + | impl TopLevel {
|
225 + | #[allow(missing_docs)] // documentation missing in model
|
226 + | pub fn dialog(&self) -> &crate::model::Dialog {
|
227 + | &self.dialog
|
206 228 | }
|
229 + | #[allow(missing_docs)] // documentation missing in model
|
230 + | pub fn dialog_list(&self) -> &[crate::model::Dialog] {
|
231 + | use std::ops::Deref;
|
232 + | self.dialog_list.deref()
|
207 233 | }
|
208 - | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
209 - | pub fn is_string(&self) -> bool {
|
210 - | self.as_string().is_ok()
|
234 + | #[allow(missing_docs)] // documentation missing in model
|
235 + | pub fn dialog_map(
|
236 + | &self,
|
237 + | ) -> &::std::collections::HashMap<::std::string::String, crate::model::Dialog> {
|
238 + | &self.dialog_map
|
211 239 | }
|
212 240 | }
|
213 - | #[pyo3::pyclass(name = "SimpleUnion")]
|
214 - | #[derive(
|
215 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
216 - | )]
|
217 - | pub struct PyUnionMarkerSimpleUnion(pub SimpleUnion);
|
241 + | #[allow(clippy::new_without_default)]
|
242 + | #[allow(clippy::too_many_arguments)]
|
218 243 | #[::pyo3::pymethods]
|
219 - | impl PyUnionMarkerSimpleUnion {
|
220 - | #[staticmethod]
|
221 - | /// Creates a new union instance of [`Int`](crate::model::SimpleUnion::Int)
|
222 - | /// :param data int:
|
223 - | /// :rtype SimpleUnion:
|
224 - | pub fn int(data: i32) -> Self {
|
225 - | Self(SimpleUnion::Int(data))
|
226 - | }
|
227 - | /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
|
228 - | /// :rtype int:
|
229 - | pub fn as_int(&self) -> ::pyo3::PyResult<i32> {
|
230 - | match self.0.as_int() {
|
231 - | Ok(variant) => Ok(*variant),
|
232 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
233 - | r"SimpleUnion variant is not of type int",
|
234 - | )),
|
235 - | }
|
236 - | }
|
237 - | /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
|
238 - | /// :rtype bool:
|
239 - | pub fn is_int(&self) -> bool {
|
240 - | self.0.is_int()
|
244 + | impl TopLevel {
|
245 + | #[new]
|
246 + | pub fn new(
|
247 + | dialog: crate::model::Dialog,
|
248 + | dialog_list: ::std::vec::Vec<crate::model::Dialog>,
|
249 + | dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
250 + | ) -> Self {
|
251 + | Self {
|
252 + | dialog,
|
253 + | dialog_list,
|
254 + | dialog_map,
|
241 255 | }
|
242 - | #[staticmethod]
|
243 - | /// Creates a new union instance of [`String`](crate::model::SimpleUnion::String)
|
244 - | /// :param data str:
|
245 - | /// :rtype SimpleUnion:
|
246 - | pub fn string(data: ::std::string::String) -> Self {
|
247 - | Self(SimpleUnion::String(data))
|
248 256 | }
|
249 - | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
250 - | /// :rtype str:
|
251 - | pub fn as_string(&self) -> ::pyo3::PyResult<::std::string::String> {
|
252 - | match self.0.as_string() {
|
253 - | Ok(variant) => Ok(variant.clone()),
|
254 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
255 - | r"SimpleUnion variant is not of type str",
|
256 - | )),
|
257 + | fn __repr__(&self) -> String {
|
258 + | format!("{self:?}")
|
257 259 | }
|
260 + | fn __str__(&self) -> String {
|
261 + | format!("{self:?}")
|
258 262 | }
|
259 - | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
260 - | /// :rtype bool:
|
261 - | pub fn is_string(&self) -> bool {
|
262 - | self.0.is_string()
|
263 + | }
|
264 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<TopLevel> {
|
265 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
266 + | ob.extract::<TopLevel>().map(Box::new)
|
263 267 | }
|
264 268 | }
|
265 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for SimpleUnion {
|
269 + |
|
270 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<TopLevel> {
|
266 271 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
267 - | PyUnionMarkerSimpleUnion(self).into_py(py)
|
272 + | (*self).into_py(py)
|
268 273 | }
|
269 274 | }
|
270 - | impl<'source> ::pyo3::FromPyObject<'source> for SimpleUnion {
|
271 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
272 - | let data: PyUnionMarkerSimpleUnion = obj.extract()?;
|
273 - | Ok(data.0)
|
275 + | impl crate::constrained::Constrained for crate::model::TopLevel {
|
276 + | type Unconstrained = crate::model::top_level_internal::Builder;
|
277 + | }
|
278 + | impl TopLevel {
|
279 + | /// Creates a new builder-style object to manufacture [`TopLevel`](crate::model::TopLevel).
|
280 + | pub fn builder() -> crate::model::top_level::Builder {
|
281 + | crate::model::top_level::Builder::default()
|
274 282 | }
|
275 283 | }
|
276 284 |
|
285 + | #[::pyo3::pyclass]
|
277 286 | #[allow(missing_docs)] // documentation missing in model
|
278 287 | #[derive(
|
279 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
288 + | ::std::clone::Clone,
|
289 + | ::std::cmp::Eq,
|
290 + | ::std::cmp::Ord,
|
291 + | ::std::cmp::PartialEq,
|
292 + | ::std::cmp::PartialOrd,
|
293 + | ::std::fmt::Debug,
|
294 + | ::std::hash::Hash,
|
280 295 | )]
|
281 - | pub enum UnionWithJsonName {
|
296 + | pub enum TestEnum {
|
282 297 | #[allow(missing_docs)] // documentation missing in model
|
283 - | Bar(::std::string::String),
|
298 + | Bar,
|
284 299 | #[allow(missing_docs)] // documentation missing in model
|
285 - | Baz(::std::string::String),
|
300 + | Baz,
|
286 301 | #[allow(missing_docs)] // documentation missing in model
|
287 - | Foo(::std::string::String),
|
302 + | Foo,
|
288 303 | }
|
289 - | impl UnionWithJsonName {
|
290 - | /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
|
291 - | /// Returns `Err(&Self)` if it can't be converted.
|
292 - | pub fn as_bar(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
293 - | if let UnionWithJsonName::Bar(val) = &self {
|
294 - | ::std::result::Result::Ok(val)
|
295 - | } else {
|
296 - | ::std::result::Result::Err(self)
|
297 - | }
|
298 - | }
|
299 - | /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
|
300 - | pub fn is_bar(&self) -> bool {
|
301 - | self.as_bar().is_ok()
|
302 - | }
|
303 - | /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
|
304 - | /// Returns `Err(&Self)` if it can't be converted.
|
305 - | pub fn as_baz(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
306 - | if let UnionWithJsonName::Baz(val) = &self {
|
307 - | ::std::result::Result::Ok(val)
|
308 - | } else {
|
309 - | ::std::result::Result::Err(self)
|
310 - | }
|
304 + | ///
|
305 + | pub(crate) mod test_enum_internal {
|
306 + | #[derive(Debug, PartialEq)]
|
307 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
308 + |
|
309 + | impl ::std::fmt::Display for ConstraintViolation {
|
310 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
311 + | write!(
|
312 + | f,
|
313 + | r#"Value provided for 'aws.protocoltests.restjson#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
|
314 + | )
|
311 315 | }
|
312 - | /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
|
313 - | pub fn is_baz(&self) -> bool {
|
314 - | self.as_baz().is_ok()
|
315 316 | }
|
316 - | /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
|
317 - | /// Returns `Err(&Self)` if it can't be converted.
|
318 - | pub fn as_foo(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
319 - | if let UnionWithJsonName::Foo(val) = &self {
|
320 - | ::std::result::Result::Ok(val)
|
321 - | } else {
|
322 - | ::std::result::Result::Err(self)
|
317 + |
|
318 + | impl ::std::error::Error for ConstraintViolation {}
|
319 + | impl ConstraintViolation {
|
320 + | pub(crate) fn as_validation_exception_field(
|
321 + | self,
|
322 + | path: ::std::string::String,
|
323 + | ) -> crate::model::ValidationExceptionField {
|
324 + | crate::model::ValidationExceptionField {
|
325 + | message: format!(
|
326 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
|
327 + | &path
|
328 + | ),
|
329 + | path,
|
323 330 | }
|
324 331 | }
|
325 - | /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
|
326 - | pub fn is_foo(&self) -> bool {
|
327 - | self.as_foo().is_ok()
|
328 332 | }
|
329 333 | }
|
330 - | #[pyo3::pyclass(name = "UnionWithJsonName")]
|
331 - | #[derive(
|
332 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
333 - | )]
|
334 - | pub struct PyUnionMarkerUnionWithJsonName(pub UnionWithJsonName);
|
335 - | #[::pyo3::pymethods]
|
336 - | impl PyUnionMarkerUnionWithJsonName {
|
337 - | #[staticmethod]
|
338 - | /// Creates a new union instance of [`Bar`](crate::model::UnionWithJsonName::Bar)
|
339 - | /// :param data str:
|
340 - | /// :rtype UnionWithJsonName:
|
341 - | pub fn bar(data: ::std::string::String) -> Self {
|
342 - | Self(UnionWithJsonName::Bar(data))
|
343 - | }
|
344 - | /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
|
345 - | /// :rtype str:
|
346 - | pub fn as_bar(&self) -> ::pyo3::PyResult<::std::string::String> {
|
347 - | match self.0.as_bar() {
|
348 - | Ok(variant) => Ok(variant.clone()),
|
349 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
350 - | r"UnionWithJsonName variant is not of type str",
|
351 - | )),
|
352 - | }
|
353 - | }
|
354 - | /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
|
355 - | /// :rtype bool:
|
356 - | pub fn is_bar(&self) -> bool {
|
357 - | self.0.is_bar()
|
358 - | }
|
359 - | #[staticmethod]
|
360 - | /// Creates a new union instance of [`Baz`](crate::model::UnionWithJsonName::Baz)
|
361 - | /// :param data str:
|
362 - | /// :rtype UnionWithJsonName:
|
363 - | pub fn baz(data: ::std::string::String) -> Self {
|
364 - | Self(UnionWithJsonName::Baz(data))
|
365 - | }
|
366 - | /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
|
367 - | /// :rtype str:
|
368 - | pub fn as_baz(&self) -> ::pyo3::PyResult<::std::string::String> {
|
369 - | match self.0.as_baz() {
|
370 - | Ok(variant) => Ok(variant.clone()),
|
371 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
372 - | r"UnionWithJsonName variant is not of type str",
|
373 - | )),
|
374 - | }
|
375 - | }
|
376 - | /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
|
377 - | /// :rtype bool:
|
378 - | pub fn is_baz(&self) -> bool {
|
379 - | self.0.is_baz()
|
380 - | }
|
381 - | #[staticmethod]
|
382 - | /// Creates a new union instance of [`Foo`](crate::model::UnionWithJsonName::Foo)
|
383 - | /// :param data str:
|
384 - | /// :rtype UnionWithJsonName:
|
385 - | pub fn foo(data: ::std::string::String) -> Self {
|
386 - | Self(UnionWithJsonName::Foo(data))
|
387 - | }
|
388 - | /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
|
389 - | /// :rtype str:
|
390 - | pub fn as_foo(&self) -> ::pyo3::PyResult<::std::string::String> {
|
391 - | match self.0.as_foo() {
|
392 - | Ok(variant) => Ok(variant.clone()),
|
393 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
394 - | r"UnionWithJsonName variant is not of type str",
|
334 + | impl ::std::convert::TryFrom<&str> for TestEnum {
|
335 + | type Error = crate::model::test_enum_internal::ConstraintViolation;
|
336 + | fn try_from(
|
337 + | s: &str,
|
338 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
339 + | match s {
|
340 + | "BAR" => Ok(TestEnum::Bar),
|
341 + | "BAZ" => Ok(TestEnum::Baz),
|
342 + | "FOO" => Ok(TestEnum::Foo),
|
343 + | _ => Err(crate::model::test_enum_internal::ConstraintViolation(
|
344 + | s.to_owned(),
|
395 345 | )),
|
396 346 | }
|
397 347 | }
|
398 - | /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
|
399 - | /// :rtype bool:
|
400 - | pub fn is_foo(&self) -> bool {
|
401 - | self.0.is_foo()
|
402 - | }
|
403 348 | }
|
404 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for UnionWithJsonName {
|
405 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
406 - | PyUnionMarkerUnionWithJsonName(self).into_py(py)
|
349 + | impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
|
350 + | type Error = crate::model::test_enum_internal::ConstraintViolation;
|
351 + | fn try_from(
|
352 + | s: ::std::string::String,
|
353 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
354 + | {
|
355 + | s.as_str().try_into()
|
407 356 | }
|
408 357 | }
|
409 - | impl<'source> ::pyo3::FromPyObject<'source> for UnionWithJsonName {
|
410 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
411 - | let data: PyUnionMarkerUnionWithJsonName = obj.extract()?;
|
412 - | Ok(data.0)
|
358 + | impl std::str::FromStr for TestEnum {
|
359 + | type Err = crate::model::test_enum_internal::ConstraintViolation;
|
360 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
361 + | Self::try_from(s)
|
413 362 | }
|
414 363 | }
|
415 - |
|
416 - | #[allow(missing_docs)] // documentation missing in model
|
417 - | #[derive(
|
418 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
419 - | )]
|
420 - | pub enum PlayerAction {
|
421 - | /// Quit the game.
|
422 - | Quit,
|
423 - | }
|
424 - | impl PlayerAction {
|
425 - | #[allow(irrefutable_let_patterns)]
|
426 - | /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
|
427 - | /// Returns `Err(&Self)` if it can't be converted.
|
428 - | pub fn as_quit(&self) -> ::std::result::Result<(), &Self> {
|
429 - | if let PlayerAction::Quit = &self {
|
430 - | ::std::result::Result::Ok(())
|
431 - | } else {
|
432 - | ::std::result::Result::Err(self)
|
364 + | impl TestEnum {
|
365 + | /// Returns the `&str` value of the enum member.
|
366 + | pub fn as_str(&self) -> &str {
|
367 + | match self {
|
368 + | TestEnum::Bar => "BAR",
|
369 + | TestEnum::Baz => "BAZ",
|
370 + | TestEnum::Foo => "FOO",
|
433 371 | }
|
434 372 | }
|
435 - | /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
|
436 - | pub fn is_quit(&self) -> bool {
|
437 - | self.as_quit().is_ok()
|
373 + | /// Returns all the `&str` representations of the enum members.
|
374 + | pub const fn values() -> &'static [&'static str] {
|
375 + | &["BAR", "BAZ", "FOO"]
|
376 + | }
|
377 + | }
|
378 + | impl ::std::convert::AsRef<str> for TestEnum {
|
379 + | fn as_ref(&self) -> &str {
|
380 + | self.as_str()
|
438 381 | }
|
439 382 | }
|
440 - | #[pyo3::pyclass(name = "PlayerAction")]
|
441 - | #[derive(
|
442 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
443 - | )]
|
444 - | pub struct PyUnionMarkerPlayerAction(pub PlayerAction);
|
445 383 | #[::pyo3::pymethods]
|
446 - | impl PyUnionMarkerPlayerAction {
|
447 - | #[allow(irrefutable_let_patterns)]
|
448 - | #[staticmethod]
|
449 - | /// Creates a new union instance of [`Quit`](crate::model::PlayerAction::Quit)
|
450 - | /// :rtype PlayerAction:
|
451 - | pub fn quit() -> Self {
|
452 - | Self(PlayerAction::Quit)
|
384 + | impl TestEnum {
|
385 + | #[getter]
|
386 + | pub fn name(&self) -> &str {
|
387 + | match self {
|
388 + | TestEnum::Bar => "Bar",
|
389 + | TestEnum::Baz => "Baz",
|
390 + | TestEnum::Foo => "Foo",
|
453 391 | }
|
454 - | /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
|
455 - | /// :rtype None:
|
456 - | pub fn as_quit(&self) -> ::pyo3::PyResult<()> {
|
457 - | self.0.as_quit().map_err(|_| {
|
458 - | ::pyo3::exceptions::PyValueError::new_err("PlayerAction variant is not None")
|
459 - | })
|
460 392 | }
|
461 - | /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
|
462 - | /// :rtype bool:
|
463 - | pub fn is_quit(&self) -> bool {
|
464 - | self.0.is_quit()
|
393 + | #[getter]
|
394 + | pub fn value(&self) -> &str {
|
395 + | self.as_str()
|
465 396 | }
|
466 - | }
|
467 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for PlayerAction {
|
468 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
469 - | PyUnionMarkerPlayerAction(self).into_py(py)
|
397 + | fn __repr__(&self) -> String {
|
398 + | self.as_str().to_owned()
|
399 + | }
|
400 + | fn __str__(&self) -> String {
|
401 + | self.as_str().to_owned()
|
470 402 | }
|
471 403 | }
|
472 - | impl<'source> ::pyo3::FromPyObject<'source> for PlayerAction {
|
473 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
474 - | let data: PyUnionMarkerPlayerAction = obj.extract()?;
|
475 - | Ok(data.0)
|
404 + | impl crate::constrained::Constrained for TestEnum {
|
405 + | type Unconstrained = ::std::string::String;
|
406 + | }
|
407 + |
|
408 + | impl ::std::convert::From<::std::string::String>
|
409 + | for crate::constrained::MaybeConstrained<crate::model::TestEnum>
|
410 + | {
|
411 + | fn from(value: ::std::string::String) -> Self {
|
412 + | Self::Unconstrained(value)
|
476 413 | }
|
477 414 | }
|
478 415 |
|
479 416 | #[::pyo3::pyclass]
|
417 + | /// :param member int:
|
480 418 | /// :rtype None:
|
481 419 | #[allow(missing_docs)] // documentation missing in model
|
482 420 | #[derive(
|
483 421 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
484 422 | )]
|
485 - | pub struct Unit {}
|
423 + | pub struct ClientOptionalDefaults {
|
424 + | #[pyo3(get, set)]
|
425 + | /// :type int:
|
426 + | #[allow(missing_docs)] // documentation missing in model
|
427 + | pub member: i32,
|
428 + | }
|
429 + | impl ClientOptionalDefaults {
|
430 + | #[allow(missing_docs)] // documentation missing in model
|
431 + | pub fn member(&self) -> i32 {
|
432 + | self.member
|
433 + | }
|
434 + | }
|
486 435 | #[allow(clippy::new_without_default)]
|
487 436 | #[allow(clippy::too_many_arguments)]
|
488 437 | #[::pyo3::pymethods]
|
489 - | impl Unit {
|
438 + | impl ClientOptionalDefaults {
|
490 439 | #[new]
|
491 - | pub fn new() -> Self {
|
492 - | Self {}
|
440 + | pub fn new(member: i32) -> Self {
|
441 + | Self { member }
|
493 442 | }
|
494 443 | fn __repr__(&self) -> String {
|
495 444 | format!("{self:?}")
|
496 445 | }
|
497 446 | fn __str__(&self) -> String {
|
498 447 | format!("{self:?}")
|
499 448 | }
|
500 449 | }
|
501 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<Unit> {
|
450 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ClientOptionalDefaults> {
|
502 451 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
503 - | ob.extract::<Unit>().map(Box::new)
|
452 + | ob.extract::<ClientOptionalDefaults>().map(Box::new)
|
504 453 | }
|
505 454 | }
|
506 455 |
|
507 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<Unit> {
|
456 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ClientOptionalDefaults> {
|
508 457 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
509 458 | (*self).into_py(py)
|
510 459 | }
|
511 460 | }
|
512 - | impl crate::constrained::Constrained for crate::model::Unit {
|
513 - | type Unconstrained = crate::model::unit_internal::Builder;
|
461 + | impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
|
462 + | type Unconstrained = crate::model::client_optional_defaults_internal::Builder;
|
514 463 | }
|
515 - | impl Unit {
|
516 - | /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
|
517 - | pub fn builder() -> crate::model::unit::Builder {
|
518 - | crate::model::unit::Builder::default()
|
464 + | impl ClientOptionalDefaults {
|
465 + | /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
466 + | pub fn builder() -> crate::model::client_optional_defaults::Builder {
|
467 + | crate::model::client_optional_defaults::Builder::default()
|
519 468 | }
|
520 469 | }
|
521 470 |
|
522 - | /// A union with a representative set of types for members.
|
523 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
524 - | pub enum MyUnion {
|
471 + | #[::pyo3::pyclass]
|
472 + | /// :param default_string str:
|
473 + | /// :param default_boolean bool:
|
474 + | /// :param default_list typing.List\[str\]:
|
475 + | /// :param default_document_map rest_json.types.Document:
|
476 + | /// :param default_document_string rest_json.types.Document:
|
477 + | /// :param default_document_boolean rest_json.types.Document:
|
478 + | /// :param default_document_list rest_json.types.Document:
|
479 + | /// :param default_null_document typing.Optional\[rest_json.types.Document\]:
|
480 + | /// :param default_timestamp rest_json.types.DateTime:
|
481 + | /// :param default_blob rest_json.types.Blob:
|
482 + | /// :param default_byte int:
|
483 + | /// :param default_short int:
|
484 + | /// :param default_integer int:
|
485 + | /// :param default_long int:
|
486 + | /// :param default_float float:
|
487 + | /// :param default_double float:
|
488 + | /// :param default_map typing.Dict\[str, str\]:
|
489 + | /// :param default_enum rest_json.model.TestEnum:
|
490 + | /// :param default_int_enum int:
|
491 + | /// :param empty_string str:
|
492 + | /// :param false_boolean bool:
|
493 + | /// :param empty_blob rest_json.types.Blob:
|
494 + | /// :param zero_byte int:
|
495 + | /// :param zero_short int:
|
496 + | /// :param zero_integer int:
|
497 + | /// :param zero_long int:
|
498 + | /// :param zero_float float:
|
499 + | /// :param zero_double float:
|
500 + | /// :rtype None:
|
501 + | #[allow(missing_docs)] // documentation missing in model
|
502 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
503 + | pub struct Defaults {
|
504 + | #[pyo3(get, set)]
|
505 + | /// :type str:
|
525 506 | #[allow(missing_docs)] // documentation missing in model
|
526 - | BlobValue(::aws_smithy_http_server_python::types::Blob),
|
507 + | pub default_string: ::std::string::String,
|
508 + | #[pyo3(get, set)]
|
509 + | /// :type bool:
|
527 510 | #[allow(missing_docs)] // documentation missing in model
|
528 - | BooleanValue(bool),
|
511 + | pub default_boolean: bool,
|
512 + | #[pyo3(get, set)]
|
513 + | /// :type typing.List\[str\]:
|
529 514 | #[allow(missing_docs)] // documentation missing in model
|
530 - | EnumValue(crate::model::FooEnum),
|
515 + | pub default_list: ::std::vec::Vec<::std::string::String>,
|
516 + | #[pyo3(get, set)]
|
517 + | /// :type rest_json.types.Document:
|
531 518 | #[allow(missing_docs)] // documentation missing in model
|
532 - | ListValue(::std::vec::Vec<::std::string::String>),
|
519 + | pub default_document_map: ::aws_smithy_http_server_python::types::Document,
|
520 + | #[pyo3(get, set)]
|
521 + | /// :type rest_json.types.Document:
|
533 522 | #[allow(missing_docs)] // documentation missing in model
|
534 - | MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
|
523 + | pub default_document_string: ::aws_smithy_http_server_python::types::Document,
|
524 + | #[pyo3(get, set)]
|
525 + | /// :type rest_json.types.Document:
|
535 526 | #[allow(missing_docs)] // documentation missing in model
|
536 - | NumberValue(i32),
|
527 + | pub default_document_boolean: ::aws_smithy_http_server_python::types::Document,
|
528 + | #[pyo3(get, set)]
|
529 + | /// :type rest_json.types.Document:
|
537 530 | #[allow(missing_docs)] // documentation missing in model
|
538 - | RenamedStructureValue(crate::model::RenamedGreeting),
|
531 + | pub default_document_list: ::aws_smithy_http_server_python::types::Document,
|
532 + | #[pyo3(get, set)]
|
533 + | /// :type typing.Optional\[rest_json.types.Document\]:
|
539 534 | #[allow(missing_docs)] // documentation missing in model
|
540 - | StringValue(::std::string::String),
|
535 + | pub default_null_document:
|
536 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
537 + | #[pyo3(get, set)]
|
538 + | /// :type rest_json.types.DateTime:
|
541 539 | #[allow(missing_docs)] // documentation missing in model
|
542 - | StructureValue(crate::model::GreetingStruct),
|
540 + | pub default_timestamp: ::aws_smithy_http_server_python::types::DateTime,
|
541 + | #[pyo3(get, set)]
|
542 + | /// :type rest_json.types.Blob:
|
543 543 | #[allow(missing_docs)] // documentation missing in model
|
544 - | TimestampValue(::aws_smithy_http_server_python::types::DateTime),
|
544 + | pub default_blob: ::aws_smithy_http_server_python::types::Blob,
|
545 + | #[pyo3(get, set)]
|
546 + | /// :type int:
|
547 + | #[allow(missing_docs)] // documentation missing in model
|
548 + | pub default_byte: i8,
|
549 + | #[pyo3(get, set)]
|
550 + | /// :type int:
|
551 + | #[allow(missing_docs)] // documentation missing in model
|
552 + | pub default_short: i16,
|
553 + | #[pyo3(get, set)]
|
554 + | /// :type int:
|
555 + | #[allow(missing_docs)] // documentation missing in model
|
556 + | pub default_integer: i32,
|
557 + | #[pyo3(get, set)]
|
558 + | /// :type int:
|
559 + | #[allow(missing_docs)] // documentation missing in model
|
560 + | pub default_long: i64,
|
561 + | #[pyo3(get, set)]
|
562 + | /// :type float:
|
563 + | #[allow(missing_docs)] // documentation missing in model
|
564 + | pub default_float: f32,
|
565 + | #[pyo3(get, set)]
|
566 + | /// :type float:
|
567 + | #[allow(missing_docs)] // documentation missing in model
|
568 + | pub default_double: f64,
|
569 + | #[pyo3(get, set)]
|
570 + | /// :type typing.Dict\[str, str\]:
|
571 + | #[allow(missing_docs)] // documentation missing in model
|
572 + | pub default_map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
573 + | #[pyo3(get, set)]
|
574 + | /// :type rest_json.model.TestEnum:
|
575 + | #[allow(missing_docs)] // documentation missing in model
|
576 + | pub default_enum: crate::model::TestEnum,
|
577 + | #[pyo3(get, set)]
|
578 + | /// :type int:
|
579 + | #[allow(missing_docs)] // documentation missing in model
|
580 + | pub default_int_enum: i32,
|
581 + | #[pyo3(get, set)]
|
582 + | /// :type str:
|
583 + | #[allow(missing_docs)] // documentation missing in model
|
584 + | pub empty_string: ::std::string::String,
|
585 + | #[pyo3(get, set)]
|
586 + | /// :type bool:
|
587 + | #[allow(missing_docs)] // documentation missing in model
|
588 + | pub false_boolean: bool,
|
589 + | #[pyo3(get, set)]
|
590 + | /// :type rest_json.types.Blob:
|
591 + | #[allow(missing_docs)] // documentation missing in model
|
592 + | pub empty_blob: ::aws_smithy_http_server_python::types::Blob,
|
593 + | #[pyo3(get, set)]
|
594 + | /// :type int:
|
595 + | #[allow(missing_docs)] // documentation missing in model
|
596 + | pub zero_byte: i8,
|
597 + | #[pyo3(get, set)]
|
598 + | /// :type int:
|
599 + | #[allow(missing_docs)] // documentation missing in model
|
600 + | pub zero_short: i16,
|
601 + | #[pyo3(get, set)]
|
602 + | /// :type int:
|
603 + | #[allow(missing_docs)] // documentation missing in model
|
604 + | pub zero_integer: i32,
|
605 + | #[pyo3(get, set)]
|
606 + | /// :type int:
|
607 + | #[allow(missing_docs)] // documentation missing in model
|
608 + | pub zero_long: i64,
|
609 + | #[pyo3(get, set)]
|
610 + | /// :type float:
|
611 + | #[allow(missing_docs)] // documentation missing in model
|
612 + | pub zero_float: f32,
|
613 + | #[pyo3(get, set)]
|
614 + | /// :type float:
|
615 + | #[allow(missing_docs)] // documentation missing in model
|
616 + | pub zero_double: f64,
|
545 617 | }
|
546 - | impl MyUnion {
|
547 - | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
548 - | /// Returns `Err(&Self)` if it can't be converted.
|
549 - | pub fn as_blob_value(
|
550 - | &self,
|
551 - | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::Blob, &Self> {
|
552 - | if let MyUnion::BlobValue(val) = &self {
|
553 - | ::std::result::Result::Ok(val)
|
554 - | } else {
|
555 - | ::std::result::Result::Err(self)
|
556 - | }
|
557 - | }
|
558 - | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
559 - | pub fn is_blob_value(&self) -> bool {
|
560 - | self.as_blob_value().is_ok()
|
618 + | impl Defaults {
|
619 + | #[allow(missing_docs)] // documentation missing in model
|
620 + | pub fn default_string(&self) -> &str {
|
621 + | use std::ops::Deref;
|
622 + | self.default_string.deref()
|
561 623 | }
|
562 - | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
563 - | /// Returns `Err(&Self)` if it can't be converted.
|
564 - | pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
|
565 - | if let MyUnion::BooleanValue(val) = &self {
|
566 - | ::std::result::Result::Ok(val)
|
567 - | } else {
|
568 - | ::std::result::Result::Err(self)
|
624 + | #[allow(missing_docs)] // documentation missing in model
|
625 + | pub fn default_boolean(&self) -> bool {
|
626 + | self.default_boolean
|
569 627 | }
|
628 + | #[allow(missing_docs)] // documentation missing in model
|
629 + | pub fn default_list(&self) -> &[::std::string::String] {
|
630 + | use std::ops::Deref;
|
631 + | self.default_list.deref()
|
570 632 | }
|
571 - | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
572 - | pub fn is_boolean_value(&self) -> bool {
|
573 - | self.as_boolean_value().is_ok()
|
633 + | #[allow(missing_docs)] // documentation missing in model
|
634 + | pub fn default_document_map(&self) -> &::aws_smithy_http_server_python::types::Document {
|
635 + | &self.default_document_map
|
574 636 | }
|
575 - | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
576 - | /// Returns `Err(&Self)` if it can't be converted.
|
577 - | pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
|
578 - | if let MyUnion::EnumValue(val) = &self {
|
579 - | ::std::result::Result::Ok(val)
|
580 - | } else {
|
581 - | ::std::result::Result::Err(self)
|
637 + | #[allow(missing_docs)] // documentation missing in model
|
638 + | pub fn default_document_string(&self) -> &::aws_smithy_http_server_python::types::Document {
|
639 + | &self.default_document_string
|
582 640 | }
|
641 + | #[allow(missing_docs)] // documentation missing in model
|
642 + | pub fn default_document_boolean(&self) -> &::aws_smithy_http_server_python::types::Document {
|
643 + | &self.default_document_boolean
|
583 644 | }
|
584 - | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
585 - | pub fn is_enum_value(&self) -> bool {
|
586 - | self.as_enum_value().is_ok()
|
645 + | #[allow(missing_docs)] // documentation missing in model
|
646 + | pub fn default_document_list(&self) -> &::aws_smithy_http_server_python::types::Document {
|
647 + | &self.default_document_list
|
587 648 | }
|
588 - | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
589 - | /// Returns `Err(&Self)` if it can't be converted.
|
590 - | pub fn as_list_value(
|
649 + | #[allow(missing_docs)] // documentation missing in model
|
650 + | pub fn default_null_document(
|
591 651 | &self,
|
592 - | ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
593 - | if let MyUnion::ListValue(val) = &self {
|
594 - | ::std::result::Result::Ok(val)
|
595 - | } else {
|
596 - | ::std::result::Result::Err(self)
|
652 + | ) -> ::std::option::Option<&::aws_smithy_http_server_python::types::Document> {
|
653 + | self.default_null_document.as_ref()
|
597 654 | }
|
655 + | #[allow(missing_docs)] // documentation missing in model
|
656 + | pub fn default_timestamp(&self) -> &::aws_smithy_http_server_python::types::DateTime {
|
657 + | &self.default_timestamp
|
598 658 | }
|
599 - | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
600 - | pub fn is_list_value(&self) -> bool {
|
601 - | self.as_list_value().is_ok()
|
659 + | #[allow(missing_docs)] // documentation missing in model
|
660 + | pub fn default_blob(&self) -> &::aws_smithy_http_server_python::types::Blob {
|
661 + | &self.default_blob
|
602 662 | }
|
603 - | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
604 - | /// Returns `Err(&Self)` if it can't be converted.
|
605 - | pub fn as_map_value(
|
606 - | &self,
|
607 - | ) -> ::std::result::Result<
|
608 - | &::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
609 - | &Self,
|
610 - | > {
|
611 - | if let MyUnion::MapValue(val) = &self {
|
612 - | ::std::result::Result::Ok(val)
|
613 - | } else {
|
614 - | ::std::result::Result::Err(self)
|
663 + | #[allow(missing_docs)] // documentation missing in model
|
664 + | pub fn default_byte(&self) -> i8 {
|
665 + | self.default_byte
|
615 666 | }
|
667 + | #[allow(missing_docs)] // documentation missing in model
|
668 + | pub fn default_short(&self) -> i16 {
|
669 + | self.default_short
|
616 670 | }
|
617 - | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
618 - | pub fn is_map_value(&self) -> bool {
|
619 - | self.as_map_value().is_ok()
|
671 + | #[allow(missing_docs)] // documentation missing in model
|
672 + | pub fn default_integer(&self) -> i32 {
|
673 + | self.default_integer
|
620 674 | }
|
621 - | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
622 - | /// Returns `Err(&Self)` if it can't be converted.
|
623 - | pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
|
624 - | if let MyUnion::NumberValue(val) = &self {
|
625 - | ::std::result::Result::Ok(val)
|
626 - | } else {
|
627 - | ::std::result::Result::Err(self)
|
675 + | #[allow(missing_docs)] // documentation missing in model
|
676 + | pub fn default_long(&self) -> i64 {
|
677 + | self.default_long
|
628 678 | }
|
679 + | #[allow(missing_docs)] // documentation missing in model
|
680 + | pub fn default_float(&self) -> f32 {
|
681 + | self.default_float
|
629 682 | }
|
630 - | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
631 - | pub fn is_number_value(&self) -> bool {
|
632 - | self.as_number_value().is_ok()
|
683 + | #[allow(missing_docs)] // documentation missing in model
|
684 + | pub fn default_double(&self) -> f64 {
|
685 + | self.default_double
|
633 686 | }
|
634 - | /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
|
635 - | /// Returns `Err(&Self)` if it can't be converted.
|
636 - | pub fn as_renamed_structure_value(
|
687 + | #[allow(missing_docs)] // documentation missing in model
|
688 + | pub fn default_map(
|
637 689 | &self,
|
638 - | ) -> ::std::result::Result<&crate::model::RenamedGreeting, &Self> {
|
639 - | if let MyUnion::RenamedStructureValue(val) = &self {
|
640 - | ::std::result::Result::Ok(val)
|
641 - | } else {
|
642 - | ::std::result::Result::Err(self)
|
690 + | ) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
|
691 + | &self.default_map
|
643 692 | }
|
693 + | #[allow(missing_docs)] // documentation missing in model
|
694 + | pub fn default_enum(&self) -> &crate::model::TestEnum {
|
695 + | &self.default_enum
|
644 696 | }
|
645 - | /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
|
646 - | pub fn is_renamed_structure_value(&self) -> bool {
|
647 - | self.as_renamed_structure_value().is_ok()
|
697 + | #[allow(missing_docs)] // documentation missing in model
|
698 + | pub fn default_int_enum(&self) -> i32 {
|
699 + | self.default_int_enum
|
648 700 | }
|
649 - | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
650 - | /// Returns `Err(&Self)` if it can't be converted.
|
651 - | pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
652 - | if let MyUnion::StringValue(val) = &self {
|
653 - | ::std::result::Result::Ok(val)
|
654 - | } else {
|
655 - | ::std::result::Result::Err(self)
|
701 + | #[allow(missing_docs)] // documentation missing in model
|
702 + | pub fn empty_string(&self) -> &str {
|
703 + | use std::ops::Deref;
|
704 + | self.empty_string.deref()
|
656 705 | }
|
706 + | #[allow(missing_docs)] // documentation missing in model
|
707 + | pub fn false_boolean(&self) -> bool {
|
708 + | self.false_boolean
|
657 709 | }
|
658 - | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
659 - | pub fn is_string_value(&self) -> bool {
|
660 - | self.as_string_value().is_ok()
|
710 + | #[allow(missing_docs)] // documentation missing in model
|
711 + | pub fn empty_blob(&self) -> &::aws_smithy_http_server_python::types::Blob {
|
712 + | &self.empty_blob
|
661 713 | }
|
662 - | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
663 - | /// Returns `Err(&Self)` if it can't be converted.
|
664 - | pub fn as_structure_value(
|
665 - | &self,
|
666 - | ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
|
667 - | if let MyUnion::StructureValue(val) = &self {
|
668 - | ::std::result::Result::Ok(val)
|
669 - | } else {
|
670 - | ::std::result::Result::Err(self)
|
714 + | #[allow(missing_docs)] // documentation missing in model
|
715 + | pub fn zero_byte(&self) -> i8 {
|
716 + | self.zero_byte
|
671 717 | }
|
718 + | #[allow(missing_docs)] // documentation missing in model
|
719 + | pub fn zero_short(&self) -> i16 {
|
720 + | self.zero_short
|
672 721 | }
|
673 - | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
674 - | pub fn is_structure_value(&self) -> bool {
|
675 - | self.as_structure_value().is_ok()
|
722 + | #[allow(missing_docs)] // documentation missing in model
|
723 + | pub fn zero_integer(&self) -> i32 {
|
724 + | self.zero_integer
|
676 725 | }
|
677 - | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
678 - | /// Returns `Err(&Self)` if it can't be converted.
|
679 - | pub fn as_timestamp_value(
|
680 - | &self,
|
681 - | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::DateTime, &Self> {
|
682 - | if let MyUnion::TimestampValue(val) = &self {
|
683 - | ::std::result::Result::Ok(val)
|
684 - | } else {
|
685 - | ::std::result::Result::Err(self)
|
726 + | #[allow(missing_docs)] // documentation missing in model
|
727 + | pub fn zero_long(&self) -> i64 {
|
728 + | self.zero_long
|
686 729 | }
|
730 + | #[allow(missing_docs)] // documentation missing in model
|
731 + | pub fn zero_float(&self) -> f32 {
|
732 + | self.zero_float
|
687 733 | }
|
688 - | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
689 - | pub fn is_timestamp_value(&self) -> bool {
|
690 - | self.as_timestamp_value().is_ok()
|
734 + | #[allow(missing_docs)] // documentation missing in model
|
735 + | pub fn zero_double(&self) -> f64 {
|
736 + | self.zero_double
|
691 737 | }
|
692 738 | }
|
693 - | #[pyo3::pyclass(name = "MyUnion")]
|
694 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
695 - | pub struct PyUnionMarkerMyUnion(pub MyUnion);
|
739 + | #[allow(clippy::new_without_default)]
|
740 + | #[allow(clippy::too_many_arguments)]
|
696 741 | #[::pyo3::pymethods]
|
697 - | impl PyUnionMarkerMyUnion {
|
698 - | #[staticmethod]
|
699 - | /// Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
|
700 - | /// :param data rest_json.types.Blob:
|
701 - | /// :rtype MyUnion:
|
702 - | pub fn blob_value(data: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
703 - | Self(MyUnion::BlobValue(data))
|
704 - | }
|
705 - | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
706 - | /// :rtype rest_json.types.Blob:
|
707 - | pub fn as_blob_value(&self) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::Blob> {
|
708 - | match self.0.as_blob_value() {
|
709 - | Ok(variant) => Ok(variant.clone()),
|
710 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
711 - | r"MyUnion variant is not of type rest_json.types.Blob",
|
712 - | )),
|
713 - | }
|
742 + | impl Defaults {
|
743 + | #[new]
|
744 + | pub fn new(
|
745 + | default_string: ::std::string::String,
|
746 + | default_boolean: bool,
|
747 + | default_list: ::std::vec::Vec<::std::string::String>,
|
748 + | default_document_map: ::aws_smithy_http_server_python::types::Document,
|
749 + | default_document_string: ::aws_smithy_http_server_python::types::Document,
|
750 + | default_document_boolean: ::aws_smithy_http_server_python::types::Document,
|
751 + | default_document_list: ::aws_smithy_http_server_python::types::Document,
|
752 + | default_null_document: ::std::option::Option<
|
753 + | ::aws_smithy_http_server_python::types::Document,
|
754 + | >,
|
755 + | default_timestamp: ::aws_smithy_http_server_python::types::DateTime,
|
756 + | default_blob: ::aws_smithy_http_server_python::types::Blob,
|
757 + | default_byte: i8,
|
758 + | default_short: i16,
|
759 + | default_integer: i32,
|
760 + | default_long: i64,
|
761 + | default_float: f32,
|
762 + | default_double: f64,
|
763 + | default_map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
764 + | default_enum: crate::model::TestEnum,
|
765 + | default_int_enum: i32,
|
766 + | empty_string: ::std::string::String,
|
767 + | false_boolean: bool,
|
768 + | empty_blob: ::aws_smithy_http_server_python::types::Blob,
|
769 + | zero_byte: i8,
|
770 + | zero_short: i16,
|
771 + | zero_integer: i32,
|
772 + | zero_long: i64,
|
773 + | zero_float: f32,
|
774 + | zero_double: f64,
|
775 + | ) -> Self {
|
776 + | Self {
|
777 + | default_string,
|
778 + | default_boolean,
|
779 + | default_list,
|
780 + | default_document_map,
|
781 + | default_document_string,
|
782 + | default_document_boolean,
|
783 + | default_document_list,
|
784 + | default_null_document,
|
785 + | default_timestamp,
|
786 + | default_blob,
|
787 + | default_byte,
|
788 + | default_short,
|
789 + | default_integer,
|
790 + | default_long,
|
791 + | default_float,
|
792 + | default_double,
|
793 + | default_map,
|
794 + | default_enum,
|
795 + | default_int_enum,
|
796 + | empty_string,
|
797 + | false_boolean,
|
798 + | empty_blob,
|
799 + | zero_byte,
|
800 + | zero_short,
|
801 + | zero_integer,
|
802 + | zero_long,
|
803 + | zero_float,
|
804 + | zero_double,
|
714 805 | }
|
715 - | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
716 - | /// :rtype bool:
|
717 - | pub fn is_blob_value(&self) -> bool {
|
718 - | self.0.is_blob_value()
|
719 806 | }
|
720 - | #[staticmethod]
|
721 - | /// Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
|
722 - | /// :param data bool:
|
723 - | /// :rtype MyUnion:
|
724 - | pub fn boolean_value(data: bool) -> Self {
|
725 - | Self(MyUnion::BooleanValue(data))
|
807 + | fn __repr__(&self) -> String {
|
808 + | format!("{self:?}")
|
726 809 | }
|
727 - | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
728 - | /// :rtype bool:
|
729 - | pub fn as_boolean_value(&self) -> ::pyo3::PyResult<bool> {
|
730 - | match self.0.as_boolean_value() {
|
731 - | Ok(variant) => Ok(*variant),
|
732 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
733 - | r"MyUnion variant is not of type bool",
|
734 - | )),
|
810 + | fn __str__(&self) -> String {
|
811 + | format!("{self:?}")
|
735 812 | }
|
813 + | }
|
814 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<Defaults> {
|
815 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
816 + | ob.extract::<Defaults>().map(Box::new)
|
736 817 | }
|
737 - | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
738 - | /// :rtype bool:
|
739 - | pub fn is_boolean_value(&self) -> bool {
|
740 - | self.0.is_boolean_value()
|
818 + | }
|
819 + |
|
820 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<Defaults> {
|
821 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
822 + | (*self).into_py(py)
|
741 823 | }
|
742 - | #[staticmethod]
|
743 - | /// Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
|
744 - | /// :param data rest_json.model.FooEnum:
|
745 - | /// :rtype MyUnion:
|
746 - | pub fn enum_value(data: crate::model::FooEnum) -> Self {
|
747 - | Self(MyUnion::EnumValue(data))
|
748 - | }
|
749 - | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
750 - | /// :rtype rest_json.model.FooEnum:
|
751 - | pub fn as_enum_value(&self) -> ::pyo3::PyResult<crate::model::FooEnum> {
|
752 - | match self.0.as_enum_value() {
|
753 - | Ok(variant) => Ok(variant.clone()),
|
754 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
755 - | r"MyUnion variant is not of type rest_json.model.FooEnum",
|
756 - | )),
|
757 - | }
|
758 - | }
|
759 - | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
760 - | /// :rtype bool:
|
761 - | pub fn is_enum_value(&self) -> bool {
|
762 - | self.0.is_enum_value()
|
763 - | }
|
764 - | #[staticmethod]
|
765 - | /// Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
|
766 - | /// :param data typing.List\[str\]:
|
767 - | /// :rtype MyUnion:
|
768 - | pub fn list_value(data: ::std::vec::Vec<::std::string::String>) -> Self {
|
769 - | Self(MyUnion::ListValue(data))
|
770 - | }
|
771 - | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
772 - | /// :rtype typing.List\[str\]:
|
773 - | pub fn as_list_value(&self) -> ::pyo3::PyResult<::std::vec::Vec<::std::string::String>> {
|
774 - | match self.0.as_list_value() {
|
775 - | Ok(variant) => Ok(variant.clone()),
|
776 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
777 - | r"MyUnion variant is not of type typing.List\[str\]",
|
778 - | )),
|
779 - | }
|
780 - | }
|
781 - | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
782 - | /// :rtype bool:
|
783 - | pub fn is_list_value(&self) -> bool {
|
784 - | self.0.is_list_value()
|
785 - | }
|
786 - | #[staticmethod]
|
787 - | /// Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
|
788 - | /// :param data typing.Dict\[str, str\]:
|
789 - | /// :rtype MyUnion:
|
790 - | pub fn map_value(
|
791 - | data: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
792 - | ) -> Self {
|
793 - | Self(MyUnion::MapValue(data))
|
794 - | }
|
795 - | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
796 - | /// :rtype typing.Dict\[str, str\]:
|
797 - | pub fn as_map_value(
|
798 - | &self,
|
799 - | ) -> ::pyo3::PyResult<::std::collections::HashMap<::std::string::String, ::std::string::String>>
|
800 - | {
|
801 - | match self.0.as_map_value() {
|
802 - | Ok(variant) => Ok(variant.clone()),
|
803 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
804 - | r"MyUnion variant is not of type typing.Dict\[str, str\]",
|
805 - | )),
|
806 - | }
|
807 - | }
|
808 - | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
809 - | /// :rtype bool:
|
810 - | pub fn is_map_value(&self) -> bool {
|
811 - | self.0.is_map_value()
|
812 - | }
|
813 - | #[staticmethod]
|
814 - | /// Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
|
815 - | /// :param data int:
|
816 - | /// :rtype MyUnion:
|
817 - | pub fn number_value(data: i32) -> Self {
|
818 - | Self(MyUnion::NumberValue(data))
|
819 - | }
|
820 - | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
821 - | /// :rtype int:
|
822 - | pub fn as_number_value(&self) -> ::pyo3::PyResult<i32> {
|
823 - | match self.0.as_number_value() {
|
824 - | Ok(variant) => Ok(*variant),
|
825 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
826 - | r"MyUnion variant is not of type int",
|
827 - | )),
|
828 - | }
|
829 - | }
|
830 - | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
831 - | /// :rtype bool:
|
832 - | pub fn is_number_value(&self) -> bool {
|
833 - | self.0.is_number_value()
|
834 - | }
|
835 - | #[staticmethod]
|
836 - | /// Creates a new union instance of [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue)
|
837 - | /// :param data rest_json.model.RenamedGreeting:
|
838 - | /// :rtype MyUnion:
|
839 - | pub fn renamed_structure_value(data: crate::model::RenamedGreeting) -> Self {
|
840 - | Self(MyUnion::RenamedStructureValue(data))
|
841 - | }
|
842 - | /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
|
843 - | /// :rtype rest_json.model.RenamedGreeting:
|
844 - | pub fn as_renamed_structure_value(&self) -> ::pyo3::PyResult<crate::model::RenamedGreeting> {
|
845 - | match self.0.as_renamed_structure_value() {
|
846 - | Ok(variant) => Ok(variant.clone()),
|
847 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
848 - | r"MyUnion variant is not of type rest_json.model.RenamedGreeting",
|
849 - | )),
|
850 - | }
|
851 - | }
|
852 - | /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
|
853 - | /// :rtype bool:
|
854 - | pub fn is_renamed_structure_value(&self) -> bool {
|
855 - | self.0.is_renamed_structure_value()
|
856 - | }
|
857 - | #[staticmethod]
|
858 - | /// Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
|
859 - | /// :param data str:
|
860 - | /// :rtype MyUnion:
|
861 - | pub fn string_value(data: ::std::string::String) -> Self {
|
862 - | Self(MyUnion::StringValue(data))
|
863 - | }
|
864 - | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
865 - | /// :rtype str:
|
866 - | pub fn as_string_value(&self) -> ::pyo3::PyResult<::std::string::String> {
|
867 - | match self.0.as_string_value() {
|
868 - | Ok(variant) => Ok(variant.clone()),
|
869 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
870 - | r"MyUnion variant is not of type str",
|
871 - | )),
|
872 - | }
|
873 - | }
|
874 - | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
875 - | /// :rtype bool:
|
876 - | pub fn is_string_value(&self) -> bool {
|
877 - | self.0.is_string_value()
|
878 - | }
|
879 - | #[staticmethod]
|
880 - | /// Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
|
881 - | /// :param data rest_json.model.GreetingStruct:
|
882 - | /// :rtype MyUnion:
|
883 - | pub fn structure_value(data: crate::model::GreetingStruct) -> Self {
|
884 - | Self(MyUnion::StructureValue(data))
|
885 - | }
|
886 - | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
887 - | /// :rtype rest_json.model.GreetingStruct:
|
888 - | pub fn as_structure_value(&self) -> ::pyo3::PyResult<crate::model::GreetingStruct> {
|
889 - | match self.0.as_structure_value() {
|
890 - | Ok(variant) => Ok(variant.clone()),
|
891 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
892 - | r"MyUnion variant is not of type rest_json.model.GreetingStruct",
|
893 - | )),
|
894 - | }
|
895 - | }
|
896 - | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
897 - | /// :rtype bool:
|
898 - | pub fn is_structure_value(&self) -> bool {
|
899 - | self.0.is_structure_value()
|
900 - | }
|
901 - | #[staticmethod]
|
902 - | /// Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
|
903 - | /// :param data rest_json.types.DateTime:
|
904 - | /// :rtype MyUnion:
|
905 - | pub fn timestamp_value(data: ::aws_smithy_http_server_python::types::DateTime) -> Self {
|
906 - | Self(MyUnion::TimestampValue(data))
|
907 - | }
|
908 - | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
909 - | /// :rtype rest_json.types.DateTime:
|
910 - | pub fn as_timestamp_value(
|
911 - | &self,
|
912 - | ) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::DateTime> {
|
913 - | match self.0.as_timestamp_value() {
|
914 - | Ok(variant) => Ok(variant.clone()),
|
915 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
916 - | r"MyUnion variant is not of type rest_json.types.DateTime",
|
917 - | )),
|
918 - | }
|
919 - | }
|
920 - | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
921 - | /// :rtype bool:
|
922 - | pub fn is_timestamp_value(&self) -> bool {
|
923 - | self.0.is_timestamp_value()
|
924 - | }
|
925 - | }
|
926 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for MyUnion {
|
927 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
928 - | PyUnionMarkerMyUnion(self).into_py(py)
|
929 - | }
|
930 - | }
|
931 - | impl<'source> ::pyo3::FromPyObject<'source> for MyUnion {
|
932 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
933 - | let data: PyUnionMarkerMyUnion = obj.extract()?;
|
934 - | Ok(data.0)
|
824 + | }
|
825 + | impl crate::constrained::Constrained for crate::model::Defaults {
|
826 + | type Unconstrained = crate::model::defaults_internal::Builder;
|
827 + | }
|
828 + | impl Defaults {
|
829 + | /// Creates a new builder-style object to manufacture [`Defaults`](crate::model::Defaults).
|
830 + | pub fn builder() -> crate::model::defaults::Builder {
|
831 + | crate::model::defaults::Builder::default()
|
935 832 | }
|
936 833 | }
|
937 834 |
|
938 835 | #[::pyo3::pyclass]
|
939 - | /// :param salutation typing.Optional\[str\]:
|
836 + | /// :param data typing.Optional\[int\]:
|
940 837 | /// :rtype None:
|
941 838 | #[allow(missing_docs)] // documentation missing in model
|
942 839 | #[derive(
|
943 840 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
944 841 | )]
|
945 - | pub struct RenamedGreeting {
|
842 + | pub struct PayloadConfig {
|
946 843 | #[pyo3(get, set)]
|
947 - | /// :type typing.Optional\[str\]:
|
844 + | /// :type typing.Optional\[int\]:
|
948 845 | #[allow(missing_docs)] // documentation missing in model
|
949 - | pub salutation: ::std::option::Option<::std::string::String>,
|
846 + | pub data: ::std::option::Option<i32>,
|
950 847 | }
|
951 - | impl RenamedGreeting {
|
848 + | impl PayloadConfig {
|
952 849 | #[allow(missing_docs)] // documentation missing in model
|
953 - | pub fn salutation(&self) -> ::std::option::Option<&str> {
|
954 - | self.salutation.as_deref()
|
850 + | pub fn data(&self) -> ::std::option::Option<i32> {
|
851 + | self.data
|
955 852 | }
|
956 853 | }
|
957 854 | #[allow(clippy::new_without_default)]
|
958 855 | #[allow(clippy::too_many_arguments)]
|
959 856 | #[::pyo3::pymethods]
|
960 - | impl RenamedGreeting {
|
857 + | impl PayloadConfig {
|
961 858 | #[new]
|
962 - | pub fn new(salutation: ::std::option::Option<::std::string::String>) -> Self {
|
963 - | Self { salutation }
|
859 + | pub fn new(data: ::std::option::Option<i32>) -> Self {
|
860 + | Self { data }
|
964 861 | }
|
965 862 | fn __repr__(&self) -> String {
|
966 863 | format!("{self:?}")
|
967 864 | }
|
968 865 | fn __str__(&self) -> String {
|
969 866 | format!("{self:?}")
|
970 867 | }
|
971 868 | }
|
972 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RenamedGreeting> {
|
869 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<PayloadConfig> {
|
973 870 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
974 - | ob.extract::<RenamedGreeting>().map(Box::new)
|
871 + | ob.extract::<PayloadConfig>().map(Box::new)
|
975 872 | }
|
976 873 | }
|
977 874 |
|
978 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RenamedGreeting> {
|
875 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<PayloadConfig> {
|
979 876 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
980 877 | (*self).into_py(py)
|
981 878 | }
|
982 879 | }
|
983 - | impl crate::constrained::Constrained for crate::model::RenamedGreeting {
|
984 - | type Unconstrained = crate::model::renamed_greeting_internal::Builder;
|
880 + | impl crate::constrained::Constrained for crate::model::PayloadConfig {
|
881 + | type Unconstrained = crate::model::payload_config_internal::Builder;
|
985 882 | }
|
986 - | impl RenamedGreeting {
|
987 - | /// Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::model::RenamedGreeting).
|
988 - | pub fn builder() -> crate::model::renamed_greeting::Builder {
|
989 - | crate::model::renamed_greeting::Builder::default()
|
883 + | impl PayloadConfig {
|
884 + | /// Creates a new builder-style object to manufacture [`PayloadConfig`](crate::model::PayloadConfig).
|
885 + | pub fn builder() -> crate::model::payload_config::Builder {
|
886 + | crate::model::payload_config::Builder::default()
|
990 887 | }
|
991 888 | }
|
992 889 |
|
993 890 | #[::pyo3::pyclass]
|
994 - | /// :param hi typing.Optional\[str\]:
|
891 + | /// :param timeout typing.Optional\[int\]:
|
995 892 | /// :rtype None:
|
996 893 | #[allow(missing_docs)] // documentation missing in model
|
997 894 | #[derive(
|
998 895 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
999 896 | )]
|
1000 - | pub struct GreetingStruct {
|
897 + | pub struct TestConfig {
|
1001 898 | #[pyo3(get, set)]
|
1002 - | /// :type typing.Optional\[str\]:
|
899 + | /// :type typing.Optional\[int\]:
|
1003 900 | #[allow(missing_docs)] // documentation missing in model
|
1004 - | pub hi: ::std::option::Option<::std::string::String>,
|
901 + | pub timeout: ::std::option::Option<i32>,
|
1005 902 | }
|
1006 - | impl GreetingStruct {
|
903 + | impl TestConfig {
|
1007 904 | #[allow(missing_docs)] // documentation missing in model
|
1008 - | pub fn hi(&self) -> ::std::option::Option<&str> {
|
1009 - | self.hi.as_deref()
|
905 + | pub fn timeout(&self) -> ::std::option::Option<i32> {
|
906 + | self.timeout
|
1010 907 | }
|
1011 908 | }
|
1012 909 | #[allow(clippy::new_without_default)]
|
1013 910 | #[allow(clippy::too_many_arguments)]
|
1014 911 | #[::pyo3::pymethods]
|
1015 - | impl GreetingStruct {
|
912 + | impl TestConfig {
|
1016 913 | #[new]
|
1017 - | pub fn new(hi: ::std::option::Option<::std::string::String>) -> Self {
|
1018 - | Self { hi }
|
914 + | pub fn new(timeout: ::std::option::Option<i32>) -> Self {
|
915 + | Self { timeout }
|
1019 916 | }
|
1020 917 | fn __repr__(&self) -> String {
|
1021 918 | format!("{self:?}")
|
1022 919 | }
|
1023 920 | fn __str__(&self) -> String {
|
1024 921 | format!("{self:?}")
|
1025 922 | }
|
1026 923 | }
|
1027 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<GreetingStruct> {
|
924 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<TestConfig> {
|
1028 925 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1029 - | ob.extract::<GreetingStruct>().map(Box::new)
|
926 + | ob.extract::<TestConfig>().map(Box::new)
|
1030 927 | }
|
1031 928 | }
|
1032 929 |
|
1033 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<GreetingStruct> {
|
930 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<TestConfig> {
|
1034 931 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1035 932 | (*self).into_py(py)
|
1036 933 | }
|
1037 934 | }
|
1038 - | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
1039 - | type Unconstrained = crate::model::greeting_struct_internal::Builder;
|
935 + | impl crate::constrained::Constrained for crate::model::TestConfig {
|
936 + | type Unconstrained = crate::model::test_config_internal::Builder;
|
1040 937 | }
|
1041 - | impl GreetingStruct {
|
1042 - | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
1043 - | pub fn builder() -> crate::model::greeting_struct::Builder {
|
1044 - | crate::model::greeting_struct::Builder::default()
|
938 + | impl TestConfig {
|
939 + | /// Creates a new builder-style object to manufacture [`TestConfig`](crate::model::TestConfig).
|
940 + | pub fn builder() -> crate::model::test_config::Builder {
|
941 + | crate::model::test_config::Builder::default()
|
1045 942 | }
|
1046 943 | }
|
1047 944 |
|
1048 - | #[::pyo3::pyclass]
|
1049 945 | #[allow(missing_docs)] // documentation missing in model
|
1050 946 | #[derive(
|
1051 - | ::std::clone::Clone,
|
1052 - | ::std::cmp::Eq,
|
1053 - | ::std::cmp::Ord,
|
1054 - | ::std::cmp::PartialEq,
|
1055 - | ::std::cmp::PartialOrd,
|
1056 - | ::std::fmt::Debug,
|
1057 - | ::std::hash::Hash,
|
947 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1058 948 | )]
|
1059 - | pub enum FooEnum {
|
1060 - | #[allow(missing_docs)] // documentation missing in model
|
1061 - | Zero,
|
1062 - | #[allow(missing_docs)] // documentation missing in model
|
1063 - | One,
|
1064 - | #[allow(missing_docs)] // documentation missing in model
|
1065 - | Bar,
|
949 + | pub enum SimpleUnion {
|
1066 950 | #[allow(missing_docs)] // documentation missing in model
|
1067 - | Baz,
|
951 + | Int(i32),
|
1068 952 | #[allow(missing_docs)] // documentation missing in model
|
1069 - | Foo,
|
953 + | String(::std::string::String),
|
1070 954 | }
|
1071 - | ///
|
1072 - | pub(crate) mod foo_enum_internal {
|
1073 - | #[derive(Debug, PartialEq)]
|
1074 - | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
1075 - |
|
1076 - | impl ::std::fmt::Display for ConstraintViolation {
|
1077 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1078 - | write!(
|
1079 - | f,
|
1080 - | r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
|
1081 - | )
|
1082 - | }
|
1083 - | }
|
1084 - |
|
1085 - | impl ::std::error::Error for ConstraintViolation {}
|
1086 - | impl ConstraintViolation {
|
1087 - | pub(crate) fn as_validation_exception_field(
|
1088 - | self,
|
1089 - | path: ::std::string::String,
|
1090 - | ) -> crate::model::ValidationExceptionField {
|
1091 - | crate::model::ValidationExceptionField {
|
1092 - | message: format!(
|
1093 - | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
|
1094 - | &path
|
1095 - | ),
|
1096 - | path,
|
1097 - | }
|
955 + | impl SimpleUnion {
|
956 + | /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
|
957 + | /// Returns `Err(&Self)` if it can't be converted.
|
958 + | pub fn as_int(&self) -> ::std::result::Result<&i32, &Self> {
|
959 + | if let SimpleUnion::Int(val) = &self {
|
960 + | ::std::result::Result::Ok(val)
|
961 + | } else {
|
962 + | ::std::result::Result::Err(self)
|
1098 963 | }
|
1099 964 | }
|
1100 - | }
|
1101 - | impl ::std::convert::TryFrom<&str> for FooEnum {
|
1102 - | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
1103 - | fn try_from(
|
1104 - | s: &str,
|
1105 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
1106 - | match s {
|
1107 - | "0" => Ok(FooEnum::Zero),
|
1108 - | "1" => Ok(FooEnum::One),
|
1109 - | "Bar" => Ok(FooEnum::Bar),
|
1110 - | "Baz" => Ok(FooEnum::Baz),
|
1111 - | "Foo" => Ok(FooEnum::Foo),
|
1112 - | _ => Err(crate::model::foo_enum_internal::ConstraintViolation(
|
1113 - | s.to_owned(),
|
1114 - | )),
|
965 + | /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
|
966 + | pub fn is_int(&self) -> bool {
|
967 + | self.as_int().is_ok()
|
1115 968 | }
|
969 + | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
970 + | /// Returns `Err(&Self)` if it can't be converted.
|
971 + | pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
972 + | if let SimpleUnion::String(val) = &self {
|
973 + | ::std::result::Result::Ok(val)
|
974 + | } else {
|
975 + | ::std::result::Result::Err(self)
|
1116 976 | }
|
1117 - | }
|
1118 - | impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
|
1119 - | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
1120 - | fn try_from(
|
1121 - | s: ::std::string::String,
|
1122 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
1123 - | {
|
1124 - | s.as_str().try_into()
|
1125 977 | }
|
1126 - | }
|
1127 - | impl std::str::FromStr for FooEnum {
|
1128 - | type Err = crate::model::foo_enum_internal::ConstraintViolation;
|
1129 - | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
1130 - | Self::try_from(s)
|
978 + | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
979 + | pub fn is_string(&self) -> bool {
|
980 + | self.as_string().is_ok()
|
1131 981 | }
|
1132 982 | }
|
1133 - | impl FooEnum {
|
1134 - | /// Returns the `&str` value of the enum member.
|
1135 - | pub fn as_str(&self) -> &str {
|
1136 - | match self {
|
1137 - | FooEnum::Zero => "0",
|
1138 - | FooEnum::One => "1",
|
1139 - | FooEnum::Bar => "Bar",
|
1140 - | FooEnum::Baz => "Baz",
|
1141 - | FooEnum::Foo => "Foo",
|
1142 - | }
|
983 + | #[pyo3::pyclass(name = "SimpleUnion")]
|
984 + | #[derive(
|
985 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
986 + | )]
|
987 + | pub struct PyUnionMarkerSimpleUnion(pub SimpleUnion);
|
988 + | #[::pyo3::pymethods]
|
989 + | impl PyUnionMarkerSimpleUnion {
|
990 + | #[staticmethod]
|
991 + | /// Creates a new union instance of [`Int`](crate::model::SimpleUnion::Int)
|
992 + | /// :param data int:
|
993 + | /// :rtype SimpleUnion:
|
994 + | pub fn int(data: i32) -> Self {
|
995 + | Self(SimpleUnion::Int(data))
|
1143 996 | }
|
1144 - | /// Returns all the `&str` representations of the enum members.
|
1145 - | pub const fn values() -> &'static [&'static str] {
|
1146 - | &["0", "1", "Bar", "Baz", "Foo"]
|
997 + | /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
|
998 + | /// :rtype int:
|
999 + | pub fn as_int(&self) -> ::pyo3::PyResult<i32> {
|
1000 + | match self.0.as_int() {
|
1001 + | Ok(variant) => Ok(*variant),
|
1002 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1003 + | r"SimpleUnion variant is not of type int",
|
1004 + | )),
|
1147 1005 | }
|
1148 - | }
|
1149 - | impl ::std::convert::AsRef<str> for FooEnum {
|
1150 - | fn as_ref(&self) -> &str {
|
1151 - | self.as_str()
|
1152 1006 | }
|
1153 - | }
|
1154 - | #[::pyo3::pymethods]
|
1155 - | impl FooEnum {
|
1156 - | #[getter]
|
1157 - | pub fn name(&self) -> &str {
|
1158 - | match self {
|
1159 - | FooEnum::Zero => "Zero",
|
1160 - | FooEnum::One => "One",
|
1161 - | FooEnum::Bar => "Bar",
|
1162 - | FooEnum::Baz => "Baz",
|
1163 - | FooEnum::Foo => "Foo",
|
1007 + | /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
|
1008 + | /// :rtype bool:
|
1009 + | pub fn is_int(&self) -> bool {
|
1010 + | self.0.is_int()
|
1164 1011 | }
|
1012 + | #[staticmethod]
|
1013 + | /// Creates a new union instance of [`String`](crate::model::SimpleUnion::String)
|
1014 + | /// :param data str:
|
1015 + | /// :rtype SimpleUnion:
|
1016 + | pub fn string(data: ::std::string::String) -> Self {
|
1017 + | Self(SimpleUnion::String(data))
|
1165 1018 | }
|
1166 - | #[getter]
|
1167 - | pub fn value(&self) -> &str {
|
1168 - | self.as_str()
|
1019 + | /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
|
1020 + | /// :rtype str:
|
1021 + | pub fn as_string(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1022 + | match self.0.as_string() {
|
1023 + | Ok(variant) => Ok(variant.clone()),
|
1024 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1025 + | r"SimpleUnion variant is not of type str",
|
1026 + | )),
|
1169 1027 | }
|
1170 - | fn __repr__(&self) -> String {
|
1171 - | self.as_str().to_owned()
|
1172 1028 | }
|
1173 - | fn __str__(&self) -> String {
|
1174 - | self.as_str().to_owned()
|
1029 + | /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
|
1030 + | /// :rtype bool:
|
1031 + | pub fn is_string(&self) -> bool {
|
1032 + | self.0.is_string()
|
1175 1033 | }
|
1176 1034 | }
|
1177 - | impl crate::constrained::Constrained for FooEnum {
|
1178 - | type Unconstrained = ::std::string::String;
|
1035 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for SimpleUnion {
|
1036 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1037 + | PyUnionMarkerSimpleUnion(self).into_py(py)
|
1038 + | }
|
1179 1039 | }
|
1180 - |
|
1181 - | impl ::std::convert::From<::std::string::String>
|
1182 - | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
1183 - | {
|
1184 - | fn from(value: ::std::string::String) -> Self {
|
1185 - | Self::Unconstrained(value)
|
1040 + | impl<'source> ::pyo3::FromPyObject<'source> for SimpleUnion {
|
1041 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1042 + | let data: PyUnionMarkerSimpleUnion = obj.extract()?;
|
1043 + | Ok(data.0)
|
1186 1044 | }
|
1187 1045 | }
|
1188 1046 |
|
1189 1047 | #[allow(missing_docs)] // documentation missing in model
|
1190 - | ///
|
1191 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1192 - | /// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
|
1193 - | ///
|
1194 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1195 - | ///
|
1196 1048 | #[derive(
|
1197 1049 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1198 1050 | )]
|
1199 - | pub(crate) struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
|
1200 - | impl StringSet {
|
1201 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
|
1202 - | pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
|
1203 - | self.0
|
1051 + | pub enum UnionWithJsonName {
|
1052 + | #[allow(missing_docs)] // documentation missing in model
|
1053 + | Bar(::std::string::String),
|
1054 + | #[allow(missing_docs)] // documentation missing in model
|
1055 + | Baz(::std::string::String),
|
1056 + | #[allow(missing_docs)] // documentation missing in model
|
1057 + | Foo(::std::string::String),
|
1058 + | }
|
1059 + | impl UnionWithJsonName {
|
1060 + | /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
|
1061 + | /// Returns `Err(&Self)` if it can't be converted.
|
1062 + | pub fn as_bar(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1063 + | if let UnionWithJsonName::Bar(val) = &self {
|
1064 + | ::std::result::Result::Ok(val)
|
1065 + | } else {
|
1066 + | ::std::result::Result::Err(self)
|
1204 1067 | }
|
1205 - |
|
1206 - | fn check_unique_items(
|
1207 - | items: ::std::vec::Vec<::std::string::String>,
|
1208 - | ) -> Result<
|
1209 - | ::std::vec::Vec<::std::string::String>,
|
1210 - | crate::model::string_set_internal::ConstraintViolation,
|
1211 - | > {
|
1212 - | let mut seen = ::std::collections::HashMap::new();
|
1213 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
1214 - | for (idx, item) in items.iter().enumerate() {
|
1215 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
1216 - | duplicate_indices.push(prev_idx);
|
1217 1068 | }
|
1069 + | /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
|
1070 + | pub fn is_bar(&self) -> bool {
|
1071 + | self.as_bar().is_ok()
|
1218 1072 | }
|
1219 - |
|
1220 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
1221 - | for idx in &duplicate_indices {
|
1222 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
1223 - | last_duplicate_indices.push(prev_idx);
|
1073 + | /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
|
1074 + | /// Returns `Err(&Self)` if it can't be converted.
|
1075 + | pub fn as_baz(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1076 + | if let UnionWithJsonName::Baz(val) = &self {
|
1077 + | ::std::result::Result::Ok(val)
|
1078 + | } else {
|
1079 + | ::std::result::Result::Err(self)
|
1224 1080 | }
|
1225 1081 | }
|
1226 - | duplicate_indices.extend(last_duplicate_indices);
|
1227 - |
|
1228 - | if !duplicate_indices.is_empty() {
|
1229 - | debug_assert!(duplicate_indices.len() >= 2);
|
1230 - | Err(
|
1231 - | crate::model::string_set_internal::ConstraintViolation::UniqueItems {
|
1232 - | duplicate_indices,
|
1233 - | original: items,
|
1234 - | },
|
1235 - | )
|
1082 + | /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
|
1083 + | pub fn is_baz(&self) -> bool {
|
1084 + | self.as_baz().is_ok()
|
1085 + | }
|
1086 + | /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
|
1087 + | /// Returns `Err(&Self)` if it can't be converted.
|
1088 + | pub fn as_foo(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1089 + | if let UnionWithJsonName::Foo(val) = &self {
|
1090 + | ::std::result::Result::Ok(val)
|
1236 1091 | } else {
|
1237 - | Ok(items)
|
1092 + | ::std::result::Result::Err(self)
|
1238 1093 | }
|
1239 1094 | }
|
1095 + | /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
|
1096 + | pub fn is_foo(&self) -> bool {
|
1097 + | self.as_foo().is_ok()
|
1098 + | }
|
1240 1099 | }
|
1241 - | impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
|
1242 - | type Error = crate::model::string_set_internal::ConstraintViolation;
|
1243 - |
|
1244 - | /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
|
1245 - | fn try_from(value: ::std::vec::Vec<::std::string::String>) -> Result<Self, Self::Error> {
|
1246 - | let value = Self::check_unique_items(value)?;
|
1247 - |
|
1248 - | Ok(Self(value))
|
1100 + | #[pyo3::pyclass(name = "UnionWithJsonName")]
|
1101 + | #[derive(
|
1102 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1103 + | )]
|
1104 + | pub struct PyUnionMarkerUnionWithJsonName(pub UnionWithJsonName);
|
1105 + | #[::pyo3::pymethods]
|
1106 + | impl PyUnionMarkerUnionWithJsonName {
|
1107 + | #[staticmethod]
|
1108 + | /// Creates a new union instance of [`Bar`](crate::model::UnionWithJsonName::Bar)
|
1109 + | /// :param data str:
|
1110 + | /// :rtype UnionWithJsonName:
|
1111 + | pub fn bar(data: ::std::string::String) -> Self {
|
1112 + | Self(UnionWithJsonName::Bar(data))
|
1113 + | }
|
1114 + | /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
|
1115 + | /// :rtype str:
|
1116 + | pub fn as_bar(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1117 + | match self.0.as_bar() {
|
1118 + | Ok(variant) => Ok(variant.clone()),
|
1119 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1120 + | r"UnionWithJsonName variant is not of type str",
|
1121 + | )),
|
1122 + | }
|
1123 + | }
|
1124 + | /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
|
1125 + | /// :rtype bool:
|
1126 + | pub fn is_bar(&self) -> bool {
|
1127 + | self.0.is_bar()
|
1128 + | }
|
1129 + | #[staticmethod]
|
1130 + | /// Creates a new union instance of [`Baz`](crate::model::UnionWithJsonName::Baz)
|
1131 + | /// :param data str:
|
1132 + | /// :rtype UnionWithJsonName:
|
1133 + | pub fn baz(data: ::std::string::String) -> Self {
|
1134 + | Self(UnionWithJsonName::Baz(data))
|
1135 + | }
|
1136 + | /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
|
1137 + | /// :rtype str:
|
1138 + | pub fn as_baz(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1139 + | match self.0.as_baz() {
|
1140 + | Ok(variant) => Ok(variant.clone()),
|
1141 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1142 + | r"UnionWithJsonName variant is not of type str",
|
1143 + | )),
|
1144 + | }
|
1145 + | }
|
1146 + | /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
|
1147 + | /// :rtype bool:
|
1148 + | pub fn is_baz(&self) -> bool {
|
1149 + | self.0.is_baz()
|
1150 + | }
|
1151 + | #[staticmethod]
|
1152 + | /// Creates a new union instance of [`Foo`](crate::model::UnionWithJsonName::Foo)
|
1153 + | /// :param data str:
|
1154 + | /// :rtype UnionWithJsonName:
|
1155 + | pub fn foo(data: ::std::string::String) -> Self {
|
1156 + | Self(UnionWithJsonName::Foo(data))
|
1157 + | }
|
1158 + | /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
|
1159 + | /// :rtype str:
|
1160 + | pub fn as_foo(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1161 + | match self.0.as_foo() {
|
1162 + | Ok(variant) => Ok(variant.clone()),
|
1163 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1164 + | r"UnionWithJsonName variant is not of type str",
|
1165 + | )),
|
1166 + | }
|
1167 + | }
|
1168 + | /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
|
1169 + | /// :rtype bool:
|
1170 + | pub fn is_foo(&self) -> bool {
|
1171 + | self.0.is_foo()
|
1249 1172 | }
|
1250 1173 | }
|
1251 - |
|
1252 - | impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
|
1253 - | fn from(value: StringSet) -> Self {
|
1254 - | value.into_inner()
|
1174 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for UnionWithJsonName {
|
1175 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1176 + | PyUnionMarkerUnionWithJsonName(self).into_py(py)
|
1255 1177 | }
|
1256 1178 | }
|
1257 - | impl crate::constrained::Constrained for StringSet {
|
1258 - | type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
|
1179 + | impl<'source> ::pyo3::FromPyObject<'source> for UnionWithJsonName {
|
1180 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1181 + | let data: PyUnionMarkerUnionWithJsonName = obj.extract()?;
|
1182 + | Ok(data.0)
|
1183 + | }
|
1259 1184 | }
|
1260 1185 |
|
1261 - | #[::pyo3::pyclass]
|
1262 - | /// :param a typing.Optional\[str\]:
|
1263 - | /// :param b typing.Optional\[str\]:
|
1264 - | /// :rtype None:
|
1265 1186 | #[allow(missing_docs)] // documentation missing in model
|
1266 1187 | #[derive(
|
1267 1188 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1268 1189 | )]
|
1269 - | pub struct StructureListMember {
|
1270 - | #[pyo3(get, set)]
|
1271 - | /// :type typing.Optional\[str\]:
|
1272 - | #[allow(missing_docs)] // documentation missing in model
|
1273 - | pub a: ::std::option::Option<::std::string::String>,
|
1274 - | #[pyo3(get, set)]
|
1275 - | /// :type typing.Optional\[str\]:
|
1276 - | #[allow(missing_docs)] // documentation missing in model
|
1277 - | pub b: ::std::option::Option<::std::string::String>,
|
1190 + | pub enum PlayerAction {
|
1191 + | /// Quit the game.
|
1192 + | Quit,
|
1278 1193 | }
|
1279 - | impl StructureListMember {
|
1280 - | #[allow(missing_docs)] // documentation missing in model
|
1281 - | pub fn a(&self) -> ::std::option::Option<&str> {
|
1282 - | self.a.as_deref()
|
1194 + | impl PlayerAction {
|
1195 + | #[allow(irrefutable_let_patterns)]
|
1196 + | /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
|
1197 + | /// Returns `Err(&Self)` if it can't be converted.
|
1198 + | pub fn as_quit(&self) -> ::std::result::Result<(), &Self> {
|
1199 + | if let PlayerAction::Quit = &self {
|
1200 + | ::std::result::Result::Ok(())
|
1201 + | } else {
|
1202 + | ::std::result::Result::Err(self)
|
1283 1203 | }
|
1284 - | #[allow(missing_docs)] // documentation missing in model
|
1285 - | pub fn b(&self) -> ::std::option::Option<&str> {
|
1286 - | self.b.as_deref()
|
1204 + | }
|
1205 + | /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
|
1206 + | pub fn is_quit(&self) -> bool {
|
1207 + | self.as_quit().is_ok()
|
1287 1208 | }
|
1288 1209 | }
|
1289 - | #[allow(clippy::new_without_default)]
|
1290 - | #[allow(clippy::too_many_arguments)]
|
1210 + | #[pyo3::pyclass(name = "PlayerAction")]
|
1211 + | #[derive(
|
1212 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1213 + | )]
|
1214 + | pub struct PyUnionMarkerPlayerAction(pub PlayerAction);
|
1291 1215 | #[::pyo3::pymethods]
|
1292 - | impl StructureListMember {
|
1293 - | #[new]
|
1294 - | pub fn new(
|
1295 - | a: ::std::option::Option<::std::string::String>,
|
1296 - | b: ::std::option::Option<::std::string::String>,
|
1297 - | ) -> Self {
|
1298 - | Self { a, b }
|
1299 - | }
|
1300 - | fn __repr__(&self) -> String {
|
1301 - | format!("{self:?}")
|
1216 + | impl PyUnionMarkerPlayerAction {
|
1217 + | #[allow(irrefutable_let_patterns)]
|
1218 + | #[staticmethod]
|
1219 + | /// Creates a new union instance of [`Quit`](crate::model::PlayerAction::Quit)
|
1220 + | /// :rtype PlayerAction:
|
1221 + | pub fn quit() -> Self {
|
1222 + | Self(PlayerAction::Quit)
|
1302 1223 | }
|
1303 - | fn __str__(&self) -> String {
|
1304 - | format!("{self:?}")
|
1224 + | /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
|
1225 + | /// :rtype None:
|
1226 + | pub fn as_quit(&self) -> ::pyo3::PyResult<()> {
|
1227 + | self.0.as_quit().map_err(|_| {
|
1228 + | ::pyo3::exceptions::PyValueError::new_err("PlayerAction variant is not None")
|
1229 + | })
|
1305 1230 | }
|
1306 - | }
|
1307 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<StructureListMember> {
|
1308 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1309 - | ob.extract::<StructureListMember>().map(Box::new)
|
1231 + | /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
|
1232 + | /// :rtype bool:
|
1233 + | pub fn is_quit(&self) -> bool {
|
1234 + | self.0.is_quit()
|
1310 1235 | }
|
1311 1236 | }
|
1312 - |
|
1313 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<StructureListMember> {
|
1237 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for PlayerAction {
|
1314 1238 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1315 - | (*self).into_py(py)
|
1239 + | PyUnionMarkerPlayerAction(self).into_py(py)
|
1316 1240 | }
|
1317 1241 | }
|
1318 - | impl crate::constrained::Constrained for crate::model::StructureListMember {
|
1319 - | type Unconstrained = crate::model::structure_list_member_internal::Builder;
|
1320 - | }
|
1321 - | impl StructureListMember {
|
1322 - | /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
|
1323 - | pub fn builder() -> crate::model::structure_list_member::Builder {
|
1324 - | crate::model::structure_list_member::Builder::default()
|
1242 + | impl<'source> ::pyo3::FromPyObject<'source> for PlayerAction {
|
1243 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1244 + | let data: PyUnionMarkerPlayerAction = obj.extract()?;
|
1245 + | Ok(data.0)
|
1325 1246 | }
|
1326 1247 | }
|
1327 1248 |
|
1328 1249 | #[::pyo3::pyclass]
|
1329 - | /// :param foo typing.Optional\[str\]:
|
1330 - | /// :param nested typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested2\]:
|
1331 1250 | /// :rtype None:
|
1332 1251 | #[allow(missing_docs)] // documentation missing in model
|
1333 1252 | #[derive(
|
1334 1253 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1335 1254 | )]
|
1336 - | pub struct RecursiveShapesInputOutputNested1 {
|
1337 - | #[pyo3(get, set)]
|
1338 - | /// :type typing.Optional\[str\]:
|
1339 - | #[allow(missing_docs)] // documentation missing in model
|
1340 - | pub foo: ::std::option::Option<::std::string::String>,
|
1341 - | #[pyo3(get, set)]
|
1342 - | /// :type typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested2\]:
|
1343 - | #[allow(missing_docs)] // documentation missing in model
|
1344 - | pub nested:
|
1345 - | ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
|
1346 - | }
|
1347 - | impl RecursiveShapesInputOutputNested1 {
|
1348 - | #[allow(missing_docs)] // documentation missing in model
|
1349 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
1350 - | self.foo.as_deref()
|
1351 - | }
|
1352 - | #[allow(missing_docs)] // documentation missing in model
|
1353 - | pub fn nested(
|
1354 - | &self,
|
1355 - | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
|
1356 - | self.nested.as_deref()
|
1357 - | }
|
1358 - | }
|
1255 + | pub struct Unit {}
|
1359 1256 | #[allow(clippy::new_without_default)]
|
1360 1257 | #[allow(clippy::too_many_arguments)]
|
1361 1258 | #[::pyo3::pymethods]
|
1362 - | impl RecursiveShapesInputOutputNested1 {
|
1259 + | impl Unit {
|
1363 1260 | #[new]
|
1364 - | pub fn new(
|
1365 - | foo: ::std::option::Option<::std::string::String>,
|
1366 - | nested: ::std::option::Option<
|
1367 - | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
1368 - | >,
|
1369 - | ) -> Self {
|
1370 - | Self { foo, nested }
|
1261 + | pub fn new() -> Self {
|
1262 + | Self {}
|
1371 1263 | }
|
1372 1264 | fn __repr__(&self) -> String {
|
1373 1265 | format!("{self:?}")
|
1374 1266 | }
|
1375 1267 | fn __str__(&self) -> String {
|
1376 1268 | format!("{self:?}")
|
1377 1269 | }
|
1378 1270 | }
|
1379 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RecursiveShapesInputOutputNested1> {
|
1271 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<Unit> {
|
1380 1272 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1381 - | ob.extract::<RecursiveShapesInputOutputNested1>()
|
1382 - | .map(Box::new)
|
1273 + | ob.extract::<Unit>().map(Box::new)
|
1383 1274 | }
|
1384 1275 | }
|
1385 1276 |
|
1386 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RecursiveShapesInputOutputNested1> {
|
1277 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<Unit> {
|
1387 1278 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1388 1279 | (*self).into_py(py)
|
1389 1280 | }
|
1390 1281 | }
|
1391 - | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
|
1392 - | type Unconstrained = crate::model::recursive_shapes_input_output_nested1_internal::Builder;
|
1282 + | impl crate::constrained::Constrained for crate::model::Unit {
|
1283 + | type Unconstrained = crate::model::unit_internal::Builder;
|
1393 1284 | }
|
1394 - | impl RecursiveShapesInputOutputNested1 {
|
1395 - | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
1396 - | pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
|
1397 - | crate::model::recursive_shapes_input_output_nested1::Builder::default()
|
1285 + | impl Unit {
|
1286 + | /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
|
1287 + | pub fn builder() -> crate::model::unit::Builder {
|
1288 + | crate::model::unit::Builder::default()
|
1289 + | }
|
1290 + | }
|
1291 + |
|
1292 + | /// A union with a representative set of types for members.
|
1293 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1294 + | pub enum MyUnion {
|
1295 + | #[allow(missing_docs)] // documentation missing in model
|
1296 + | BlobValue(::aws_smithy_http_server_python::types::Blob),
|
1297 + | #[allow(missing_docs)] // documentation missing in model
|
1298 + | BooleanValue(bool),
|
1299 + | #[allow(missing_docs)] // documentation missing in model
|
1300 + | EnumValue(crate::model::FooEnum),
|
1301 + | #[allow(missing_docs)] // documentation missing in model
|
1302 + | ListValue(::std::vec::Vec<::std::string::String>),
|
1303 + | #[allow(missing_docs)] // documentation missing in model
|
1304 + | MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
|
1305 + | #[allow(missing_docs)] // documentation missing in model
|
1306 + | NumberValue(i32),
|
1307 + | #[allow(missing_docs)] // documentation missing in model
|
1308 + | RenamedStructureValue(crate::model::RenamedGreeting),
|
1309 + | #[allow(missing_docs)] // documentation missing in model
|
1310 + | StringValue(::std::string::String),
|
1311 + | #[allow(missing_docs)] // documentation missing in model
|
1312 + | StructureValue(crate::model::GreetingStruct),
|
1313 + | #[allow(missing_docs)] // documentation missing in model
|
1314 + | TimestampValue(::aws_smithy_http_server_python::types::DateTime),
|
1315 + | }
|
1316 + | impl MyUnion {
|
1317 + | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
1318 + | /// Returns `Err(&Self)` if it can't be converted.
|
1319 + | pub fn as_blob_value(
|
1320 + | &self,
|
1321 + | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::Blob, &Self> {
|
1322 + | if let MyUnion::BlobValue(val) = &self {
|
1323 + | ::std::result::Result::Ok(val)
|
1324 + | } else {
|
1325 + | ::std::result::Result::Err(self)
|
1326 + | }
|
1327 + | }
|
1328 + | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
1329 + | pub fn is_blob_value(&self) -> bool {
|
1330 + | self.as_blob_value().is_ok()
|
1331 + | }
|
1332 + | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
1333 + | /// Returns `Err(&Self)` if it can't be converted.
|
1334 + | pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
|
1335 + | if let MyUnion::BooleanValue(val) = &self {
|
1336 + | ::std::result::Result::Ok(val)
|
1337 + | } else {
|
1338 + | ::std::result::Result::Err(self)
|
1339 + | }
|
1340 + | }
|
1341 + | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
1342 + | pub fn is_boolean_value(&self) -> bool {
|
1343 + | self.as_boolean_value().is_ok()
|
1344 + | }
|
1345 + | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
1346 + | /// Returns `Err(&Self)` if it can't be converted.
|
1347 + | pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
|
1348 + | if let MyUnion::EnumValue(val) = &self {
|
1349 + | ::std::result::Result::Ok(val)
|
1350 + | } else {
|
1351 + | ::std::result::Result::Err(self)
|
1352 + | }
|
1353 + | }
|
1354 + | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
1355 + | pub fn is_enum_value(&self) -> bool {
|
1356 + | self.as_enum_value().is_ok()
|
1357 + | }
|
1358 + | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
1359 + | /// Returns `Err(&Self)` if it can't be converted.
|
1360 + | pub fn as_list_value(
|
1361 + | &self,
|
1362 + | ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
1363 + | if let MyUnion::ListValue(val) = &self {
|
1364 + | ::std::result::Result::Ok(val)
|
1365 + | } else {
|
1366 + | ::std::result::Result::Err(self)
|
1367 + | }
|
1368 + | }
|
1369 + | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
1370 + | pub fn is_list_value(&self) -> bool {
|
1371 + | self.as_list_value().is_ok()
|
1372 + | }
|
1373 + | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
1374 + | /// Returns `Err(&Self)` if it can't be converted.
|
1375 + | pub fn as_map_value(
|
1376 + | &self,
|
1377 + | ) -> ::std::result::Result<
|
1378 + | &::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1379 + | &Self,
|
1380 + | > {
|
1381 + | if let MyUnion::MapValue(val) = &self {
|
1382 + | ::std::result::Result::Ok(val)
|
1383 + | } else {
|
1384 + | ::std::result::Result::Err(self)
|
1385 + | }
|
1386 + | }
|
1387 + | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
1388 + | pub fn is_map_value(&self) -> bool {
|
1389 + | self.as_map_value().is_ok()
|
1390 + | }
|
1391 + | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
1392 + | /// Returns `Err(&Self)` if it can't be converted.
|
1393 + | pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
|
1394 + | if let MyUnion::NumberValue(val) = &self {
|
1395 + | ::std::result::Result::Ok(val)
|
1396 + | } else {
|
1397 + | ::std::result::Result::Err(self)
|
1398 + | }
|
1399 + | }
|
1400 + | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
1401 + | pub fn is_number_value(&self) -> bool {
|
1402 + | self.as_number_value().is_ok()
|
1403 + | }
|
1404 + | /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
|
1405 + | /// Returns `Err(&Self)` if it can't be converted.
|
1406 + | pub fn as_renamed_structure_value(
|
1407 + | &self,
|
1408 + | ) -> ::std::result::Result<&crate::model::RenamedGreeting, &Self> {
|
1409 + | if let MyUnion::RenamedStructureValue(val) = &self {
|
1410 + | ::std::result::Result::Ok(val)
|
1411 + | } else {
|
1412 + | ::std::result::Result::Err(self)
|
1413 + | }
|
1414 + | }
|
1415 + | /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
|
1416 + | pub fn is_renamed_structure_value(&self) -> bool {
|
1417 + | self.as_renamed_structure_value().is_ok()
|
1418 + | }
|
1419 + | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
1420 + | /// Returns `Err(&Self)` if it can't be converted.
|
1421 + | pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1422 + | if let MyUnion::StringValue(val) = &self {
|
1423 + | ::std::result::Result::Ok(val)
|
1424 + | } else {
|
1425 + | ::std::result::Result::Err(self)
|
1426 + | }
|
1427 + | }
|
1428 + | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
1429 + | pub fn is_string_value(&self) -> bool {
|
1430 + | self.as_string_value().is_ok()
|
1431 + | }
|
1432 + | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
1433 + | /// Returns `Err(&Self)` if it can't be converted.
|
1434 + | pub fn as_structure_value(
|
1435 + | &self,
|
1436 + | ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
|
1437 + | if let MyUnion::StructureValue(val) = &self {
|
1438 + | ::std::result::Result::Ok(val)
|
1439 + | } else {
|
1440 + | ::std::result::Result::Err(self)
|
1441 + | }
|
1442 + | }
|
1443 + | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
1444 + | pub fn is_structure_value(&self) -> bool {
|
1445 + | self.as_structure_value().is_ok()
|
1446 + | }
|
1447 + | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
1448 + | /// Returns `Err(&Self)` if it can't be converted.
|
1449 + | pub fn as_timestamp_value(
|
1450 + | &self,
|
1451 + | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::DateTime, &Self> {
|
1452 + | if let MyUnion::TimestampValue(val) = &self {
|
1453 + | ::std::result::Result::Ok(val)
|
1454 + | } else {
|
1455 + | ::std::result::Result::Err(self)
|
1456 + | }
|
1457 + | }
|
1458 + | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
1459 + | pub fn is_timestamp_value(&self) -> bool {
|
1460 + | self.as_timestamp_value().is_ok()
|
1461 + | }
|
1462 + | }
|
1463 + | #[pyo3::pyclass(name = "MyUnion")]
|
1464 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1465 + | pub struct PyUnionMarkerMyUnion(pub MyUnion);
|
1466 + | #[::pyo3::pymethods]
|
1467 + | impl PyUnionMarkerMyUnion {
|
1468 + | #[staticmethod]
|
1469 + | /// Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
|
1470 + | /// :param data rest_json.types.Blob:
|
1471 + | /// :rtype MyUnion:
|
1472 + | pub fn blob_value(data: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
1473 + | Self(MyUnion::BlobValue(data))
|
1474 + | }
|
1475 + | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
1476 + | /// :rtype rest_json.types.Blob:
|
1477 + | pub fn as_blob_value(&self) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::Blob> {
|
1478 + | match self.0.as_blob_value() {
|
1479 + | Ok(variant) => Ok(variant.clone()),
|
1480 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1481 + | r"MyUnion variant is not of type rest_json.types.Blob",
|
1482 + | )),
|
1483 + | }
|
1484 + | }
|
1485 + | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
1486 + | /// :rtype bool:
|
1487 + | pub fn is_blob_value(&self) -> bool {
|
1488 + | self.0.is_blob_value()
|
1489 + | }
|
1490 + | #[staticmethod]
|
1491 + | /// Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
|
1492 + | /// :param data bool:
|
1493 + | /// :rtype MyUnion:
|
1494 + | pub fn boolean_value(data: bool) -> Self {
|
1495 + | Self(MyUnion::BooleanValue(data))
|
1496 + | }
|
1497 + | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
1498 + | /// :rtype bool:
|
1499 + | pub fn as_boolean_value(&self) -> ::pyo3::PyResult<bool> {
|
1500 + | match self.0.as_boolean_value() {
|
1501 + | Ok(variant) => Ok(*variant),
|
1502 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1503 + | r"MyUnion variant is not of type bool",
|
1504 + | )),
|
1505 + | }
|
1506 + | }
|
1507 + | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
1508 + | /// :rtype bool:
|
1509 + | pub fn is_boolean_value(&self) -> bool {
|
1510 + | self.0.is_boolean_value()
|
1511 + | }
|
1512 + | #[staticmethod]
|
1513 + | /// Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
|
1514 + | /// :param data rest_json.model.FooEnum:
|
1515 + | /// :rtype MyUnion:
|
1516 + | pub fn enum_value(data: crate::model::FooEnum) -> Self {
|
1517 + | Self(MyUnion::EnumValue(data))
|
1518 + | }
|
1519 + | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
1520 + | /// :rtype rest_json.model.FooEnum:
|
1521 + | pub fn as_enum_value(&self) -> ::pyo3::PyResult<crate::model::FooEnum> {
|
1522 + | match self.0.as_enum_value() {
|
1523 + | Ok(variant) => Ok(variant.clone()),
|
1524 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1525 + | r"MyUnion variant is not of type rest_json.model.FooEnum",
|
1526 + | )),
|
1527 + | }
|
1528 + | }
|
1529 + | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
1530 + | /// :rtype bool:
|
1531 + | pub fn is_enum_value(&self) -> bool {
|
1532 + | self.0.is_enum_value()
|
1533 + | }
|
1534 + | #[staticmethod]
|
1535 + | /// Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
|
1536 + | /// :param data typing.List\[str\]:
|
1537 + | /// :rtype MyUnion:
|
1538 + | pub fn list_value(data: ::std::vec::Vec<::std::string::String>) -> Self {
|
1539 + | Self(MyUnion::ListValue(data))
|
1540 + | }
|
1541 + | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
1542 + | /// :rtype typing.List\[str\]:
|
1543 + | pub fn as_list_value(&self) -> ::pyo3::PyResult<::std::vec::Vec<::std::string::String>> {
|
1544 + | match self.0.as_list_value() {
|
1545 + | Ok(variant) => Ok(variant.clone()),
|
1546 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1547 + | r"MyUnion variant is not of type typing.List\[str\]",
|
1548 + | )),
|
1549 + | }
|
1550 + | }
|
1551 + | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
1552 + | /// :rtype bool:
|
1553 + | pub fn is_list_value(&self) -> bool {
|
1554 + | self.0.is_list_value()
|
1555 + | }
|
1556 + | #[staticmethod]
|
1557 + | /// Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
|
1558 + | /// :param data typing.Dict\[str, str\]:
|
1559 + | /// :rtype MyUnion:
|
1560 + | pub fn map_value(
|
1561 + | data: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1562 + | ) -> Self {
|
1563 + | Self(MyUnion::MapValue(data))
|
1564 + | }
|
1565 + | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
1566 + | /// :rtype typing.Dict\[str, str\]:
|
1567 + | pub fn as_map_value(
|
1568 + | &self,
|
1569 + | ) -> ::pyo3::PyResult<::std::collections::HashMap<::std::string::String, ::std::string::String>>
|
1570 + | {
|
1571 + | match self.0.as_map_value() {
|
1572 + | Ok(variant) => Ok(variant.clone()),
|
1573 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1574 + | r"MyUnion variant is not of type typing.Dict\[str, str\]",
|
1575 + | )),
|
1576 + | }
|
1577 + | }
|
1578 + | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
1579 + | /// :rtype bool:
|
1580 + | pub fn is_map_value(&self) -> bool {
|
1581 + | self.0.is_map_value()
|
1582 + | }
|
1583 + | #[staticmethod]
|
1584 + | /// Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
|
1585 + | /// :param data int:
|
1586 + | /// :rtype MyUnion:
|
1587 + | pub fn number_value(data: i32) -> Self {
|
1588 + | Self(MyUnion::NumberValue(data))
|
1589 + | }
|
1590 + | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
1591 + | /// :rtype int:
|
1592 + | pub fn as_number_value(&self) -> ::pyo3::PyResult<i32> {
|
1593 + | match self.0.as_number_value() {
|
1594 + | Ok(variant) => Ok(*variant),
|
1595 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1596 + | r"MyUnion variant is not of type int",
|
1597 + | )),
|
1598 + | }
|
1599 + | }
|
1600 + | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
1601 + | /// :rtype bool:
|
1602 + | pub fn is_number_value(&self) -> bool {
|
1603 + | self.0.is_number_value()
|
1604 + | }
|
1605 + | #[staticmethod]
|
1606 + | /// Creates a new union instance of [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue)
|
1607 + | /// :param data rest_json.model.RenamedGreeting:
|
1608 + | /// :rtype MyUnion:
|
1609 + | pub fn renamed_structure_value(data: crate::model::RenamedGreeting) -> Self {
|
1610 + | Self(MyUnion::RenamedStructureValue(data))
|
1611 + | }
|
1612 + | /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
|
1613 + | /// :rtype rest_json.model.RenamedGreeting:
|
1614 + | pub fn as_renamed_structure_value(&self) -> ::pyo3::PyResult<crate::model::RenamedGreeting> {
|
1615 + | match self.0.as_renamed_structure_value() {
|
1616 + | Ok(variant) => Ok(variant.clone()),
|
1617 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1618 + | r"MyUnion variant is not of type rest_json.model.RenamedGreeting",
|
1619 + | )),
|
1620 + | }
|
1621 + | }
|
1622 + | /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
|
1623 + | /// :rtype bool:
|
1624 + | pub fn is_renamed_structure_value(&self) -> bool {
|
1625 + | self.0.is_renamed_structure_value()
|
1626 + | }
|
1627 + | #[staticmethod]
|
1628 + | /// Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
|
1629 + | /// :param data str:
|
1630 + | /// :rtype MyUnion:
|
1631 + | pub fn string_value(data: ::std::string::String) -> Self {
|
1632 + | Self(MyUnion::StringValue(data))
|
1633 + | }
|
1634 + | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
1635 + | /// :rtype str:
|
1636 + | pub fn as_string_value(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1637 + | match self.0.as_string_value() {
|
1638 + | Ok(variant) => Ok(variant.clone()),
|
1639 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1640 + | r"MyUnion variant is not of type str",
|
1641 + | )),
|
1642 + | }
|
1643 + | }
|
1644 + | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
1645 + | /// :rtype bool:
|
1646 + | pub fn is_string_value(&self) -> bool {
|
1647 + | self.0.is_string_value()
|
1648 + | }
|
1649 + | #[staticmethod]
|
1650 + | /// Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
|
1651 + | /// :param data rest_json.model.GreetingStruct:
|
1652 + | /// :rtype MyUnion:
|
1653 + | pub fn structure_value(data: crate::model::GreetingStruct) -> Self {
|
1654 + | Self(MyUnion::StructureValue(data))
|
1655 + | }
|
1656 + | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
1657 + | /// :rtype rest_json.model.GreetingStruct:
|
1658 + | pub fn as_structure_value(&self) -> ::pyo3::PyResult<crate::model::GreetingStruct> {
|
1659 + | match self.0.as_structure_value() {
|
1660 + | Ok(variant) => Ok(variant.clone()),
|
1661 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1662 + | r"MyUnion variant is not of type rest_json.model.GreetingStruct",
|
1663 + | )),
|
1664 + | }
|
1665 + | }
|
1666 + | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
1667 + | /// :rtype bool:
|
1668 + | pub fn is_structure_value(&self) -> bool {
|
1669 + | self.0.is_structure_value()
|
1670 + | }
|
1671 + | #[staticmethod]
|
1672 + | /// Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
|
1673 + | /// :param data rest_json.types.DateTime:
|
1674 + | /// :rtype MyUnion:
|
1675 + | pub fn timestamp_value(data: ::aws_smithy_http_server_python::types::DateTime) -> Self {
|
1676 + | Self(MyUnion::TimestampValue(data))
|
1677 + | }
|
1678 + | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
1679 + | /// :rtype rest_json.types.DateTime:
|
1680 + | pub fn as_timestamp_value(
|
1681 + | &self,
|
1682 + | ) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::DateTime> {
|
1683 + | match self.0.as_timestamp_value() {
|
1684 + | Ok(variant) => Ok(variant.clone()),
|
1685 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1686 + | r"MyUnion variant is not of type rest_json.types.DateTime",
|
1687 + | )),
|
1688 + | }
|
1689 + | }
|
1690 + | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
1691 + | /// :rtype bool:
|
1692 + | pub fn is_timestamp_value(&self) -> bool {
|
1693 + | self.0.is_timestamp_value()
|
1694 + | }
|
1695 + | }
|
1696 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for MyUnion {
|
1697 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1698 + | PyUnionMarkerMyUnion(self).into_py(py)
|
1699 + | }
|
1700 + | }
|
1701 + | impl<'source> ::pyo3::FromPyObject<'source> for MyUnion {
|
1702 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1703 + | let data: PyUnionMarkerMyUnion = obj.extract()?;
|
1704 + | Ok(data.0)
|
1705 + | }
|
1706 + | }
|
1707 + |
|
1708 + | #[::pyo3::pyclass]
|
1709 + | /// :param salutation typing.Optional\[str\]:
|
1710 + | /// :rtype None:
|
1711 + | #[allow(missing_docs)] // documentation missing in model
|
1712 + | #[derive(
|
1713 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1714 + | )]
|
1715 + | pub struct RenamedGreeting {
|
1716 + | #[pyo3(get, set)]
|
1717 + | /// :type typing.Optional\[str\]:
|
1718 + | #[allow(missing_docs)] // documentation missing in model
|
1719 + | pub salutation: ::std::option::Option<::std::string::String>,
|
1720 + | }
|
1721 + | impl RenamedGreeting {
|
1722 + | #[allow(missing_docs)] // documentation missing in model
|
1723 + | pub fn salutation(&self) -> ::std::option::Option<&str> {
|
1724 + | self.salutation.as_deref()
|
1725 + | }
|
1726 + | }
|
1727 + | #[allow(clippy::new_without_default)]
|
1728 + | #[allow(clippy::too_many_arguments)]
|
1729 + | #[::pyo3::pymethods]
|
1730 + | impl RenamedGreeting {
|
1731 + | #[new]
|
1732 + | pub fn new(salutation: ::std::option::Option<::std::string::String>) -> Self {
|
1733 + | Self { salutation }
|
1734 + | }
|
1735 + | fn __repr__(&self) -> String {
|
1736 + | format!("{self:?}")
|
1737 + | }
|
1738 + | fn __str__(&self) -> String {
|
1739 + | format!("{self:?}")
|
1740 + | }
|
1741 + | }
|
1742 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RenamedGreeting> {
|
1743 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1744 + | ob.extract::<RenamedGreeting>().map(Box::new)
|
1745 + | }
|
1746 + | }
|
1747 + |
|
1748 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RenamedGreeting> {
|
1749 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1750 + | (*self).into_py(py)
|
1751 + | }
|
1752 + | }
|
1753 + | impl crate::constrained::Constrained for crate::model::RenamedGreeting {
|
1754 + | type Unconstrained = crate::model::renamed_greeting_internal::Builder;
|
1755 + | }
|
1756 + | impl RenamedGreeting {
|
1757 + | /// Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::model::RenamedGreeting).
|
1758 + | pub fn builder() -> crate::model::renamed_greeting::Builder {
|
1759 + | crate::model::renamed_greeting::Builder::default()
|
1760 + | }
|
1761 + | }
|
1762 + |
|
1763 + | #[::pyo3::pyclass]
|
1764 + | /// :param hi typing.Optional\[str\]:
|
1765 + | /// :rtype None:
|
1766 + | #[allow(missing_docs)] // documentation missing in model
|
1767 + | #[derive(
|
1768 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1769 + | )]
|
1770 + | pub struct GreetingStruct {
|
1771 + | #[pyo3(get, set)]
|
1772 + | /// :type typing.Optional\[str\]:
|
1773 + | #[allow(missing_docs)] // documentation missing in model
|
1774 + | pub hi: ::std::option::Option<::std::string::String>,
|
1775 + | }
|
1776 + | impl GreetingStruct {
|
1777 + | #[allow(missing_docs)] // documentation missing in model
|
1778 + | pub fn hi(&self) -> ::std::option::Option<&str> {
|
1779 + | self.hi.as_deref()
|
1780 + | }
|
1781 + | }
|
1782 + | #[allow(clippy::new_without_default)]
|
1783 + | #[allow(clippy::too_many_arguments)]
|
1784 + | #[::pyo3::pymethods]
|
1785 + | impl GreetingStruct {
|
1786 + | #[new]
|
1787 + | pub fn new(hi: ::std::option::Option<::std::string::String>) -> Self {
|
1788 + | Self { hi }
|
1789 + | }
|
1790 + | fn __repr__(&self) -> String {
|
1791 + | format!("{self:?}")
|
1792 + | }
|
1793 + | fn __str__(&self) -> String {
|
1794 + | format!("{self:?}")
|
1795 + | }
|
1796 + | }
|
1797 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<GreetingStruct> {
|
1798 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1799 + | ob.extract::<GreetingStruct>().map(Box::new)
|
1800 + | }
|
1801 + | }
|
1802 + |
|
1803 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<GreetingStruct> {
|
1804 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1805 + | (*self).into_py(py)
|
1806 + | }
|
1807 + | }
|
1808 + | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
1809 + | type Unconstrained = crate::model::greeting_struct_internal::Builder;
|
1810 + | }
|
1811 + | impl GreetingStruct {
|
1812 + | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
1813 + | pub fn builder() -> crate::model::greeting_struct::Builder {
|
1814 + | crate::model::greeting_struct::Builder::default()
|
1815 + | }
|
1816 + | }
|
1817 + |
|
1818 + | #[::pyo3::pyclass]
|
1819 + | #[allow(missing_docs)] // documentation missing in model
|
1820 + | #[derive(
|
1821 + | ::std::clone::Clone,
|
1822 + | ::std::cmp::Eq,
|
1823 + | ::std::cmp::Ord,
|
1824 + | ::std::cmp::PartialEq,
|
1825 + | ::std::cmp::PartialOrd,
|
1826 + | ::std::fmt::Debug,
|
1827 + | ::std::hash::Hash,
|
1828 + | )]
|
1829 + | pub enum FooEnum {
|
1830 + | #[allow(missing_docs)] // documentation missing in model
|
1831 + | Zero,
|
1832 + | #[allow(missing_docs)] // documentation missing in model
|
1833 + | One,
|
1834 + | #[allow(missing_docs)] // documentation missing in model
|
1835 + | Bar,
|
1836 + | #[allow(missing_docs)] // documentation missing in model
|
1837 + | Baz,
|
1838 + | #[allow(missing_docs)] // documentation missing in model
|
1839 + | Foo,
|
1840 + | }
|
1841 + | ///
|
1842 + | pub(crate) mod foo_enum_internal {
|
1843 + | #[derive(Debug, PartialEq)]
|
1844 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
1845 + |
|
1846 + | impl ::std::fmt::Display for ConstraintViolation {
|
1847 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1848 + | write!(
|
1849 + | f,
|
1850 + | r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
|
1851 + | )
|
1852 + | }
|
1853 + | }
|
1854 + |
|
1855 + | impl ::std::error::Error for ConstraintViolation {}
|
1856 + | impl ConstraintViolation {
|
1857 + | pub(crate) fn as_validation_exception_field(
|
1858 + | self,
|
1859 + | path: ::std::string::String,
|
1860 + | ) -> crate::model::ValidationExceptionField {
|
1861 + | crate::model::ValidationExceptionField {
|
1862 + | message: format!(
|
1863 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
|
1864 + | &path
|
1865 + | ),
|
1866 + | path,
|
1867 + | }
|
1868 + | }
|
1869 + | }
|
1870 + | }
|
1871 + | impl ::std::convert::TryFrom<&str> for FooEnum {
|
1872 + | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
1873 + | fn try_from(
|
1874 + | s: &str,
|
1875 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
1876 + | match s {
|
1877 + | "0" => Ok(FooEnum::Zero),
|
1878 + | "1" => Ok(FooEnum::One),
|
1879 + | "Bar" => Ok(FooEnum::Bar),
|
1880 + | "Baz" => Ok(FooEnum::Baz),
|
1881 + | "Foo" => Ok(FooEnum::Foo),
|
1882 + | _ => Err(crate::model::foo_enum_internal::ConstraintViolation(
|
1883 + | s.to_owned(),
|
1884 + | )),
|
1885 + | }
|
1886 + | }
|
1887 + | }
|
1888 + | impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
|
1889 + | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
1890 + | fn try_from(
|
1891 + | s: ::std::string::String,
|
1892 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
1893 + | {
|
1894 + | s.as_str().try_into()
|
1895 + | }
|
1896 + | }
|
1897 + | impl std::str::FromStr for FooEnum {
|
1898 + | type Err = crate::model::foo_enum_internal::ConstraintViolation;
|
1899 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
1900 + | Self::try_from(s)
|
1901 + | }
|
1902 + | }
|
1903 + | impl FooEnum {
|
1904 + | /// Returns the `&str` value of the enum member.
|
1905 + | pub fn as_str(&self) -> &str {
|
1906 + | match self {
|
1907 + | FooEnum::Zero => "0",
|
1908 + | FooEnum::One => "1",
|
1909 + | FooEnum::Bar => "Bar",
|
1910 + | FooEnum::Baz => "Baz",
|
1911 + | FooEnum::Foo => "Foo",
|
1912 + | }
|
1913 + | }
|
1914 + | /// Returns all the `&str` representations of the enum members.
|
1915 + | pub const fn values() -> &'static [&'static str] {
|
1916 + | &["0", "1", "Bar", "Baz", "Foo"]
|
1917 + | }
|
1918 + | }
|
1919 + | impl ::std::convert::AsRef<str> for FooEnum {
|
1920 + | fn as_ref(&self) -> &str {
|
1921 + | self.as_str()
|
1922 + | }
|
1923 + | }
|
1924 + | #[::pyo3::pymethods]
|
1925 + | impl FooEnum {
|
1926 + | #[getter]
|
1927 + | pub fn name(&self) -> &str {
|
1928 + | match self {
|
1929 + | FooEnum::Zero => "Zero",
|
1930 + | FooEnum::One => "One",
|
1931 + | FooEnum::Bar => "Bar",
|
1932 + | FooEnum::Baz => "Baz",
|
1933 + | FooEnum::Foo => "Foo",
|
1934 + | }
|
1935 + | }
|
1936 + | #[getter]
|
1937 + | pub fn value(&self) -> &str {
|
1938 + | self.as_str()
|
1939 + | }
|
1940 + | fn __repr__(&self) -> String {
|
1941 + | self.as_str().to_owned()
|
1942 + | }
|
1943 + | fn __str__(&self) -> String {
|
1944 + | self.as_str().to_owned()
|
1945 + | }
|
1946 + | }
|
1947 + | impl crate::constrained::Constrained for FooEnum {
|
1948 + | type Unconstrained = ::std::string::String;
|
1949 + | }
|
1950 + |
|
1951 + | impl ::std::convert::From<::std::string::String>
|
1952 + | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
1953 + | {
|
1954 + | fn from(value: ::std::string::String) -> Self {
|
1955 + | Self::Unconstrained(value)
|
1956 + | }
|
1957 + | }
|
1958 + |
|
1959 + | #[allow(missing_docs)] // documentation missing in model
|
1960 + | ///
|
1961 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1962 + | /// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
|
1963 + | ///
|
1964 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1965 + | ///
|
1966 + | #[derive(
|
1967 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1968 + | )]
|
1969 + | pub(crate) struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
|
1970 + | impl StringSet {
|
1971 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
|
1972 + | pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
|
1973 + | self.0
|
1974 + | }
|
1975 + |
|
1976 + | fn check_unique_items(
|
1977 + | items: ::std::vec::Vec<::std::string::String>,
|
1978 + | ) -> Result<
|
1979 + | ::std::vec::Vec<::std::string::String>,
|
1980 + | crate::model::string_set_internal::ConstraintViolation,
|
1981 + | > {
|
1982 + | let mut seen = ::std::collections::HashMap::new();
|
1983 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
1984 + | for (idx, item) in items.iter().enumerate() {
|
1985 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
1986 + | duplicate_indices.push(prev_idx);
|
1987 + | }
|
1988 + | }
|
1989 + |
|
1990 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
1991 + | for idx in &duplicate_indices {
|
1992 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
1993 + | last_duplicate_indices.push(prev_idx);
|
1994 + | }
|
1995 + | }
|
1996 + | duplicate_indices.extend(last_duplicate_indices);
|
1997 + |
|
1998 + | if !duplicate_indices.is_empty() {
|
1999 + | debug_assert!(duplicate_indices.len() >= 2);
|
2000 + | Err(
|
2001 + | crate::model::string_set_internal::ConstraintViolation::UniqueItems {
|
2002 + | duplicate_indices,
|
2003 + | original: items,
|
2004 + | },
|
2005 + | )
|
2006 + | } else {
|
2007 + | Ok(items)
|
2008 + | }
|
2009 + | }
|
2010 + | }
|
2011 + | impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
|
2012 + | type Error = crate::model::string_set_internal::ConstraintViolation;
|
2013 + |
|
2014 + | /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
|
2015 + | fn try_from(value: ::std::vec::Vec<::std::string::String>) -> Result<Self, Self::Error> {
|
2016 + | let value = Self::check_unique_items(value)?;
|
2017 + |
|
2018 + | Ok(Self(value))
|
2019 + | }
|
2020 + | }
|
2021 + |
|
2022 + | impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
|
2023 + | fn from(value: StringSet) -> Self {
|
2024 + | value.into_inner()
|
2025 + | }
|
2026 + | }
|
2027 + | impl crate::constrained::Constrained for StringSet {
|
2028 + | type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
|
2029 + | }
|
2030 + |
|
2031 + | #[::pyo3::pyclass]
|
2032 + | /// :param a typing.Optional\[str\]:
|
2033 + | /// :param b typing.Optional\[str\]:
|
2034 + | /// :rtype None:
|
2035 + | #[allow(missing_docs)] // documentation missing in model
|
2036 + | #[derive(
|
2037 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2038 + | )]
|
2039 + | pub struct StructureListMember {
|
2040 + | #[pyo3(get, set)]
|
2041 + | /// :type typing.Optional\[str\]:
|
2042 + | #[allow(missing_docs)] // documentation missing in model
|
2043 + | pub a: ::std::option::Option<::std::string::String>,
|
2044 + | #[pyo3(get, set)]
|
2045 + | /// :type typing.Optional\[str\]:
|
2046 + | #[allow(missing_docs)] // documentation missing in model
|
2047 + | pub b: ::std::option::Option<::std::string::String>,
|
2048 + | }
|
2049 + | impl StructureListMember {
|
2050 + | #[allow(missing_docs)] // documentation missing in model
|
2051 + | pub fn a(&self) -> ::std::option::Option<&str> {
|
2052 + | self.a.as_deref()
|
2053 + | }
|
2054 + | #[allow(missing_docs)] // documentation missing in model
|
2055 + | pub fn b(&self) -> ::std::option::Option<&str> {
|
2056 + | self.b.as_deref()
|
2057 + | }
|
2058 + | }
|
2059 + | #[allow(clippy::new_without_default)]
|
2060 + | #[allow(clippy::too_many_arguments)]
|
2061 + | #[::pyo3::pymethods]
|
2062 + | impl StructureListMember {
|
2063 + | #[new]
|
2064 + | pub fn new(
|
2065 + | a: ::std::option::Option<::std::string::String>,
|
2066 + | b: ::std::option::Option<::std::string::String>,
|
2067 + | ) -> Self {
|
2068 + | Self { a, b }
|
2069 + | }
|
2070 + | fn __repr__(&self) -> String {
|
2071 + | format!("{self:?}")
|
2072 + | }
|
2073 + | fn __str__(&self) -> String {
|
2074 + | format!("{self:?}")
|
2075 + | }
|
2076 + | }
|
2077 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<StructureListMember> {
|
2078 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2079 + | ob.extract::<StructureListMember>().map(Box::new)
|
2080 + | }
|
2081 + | }
|
2082 + |
|
2083 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<StructureListMember> {
|
2084 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2085 + | (*self).into_py(py)
|
2086 + | }
|
2087 + | }
|
2088 + | impl crate::constrained::Constrained for crate::model::StructureListMember {
|
2089 + | type Unconstrained = crate::model::structure_list_member_internal::Builder;
|
2090 + | }
|
2091 + | impl StructureListMember {
|
2092 + | /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
|
2093 + | pub fn builder() -> crate::model::structure_list_member::Builder {
|
2094 + | crate::model::structure_list_member::Builder::default()
|
2095 + | }
|
2096 + | }
|
2097 + |
|
2098 + | #[::pyo3::pyclass]
|
2099 + | /// :param foo typing.Optional\[str\]:
|
2100 + | /// :param nested typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested2\]:
|
2101 + | /// :rtype None:
|
2102 + | #[allow(missing_docs)] // documentation missing in model
|
2103 + | #[derive(
|
2104 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2105 + | )]
|
2106 + | pub struct RecursiveShapesInputOutputNested1 {
|
2107 + | #[pyo3(get, set)]
|
2108 + | /// :type typing.Optional\[str\]:
|
2109 + | #[allow(missing_docs)] // documentation missing in model
|
2110 + | pub foo: ::std::option::Option<::std::string::String>,
|
2111 + | #[pyo3(get, set)]
|
2112 + | /// :type typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested2\]:
|
2113 + | #[allow(missing_docs)] // documentation missing in model
|
2114 + | pub nested:
|
2115 + | ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
|
2116 + | }
|
2117 + | impl RecursiveShapesInputOutputNested1 {
|
2118 + | #[allow(missing_docs)] // documentation missing in model
|
2119 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
2120 + | self.foo.as_deref()
|
2121 + | }
|
2122 + | #[allow(missing_docs)] // documentation missing in model
|
2123 + | pub fn nested(
|
2124 + | &self,
|
2125 + | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
|
2126 + | self.nested.as_deref()
|
2127 + | }
|
2128 + | }
|
2129 + | #[allow(clippy::new_without_default)]
|
2130 + | #[allow(clippy::too_many_arguments)]
|
2131 + | #[::pyo3::pymethods]
|
2132 + | impl RecursiveShapesInputOutputNested1 {
|
2133 + | #[new]
|
2134 + | pub fn new(
|
2135 + | foo: ::std::option::Option<::std::string::String>,
|
2136 + | nested: ::std::option::Option<
|
2137 + | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
2138 + | >,
|
2139 + | ) -> Self {
|
2140 + | Self { foo, nested }
|
2141 + | }
|
2142 + | fn __repr__(&self) -> String {
|
2143 + | format!("{self:?}")
|
2144 + | }
|
2145 + | fn __str__(&self) -> String {
|
2146 + | format!("{self:?}")
|
2147 + | }
|
2148 + | }
|
2149 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RecursiveShapesInputOutputNested1> {
|
2150 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2151 + | ob.extract::<RecursiveShapesInputOutputNested1>()
|
2152 + | .map(Box::new)
|
2153 + | }
|
2154 + | }
|
2155 + |
|
2156 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RecursiveShapesInputOutputNested1> {
|
2157 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2158 + | (*self).into_py(py)
|
2159 + | }
|
2160 + | }
|
2161 + | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
|
2162 + | type Unconstrained = crate::model::recursive_shapes_input_output_nested1_internal::Builder;
|
2163 + | }
|
2164 + | impl RecursiveShapesInputOutputNested1 {
|
2165 + | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
2166 + | pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
|
2167 + | crate::model::recursive_shapes_input_output_nested1::Builder::default()
|
2168 + | }
|
2169 + | }
|
2170 + |
|
2171 + | #[::pyo3::pyclass]
|
2172 + | /// :param bar typing.Optional\[str\]:
|
2173 + | /// :param recursive_member typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested1\]:
|
2174 + | /// :rtype None:
|
2175 + | #[allow(missing_docs)] // documentation missing in model
|
2176 + | #[derive(
|
2177 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2178 + | )]
|
2179 + | pub struct RecursiveShapesInputOutputNested2 {
|
2180 + | #[pyo3(get, set)]
|
2181 + | /// :type typing.Optional\[str\]:
|
2182 + | #[allow(missing_docs)] // documentation missing in model
|
2183 + | pub bar: ::std::option::Option<::std::string::String>,
|
2184 + | #[pyo3(get, set)]
|
2185 + | /// :type typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested1\]:
|
2186 + | #[allow(missing_docs)] // documentation missing in model
|
2187 + | pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
2188 + | }
|
2189 + | impl RecursiveShapesInputOutputNested2 {
|
2190 + | #[allow(missing_docs)] // documentation missing in model
|
2191 + | pub fn bar(&self) -> ::std::option::Option<&str> {
|
2192 + | self.bar.as_deref()
|
2193 + | }
|
2194 + | #[allow(missing_docs)] // documentation missing in model
|
2195 + | pub fn recursive_member(
|
2196 + | &self,
|
2197 + | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
|
2198 + | self.recursive_member.as_ref()
|
2199 + | }
|
2200 + | }
|
2201 + | #[allow(clippy::new_without_default)]
|
2202 + | #[allow(clippy::too_many_arguments)]
|
2203 + | #[::pyo3::pymethods]
|
2204 + | impl RecursiveShapesInputOutputNested2 {
|
2205 + | #[new]
|
2206 + | pub fn new(
|
2207 + | bar: ::std::option::Option<::std::string::String>,
|
2208 + | recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
2209 + | ) -> Self {
|
2210 + | Self {
|
2211 + | bar,
|
2212 + | recursive_member,
|
2213 + | }
|
2214 + | }
|
2215 + | fn __repr__(&self) -> String {
|
2216 + | format!("{self:?}")
|
2217 + | }
|
2218 + | fn __str__(&self) -> String {
|
2219 + | format!("{self:?}")
|
2220 + | }
|
2221 + | }
|
2222 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RecursiveShapesInputOutputNested2> {
|
2223 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2224 + | ob.extract::<RecursiveShapesInputOutputNested2>()
|
2225 + | .map(Box::new)
|
2226 + | }
|
2227 + | }
|
2228 + |
|
2229 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RecursiveShapesInputOutputNested2> {
|
2230 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2231 + | (*self).into_py(py)
|
2232 + | }
|
2233 + | }
|
2234 + | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
|
2235 + | type Unconstrained = crate::model::recursive_shapes_input_output_nested2_internal::Builder;
|
2236 + | }
|
2237 + | impl RecursiveShapesInputOutputNested2 {
|
2238 + | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
2239 + | pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
|
2240 + | crate::model::recursive_shapes_input_output_nested2::Builder::default()
|
2241 + | }
|
2242 + | }
|
2243 + |
|
2244 + | #[allow(missing_docs)] // documentation missing in model
|
2245 + | ///
|
2246 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2247 + | /// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
|
2248 + | ///
|
2249 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2250 + | ///
|
2251 + | #[derive(
|
2252 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2253 + | )]
|
2254 + | pub(crate) struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
|
2255 + | impl IntegerEnumSet {
|
2256 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
2257 + | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
2258 + | self.0
|
2259 + | }
|
2260 + |
|
2261 + | fn check_unique_items(
|
2262 + | items: ::std::vec::Vec<i32>,
|
2263 + | ) -> Result<::std::vec::Vec<i32>, crate::model::integer_enum_set_internal::ConstraintViolation>
|
2264 + | {
|
2265 + | let mut seen = ::std::collections::HashMap::new();
|
2266 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
2267 + | for (idx, item) in items.iter().enumerate() {
|
2268 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
2269 + | duplicate_indices.push(prev_idx);
|
2270 + | }
|
2271 + | }
|
2272 + |
|
2273 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
2274 + | for idx in &duplicate_indices {
|
2275 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
2276 + | last_duplicate_indices.push(prev_idx);
|
2277 + | }
|
2278 + | }
|
2279 + | duplicate_indices.extend(last_duplicate_indices);
|
2280 + |
|
2281 + | if !duplicate_indices.is_empty() {
|
2282 + | debug_assert!(duplicate_indices.len() >= 2);
|
2283 + | Err(
|
2284 + | crate::model::integer_enum_set_internal::ConstraintViolation::UniqueItems {
|
2285 + | duplicate_indices,
|
2286 + | original: items,
|
2287 + | },
|
2288 + | )
|
2289 + | } else {
|
2290 + | Ok(items)
|
2291 + | }
|
2292 + | }
|
2293 + | }
|
2294 + | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
|
2295 + | type Error = crate::model::integer_enum_set_internal::ConstraintViolation;
|
2296 + |
|
2297 + | /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
2298 + | fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
|
2299 + | let value = Self::check_unique_items(value)?;
|
2300 + |
|
2301 + | Ok(Self(value))
|
2302 + | }
|
2303 + | }
|
2304 + |
|
2305 + | impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
|
2306 + | fn from(value: IntegerEnumSet) -> Self {
|
2307 + | value.into_inner()
|
2308 + | }
|
2309 + | }
|
2310 + | impl crate::constrained::Constrained for IntegerEnumSet {
|
2311 + | type Unconstrained =
|
2312 + | crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
|
2313 + | }
|
2314 + |
|
2315 + | #[allow(missing_docs)] // documentation missing in model
|
2316 + | ///
|
2317 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2318 + | /// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
|
2319 + | ///
|
2320 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2321 + | ///
|
2322 + | #[derive(
|
2323 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2324 + | )]
|
2325 + | pub(crate) struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
|
2326 + | impl FooEnumSet {
|
2327 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
|
2328 + | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
|
2329 + | self.0
|
2330 + | }
|
2331 + |
|
2332 + | fn check_unique_items(
|
2333 + | items: ::std::vec::Vec<crate::model::FooEnum>,
|
2334 + | ) -> Result<
|
2335 + | ::std::vec::Vec<crate::model::FooEnum>,
|
2336 + | crate::model::foo_enum_set_internal::ConstraintViolation,
|
2337 + | > {
|
2338 + | let mut seen = ::std::collections::HashMap::new();
|
2339 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
2340 + | for (idx, item) in items.iter().enumerate() {
|
2341 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
2342 + | duplicate_indices.push(prev_idx);
|
2343 + | }
|
2344 + | }
|
2345 + |
|
2346 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
2347 + | for idx in &duplicate_indices {
|
2348 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
2349 + | last_duplicate_indices.push(prev_idx);
|
2350 + | }
|
2351 + | }
|
2352 + | duplicate_indices.extend(last_duplicate_indices);
|
2353 + |
|
2354 + | if !duplicate_indices.is_empty() {
|
2355 + | debug_assert!(duplicate_indices.len() >= 2);
|
2356 + | Err(
|
2357 + | crate::model::foo_enum_set_internal::ConstraintViolation::UniqueItems {
|
2358 + | duplicate_indices,
|
2359 + | original: items,
|
2360 + | },
|
2361 + | )
|
2362 + | } else {
|
2363 + | Ok(items)
|
2364 + | }
|
2365 + | }
|
2366 + | }
|
2367 + | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
|
2368 + | type Error = crate::model::foo_enum_set_internal::ConstraintViolation;
|
2369 + |
|
2370 + | /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
|
2371 + | fn try_from(value: ::std::vec::Vec<crate::model::FooEnum>) -> Result<Self, Self::Error> {
|
2372 + | let value = Self::check_unique_items(value)?;
|
2373 + |
|
2374 + | Ok(Self(value))
|
2375 + | }
|
2376 + | }
|
2377 + |
|
2378 + | impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
|
2379 + | fn from(value: FooEnumSet) -> Self {
|
2380 + | value.into_inner()
|
2381 + | }
|
2382 + | }
|
2383 + | impl crate::constrained::Constrained for FooEnumSet {
|
2384 + | type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
|
2385 + | }
|
2386 + |
|
2387 + | #[::pyo3::pyclass]
|
2388 + | /// :param foo typing.Optional\[str\]:
|
2389 + | /// :rtype None:
|
2390 + | #[allow(missing_docs)] // documentation missing in model
|
2391 + | #[derive(
|
2392 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2393 + | )]
|
2394 + | pub struct ComplexNestedErrorData {
|
2395 + | #[pyo3(get, set)]
|
2396 + | /// :type typing.Optional\[str\]:
|
2397 + | #[allow(missing_docs)] // documentation missing in model
|
2398 + | pub foo: ::std::option::Option<::std::string::String>,
|
2399 + | }
|
2400 + | impl ComplexNestedErrorData {
|
2401 + | #[allow(missing_docs)] // documentation missing in model
|
2402 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
2403 + | self.foo.as_deref()
|
2404 + | }
|
2405 + | }
|
2406 + | #[allow(clippy::new_without_default)]
|
2407 + | #[allow(clippy::too_many_arguments)]
|
2408 + | #[::pyo3::pymethods]
|
2409 + | impl ComplexNestedErrorData {
|
2410 + | #[new]
|
2411 + | pub fn new(foo: ::std::option::Option<::std::string::String>) -> Self {
|
2412 + | Self { foo }
|
2413 + | }
|
2414 + | fn __repr__(&self) -> String {
|
2415 + | format!("{self:?}")
|
2416 + | }
|
2417 + | fn __str__(&self) -> String {
|
2418 + | format!("{self:?}")
|
2419 + | }
|
2420 + | }
|
2421 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ComplexNestedErrorData> {
|
2422 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2423 + | ob.extract::<ComplexNestedErrorData>().map(Box::new)
|
2424 + | }
|
2425 + | }
|
2426 + |
|
2427 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ComplexNestedErrorData> {
|
2428 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2429 + | (*self).into_py(py)
|
2430 + | }
|
2431 + | }
|
2432 + | impl ComplexNestedErrorData {
|
2433 + | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
2434 + | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
2435 + | crate::model::complex_nested_error_data::Builder::default()
|
2436 + | }
|
2437 + | }
|
2438 + |
|
2439 + | #[allow(missing_docs)] // documentation missing in model
|
2440 + | #[derive(
|
2441 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2442 + | )]
|
2443 + | pub enum UnionPayload {
|
2444 + | #[allow(missing_docs)] // documentation missing in model
|
2445 + | Greeting(::std::string::String),
|
2446 + | }
|
2447 + | impl UnionPayload {
|
2448 + | #[allow(irrefutable_let_patterns)]
|
2449 + | /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
|
2450 + | /// Returns `Err(&Self)` if it can't be converted.
|
2451 + | pub fn as_greeting(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
2452 + | if let UnionPayload::Greeting(val) = &self {
|
2453 + | ::std::result::Result::Ok(val)
|
2454 + | } else {
|
2455 + | ::std::result::Result::Err(self)
|
2456 + | }
|
2457 + | }
|
2458 + | /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
|
2459 + | pub fn is_greeting(&self) -> bool {
|
2460 + | self.as_greeting().is_ok()
|
2461 + | }
|
2462 + | }
|
2463 + | #[pyo3::pyclass(name = "UnionPayload")]
|
2464 + | #[derive(
|
2465 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2466 + | )]
|
2467 + | pub struct PyUnionMarkerUnionPayload(pub UnionPayload);
|
2468 + | #[::pyo3::pymethods]
|
2469 + | impl PyUnionMarkerUnionPayload {
|
2470 + | #[allow(irrefutable_let_patterns)]
|
2471 + | #[staticmethod]
|
2472 + | /// Creates a new union instance of [`Greeting`](crate::model::UnionPayload::Greeting)
|
2473 + | /// :param data str:
|
2474 + | /// :rtype UnionPayload:
|
2475 + | pub fn greeting(data: ::std::string::String) -> Self {
|
2476 + | Self(UnionPayload::Greeting(data))
|
2477 + | }
|
2478 + | /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
|
2479 + | /// :rtype str:
|
2480 + | pub fn as_greeting(&self) -> ::pyo3::PyResult<::std::string::String> {
|
2481 + | match self.0.as_greeting() {
|
2482 + | Ok(variant) => Ok(variant.clone()),
|
2483 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
2484 + | r"UnionPayload variant is not of type str",
|
2485 + | )),
|
2486 + | }
|
2487 + | }
|
2488 + | /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
|
2489 + | /// :rtype bool:
|
2490 + | pub fn is_greeting(&self) -> bool {
|
2491 + | self.0.is_greeting()
|
2492 + | }
|
2493 + | }
|
2494 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for UnionPayload {
|
2495 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2496 + | PyUnionMarkerUnionPayload(self).into_py(py)
|
2497 + | }
|
2498 + | }
|
2499 + | impl<'source> ::pyo3::FromPyObject<'source> for UnionPayload {
|
2500 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2501 + | let data: PyUnionMarkerUnionPayload = obj.extract()?;
|
2502 + | Ok(data.0)
|
2503 + | }
|
2504 + | }
|
2505 + |
|
2506 + | #[::pyo3::pyclass]
|
2507 + | #[allow(missing_docs)] // documentation missing in model
|
2508 + | #[derive(
|
2509 + | ::std::clone::Clone,
|
2510 + | ::std::cmp::Eq,
|
2511 + | ::std::cmp::Ord,
|
2512 + | ::std::cmp::PartialEq,
|
2513 + | ::std::cmp::PartialOrd,
|
2514 + | ::std::fmt::Debug,
|
2515 + | ::std::hash::Hash,
|
2516 + | )]
|
2517 + | pub enum StringEnum {
|
2518 + | #[allow(missing_docs)] // documentation missing in model
|
2519 + | V,
|
2520 + | }
|
2521 + | ///
|
2522 + | pub(crate) mod string_enum_internal {
|
2523 + | #[derive(Debug, PartialEq)]
|
2524 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
2525 + |
|
2526 + | impl ::std::fmt::Display for ConstraintViolation {
|
2527 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2528 + | write!(
|
2529 + | f,
|
2530 + | r#"Value provided for 'aws.protocoltests.restjson#StringEnum' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#
|
2531 + | )
|
2532 + | }
|
2533 + | }
|
2534 + |
|
2535 + | impl ::std::error::Error for ConstraintViolation {}
|
2536 + | impl ConstraintViolation {
|
2537 + | pub(crate) fn as_validation_exception_field(
|
2538 + | self,
|
2539 + | path: ::std::string::String,
|
2540 + | ) -> crate::model::ValidationExceptionField {
|
2541 + | crate::model::ValidationExceptionField {
|
2542 + | message: format!(
|
2543 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
|
2544 + | &path
|
2545 + | ),
|
2546 + | path,
|
2547 + | }
|
2548 + | }
|
2549 + | }
|
2550 + | }
|
2551 + | impl ::std::convert::TryFrom<&str> for StringEnum {
|
2552 + | type Error = crate::model::string_enum_internal::ConstraintViolation;
|
2553 + | fn try_from(
|
2554 + | s: &str,
|
2555 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
2556 + | match s {
|
2557 + | "enumvalue" => Ok(StringEnum::V),
|
2558 + | _ => Err(crate::model::string_enum_internal::ConstraintViolation(
|
2559 + | s.to_owned(),
|
2560 + | )),
|
2561 + | }
|
2562 + | }
|
2563 + | }
|
2564 + | impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
|
2565 + | type Error = crate::model::string_enum_internal::ConstraintViolation;
|
2566 + | fn try_from(
|
2567 + | s: ::std::string::String,
|
2568 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
2569 + | {
|
2570 + | s.as_str().try_into()
|
2571 + | }
|
2572 + | }
|
2573 + | impl std::str::FromStr for StringEnum {
|
2574 + | type Err = crate::model::string_enum_internal::ConstraintViolation;
|
2575 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
2576 + | Self::try_from(s)
|
2577 + | }
|
2578 + | }
|
2579 + | impl StringEnum {
|
2580 + | /// Returns the `&str` value of the enum member.
|
2581 + | pub fn as_str(&self) -> &str {
|
2582 + | match self {
|
2583 + | StringEnum::V => "enumvalue",
|
2584 + | }
|
2585 + | }
|
2586 + | /// Returns all the `&str` representations of the enum members.
|
2587 + | pub const fn values() -> &'static [&'static str] {
|
2588 + | &["enumvalue"]
|
2589 + | }
|
2590 + | }
|
2591 + | impl ::std::convert::AsRef<str> for StringEnum {
|
2592 + | fn as_ref(&self) -> &str {
|
2593 + | self.as_str()
|
2594 + | }
|
2595 + | }
|
2596 + | #[::pyo3::pymethods]
|
2597 + | impl StringEnum {
|
2598 + | #[getter]
|
2599 + | pub fn name(&self) -> &str {
|
2600 + | match self {
|
2601 + | StringEnum::V => "V",
|
2602 + | }
|
2603 + | }
|
2604 + | #[getter]
|
2605 + | pub fn value(&self) -> &str {
|
2606 + | self.as_str()
|
2607 + | }
|
2608 + | fn __repr__(&self) -> String {
|
2609 + | self.as_str().to_owned()
|
2610 + | }
|
2611 + | fn __str__(&self) -> String {
|
2612 + | self.as_str().to_owned()
|
2613 + | }
|
2614 + | }
|
2615 + | impl crate::constrained::Constrained for StringEnum {
|
2616 + | type Unconstrained = ::std::string::String;
|
2617 + | }
|
2618 + |
|
2619 + | impl ::std::convert::From<::std::string::String>
|
2620 + | for crate::constrained::MaybeConstrained<crate::model::StringEnum>
|
2621 + | {
|
2622 + | fn from(value: ::std::string::String) -> Self {
|
2623 + | Self::Unconstrained(value)
|
2624 + | }
|
2625 + | }
|
2626 + |
|
2627 + | #[::pyo3::pyclass]
|
2628 + | /// :param greeting typing.Optional\[str\]:
|
2629 + | /// :param name typing.Optional\[str\]:
|
2630 + | /// :rtype None:
|
2631 + | #[allow(missing_docs)] // documentation missing in model
|
2632 + | #[derive(
|
2633 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2634 + | )]
|
2635 + | pub struct NestedPayload {
|
2636 + | #[pyo3(get, set)]
|
2637 + | /// :type typing.Optional\[str\]:
|
2638 + | #[allow(missing_docs)] // documentation missing in model
|
2639 + | pub greeting: ::std::option::Option<::std::string::String>,
|
2640 + | #[pyo3(get, set)]
|
2641 + | /// :type typing.Optional\[str\]:
|
2642 + | #[allow(missing_docs)] // documentation missing in model
|
2643 + | pub name: ::std::option::Option<::std::string::String>,
|
2644 + | }
|
2645 + | impl NestedPayload {
|
2646 + | #[allow(missing_docs)] // documentation missing in model
|
2647 + | pub fn greeting(&self) -> ::std::option::Option<&str> {
|
2648 + | self.greeting.as_deref()
|
2649 + | }
|
2650 + | #[allow(missing_docs)] // documentation missing in model
|
2651 + | pub fn name(&self) -> ::std::option::Option<&str> {
|
2652 + | self.name.as_deref()
|
2653 + | }
|
2654 + | }
|
2655 + | #[allow(clippy::new_without_default)]
|
2656 + | #[allow(clippy::too_many_arguments)]
|
2657 + | #[::pyo3::pymethods]
|
2658 + | impl NestedPayload {
|
2659 + | #[new]
|
2660 + | pub fn new(
|
2661 + | greeting: ::std::option::Option<::std::string::String>,
|
2662 + | name: ::std::option::Option<::std::string::String>,
|
2663 + | ) -> Self {
|
2664 + | Self { greeting, name }
|
2665 + | }
|
2666 + | fn __repr__(&self) -> String {
|
2667 + | format!("{self:?}")
|
2668 + | }
|
2669 + | fn __str__(&self) -> String {
|
2670 + | format!("{self:?}")
|
2671 + | }
|
2672 + | }
|
2673 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<NestedPayload> {
|
2674 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
2675 + | ob.extract::<NestedPayload>().map(Box::new)
|
2676 + | }
|
2677 + | }
|
2678 + |
|
2679 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<NestedPayload> {
|
2680 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
2681 + | (*self).into_py(py)
|
2682 + | }
|
2683 + | }
|
2684 + | impl crate::constrained::Constrained for crate::model::NestedPayload {
|
2685 + | type Unconstrained = crate::model::nested_payload_internal::Builder;
|
2686 + | }
|
2687 + | impl NestedPayload {
|
2688 + | /// Creates a new builder-style object to manufacture [`NestedPayload`](crate::model::NestedPayload).
|
2689 + | pub fn builder() -> crate::model::nested_payload::Builder {
|
2690 + | crate::model::nested_payload::Builder::default()
|
2691 + | }
|
2692 + | }
|
2693 + |
|
2694 + | #[allow(missing_docs)] // documentation missing in model
|
2695 + | ///
|
2696 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2697 + | /// [constraint traits]. Use [`IntegerSet::try_from`] to construct values of this type.
|
2698 + | ///
|
2699 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2700 + | ///
|
2701 + | #[derive(
|
2702 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
2703 + | )]
|
2704 + | pub(crate) struct IntegerSet(pub(crate) ::std::vec::Vec<i32>);
|
2705 + | impl IntegerSet {
|
2706 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
2707 + | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
2708 + | self.0
|
2709 + | }
|
2710 + |
|
2711 + | fn check_unique_items(
|
2712 + | items: ::std::vec::Vec<i32>,
|
2713 + | ) -> Result<::std::vec::Vec<i32>, crate::model::integer_set_internal::ConstraintViolation> {
|
2714 + | let mut seen = ::std::collections::HashMap::new();
|
2715 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
2716 + | for (idx, item) in items.iter().enumerate() {
|
2717 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
2718 + | duplicate_indices.push(prev_idx);
|
2719 + | }
|
2720 + | }
|
2721 + |
|
2722 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
2723 + | for idx in &duplicate_indices {
|
2724 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
2725 + | last_duplicate_indices.push(prev_idx);
|
2726 + | }
|
2727 + | }
|
2728 + | duplicate_indices.extend(last_duplicate_indices);
|
2729 + |
|
2730 + | if !duplicate_indices.is_empty() {
|
2731 + | debug_assert!(duplicate_indices.len() >= 2);
|
2732 + | Err(
|
2733 + | crate::model::integer_set_internal::ConstraintViolation::UniqueItems {
|
2734 + | duplicate_indices,
|
2735 + | original: items,
|
2736 + | },
|
2737 + | )
|
2738 + | } else {
|
2739 + | Ok(items)
|
2740 + | }
|
2741 + | }
|
2742 + | }
|
2743 + | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerSet {
|
2744 + | type Error = crate::model::integer_set_internal::ConstraintViolation;
|
2745 + |
|
2746 + | /// Constructs a `IntegerSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
2747 + | fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
|
2748 + | let value = Self::check_unique_items(value)?;
|
2749 + |
|
2750 + | Ok(Self(value))
|
2751 + | }
|
2752 + | }
|
2753 + |
|
2754 + | impl ::std::convert::From<IntegerSet> for ::std::vec::Vec<i32> {
|
2755 + | fn from(value: IntegerSet) -> Self {
|
2756 + | value.into_inner()
|
2757 + | }
|
2758 + | }
|
2759 + | impl crate::constrained::Constrained for IntegerSet {
|
2760 + | type Unconstrained = crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained;
|
2761 + | }
|
2762 + |
|
2763 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2764 + | ///
|
2765 + | pub mod validation_exception_field {
|
2766 + |
|
2767 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2768 + | /// Holds one variant for each of the ways the builder can fail.
|
2769 + |
|
2770 + | #[allow(clippy::enum_variant_names)]
|
2771 + | pub enum ConstraintViolation {
|
2772 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
2773 + | MissingPath,
|
2774 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
2775 + | MissingMessage,
|
2776 + | }
|
2777 + | impl ::std::fmt::Display for ConstraintViolation {
|
2778 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2779 + | match self {
|
2780 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
2781 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
2782 + | }
|
2783 + | }
|
2784 + | }
|
2785 + | impl ::std::error::Error for ConstraintViolation {}
|
2786 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
2787 + | type Error = ConstraintViolation;
|
2788 + |
|
2789 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
2790 + | builder.build()
|
2791 + | }
|
2792 + | }
|
2793 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2794 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2795 + | pub struct Builder {
|
2796 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
2797 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
2798 + | }
|
2799 + | impl Builder {
|
2800 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
2801 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
2802 + | self.path = Some(input);
|
2803 + | self
|
2804 + | }
|
2805 + | /// A detailed description of the validation failure.
|
2806 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
2807 + | self.message = Some(input);
|
2808 + | self
|
2809 + | }
|
2810 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2811 + | ///
|
2812 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if you do not provide a value for all non-`Option`al members.
|
2813 + | ///
|
2814 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
2815 + | self.build_enforcing_required_and_enum_traits()
|
2816 + | }
|
2817 + | fn build_enforcing_required_and_enum_traits(
|
2818 + | self,
|
2819 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
2820 + | Ok(crate::model::ValidationExceptionField {
|
2821 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
2822 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
2823 + | })
|
2824 + | }
|
1398 2825 | }
|
1399 2826 | }
|
2827 + | /// See [`Dialog`](crate::model::Dialog).
|
2828 + | ///
|
2829 + | pub(crate) mod dialog_internal {
|
1400 2830 |
|
1401 - | #[::pyo3::pyclass]
|
1402 - | /// :param bar typing.Optional\[str\]:
|
1403 - | /// :param recursive_member typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested1\]:
|
1404 - | /// :rtype None:
|
1405 - | #[allow(missing_docs)] // documentation missing in model
|
1406 - | #[derive(
|
1407 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1408 - | )]
|
1409 - | pub struct RecursiveShapesInputOutputNested2 {
|
1410 - | #[pyo3(get, set)]
|
1411 - | /// :type typing.Optional\[str\]:
|
2831 + | impl ::std::convert::From<Builder> for crate::model::Dialog {
|
2832 + | fn from(builder: Builder) -> Self {
|
2833 + | builder.build()
|
2834 + | }
|
2835 + | }
|
2836 + | /// A builder for [`Dialog`](crate::model::Dialog).
|
2837 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2838 + | pub(crate) struct Builder {
|
2839 + | pub(crate) language: ::std::option::Option<::std::string::String>,
|
2840 + | pub(crate) greeting: ::std::option::Option<::std::string::String>,
|
2841 + | pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
|
2842 + | }
|
2843 + | impl Builder {
|
1412 2844 | #[allow(missing_docs)] // documentation missing in model
|
1413 - | pub bar: ::std::option::Option<::std::string::String>,
|
1414 - | #[pyo3(get, set)]
|
1415 - | /// :type typing.Optional\[rest_json.model.RecursiveShapesInputOutputNested1\]:
|
2845 + | pub(crate) fn set_language(
|
2846 + | mut self,
|
2847 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2848 + | ) -> Self {
|
2849 + | self.language = input.map(|v| v.into());
|
2850 + | self
|
2851 + | }
|
1416 2852 | #[allow(missing_docs)] // documentation missing in model
|
1417 - | pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
2853 + | pub(crate) fn set_greeting(
|
2854 + | mut self,
|
2855 + | input: impl ::std::convert::Into<::std::string::String>,
|
2856 + | ) -> Self {
|
2857 + | self.greeting = Some(input.into());
|
2858 + | self
|
2859 + | }
|
2860 + | #[allow(missing_docs)] // documentation missing in model
|
2861 + | pub(crate) fn set_farewell(
|
2862 + | mut self,
|
2863 + | input: Option<impl ::std::convert::Into<crate::model::Farewell>>,
|
2864 + | ) -> Self {
|
2865 + | self.farewell = input.map(|v| v.into());
|
2866 + | self
|
2867 + | }
|
2868 + | /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
|
2869 + | pub fn build(self) -> crate::model::Dialog {
|
2870 + | self.build_enforcing_all_constraints()
|
2871 + | }
|
2872 + | fn build_enforcing_all_constraints(self) -> crate::model::Dialog {
|
2873 + | crate::model::Dialog {
|
2874 + | language: self.language,
|
2875 + | greeting: self.greeting.unwrap_or_else(
|
2876 + | #[allow(clippy::redundant_closure)]
|
2877 + | || String::from("hi"),
|
2878 + | ),
|
2879 + | farewell: self.farewell,
|
2880 + | }
|
2881 + | }
|
2882 + | }
|
1418 2883 | }
|
1419 - | impl RecursiveShapesInputOutputNested2 {
|
2884 + | /// See [`Dialog`](crate::model::Dialog).
|
2885 + | ///
|
2886 + | pub mod dialog {
|
2887 + |
|
2888 + | impl ::std::convert::From<Builder> for crate::model::Dialog {
|
2889 + | fn from(builder: Builder) -> Self {
|
2890 + | builder.build()
|
2891 + | }
|
2892 + | }
|
2893 + | /// A builder for [`Dialog`](crate::model::Dialog).
|
2894 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2895 + | pub struct Builder {
|
2896 + | pub(crate) language: ::std::option::Option<::std::string::String>,
|
2897 + | pub(crate) greeting: ::std::option::Option<::std::string::String>,
|
2898 + | pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
|
2899 + | }
|
2900 + | impl Builder {
|
1420 2901 | #[allow(missing_docs)] // documentation missing in model
|
1421 - | pub fn bar(&self) -> ::std::option::Option<&str> {
|
1422 - | self.bar.as_deref()
|
2902 + | pub fn language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2903 + | self.language = input;
|
2904 + | self
|
1423 2905 | }
|
1424 2906 | #[allow(missing_docs)] // documentation missing in model
|
1425 - | pub fn recursive_member(
|
1426 - | &self,
|
1427 - | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
|
1428 - | self.recursive_member.as_ref()
|
2907 + | pub fn greeting(mut self, input: ::std::string::String) -> Self {
|
2908 + | self.greeting = Some(input);
|
2909 + | self
|
2910 + | }
|
2911 + | #[allow(missing_docs)] // documentation missing in model
|
2912 + | pub fn farewell(mut self, input: ::std::option::Option<crate::model::Farewell>) -> Self {
|
2913 + | self.farewell = input;
|
2914 + | self
|
2915 + | }
|
2916 + | /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
|
2917 + | pub fn build(self) -> crate::model::Dialog {
|
2918 + | self.build_enforcing_required_and_enum_traits()
|
2919 + | }
|
2920 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::Dialog {
|
2921 + | crate::model::Dialog {
|
2922 + | language: self.language,
|
2923 + | greeting: self.greeting.unwrap_or_else(
|
2924 + | #[allow(clippy::redundant_closure)]
|
2925 + | || String::from("hi"),
|
2926 + | ),
|
2927 + | farewell: self.farewell,
|
2928 + | }
|
2929 + | }
|
1429 2930 | }
|
1430 2931 | }
|
1431 - | #[allow(clippy::new_without_default)]
|
1432 - | #[allow(clippy::too_many_arguments)]
|
1433 - | #[::pyo3::pymethods]
|
1434 - | impl RecursiveShapesInputOutputNested2 {
|
1435 - | #[new]
|
1436 - | pub fn new(
|
1437 - | bar: ::std::option::Option<::std::string::String>,
|
1438 - | recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
2932 + | /// See [`Farewell`](crate::model::Farewell).
|
2933 + | ///
|
2934 + | pub(crate) mod farewell_internal {
|
2935 + |
|
2936 + | impl ::std::convert::From<Builder> for crate::model::Farewell {
|
2937 + | fn from(builder: Builder) -> Self {
|
2938 + | builder.build()
|
2939 + | }
|
2940 + | }
|
2941 + | /// A builder for [`Farewell`](crate::model::Farewell).
|
2942 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2943 + | pub(crate) struct Builder {
|
2944 + | pub(crate) phrase: ::std::option::Option<::std::string::String>,
|
2945 + | }
|
2946 + | impl Builder {
|
2947 + | #[allow(missing_docs)] // documentation missing in model
|
2948 + | pub(crate) fn set_phrase(
|
2949 + | mut self,
|
2950 + | input: impl ::std::convert::Into<::std::string::String>,
|
1439 2951 | ) -> Self {
|
1440 - | Self {
|
1441 - | bar,
|
1442 - | recursive_member,
|
2952 + | self.phrase = Some(input.into());
|
2953 + | self
|
2954 + | }
|
2955 + | /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
|
2956 + | pub fn build(self) -> crate::model::Farewell {
|
2957 + | self.build_enforcing_all_constraints()
|
2958 + | }
|
2959 + | fn build_enforcing_all_constraints(self) -> crate::model::Farewell {
|
2960 + | crate::model::Farewell {
|
2961 + | phrase: self.phrase.unwrap_or_else(
|
2962 + | #[allow(clippy::redundant_closure)]
|
2963 + | || String::from("bye"),
|
2964 + | ),
|
2965 + | }
|
2966 + | }
|
2967 + | }
|
2968 + | }
|
2969 + | /// See [`Farewell`](crate::model::Farewell).
|
2970 + | ///
|
2971 + | pub mod farewell {
|
2972 + |
|
2973 + | impl ::std::convert::From<Builder> for crate::model::Farewell {
|
2974 + | fn from(builder: Builder) -> Self {
|
2975 + | builder.build()
|
2976 + | }
|
2977 + | }
|
2978 + | /// A builder for [`Farewell`](crate::model::Farewell).
|
2979 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2980 + | pub struct Builder {
|
2981 + | pub(crate) phrase: ::std::option::Option<::std::string::String>,
|
2982 + | }
|
2983 + | impl Builder {
|
2984 + | #[allow(missing_docs)] // documentation missing in model
|
2985 + | pub fn phrase(mut self, input: ::std::string::String) -> Self {
|
2986 + | self.phrase = Some(input);
|
2987 + | self
|
2988 + | }
|
2989 + | /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
|
2990 + | pub fn build(self) -> crate::model::Farewell {
|
2991 + | self.build_enforcing_required_and_enum_traits()
|
2992 + | }
|
2993 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::Farewell {
|
2994 + | crate::model::Farewell {
|
2995 + | phrase: self.phrase.unwrap_or_else(
|
2996 + | #[allow(clippy::redundant_closure)]
|
2997 + | || String::from("bye"),
|
2998 + | ),
|
2999 + | }
|
3000 + | }
|
3001 + | }
|
3002 + | }
|
3003 + | /// See [`TopLevel`](crate::model::TopLevel).
|
3004 + | ///
|
3005 + | pub(crate) mod top_level_internal {
|
3006 + |
|
3007 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
3008 + | /// Holds one variant for each of the ways the builder can fail.
|
3009 + | #[non_exhaustive]
|
3010 + | #[allow(clippy::enum_variant_names)]
|
3011 + | pub(crate) enum ConstraintViolation {
|
3012 + | /// `dialog` was not provided but it is required when building `TopLevel`.
|
3013 + | MissingDialog,
|
3014 + | }
|
3015 + | impl ::std::fmt::Display for ConstraintViolation {
|
3016 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3017 + | match self {
|
3018 + | ConstraintViolation::MissingDialog => write!(
|
3019 + | f,
|
3020 + | "`dialog` was not provided but it is required when building `TopLevel`"
|
3021 + | ),
|
3022 + | }
|
3023 + | }
|
3024 + | }
|
3025 + | impl ::std::error::Error for ConstraintViolation {}
|
3026 + | impl ConstraintViolation {
|
3027 + | pub(crate) fn as_validation_exception_field(
|
3028 + | self,
|
3029 + | path: ::std::string::String,
|
3030 + | ) -> crate::model::ValidationExceptionField {
|
3031 + | match self {
|
3032 + | ConstraintViolation::MissingDialog => crate::model::ValidationExceptionField {
|
3033 + | message: format!("Value at '{}/dialog' failed to satisfy constraint: Member must not be null", path),
|
3034 + | path: path + "/dialog",
|
3035 + | },
|
3036 + | }
|
3037 + | }
|
3038 + | }
|
3039 + | impl ::std::convert::From<Builder>
|
3040 + | for crate::constrained::MaybeConstrained<crate::model::TopLevel>
|
3041 + | {
|
3042 + | fn from(builder: Builder) -> Self {
|
3043 + | Self::Unconstrained(builder)
|
3044 + | }
|
3045 + | }
|
3046 + | impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
|
3047 + | type Error = ConstraintViolation;
|
3048 + |
|
3049 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
3050 + | builder.build()
|
3051 + | }
|
3052 + | }
|
3053 + | /// A builder for [`TopLevel`](crate::model::TopLevel).
|
3054 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3055 + | pub(crate) struct Builder {
|
3056 + | pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
|
3057 + | pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
|
3058 + | pub(crate) dialog_map: ::std::option::Option<
|
3059 + | ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
3060 + | >,
|
3061 + | }
|
3062 + | impl Builder {
|
3063 + | #[allow(missing_docs)] // documentation missing in model
|
3064 + | pub(crate) fn set_dialog(
|
3065 + | mut self,
|
3066 + | input: impl ::std::convert::Into<crate::model::Dialog>,
|
3067 + | ) -> Self {
|
3068 + | self.dialog = Some(input.into());
|
3069 + | self
|
3070 + | }
|
3071 + | #[allow(missing_docs)] // documentation missing in model
|
3072 + | pub(crate) fn set_dialog_list(
|
3073 + | mut self,
|
3074 + | input: impl ::std::convert::Into<::std::vec::Vec<crate::model::Dialog>>,
|
3075 + | ) -> Self {
|
3076 + | self.dialog_list = Some(input.into());
|
3077 + | self
|
3078 + | }
|
3079 + | #[allow(missing_docs)] // documentation missing in model
|
3080 + | pub(crate) fn set_dialog_map(
|
3081 + | mut self,
|
3082 + | input: impl ::std::convert::Into<
|
3083 + | ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
3084 + | >,
|
3085 + | ) -> Self {
|
3086 + | self.dialog_map = Some(input.into());
|
3087 + | self
|
3088 + | }
|
3089 + | /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
|
3090 + | ///
|
3091 + | /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
|
3092 + | ///
|
3093 + | pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
3094 + | self.build_enforcing_all_constraints()
|
3095 + | }
|
3096 + | fn build_enforcing_all_constraints(
|
3097 + | self,
|
3098 + | ) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
3099 + | Ok(crate::model::TopLevel {
|
3100 + | dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
|
3101 + | dialog_list: self.dialog_list.unwrap_or_else(
|
3102 + | #[allow(clippy::redundant_closure)]
|
3103 + | || ::std::vec::Vec::new(),
|
3104 + | ),
|
3105 + | dialog_map: self.dialog_map.unwrap_or_else(
|
3106 + | #[allow(clippy::redundant_closure)]
|
3107 + | || ::std::collections::HashMap::new(),
|
3108 + | ),
|
3109 + | })
|
3110 + | }
|
3111 + | }
|
3112 + | }
|
3113 + | /// See [`TopLevel`](crate::model::TopLevel).
|
3114 + | ///
|
3115 + | pub mod top_level {
|
3116 + |
|
3117 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
3118 + | /// Holds one variant for each of the ways the builder can fail.
|
3119 + |
|
3120 + | #[allow(clippy::enum_variant_names)]
|
3121 + | pub enum ConstraintViolation {
|
3122 + | /// `dialog` was not provided but it is required when building `TopLevel`.
|
3123 + | MissingDialog,
|
3124 + | }
|
3125 + | impl ::std::fmt::Display for ConstraintViolation {
|
3126 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3127 + | match self {
|
3128 + | ConstraintViolation::MissingDialog => write!(
|
3129 + | f,
|
3130 + | "`dialog` was not provided but it is required when building `TopLevel`"
|
3131 + | ),
|
3132 + | }
|
3133 + | }
|
3134 + | }
|
3135 + | impl ::std::error::Error for ConstraintViolation {}
|
3136 + | impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
|
3137 + | type Error = ConstraintViolation;
|
3138 + |
|
3139 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
3140 + | builder.build()
|
3141 + | }
|
3142 + | }
|
3143 + | /// A builder for [`TopLevel`](crate::model::TopLevel).
|
3144 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3145 + | pub struct Builder {
|
3146 + | pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
|
3147 + | pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
|
3148 + | pub(crate) dialog_map: ::std::option::Option<
|
3149 + | ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
3150 + | >,
|
3151 + | }
|
3152 + | impl Builder {
|
3153 + | #[allow(missing_docs)] // documentation missing in model
|
3154 + | pub fn dialog(mut self, input: crate::model::Dialog) -> Self {
|
3155 + | self.dialog = Some(input);
|
3156 + | self
|
3157 + | }
|
3158 + | #[allow(missing_docs)] // documentation missing in model
|
3159 + | pub fn dialog_list(mut self, input: ::std::vec::Vec<crate::model::Dialog>) -> Self {
|
3160 + | self.dialog_list = Some(input);
|
3161 + | self
|
3162 + | }
|
3163 + | #[allow(missing_docs)] // documentation missing in model
|
3164 + | pub fn dialog_map(
|
3165 + | mut self,
|
3166 + | input: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
|
3167 + | ) -> Self {
|
3168 + | self.dialog_map = Some(input);
|
3169 + | self
|
3170 + | }
|
3171 + | /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
|
3172 + | ///
|
3173 + | /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if you do not provide a value for all non-`Option`al members.
|
3174 + | ///
|
3175 + | pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
3176 + | self.build_enforcing_required_and_enum_traits()
|
3177 + | }
|
3178 + | fn build_enforcing_required_and_enum_traits(
|
3179 + | self,
|
3180 + | ) -> Result<crate::model::TopLevel, ConstraintViolation> {
|
3181 + | Ok(crate::model::TopLevel {
|
3182 + | dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
|
3183 + | dialog_list: self.dialog_list.unwrap_or_else(
|
3184 + | #[allow(clippy::redundant_closure)]
|
3185 + | || ::std::vec::Vec::new(),
|
3186 + | ),
|
3187 + | dialog_map: self.dialog_map.unwrap_or_else(
|
3188 + | #[allow(clippy::redundant_closure)]
|
3189 + | || ::std::collections::HashMap::new(),
|
3190 + | ),
|
3191 + | })
|
3192 + | }
|
3193 + | }
|
3194 + | }
|
3195 + | /// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3196 + | ///
|
3197 + | pub(crate) mod client_optional_defaults_internal {
|
3198 + |
|
3199 + | impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
|
3200 + | fn from(builder: Builder) -> Self {
|
3201 + | builder.build()
|
3202 + | }
|
3203 + | }
|
3204 + | /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3205 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3206 + | pub(crate) struct Builder {
|
3207 + | pub(crate) member: ::std::option::Option<i32>,
|
1443 3208 | }
|
3209 + | impl Builder {
|
3210 + | #[allow(missing_docs)] // documentation missing in model
|
3211 + | pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
3212 + | self.member = Some(input.into());
|
3213 + | self
|
1444 3214 | }
|
1445 - | fn __repr__(&self) -> String {
|
1446 - | format!("{self:?}")
|
3215 + | /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3216 + | pub fn build(self) -> crate::model::ClientOptionalDefaults {
|
3217 + | self.build_enforcing_all_constraints()
|
3218 + | }
|
3219 + | fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
|
3220 + | crate::model::ClientOptionalDefaults {
|
3221 + | member: self.member.unwrap_or(0i32),
|
1447 3222 | }
|
1448 - | fn __str__(&self) -> String {
|
1449 - | format!("{self:?}")
|
1450 3223 | }
|
1451 - | }
|
1452 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<RecursiveShapesInputOutputNested2> {
|
1453 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1454 - | ob.extract::<RecursiveShapesInputOutputNested2>()
|
1455 - | .map(Box::new)
|
1456 3224 | }
|
1457 3225 | }
|
3226 + | /// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3227 + | ///
|
3228 + | pub mod client_optional_defaults {
|
1458 3229 |
|
1459 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<RecursiveShapesInputOutputNested2> {
|
1460 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1461 - | (*self).into_py(py)
|
3230 + | impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
|
3231 + | fn from(builder: Builder) -> Self {
|
3232 + | builder.build()
|
3233 + | }
|
3234 + | }
|
3235 + | /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3236 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3237 + | pub struct Builder {
|
3238 + | pub(crate) member: ::std::option::Option<i32>,
|
3239 + | }
|
3240 + | impl Builder {
|
3241 + | #[allow(missing_docs)] // documentation missing in model
|
3242 + | pub fn member(mut self, input: i32) -> Self {
|
3243 + | self.member = Some(input);
|
3244 + | self
|
3245 + | }
|
3246 + | /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
3247 + | pub fn build(self) -> crate::model::ClientOptionalDefaults {
|
3248 + | self.build_enforcing_required_and_enum_traits()
|
3249 + | }
|
3250 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::ClientOptionalDefaults {
|
3251 + | crate::model::ClientOptionalDefaults {
|
3252 + | member: self.member.unwrap_or(0i32),
|
3253 + | }
|
1462 3254 | }
|
1463 - | }
|
1464 - | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
|
1465 - | type Unconstrained = crate::model::recursive_shapes_input_output_nested2_internal::Builder;
|
1466 - | }
|
1467 - | impl RecursiveShapesInputOutputNested2 {
|
1468 - | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1469 - | pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
|
1470 - | crate::model::recursive_shapes_input_output_nested2::Builder::default()
|
1471 3255 | }
|
1472 3256 | }
|
1473 - |
|
1474 - | #[allow(missing_docs)] // documentation missing in model
|
1475 - | ///
|
1476 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1477 - | /// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
|
1478 - | ///
|
1479 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
3257 + | /// See [`Defaults`](crate::model::Defaults).
|
1480 3258 | ///
|
1481 - | #[derive(
|
1482 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1483 - | )]
|
1484 - | pub(crate) struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
|
1485 - | impl IntegerEnumSet {
|
1486 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
1487 - | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
1488 - | self.0
|
1489 - | }
|
3259 + | pub(crate) mod defaults_internal {
|
1490 3260 |
|
1491 - | fn check_unique_items(
|
1492 - | items: ::std::vec::Vec<i32>,
|
1493 - | ) -> Result<::std::vec::Vec<i32>, crate::model::integer_enum_set_internal::ConstraintViolation>
|
1494 - | {
|
1495 - | let mut seen = ::std::collections::HashMap::new();
|
1496 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
1497 - | for (idx, item) in items.iter().enumerate() {
|
1498 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
1499 - | duplicate_indices.push(prev_idx);
|
3261 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
3262 + | /// Holds one variant for each of the ways the builder can fail.
|
3263 + | #[non_exhaustive]
|
3264 + | #[allow(clippy::enum_variant_names)]
|
3265 + | pub(crate) enum ConstraintViolation {
|
3266 + | /// Constraint violation occurred building member `default_enum` when building `Defaults`.
|
3267 + | #[doc(hidden)]
|
3268 + | DefaultEnum(crate::model::test_enum_internal::ConstraintViolation),
|
1500 3269 | }
|
3270 + | impl ::std::fmt::Display for ConstraintViolation {
|
3271 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3272 + | match self {
|
3273 + | ConstraintViolation::DefaultEnum(_) => write!(f, "constraint violation occurred building member `default_enum` when building `Defaults`"),
|
1501 3274 | }
|
1502 - |
|
1503 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
1504 - | for idx in &duplicate_indices {
|
1505 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
1506 - | last_duplicate_indices.push(prev_idx);
|
1507 3275 | }
|
1508 3276 | }
|
1509 - | duplicate_indices.extend(last_duplicate_indices);
|
1510 - |
|
1511 - | if !duplicate_indices.is_empty() {
|
1512 - | debug_assert!(duplicate_indices.len() >= 2);
|
1513 - | Err(
|
1514 - | crate::model::integer_enum_set_internal::ConstraintViolation::UniqueItems {
|
1515 - | duplicate_indices,
|
1516 - | original: items,
|
1517 - | },
|
1518 - | )
|
1519 - | } else {
|
1520 - | Ok(items)
|
3277 + | impl ::std::error::Error for ConstraintViolation {}
|
3278 + | impl ConstraintViolation {
|
3279 + | pub(crate) fn as_validation_exception_field(
|
3280 + | self,
|
3281 + | path: ::std::string::String,
|
3282 + | ) -> crate::model::ValidationExceptionField {
|
3283 + | match self {
|
3284 + | ConstraintViolation::DefaultEnum(inner) => {
|
3285 + | inner.as_validation_exception_field(path + "/defaultEnum")
|
1521 3286 | }
|
1522 3287 | }
|
1523 - | }
|
1524 - | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
|
1525 - | type Error = crate::model::integer_enum_set_internal::ConstraintViolation;
|
1526 - |
|
1527 - | /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
1528 - | fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
|
1529 - | let value = Self::check_unique_items(value)?;
|
1530 - |
|
1531 - | Ok(Self(value))
|
1532 3288 | }
|
1533 - | }
|
1534 - |
|
1535 - | impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
|
1536 - | fn from(value: IntegerEnumSet) -> Self {
|
1537 - | value.into_inner()
|
1538 3289 | }
|
1539 - | }
|
1540 - | impl crate::constrained::Constrained for IntegerEnumSet {
|
1541 - | type Unconstrained =
|
1542 - | crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
|
1543 - | }
|
1544 - |
|
1545 - | #[allow(missing_docs)] // documentation missing in model
|
1546 - | ///
|
1547 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1548 - | /// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
|
1549 - | ///
|
1550 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1551 - | ///
|
1552 - | #[derive(
|
1553 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1554 - | )]
|
1555 - | pub(crate) struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
|
1556 - | impl FooEnumSet {
|
1557 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
|
1558 - | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
|
1559 - | self.0
|
3290 + | impl ::std::convert::From<Builder>
|
3291 + | for crate::constrained::MaybeConstrained<crate::model::Defaults>
|
3292 + | {
|
3293 + | fn from(builder: Builder) -> Self {
|
3294 + | Self::Unconstrained(builder)
|
1560 3295 | }
|
3296 + | }
|
3297 + | impl ::std::convert::TryFrom<Builder> for crate::model::Defaults {
|
3298 + | type Error = ConstraintViolation;
|
1561 3299 |
|
1562 - | fn check_unique_items(
|
1563 - | items: ::std::vec::Vec<crate::model::FooEnum>,
|
1564 - | ) -> Result<
|
1565 - | ::std::vec::Vec<crate::model::FooEnum>,
|
1566 - | crate::model::foo_enum_set_internal::ConstraintViolation,
|
1567 - | > {
|
1568 - | let mut seen = ::std::collections::HashMap::new();
|
1569 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
1570 - | for (idx, item) in items.iter().enumerate() {
|
1571 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
1572 - | duplicate_indices.push(prev_idx);
|
3300 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
3301 + | builder.build()
|
1573 3302 | }
|
1574 3303 | }
|
1575 - |
|
1576 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
1577 - | for idx in &duplicate_indices {
|
1578 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
1579 - | last_duplicate_indices.push(prev_idx);
|
3304 + | /// A builder for [`Defaults`](crate::model::Defaults).
|
3305 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3306 + | pub(crate) struct Builder {
|
3307 + | pub(crate) default_string: ::std::option::Option<::std::string::String>,
|
3308 + | pub(crate) default_boolean: ::std::option::Option<bool>,
|
3309 + | pub(crate) default_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
3310 + | pub(crate) default_document_map:
|
3311 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3312 + | pub(crate) default_document_string:
|
3313 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3314 + | pub(crate) default_document_boolean:
|
3315 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3316 + | pub(crate) default_document_list:
|
3317 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3318 + | pub(crate) default_null_document:
|
3319 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3320 + | pub(crate) default_timestamp:
|
3321 + | ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
3322 + | pub(crate) default_blob:
|
3323 + | ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
3324 + | pub(crate) default_byte: ::std::option::Option<i8>,
|
3325 + | pub(crate) default_short: ::std::option::Option<i16>,
|
3326 + | pub(crate) default_integer: ::std::option::Option<i32>,
|
3327 + | pub(crate) default_long: ::std::option::Option<i64>,
|
3328 + | pub(crate) default_float: ::std::option::Option<f32>,
|
3329 + | pub(crate) default_double: ::std::option::Option<f64>,
|
3330 + | pub(crate) default_map: ::std::option::Option<
|
3331 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
3332 + | >,
|
3333 + | pub(crate) default_enum:
|
3334 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TestEnum>>,
|
3335 + | pub(crate) default_int_enum: ::std::option::Option<i32>,
|
3336 + | pub(crate) empty_string: ::std::option::Option<::std::string::String>,
|
3337 + | pub(crate) false_boolean: ::std::option::Option<bool>,
|
3338 + | pub(crate) empty_blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
3339 + | pub(crate) zero_byte: ::std::option::Option<i8>,
|
3340 + | pub(crate) zero_short: ::std::option::Option<i16>,
|
3341 + | pub(crate) zero_integer: ::std::option::Option<i32>,
|
3342 + | pub(crate) zero_long: ::std::option::Option<i64>,
|
3343 + | pub(crate) zero_float: ::std::option::Option<f32>,
|
3344 + | pub(crate) zero_double: ::std::option::Option<f64>,
|
1580 3345 | }
|
3346 + | impl Builder {
|
3347 + | #[allow(missing_docs)] // documentation missing in model
|
3348 + | pub(crate) fn set_default_string(
|
3349 + | mut self,
|
3350 + | input: impl ::std::convert::Into<::std::string::String>,
|
3351 + | ) -> Self {
|
3352 + | self.default_string = Some(input.into());
|
3353 + | self
|
1581 3354 | }
|
1582 - | duplicate_indices.extend(last_duplicate_indices);
|
1583 - |
|
1584 - | if !duplicate_indices.is_empty() {
|
1585 - | debug_assert!(duplicate_indices.len() >= 2);
|
1586 - | Err(
|
1587 - | crate::model::foo_enum_set_internal::ConstraintViolation::UniqueItems {
|
1588 - | duplicate_indices,
|
1589 - | original: items,
|
1590 - | },
|
1591 - | )
|
1592 - | } else {
|
1593 - | Ok(items)
|
3355 + | #[allow(missing_docs)] // documentation missing in model
|
3356 + | pub(crate) fn set_default_boolean(
|
3357 + | mut self,
|
3358 + | input: impl ::std::convert::Into<bool>,
|
3359 + | ) -> Self {
|
3360 + | self.default_boolean = Some(input.into());
|
3361 + | self
|
1594 3362 | }
|
3363 + | #[allow(missing_docs)] // documentation missing in model
|
3364 + | pub(crate) fn set_default_list(
|
3365 + | mut self,
|
3366 + | input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>,
|
3367 + | ) -> Self {
|
3368 + | self.default_list = Some(input.into());
|
3369 + | self
|
1595 3370 | }
|
1596 - | }
|
1597 - | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
|
1598 - | type Error = crate::model::foo_enum_set_internal::ConstraintViolation;
|
1599 - |
|
1600 - | /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
|
1601 - | fn try_from(value: ::std::vec::Vec<crate::model::FooEnum>) -> Result<Self, Self::Error> {
|
1602 - | let value = Self::check_unique_items(value)?;
|
1603 - |
|
1604 - | Ok(Self(value))
|
3371 + | #[allow(missing_docs)] // documentation missing in model
|
3372 + | pub(crate) fn set_default_document_map(
|
3373 + | mut self,
|
3374 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Document>,
|
3375 + | ) -> Self {
|
3376 + | self.default_document_map = Some(input.into());
|
3377 + | self
|
1605 3378 | }
|
1606 - | }
|
1607 - |
|
1608 - | impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
|
1609 - | fn from(value: FooEnumSet) -> Self {
|
1610 - | value.into_inner()
|
3379 + | #[allow(missing_docs)] // documentation missing in model
|
3380 + | pub(crate) fn set_default_document_string(
|
3381 + | mut self,
|
3382 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Document>,
|
3383 + | ) -> Self {
|
3384 + | self.default_document_string = Some(input.into());
|
3385 + | self
|
1611 3386 | }
|
1612 - | }
|
1613 - | impl crate::constrained::Constrained for FooEnumSet {
|
1614 - | type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
|
1615 - | }
|
1616 - |
|
1617 - | #[::pyo3::pyclass]
|
1618 - | /// :param foo typing.Optional\[str\]:
|
1619 - | /// :rtype None:
|
1620 - | #[allow(missing_docs)] // documentation missing in model
|
1621 - | #[derive(
|
1622 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1623 - | )]
|
1624 - | pub struct ComplexNestedErrorData {
|
1625 - | #[pyo3(get, set)]
|
1626 - | /// :type typing.Optional\[str\]:
|
1627 3387 | #[allow(missing_docs)] // documentation missing in model
|
1628 - | pub foo: ::std::option::Option<::std::string::String>,
|
1629 - | }
|
1630 - | impl ComplexNestedErrorData {
|
3388 + | pub(crate) fn set_default_document_boolean(
|
3389 + | mut self,
|
3390 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Document>,
|
3391 + | ) -> Self {
|
3392 + | self.default_document_boolean = Some(input.into());
|
3393 + | self
|
3394 + | }
|
1631 3395 | #[allow(missing_docs)] // documentation missing in model
|
1632 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
1633 - | self.foo.as_deref()
|
3396 + | pub(crate) fn set_default_document_list(
|
3397 + | mut self,
|
3398 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Document>,
|
3399 + | ) -> Self {
|
3400 + | self.default_document_list = Some(input.into());
|
3401 + | self
|
3402 + | }
|
3403 + | #[allow(missing_docs)] // documentation missing in model
|
3404 + | pub(crate) fn set_default_null_document(
|
3405 + | mut self,
|
3406 + | input: Option<
|
3407 + | impl ::std::convert::Into<::aws_smithy_http_server_python::types::Document>,
|
3408 + | >,
|
3409 + | ) -> Self {
|
3410 + | self.default_null_document = input.map(|v| v.into());
|
3411 + | self
|
3412 + | }
|
3413 + | #[allow(missing_docs)] // documentation missing in model
|
3414 + | pub(crate) fn set_default_timestamp(
|
3415 + | mut self,
|
3416 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::DateTime>,
|
3417 + | ) -> Self {
|
3418 + | self.default_timestamp = Some(input.into());
|
3419 + | self
|
3420 + | }
|
3421 + | #[allow(missing_docs)] // documentation missing in model
|
3422 + | pub(crate) fn set_default_blob(
|
3423 + | mut self,
|
3424 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Blob>,
|
3425 + | ) -> Self {
|
3426 + | self.default_blob = Some(input.into());
|
3427 + | self
|
3428 + | }
|
3429 + | #[allow(missing_docs)] // documentation missing in model
|
3430 + | pub(crate) fn set_default_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
3431 + | self.default_byte = Some(input.into());
|
3432 + | self
|
3433 + | }
|
3434 + | #[allow(missing_docs)] // documentation missing in model
|
3435 + | pub(crate) fn set_default_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
3436 + | self.default_short = Some(input.into());
|
3437 + | self
|
1634 3438 | }
|
1635 - | }
|
1636 - | #[allow(clippy::new_without_default)]
|
1637 - | #[allow(clippy::too_many_arguments)]
|
1638 - | #[::pyo3::pymethods]
|
1639 - | impl ComplexNestedErrorData {
|
1640 - | #[new]
|
1641 - | pub fn new(foo: ::std::option::Option<::std::string::String>) -> Self {
|
1642 - | Self { foo }
|
3439 + | #[allow(missing_docs)] // documentation missing in model
|
3440 + | pub(crate) fn set_default_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
3441 + | self.default_integer = Some(input.into());
|
3442 + | self
|
1643 3443 | }
|
1644 - | fn __repr__(&self) -> String {
|
1645 - | format!("{self:?}")
|
3444 + | #[allow(missing_docs)] // documentation missing in model
|
3445 + | pub(crate) fn set_default_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
3446 + | self.default_long = Some(input.into());
|
3447 + | self
|
1646 3448 | }
|
1647 - | fn __str__(&self) -> String {
|
1648 - | format!("{self:?}")
|
3449 + | #[allow(missing_docs)] // documentation missing in model
|
3450 + | pub(crate) fn set_default_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
3451 + | self.default_float = Some(input.into());
|
3452 + | self
|
1649 3453 | }
|
1650 - | }
|
1651 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ComplexNestedErrorData> {
|
1652 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1653 - | ob.extract::<ComplexNestedErrorData>().map(Box::new)
|
3454 + | #[allow(missing_docs)] // documentation missing in model
|
3455 + | pub(crate) fn set_default_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
3456 + | self.default_double = Some(input.into());
|
3457 + | self
|
1654 3458 | }
|
1655 - | }
|
1656 - |
|
1657 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ComplexNestedErrorData> {
|
1658 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1659 - | (*self).into_py(py)
|
3459 + | #[allow(missing_docs)] // documentation missing in model
|
3460 + | pub(crate) fn set_default_map(
|
3461 + | mut self,
|
3462 + | input: impl ::std::convert::Into<
|
3463 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
3464 + | >,
|
3465 + | ) -> Self {
|
3466 + | self.default_map = Some(input.into());
|
3467 + | self
|
1660 3468 | }
|
1661 - | }
|
1662 - | impl ComplexNestedErrorData {
|
1663 - | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1664 - | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
1665 - | crate::model::complex_nested_error_data::Builder::default()
|
3469 + | #[allow(missing_docs)] // documentation missing in model
|
3470 + | pub(crate) fn set_default_enum(
|
3471 + | mut self,
|
3472 + | input: impl ::std::convert::Into<
|
3473 + | crate::constrained::MaybeConstrained<crate::model::TestEnum>,
|
3474 + | >,
|
3475 + | ) -> Self {
|
3476 + | self.default_enum = Some(input.into());
|
3477 + | self
|
1666 3478 | }
|
1667 - | }
|
1668 - |
|
1669 - | #[allow(missing_docs)] // documentation missing in model
|
1670 - | #[derive(
|
1671 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1672 - | )]
|
1673 - | pub enum UnionPayload {
|
1674 3479 | #[allow(missing_docs)] // documentation missing in model
|
1675 - | Greeting(::std::string::String),
|
1676 - | }
|
1677 - | impl UnionPayload {
|
1678 - | #[allow(irrefutable_let_patterns)]
|
1679 - | /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
|
1680 - | /// Returns `Err(&Self)` if it can't be converted.
|
1681 - | pub fn as_greeting(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1682 - | if let UnionPayload::Greeting(val) = &self {
|
1683 - | ::std::result::Result::Ok(val)
|
1684 - | } else {
|
1685 - | ::std::result::Result::Err(self)
|
3480 + | pub(crate) fn set_default_int_enum(
|
3481 + | mut self,
|
3482 + | input: impl ::std::convert::Into<i32>,
|
3483 + | ) -> Self {
|
3484 + | self.default_int_enum = Some(input.into());
|
3485 + | self
|
1686 3486 | }
|
3487 + | #[allow(missing_docs)] // documentation missing in model
|
3488 + | pub(crate) fn set_empty_string(
|
3489 + | mut self,
|
3490 + | input: impl ::std::convert::Into<::std::string::String>,
|
3491 + | ) -> Self {
|
3492 + | self.empty_string = Some(input.into());
|
3493 + | self
|
1687 3494 | }
|
1688 - | /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
|
1689 - | pub fn is_greeting(&self) -> bool {
|
1690 - | self.as_greeting().is_ok()
|
3495 + | #[allow(missing_docs)] // documentation missing in model
|
3496 + | pub(crate) fn set_false_boolean(mut self, input: impl ::std::convert::Into<bool>) -> Self {
|
3497 + | self.false_boolean = Some(input.into());
|
3498 + | self
|
1691 3499 | }
|
1692 - | }
|
1693 - | #[pyo3::pyclass(name = "UnionPayload")]
|
1694 - | #[derive(
|
1695 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1696 - | )]
|
1697 - | pub struct PyUnionMarkerUnionPayload(pub UnionPayload);
|
1698 - | #[::pyo3::pymethods]
|
1699 - | impl PyUnionMarkerUnionPayload {
|
1700 - | #[allow(irrefutable_let_patterns)]
|
1701 - | #[staticmethod]
|
1702 - | /// Creates a new union instance of [`Greeting`](crate::model::UnionPayload::Greeting)
|
1703 - | /// :param data str:
|
1704 - | /// :rtype UnionPayload:
|
1705 - | pub fn greeting(data: ::std::string::String) -> Self {
|
1706 - | Self(UnionPayload::Greeting(data))
|
3500 + | #[allow(missing_docs)] // documentation missing in model
|
3501 + | pub(crate) fn set_empty_blob(
|
3502 + | mut self,
|
3503 + | input: impl ::std::convert::Into<::aws_smithy_http_server_python::types::Blob>,
|
3504 + | ) -> Self {
|
3505 + | self.empty_blob = Some(input.into());
|
3506 + | self
|
1707 3507 | }
|
1708 - | /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
|
1709 - | /// :rtype str:
|
1710 - | pub fn as_greeting(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1711 - | match self.0.as_greeting() {
|
1712 - | Ok(variant) => Ok(variant.clone()),
|
1713 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1714 - | r"UnionPayload variant is not of type str",
|
1715 - | )),
|
3508 + | #[allow(missing_docs)] // documentation missing in model
|
3509 + | pub(crate) fn set_zero_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
|
3510 + | self.zero_byte = Some(input.into());
|
3511 + | self
|
1716 3512 | }
|
3513 + | #[allow(missing_docs)] // documentation missing in model
|
3514 + | pub(crate) fn set_zero_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
|
3515 + | self.zero_short = Some(input.into());
|
3516 + | self
|
1717 3517 | }
|
1718 - | /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
|
1719 - | /// :rtype bool:
|
1720 - | pub fn is_greeting(&self) -> bool {
|
1721 - | self.0.is_greeting()
|
3518 + | #[allow(missing_docs)] // documentation missing in model
|
3519 + | pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
3520 + | self.zero_integer = Some(input.into());
|
3521 + | self
|
1722 3522 | }
|
1723 - | }
|
1724 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for UnionPayload {
|
1725 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1726 - | PyUnionMarkerUnionPayload(self).into_py(py)
|
3523 + | #[allow(missing_docs)] // documentation missing in model
|
3524 + | pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
|
3525 + | self.zero_long = Some(input.into());
|
3526 + | self
|
1727 3527 | }
|
1728 - | }
|
1729 - | impl<'source> ::pyo3::FromPyObject<'source> for UnionPayload {
|
1730 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1731 - | let data: PyUnionMarkerUnionPayload = obj.extract()?;
|
1732 - | Ok(data.0)
|
3528 + | #[allow(missing_docs)] // documentation missing in model
|
3529 + | pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
|
3530 + | self.zero_float = Some(input.into());
|
3531 + | self
|
1733 3532 | }
|
1734 - | }
|
1735 - |
|
1736 - | #[::pyo3::pyclass]
|
1737 - | #[allow(missing_docs)] // documentation missing in model
|
1738 - | #[derive(
|
1739 - | ::std::clone::Clone,
|
1740 - | ::std::cmp::Eq,
|
1741 - | ::std::cmp::Ord,
|
1742 - | ::std::cmp::PartialEq,
|
1743 - | ::std::cmp::PartialOrd,
|
1744 - | ::std::fmt::Debug,
|
1745 - | ::std::hash::Hash,
|
1746 - | )]
|
1747 - | pub enum StringEnum {
|
1748 3533 | #[allow(missing_docs)] // documentation missing in model
|
1749 - | V,
|
1750 - | }
|
1751 - | ///
|
1752 - | pub(crate) mod string_enum_internal {
|
1753 - | #[derive(Debug, PartialEq)]
|
1754 - | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
1755 - |
|
1756 - | impl ::std::fmt::Display for ConstraintViolation {
|
1757 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1758 - | write!(
|
1759 - | f,
|
1760 - | r#"Value provided for 'aws.protocoltests.restjson#StringEnum' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#
|
1761 - | )
|
3534 + | pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
|
3535 + | self.zero_double = Some(input.into());
|
3536 + | self
|
1762 3537 | }
|
3538 + | /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
|
3539 + | ///
|
3540 + | /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
|
3541 + | ///
|
3542 + | pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
|
3543 + | self.build_enforcing_all_constraints()
|
1763 3544 | }
|
1764 - |
|
1765 - | impl ::std::error::Error for ConstraintViolation {}
|
1766 - | impl ConstraintViolation {
|
1767 - | pub(crate) fn as_validation_exception_field(
|
3545 + | fn build_enforcing_all_constraints(
|
1768 3546 | self,
|
1769 - | path: ::std::string::String,
|
1770 - | ) -> crate::model::ValidationExceptionField {
|
1771 - | crate::model::ValidationExceptionField {
|
1772 - | message: format!(
|
1773 - | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
|
1774 - | &path
|
3547 + | ) -> Result<crate::model::Defaults, ConstraintViolation> {
|
3548 + | Ok(crate::model::Defaults {
|
3549 + | default_string: self.default_string.unwrap_or_else(
|
3550 + | #[allow(clippy::redundant_closure)]
|
3551 + | || String::from("hi"),
|
1775 3552 | ),
|
1776 - | path,
|
1777 - | }
|
3553 + | default_boolean: self.default_boolean.unwrap_or(true),
|
3554 + | default_list: self.default_list.unwrap_or_else(
|
3555 + | #[allow(clippy::redundant_closure)]
|
3556 + | || ::std::vec::Vec::new(),
|
3557 + | ),
|
3558 + | default_document_map: self.default_document_map.unwrap_or_else(
|
3559 + | #[allow(clippy::redundant_closure)]
|
3560 + | || {
|
3561 + | ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
|
3562 + | .into()
|
3563 + | },
|
3564 + | ),
|
3565 + | default_document_string: self.default_document_string.unwrap_or_else(
|
3566 + | #[allow(clippy::redundant_closure)]
|
3567 + | || {
|
3568 + | ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
|
3569 + | .into()
|
3570 + | },
|
3571 + | ),
|
3572 + | default_document_boolean: self
|
3573 + | .default_document_boolean
|
3574 + | .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
|
3575 + | default_document_list: self.default_document_list.unwrap_or_else(
|
3576 + | #[allow(clippy::redundant_closure)]
|
3577 + | || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
|
3578 + | ),
|
3579 + | default_null_document: self.default_null_document,
|
3580 + | default_timestamp: self.default_timestamp.unwrap_or_else(
|
3581 + | #[allow(clippy::redundant_closure)]
|
3582 + | || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
|
3583 + | ),
|
3584 + | default_blob: self.default_blob.unwrap_or_else(
|
3585 + | #[allow(clippy::redundant_closure)]
|
3586 + | || ::aws_smithy_types::Blob::new("abc").into(),
|
3587 + | ),
|
3588 + | default_byte: self.default_byte.unwrap_or(1i8),
|
3589 + | default_short: self.default_short.unwrap_or(1i16),
|
3590 + | default_integer: self.default_integer.unwrap_or(10i32),
|
3591 + | default_long: self.default_long.unwrap_or(100i64),
|
3592 + | default_float: self.default_float.unwrap_or(1.0f32),
|
3593 + | default_double: self.default_double.unwrap_or(1.0f64),
|
3594 + | default_map: self.default_map.unwrap_or_else(
|
3595 + | #[allow(clippy::redundant_closure)]
|
3596 + | || ::std::collections::HashMap::new(),
|
3597 + | ),
|
3598 + | default_enum: self
|
3599 + | .default_enum
|
3600 + | .map(|v| match v {
|
3601 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3602 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3603 + | })
|
3604 + | .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
|
3605 + | .transpose()?
|
3606 + | .unwrap_or(
|
3607 + | "FOO"
|
3608 + | .parse::<crate::model::TestEnum>()
|
3609 + | .expect("static value validated to member"),
|
3610 + | ),
|
3611 + | default_int_enum: self.default_int_enum.unwrap_or(1i32),
|
3612 + | empty_string: self.empty_string.unwrap_or_else(
|
3613 + | #[allow(clippy::redundant_closure)]
|
3614 + | || String::from(""),
|
3615 + | ),
|
3616 + | false_boolean: self.false_boolean.unwrap_or(false),
|
3617 + | empty_blob: self.empty_blob.unwrap_or_else(
|
3618 + | #[allow(clippy::redundant_closure)]
|
3619 + | || ::aws_smithy_types::Blob::new("").into(),
|
3620 + | ),
|
3621 + | zero_byte: self.zero_byte.unwrap_or(0i8),
|
3622 + | zero_short: self.zero_short.unwrap_or(0i16),
|
3623 + | zero_integer: self.zero_integer.unwrap_or(0i32),
|
3624 + | zero_long: self.zero_long.unwrap_or(0i64),
|
3625 + | zero_float: self.zero_float.unwrap_or(0.0f32),
|
3626 + | zero_double: self.zero_double.unwrap_or(0.0f64),
|
3627 + | })
|
1778 3628 | }
|
1779 3629 | }
|
1780 3630 | }
|
1781 - | impl ::std::convert::TryFrom<&str> for StringEnum {
|
1782 - | type Error = crate::model::string_enum_internal::ConstraintViolation;
|
1783 - | fn try_from(
|
1784 - | s: &str,
|
1785 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
1786 - | match s {
|
1787 - | "enumvalue" => Ok(StringEnum::V),
|
1788 - | _ => Err(crate::model::string_enum_internal::ConstraintViolation(
|
1789 - | s.to_owned(),
|
1790 - | )),
|
3631 + | /// See [`Defaults`](crate::model::Defaults).
|
3632 + | ///
|
3633 + | pub mod defaults {
|
3634 + |
|
3635 + | impl ::std::convert::From<Builder> for crate::model::Defaults {
|
3636 + | fn from(builder: Builder) -> Self {
|
3637 + | builder.build()
|
1791 3638 | }
|
1792 3639 | }
|
1793 - | }
|
1794 - | impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
|
1795 - | type Error = crate::model::string_enum_internal::ConstraintViolation;
|
1796 - | fn try_from(
|
1797 - | s: ::std::string::String,
|
1798 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
1799 - | {
|
1800 - | s.as_str().try_into()
|
3640 + | /// A builder for [`Defaults`](crate::model::Defaults).
|
3641 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3642 + | pub struct Builder {
|
3643 + | pub(crate) default_string: ::std::option::Option<::std::string::String>,
|
3644 + | pub(crate) default_boolean: ::std::option::Option<bool>,
|
3645 + | pub(crate) default_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
3646 + | pub(crate) default_document_map:
|
3647 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3648 + | pub(crate) default_document_string:
|
3649 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3650 + | pub(crate) default_document_boolean:
|
3651 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3652 + | pub(crate) default_document_list:
|
3653 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3654 + | pub(crate) default_null_document:
|
3655 + | ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3656 + | pub(crate) default_timestamp:
|
3657 + | ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
3658 + | pub(crate) default_blob:
|
3659 + | ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
3660 + | pub(crate) default_byte: ::std::option::Option<i8>,
|
3661 + | pub(crate) default_short: ::std::option::Option<i16>,
|
3662 + | pub(crate) default_integer: ::std::option::Option<i32>,
|
3663 + | pub(crate) default_long: ::std::option::Option<i64>,
|
3664 + | pub(crate) default_float: ::std::option::Option<f32>,
|
3665 + | pub(crate) default_double: ::std::option::Option<f64>,
|
3666 + | pub(crate) default_map: ::std::option::Option<
|
3667 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
3668 + | >,
|
3669 + | pub(crate) default_enum: ::std::option::Option<crate::model::TestEnum>,
|
3670 + | pub(crate) default_int_enum: ::std::option::Option<i32>,
|
3671 + | pub(crate) empty_string: ::std::option::Option<::std::string::String>,
|
3672 + | pub(crate) false_boolean: ::std::option::Option<bool>,
|
3673 + | pub(crate) empty_blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
3674 + | pub(crate) zero_byte: ::std::option::Option<i8>,
|
3675 + | pub(crate) zero_short: ::std::option::Option<i16>,
|
3676 + | pub(crate) zero_integer: ::std::option::Option<i32>,
|
3677 + | pub(crate) zero_long: ::std::option::Option<i64>,
|
3678 + | pub(crate) zero_float: ::std::option::Option<f32>,
|
3679 + | pub(crate) zero_double: ::std::option::Option<f64>,
|
1801 3680 | }
|
1802 - | }
|
1803 - | impl std::str::FromStr for StringEnum {
|
1804 - | type Err = crate::model::string_enum_internal::ConstraintViolation;
|
1805 - | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
1806 - | Self::try_from(s)
|
3681 + | impl Builder {
|
3682 + | #[allow(missing_docs)] // documentation missing in model
|
3683 + | pub fn default_string(mut self, input: ::std::string::String) -> Self {
|
3684 + | self.default_string = Some(input);
|
3685 + | self
|
1807 3686 | }
|
1808 - | }
|
1809 - | impl StringEnum {
|
1810 - | /// Returns the `&str` value of the enum member.
|
1811 - | pub fn as_str(&self) -> &str {
|
1812 - | match self {
|
1813 - | StringEnum::V => "enumvalue",
|
3687 + | #[allow(missing_docs)] // documentation missing in model
|
3688 + | pub fn default_boolean(mut self, input: bool) -> Self {
|
3689 + | self.default_boolean = Some(input);
|
3690 + | self
|
3691 + | }
|
3692 + | #[allow(missing_docs)] // documentation missing in model
|
3693 + | pub fn default_list(mut self, input: ::std::vec::Vec<::std::string::String>) -> Self {
|
3694 + | self.default_list = Some(input);
|
3695 + | self
|
1814 3696 | }
|
3697 + | #[allow(missing_docs)] // documentation missing in model
|
3698 + | pub fn default_document_map(
|
3699 + | mut self,
|
3700 + | input: ::aws_smithy_http_server_python::types::Document,
|
3701 + | ) -> Self {
|
3702 + | self.default_document_map = Some(input);
|
3703 + | self
|
1815 3704 | }
|
1816 - | /// Returns all the `&str` representations of the enum members.
|
1817 - | pub const fn values() -> &'static [&'static str] {
|
1818 - | &["enumvalue"]
|
3705 + | #[allow(missing_docs)] // documentation missing in model
|
3706 + | pub fn default_document_string(
|
3707 + | mut self,
|
3708 + | input: ::aws_smithy_http_server_python::types::Document,
|
3709 + | ) -> Self {
|
3710 + | self.default_document_string = Some(input);
|
3711 + | self
|
1819 3712 | }
|
1820 - | }
|
1821 - | impl ::std::convert::AsRef<str> for StringEnum {
|
1822 - | fn as_ref(&self) -> &str {
|
1823 - | self.as_str()
|
3713 + | #[allow(missing_docs)] // documentation missing in model
|
3714 + | pub fn default_document_boolean(
|
3715 + | mut self,
|
3716 + | input: ::aws_smithy_http_server_python::types::Document,
|
3717 + | ) -> Self {
|
3718 + | self.default_document_boolean = Some(input);
|
3719 + | self
|
1824 3720 | }
|
1825 - | }
|
1826 - | #[::pyo3::pymethods]
|
1827 - | impl StringEnum {
|
1828 - | #[getter]
|
1829 - | pub fn name(&self) -> &str {
|
1830 - | match self {
|
1831 - | StringEnum::V => "V",
|
3721 + | #[allow(missing_docs)] // documentation missing in model
|
3722 + | pub fn default_document_list(
|
3723 + | mut self,
|
3724 + | input: ::aws_smithy_http_server_python::types::Document,
|
3725 + | ) -> Self {
|
3726 + | self.default_document_list = Some(input);
|
3727 + | self
|
1832 3728 | }
|
3729 + | #[allow(missing_docs)] // documentation missing in model
|
3730 + | pub fn default_null_document(
|
3731 + | mut self,
|
3732 + | input: ::std::option::Option<::aws_smithy_http_server_python::types::Document>,
|
3733 + | ) -> Self {
|
3734 + | self.default_null_document = input;
|
3735 + | self
|
1833 3736 | }
|
1834 - | #[getter]
|
1835 - | pub fn value(&self) -> &str {
|
1836 - | self.as_str()
|
3737 + | #[allow(missing_docs)] // documentation missing in model
|
3738 + | pub fn default_timestamp(
|
3739 + | mut self,
|
3740 + | input: ::aws_smithy_http_server_python::types::DateTime,
|
3741 + | ) -> Self {
|
3742 + | self.default_timestamp = Some(input);
|
3743 + | self
|
1837 3744 | }
|
1838 - | fn __repr__(&self) -> String {
|
1839 - | self.as_str().to_owned()
|
3745 + | #[allow(missing_docs)] // documentation missing in model
|
3746 + | pub fn default_blob(mut self, input: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
3747 + | self.default_blob = Some(input);
|
3748 + | self
|
1840 3749 | }
|
1841 - | fn __str__(&self) -> String {
|
1842 - | self.as_str().to_owned()
|
3750 + | #[allow(missing_docs)] // documentation missing in model
|
3751 + | pub fn default_byte(mut self, input: i8) -> Self {
|
3752 + | self.default_byte = Some(input);
|
3753 + | self
|
1843 3754 | }
|
1844 - | }
|
1845 - | impl crate::constrained::Constrained for StringEnum {
|
1846 - | type Unconstrained = ::std::string::String;
|
1847 - | }
|
1848 - |
|
1849 - | impl ::std::convert::From<::std::string::String>
|
1850 - | for crate::constrained::MaybeConstrained<crate::model::StringEnum>
|
1851 - | {
|
1852 - | fn from(value: ::std::string::String) -> Self {
|
1853 - | Self::Unconstrained(value)
|
3755 + | #[allow(missing_docs)] // documentation missing in model
|
3756 + | pub fn default_short(mut self, input: i16) -> Self {
|
3757 + | self.default_short = Some(input);
|
3758 + | self
|
1854 3759 | }
|
1855 - | }
|
1856 - |
|
1857 - | #[::pyo3::pyclass]
|
1858 - | /// :param greeting typing.Optional\[str\]:
|
1859 - | /// :param name typing.Optional\[str\]:
|
1860 - | /// :rtype None:
|
1861 - | #[allow(missing_docs)] // documentation missing in model
|
1862 - | #[derive(
|
1863 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1864 - | )]
|
1865 - | pub struct NestedPayload {
|
1866 - | #[pyo3(get, set)]
|
1867 - | /// :type typing.Optional\[str\]:
|
1868 3760 | #[allow(missing_docs)] // documentation missing in model
|
1869 - | pub greeting: ::std::option::Option<::std::string::String>,
|
1870 - | #[pyo3(get, set)]
|
1871 - | /// :type typing.Optional\[str\]:
|
3761 + | pub fn default_integer(mut self, input: i32) -> Self {
|
3762 + | self.default_integer = Some(input);
|
3763 + | self
|
3764 + | }
|
1872 3765 | #[allow(missing_docs)] // documentation missing in model
|
1873 - | pub name: ::std::option::Option<::std::string::String>,
|
1874 - | }
|
1875 - | impl NestedPayload {
|
3766 + | pub fn default_long(mut self, input: i64) -> Self {
|
3767 + | self.default_long = Some(input);
|
3768 + | self
|
3769 + | }
|
1876 3770 | #[allow(missing_docs)] // documentation missing in model
|
1877 - | pub fn greeting(&self) -> ::std::option::Option<&str> {
|
1878 - | self.greeting.as_deref()
|
3771 + | pub fn default_float(mut self, input: f32) -> Self {
|
3772 + | self.default_float = Some(input);
|
3773 + | self
|
1879 3774 | }
|
1880 3775 | #[allow(missing_docs)] // documentation missing in model
|
1881 - | pub fn name(&self) -> ::std::option::Option<&str> {
|
1882 - | self.name.as_deref()
|
3776 + | pub fn default_double(mut self, input: f64) -> Self {
|
3777 + | self.default_double = Some(input);
|
3778 + | self
|
1883 3779 | }
|
1884 - | }
|
1885 - | #[allow(clippy::new_without_default)]
|
1886 - | #[allow(clippy::too_many_arguments)]
|
1887 - | #[::pyo3::pymethods]
|
1888 - | impl NestedPayload {
|
1889 - | #[new]
|
1890 - | pub fn new(
|
1891 - | greeting: ::std::option::Option<::std::string::String>,
|
1892 - | name: ::std::option::Option<::std::string::String>,
|
3780 + | #[allow(missing_docs)] // documentation missing in model
|
3781 + | pub fn default_map(
|
3782 + | mut self,
|
3783 + | input: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1893 3784 | ) -> Self {
|
1894 - | Self { greeting, name }
|
3785 + | self.default_map = Some(input);
|
3786 + | self
|
1895 3787 | }
|
1896 - | fn __repr__(&self) -> String {
|
1897 - | format!("{self:?}")
|
3788 + | #[allow(missing_docs)] // documentation missing in model
|
3789 + | pub fn default_enum(mut self, input: crate::model::TestEnum) -> Self {
|
3790 + | self.default_enum = Some(input);
|
3791 + | self
|
1898 3792 | }
|
1899 - | fn __str__(&self) -> String {
|
1900 - | format!("{self:?}")
|
3793 + | #[allow(missing_docs)] // documentation missing in model
|
3794 + | pub fn default_int_enum(mut self, input: i32) -> Self {
|
3795 + | self.default_int_enum = Some(input);
|
3796 + | self
|
1901 3797 | }
|
1902 - | }
|
1903 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<NestedPayload> {
|
1904 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1905 - | ob.extract::<NestedPayload>().map(Box::new)
|
3798 + | #[allow(missing_docs)] // documentation missing in model
|
3799 + | pub fn empty_string(mut self, input: ::std::string::String) -> Self {
|
3800 + | self.empty_string = Some(input);
|
3801 + | self
|
1906 3802 | }
|
1907 - | }
|
1908 - |
|
1909 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<NestedPayload> {
|
1910 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1911 - | (*self).into_py(py)
|
3803 + | #[allow(missing_docs)] // documentation missing in model
|
3804 + | pub fn false_boolean(mut self, input: bool) -> Self {
|
3805 + | self.false_boolean = Some(input);
|
3806 + | self
|
1912 3807 | }
|
1913 - | }
|
1914 - | impl crate::constrained::Constrained for crate::model::NestedPayload {
|
1915 - | type Unconstrained = crate::model::nested_payload_internal::Builder;
|
1916 - | }
|
1917 - | impl NestedPayload {
|
1918 - | /// Creates a new builder-style object to manufacture [`NestedPayload`](crate::model::NestedPayload).
|
1919 - | pub fn builder() -> crate::model::nested_payload::Builder {
|
1920 - | crate::model::nested_payload::Builder::default()
|
3808 + | #[allow(missing_docs)] // documentation missing in model
|
3809 + | pub fn empty_blob(mut self, input: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
3810 + | self.empty_blob = Some(input);
|
3811 + | self
|
1921 3812 | }
|
1922 - | }
|
1923 - |
|
1924 - | #[allow(missing_docs)] // documentation missing in model
|
1925 - | ///
|
1926 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1927 - | /// [constraint traits]. Use [`IntegerSet::try_from`] to construct values of this type.
|
1928 - | ///
|
1929 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1930 - | ///
|
1931 - | #[derive(
|
1932 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1933 - | )]
|
1934 - | pub(crate) struct IntegerSet(pub(crate) ::std::vec::Vec<i32>);
|
1935 - | impl IntegerSet {
|
1936 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
1937 - | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
1938 - | self.0
|
3813 + | #[allow(missing_docs)] // documentation missing in model
|
3814 + | pub fn zero_byte(mut self, input: i8) -> Self {
|
3815 + | self.zero_byte = Some(input);
|
3816 + | self
|
1939 3817 | }
|
1940 - |
|
1941 - | fn check_unique_items(
|
1942 - | items: ::std::vec::Vec<i32>,
|
1943 - | ) -> Result<::std::vec::Vec<i32>, crate::model::integer_set_internal::ConstraintViolation> {
|
1944 - | let mut seen = ::std::collections::HashMap::new();
|
1945 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
1946 - | for (idx, item) in items.iter().enumerate() {
|
1947 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
1948 - | duplicate_indices.push(prev_idx);
|
3818 + | #[allow(missing_docs)] // documentation missing in model
|
3819 + | pub fn zero_short(mut self, input: i16) -> Self {
|
3820 + | self.zero_short = Some(input);
|
3821 + | self
|
3822 + | }
|
3823 + | #[allow(missing_docs)] // documentation missing in model
|
3824 + | pub fn zero_integer(mut self, input: i32) -> Self {
|
3825 + | self.zero_integer = Some(input);
|
3826 + | self
|
1949 3827 | }
|
3828 + | #[allow(missing_docs)] // documentation missing in model
|
3829 + | pub fn zero_long(mut self, input: i64) -> Self {
|
3830 + | self.zero_long = Some(input);
|
3831 + | self
|
1950 3832 | }
|
1951 - |
|
1952 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
1953 - | for idx in &duplicate_indices {
|
1954 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
1955 - | last_duplicate_indices.push(prev_idx);
|
3833 + | #[allow(missing_docs)] // documentation missing in model
|
3834 + | pub fn zero_float(mut self, input: f32) -> Self {
|
3835 + | self.zero_float = Some(input);
|
3836 + | self
|
1956 3837 | }
|
3838 + | #[allow(missing_docs)] // documentation missing in model
|
3839 + | pub fn zero_double(mut self, input: f64) -> Self {
|
3840 + | self.zero_double = Some(input);
|
3841 + | self
|
1957 3842 | }
|
1958 - | duplicate_indices.extend(last_duplicate_indices);
|
1959 - |
|
1960 - | if !duplicate_indices.is_empty() {
|
1961 - | debug_assert!(duplicate_indices.len() >= 2);
|
1962 - | Err(
|
1963 - | crate::model::integer_set_internal::ConstraintViolation::UniqueItems {
|
1964 - | duplicate_indices,
|
1965 - | original: items,
|
1966 - | },
|
1967 - | )
|
1968 - | } else {
|
1969 - | Ok(items)
|
3843 + | /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
|
3844 + | pub fn build(self) -> crate::model::Defaults {
|
3845 + | self.build_enforcing_required_and_enum_traits()
|
1970 3846 | }
|
3847 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::Defaults {
|
3848 + | crate::model::Defaults {
|
3849 + | default_string: self.default_string.unwrap_or_else(
|
3850 + | #[allow(clippy::redundant_closure)]
|
3851 + | || String::from("hi"),
|
3852 + | ),
|
3853 + | default_boolean: self.default_boolean.unwrap_or(true),
|
3854 + | default_list: self.default_list.unwrap_or_else(
|
3855 + | #[allow(clippy::redundant_closure)]
|
3856 + | || ::std::vec::Vec::new(),
|
3857 + | ),
|
3858 + | default_document_map: self.default_document_map.unwrap_or_else(
|
3859 + | #[allow(clippy::redundant_closure)]
|
3860 + | || {
|
3861 + | ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
|
3862 + | .into()
|
3863 + | },
|
3864 + | ),
|
3865 + | default_document_string: self.default_document_string.unwrap_or_else(
|
3866 + | #[allow(clippy::redundant_closure)]
|
3867 + | || {
|
3868 + | ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
|
3869 + | .into()
|
3870 + | },
|
3871 + | ),
|
3872 + | default_document_boolean: self
|
3873 + | .default_document_boolean
|
3874 + | .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
|
3875 + | default_document_list: self.default_document_list.unwrap_or_else(
|
3876 + | #[allow(clippy::redundant_closure)]
|
3877 + | || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
|
3878 + | ),
|
3879 + | default_null_document: self.default_null_document,
|
3880 + | default_timestamp: self.default_timestamp.unwrap_or_else(
|
3881 + | #[allow(clippy::redundant_closure)]
|
3882 + | || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
|
3883 + | ),
|
3884 + | default_blob: self.default_blob.unwrap_or_else(
|
3885 + | #[allow(clippy::redundant_closure)]
|
3886 + | || ::aws_smithy_types::Blob::new("abc").into(),
|
3887 + | ),
|
3888 + | default_byte: self.default_byte.unwrap_or(1i8),
|
3889 + | default_short: self.default_short.unwrap_or(1i16),
|
3890 + | default_integer: self.default_integer.unwrap_or(10i32),
|
3891 + | default_long: self.default_long.unwrap_or(100i64),
|
3892 + | default_float: self.default_float.unwrap_or(1.0f32),
|
3893 + | default_double: self.default_double.unwrap_or(1.0f64),
|
3894 + | default_map: self.default_map.unwrap_or_else(
|
3895 + | #[allow(clippy::redundant_closure)]
|
3896 + | || ::std::collections::HashMap::new(),
|
3897 + | ),
|
3898 + | default_enum: self.default_enum.unwrap_or(
|
3899 + | "FOO"
|
3900 + | .parse::<crate::model::TestEnum>()
|
3901 + | .expect("static value validated to member"),
|
3902 + | ),
|
3903 + | default_int_enum: self.default_int_enum.unwrap_or(1i32),
|
3904 + | empty_string: self.empty_string.unwrap_or_else(
|
3905 + | #[allow(clippy::redundant_closure)]
|
3906 + | || String::from(""),
|
3907 + | ),
|
3908 + | false_boolean: self.false_boolean.unwrap_or(false),
|
3909 + | empty_blob: self.empty_blob.unwrap_or_else(
|
3910 + | #[allow(clippy::redundant_closure)]
|
3911 + | || ::aws_smithy_types::Blob::new("").into(),
|
3912 + | ),
|
3913 + | zero_byte: self.zero_byte.unwrap_or(0i8),
|
3914 + | zero_short: self.zero_short.unwrap_or(0i16),
|
3915 + | zero_integer: self.zero_integer.unwrap_or(0i32),
|
3916 + | zero_long: self.zero_long.unwrap_or(0i64),
|
3917 + | zero_float: self.zero_float.unwrap_or(0.0f32),
|
3918 + | zero_double: self.zero_double.unwrap_or(0.0f64),
|
1971 3919 | }
|
1972 - | }
|
1973 - | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerSet {
|
1974 - | type Error = crate::model::integer_set_internal::ConstraintViolation;
|
1975 - |
|
1976 - | /// Constructs a `IntegerSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
1977 - | fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
|
1978 - | let value = Self::check_unique_items(value)?;
|
1979 - |
|
1980 - | Ok(Self(value))
|
1981 3920 | }
|
1982 - | }
|
1983 - |
|
1984 - | impl ::std::convert::From<IntegerSet> for ::std::vec::Vec<i32> {
|
1985 - | fn from(value: IntegerSet) -> Self {
|
1986 - | value.into_inner()
|
1987 3921 | }
|
1988 3922 | }
|
1989 - | impl crate::constrained::Constrained for IntegerSet {
|
1990 - | type Unconstrained = crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained;
|
1991 - | }
|
1992 - |
|
1993 3923 | /// See [`PayloadConfig`](crate::model::PayloadConfig).
|
1994 3924 | ///
|
1995 3925 | pub(crate) mod payload_config_internal {
|
1996 3926 |
|
1997 3927 | impl ::std::convert::From<Builder> for crate::model::PayloadConfig {
|
1998 3928 | fn from(builder: Builder) -> Self {
|
1999 3929 | builder.build()
|
2000 3930 | }
|
2001 3931 | }
|
2002 3932 | /// A builder for [`PayloadConfig`](crate::model::PayloadConfig).
|