1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[::pyo3::pyclass]
|
3 + | /// :param top_level rest_json.model.TopLevel:
|
4 + | /// :rtype None:
|
5 + | #[allow(missing_docs)] // documentation missing in model
|
6 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
7 + | pub struct OperationWithNestedStructureInput {
|
8 + | #[pyo3(get, set)]
|
9 + | /// :type rest_json.model.TopLevel:
|
10 + | #[allow(missing_docs)] // documentation missing in model
|
11 + | pub top_level: crate::model::TopLevel,
|
12 + | }
|
13 + | impl OperationWithNestedStructureInput {
|
14 + | #[allow(missing_docs)] // documentation missing in model
|
15 + | pub fn top_level(&self) -> &crate::model::TopLevel {
|
16 + | &self.top_level
|
17 + | }
|
18 + | }
|
19 + | #[allow(clippy::new_without_default)]
|
20 + | #[allow(clippy::too_many_arguments)]
|
21 + | #[::pyo3::pymethods]
|
22 + | impl OperationWithNestedStructureInput {
|
23 + | #[new]
|
24 + | pub fn new(top_level: crate::model::TopLevel) -> Self {
|
25 + | Self { top_level }
|
26 + | }
|
27 + | fn __repr__(&self) -> String {
|
28 + | format!("{self:?}")
|
29 + | }
|
30 + | fn __str__(&self) -> String {
|
31 + | format!("{self:?}")
|
32 + | }
|
33 + | }
|
34 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<OperationWithNestedStructureInput> {
|
35 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
36 + | ob.extract::<OperationWithNestedStructureInput>()
|
37 + | .map(Box::new)
|
38 + | }
|
39 + | }
|
40 + |
|
41 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<OperationWithNestedStructureInput> {
|
42 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
43 + | (*self).into_py(py)
|
44 + | }
|
45 + | }
|
46 + | impl crate::constrained::Constrained for crate::input::OperationWithNestedStructureInput {
|
47 + | type Unconstrained = crate::input::operation_with_nested_structure_input_internal::Builder;
|
48 + | }
|
49 + | impl OperationWithNestedStructureInput {
|
50 + | /// Creates a new builder-style object to manufacture [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
51 + | pub fn builder() -> crate::input::operation_with_nested_structure_input::Builder {
|
52 + | crate::input::operation_with_nested_structure_input::Builder::default()
|
53 + | }
|
54 + | }
|
55 + |
|
56 + | #[::pyo3::pyclass]
|
57 + | /// :param defaults typing.Optional\[rest_json.model.Defaults\]:
|
58 + | /// :param client_optional_defaults typing.Optional\[rest_json.model.ClientOptionalDefaults\]:
|
59 + | /// :param top_level_default str:
|
60 + | /// :param other_top_level_default int:
|
61 + | /// :rtype None:
|
62 + | #[allow(missing_docs)] // documentation missing in model
|
63 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
64 + | pub struct OperationWithDefaultsInput {
|
65 + | #[pyo3(get, set)]
|
66 + | /// :type typing.Optional\[rest_json.model.Defaults\]:
|
67 + | #[allow(missing_docs)] // documentation missing in model
|
68 + | pub defaults: ::std::option::Option<crate::model::Defaults>,
|
69 + | #[pyo3(get, set)]
|
70 + | /// :type typing.Optional\[rest_json.model.ClientOptionalDefaults\]:
|
71 + | #[allow(missing_docs)] // documentation missing in model
|
72 + | pub client_optional_defaults: ::std::option::Option<crate::model::ClientOptionalDefaults>,
|
73 + | #[pyo3(get, set)]
|
74 + | /// :type str:
|
75 + | #[allow(missing_docs)] // documentation missing in model
|
76 + | pub top_level_default: ::std::string::String,
|
77 + | #[pyo3(get, set)]
|
78 + | /// :type int:
|
79 + | #[allow(missing_docs)] // documentation missing in model
|
80 + | pub other_top_level_default: i32,
|
81 + | }
|
82 + | impl OperationWithDefaultsInput {
|
83 + | #[allow(missing_docs)] // documentation missing in model
|
84 + | pub fn defaults(&self) -> ::std::option::Option<&crate::model::Defaults> {
|
85 + | self.defaults.as_ref()
|
86 + | }
|
87 + | #[allow(missing_docs)] // documentation missing in model
|
88 + | pub fn client_optional_defaults(
|
89 + | &self,
|
90 + | ) -> ::std::option::Option<&crate::model::ClientOptionalDefaults> {
|
91 + | self.client_optional_defaults.as_ref()
|
92 + | }
|
93 + | #[allow(missing_docs)] // documentation missing in model
|
94 + | pub fn top_level_default(&self) -> &str {
|
95 + | use std::ops::Deref;
|
96 + | self.top_level_default.deref()
|
97 + | }
|
98 + | #[allow(missing_docs)] // documentation missing in model
|
99 + | pub fn other_top_level_default(&self) -> i32 {
|
100 + | self.other_top_level_default
|
101 + | }
|
102 + | }
|
103 + | #[allow(clippy::new_without_default)]
|
104 + | #[allow(clippy::too_many_arguments)]
|
105 + | #[::pyo3::pymethods]
|
106 + | impl OperationWithDefaultsInput {
|
107 + | #[new]
|
108 + | pub fn new(
|
109 + | defaults: ::std::option::Option<crate::model::Defaults>,
|
110 + | client_optional_defaults: ::std::option::Option<crate::model::ClientOptionalDefaults>,
|
111 + | top_level_default: ::std::string::String,
|
112 + | other_top_level_default: i32,
|
113 + | ) -> Self {
|
114 + | Self {
|
115 + | defaults,
|
116 + | client_optional_defaults,
|
117 + | top_level_default,
|
118 + | other_top_level_default,
|
119 + | }
|
120 + | }
|
121 + | fn __repr__(&self) -> String {
|
122 + | format!("{self:?}")
|
123 + | }
|
124 + | fn __str__(&self) -> String {
|
125 + | format!("{self:?}")
|
126 + | }
|
127 + | }
|
128 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<OperationWithDefaultsInput> {
|
129 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
130 + | ob.extract::<OperationWithDefaultsInput>().map(Box::new)
|
131 + | }
|
132 + | }
|
133 + |
|
134 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<OperationWithDefaultsInput> {
|
135 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
136 + | (*self).into_py(py)
|
137 + | }
|
138 + | }
|
139 + | impl crate::constrained::Constrained for crate::input::OperationWithDefaultsInput {
|
140 + | type Unconstrained = crate::input::operation_with_defaults_input_internal::Builder;
|
141 + | }
|
142 + | impl OperationWithDefaultsInput {
|
143 + | /// Creates a new builder-style object to manufacture [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
144 + | pub fn builder() -> crate::input::operation_with_defaults_input::Builder {
|
145 + | crate::input::operation_with_defaults_input::Builder::default()
|
146 + | }
|
147 + | }
|
148 + |
|
149 + | #[::pyo3::pyclass]
|
150 + | /// :param value typing.Optional\[int\]:
|
151 + | /// :rtype None:
|
152 + | #[allow(missing_docs)] // documentation missing in model
|
153 + | #[derive(
|
154 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
155 + | )]
|
156 + | pub struct ContentTypeParametersInput {
|
157 + | #[pyo3(get, set)]
|
158 + | /// :type typing.Optional\[int\]:
|
159 + | #[allow(missing_docs)] // documentation missing in model
|
160 + | pub value: ::std::option::Option<i32>,
|
161 + | }
|
162 + | impl ContentTypeParametersInput {
|
163 + | #[allow(missing_docs)] // documentation missing in model
|
164 + | pub fn value(&self) -> ::std::option::Option<i32> {
|
165 + | self.value
|
166 + | }
|
167 + | }
|
168 + | #[allow(clippy::new_without_default)]
|
169 + | #[allow(clippy::too_many_arguments)]
|
170 + | #[::pyo3::pymethods]
|
171 + | impl ContentTypeParametersInput {
|
172 + | #[new]
|
173 + | pub fn new(value: ::std::option::Option<i32>) -> Self {
|
174 + | Self { value }
|
175 + | }
|
176 + | fn __repr__(&self) -> String {
|
177 + | format!("{self:?}")
|
178 + | }
|
179 + | fn __str__(&self) -> String {
|
180 + | format!("{self:?}")
|
181 + | }
|
182 + | }
|
183 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ContentTypeParametersInput> {
|
184 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
185 + | ob.extract::<ContentTypeParametersInput>().map(Box::new)
|
186 + | }
|
187 + | }
|
188 + |
|
189 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ContentTypeParametersInput> {
|
190 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
191 + | (*self).into_py(py)
|
192 + | }
|
193 + | }
|
194 + | impl crate::constrained::Constrained for crate::input::ContentTypeParametersInput {
|
195 + | type Unconstrained = crate::input::content_type_parameters_input_internal::Builder;
|
196 + | }
|
197 + | impl ContentTypeParametersInput {
|
198 + | /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
199 + | pub fn builder() -> crate::input::content_type_parameters_input::Builder {
|
200 + | crate::input::content_type_parameters_input::Builder::default()
|
201 + | }
|
202 + | }
|
203 + |
|
2 204 | #[::pyo3::pyclass]
|
3 205 | /// :param encoding typing.Optional\[str\]:
|
4 206 | /// :param data typing.Optional\[str\]:
|
5 207 | /// :rtype None:
|
6 208 | #[allow(missing_docs)] // documentation missing in model
|
7 209 | #[derive(
|
8 210 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
9 211 | )]
|
10 212 | pub struct PutWithContentEncodingInput {
|
11 213 | #[pyo3(get, set)]
|
7046 7291 | }
|
7047 7292 | impl crate::constrained::Constrained for crate::input::NoInputAndNoOutputInput {
|
7048 7293 | type Unconstrained = crate::input::no_input_and_no_output_input_internal::Builder;
|
7049 7294 | }
|
7050 7295 | impl NoInputAndNoOutputInput {
|
7051 7296 | /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputInput`](crate::input::NoInputAndNoOutputInput).
|
7052 7297 | pub fn builder() -> crate::input::no_input_and_no_output_input::Builder {
|
7053 7298 | crate::input::no_input_and_no_output_input::Builder::default()
|
7054 7299 | }
|
7055 7300 | }
|
7301 + | /// See [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7302 + | ///
|
7303 + | pub(crate) mod operation_with_nested_structure_input_internal {
|
7304 + |
|
7305 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
7306 + | /// Holds one variant for each of the ways the builder can fail.
|
7307 + | #[non_exhaustive]
|
7308 + | #[allow(clippy::enum_variant_names)]
|
7309 + | pub(crate) enum ConstraintViolation {
|
7310 + | /// `top_level` was not provided but it is required when building `OperationWithNestedStructureInput`.
|
7311 + | MissingTopLevel,
|
7312 + | /// Constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`.
|
7313 + | #[doc(hidden)]
|
7314 + | TopLevel(crate::model::top_level_internal::ConstraintViolation),
|
7315 + | }
|
7316 + | impl ::std::fmt::Display for ConstraintViolation {
|
7317 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
7318 + | match self {
|
7319 + | ConstraintViolation::MissingTopLevel => write!(f, "`top_level` was not provided but it is required when building `OperationWithNestedStructureInput`"),
|
7320 + | ConstraintViolation::TopLevel(_) => write!(f, "constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`"),
|
7321 + | }
|
7322 + | }
|
7323 + | }
|
7324 + | impl ::std::error::Error for ConstraintViolation {}
|
7325 + | impl ConstraintViolation {
|
7326 + | pub(crate) fn as_validation_exception_field(
|
7327 + | self,
|
7328 + | path: ::std::string::String,
|
7329 + | ) -> crate::model::ValidationExceptionField {
|
7330 + | match self {
|
7331 + | ConstraintViolation::MissingTopLevel => crate::model::ValidationExceptionField {
|
7332 + | message: format!("Value at '{}/topLevel' failed to satisfy constraint: Member must not be null", path),
|
7333 + | path: path + "/topLevel",
|
7334 + | },
|
7335 + | ConstraintViolation::TopLevel(inner) => inner.as_validation_exception_field(path + "/topLevel"),
|
7336 + | }
|
7337 + | }
|
7338 + | }
|
7339 + | impl ::std::convert::From<ConstraintViolation>
|
7340 + | for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
7341 + | {
|
7342 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
7343 + | let first_validation_exception_field =
|
7344 + | constraint_violation.as_validation_exception_field("".to_owned());
|
7345 + | let validation_exception = crate::error::ValidationException {
|
7346 + | message: format!(
|
7347 + | "1 validation error detected. {}",
|
7348 + | &first_validation_exception_field.message
|
7349 + | ),
|
7350 + | field_list: Some(vec![first_validation_exception_field]),
|
7351 + | };
|
7352 + | Self::ConstraintViolation(
|
7353 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
7354 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
7355 + | )
|
7356 + | }
|
7357 + | }
|
7358 + | impl ::std::convert::From<Builder>
|
7359 + | for crate::constrained::MaybeConstrained<crate::input::OperationWithNestedStructureInput>
|
7360 + | {
|
7361 + | fn from(builder: Builder) -> Self {
|
7362 + | Self::Unconstrained(builder)
|
7363 + | }
|
7364 + | }
|
7365 + | impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithNestedStructureInput {
|
7366 + | type Error = ConstraintViolation;
|
7367 + |
|
7368 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
7369 + | builder.build()
|
7370 + | }
|
7371 + | }
|
7372 + | /// A builder for [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7373 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7374 + | pub(crate) struct Builder {
|
7375 + | pub(crate) top_level:
|
7376 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TopLevel>>,
|
7377 + | }
|
7378 + | impl Builder {
|
7379 + | #[allow(missing_docs)] // documentation missing in model
|
7380 + | pub(crate) fn set_top_level(
|
7381 + | mut self,
|
7382 + | input: impl ::std::convert::Into<
|
7383 + | crate::constrained::MaybeConstrained<crate::model::TopLevel>,
|
7384 + | >,
|
7385 + | ) -> Self {
|
7386 + | self.top_level = Some(input.into());
|
7387 + | self
|
7388 + | }
|
7389 + | /// Consumes the builder and constructs a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7390 + | ///
|
7391 + | /// The builder fails to construct a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput) if a [`ConstraintViolation`] occurs.
|
7392 + | ///
|
7393 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
7394 + | pub fn build(
|
7395 + | self,
|
7396 + | ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
|
7397 + | self.build_enforcing_all_constraints()
|
7398 + | }
|
7399 + | fn build_enforcing_all_constraints(
|
7400 + | self,
|
7401 + | ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
|
7402 + | Ok(crate::input::OperationWithNestedStructureInput {
|
7403 + | top_level: self
|
7404 + | .top_level
|
7405 + | .map(|v| match v {
|
7406 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
7407 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
7408 + | })
|
7409 + | .map(|res| res.map_err(ConstraintViolation::TopLevel))
|
7410 + | .transpose()?
|
7411 + | .ok_or(ConstraintViolation::MissingTopLevel)?,
|
7412 + | })
|
7413 + | }
|
7414 + | }
|
7415 + | }
|
7416 + | /// See [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7417 + | ///
|
7418 + | pub mod operation_with_nested_structure_input {
|
7419 + |
|
7420 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
7421 + | /// Holds one variant for each of the ways the builder can fail.
|
7422 + |
|
7423 + | #[allow(clippy::enum_variant_names)]
|
7424 + | pub enum ConstraintViolation {
|
7425 + | /// `top_level` was not provided but it is required when building `OperationWithNestedStructureInput`.
|
7426 + | MissingTopLevel,
|
7427 + | }
|
7428 + | impl ::std::fmt::Display for ConstraintViolation {
|
7429 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
7430 + | match self {
|
7431 + | ConstraintViolation::MissingTopLevel => write!(f, "`top_level` was not provided but it is required when building `OperationWithNestedStructureInput`"),
|
7432 + | }
|
7433 + | }
|
7434 + | }
|
7435 + | impl ::std::error::Error for ConstraintViolation {}
|
7436 + | impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithNestedStructureInput {
|
7437 + | type Error = ConstraintViolation;
|
7438 + |
|
7439 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
7440 + | builder.build()
|
7441 + | }
|
7442 + | }
|
7443 + | /// A builder for [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7444 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7445 + | pub struct Builder {
|
7446 + | pub(crate) top_level: ::std::option::Option<crate::model::TopLevel>,
|
7447 + | }
|
7448 + | impl Builder {
|
7449 + | #[allow(missing_docs)] // documentation missing in model
|
7450 + | pub fn top_level(mut self, input: crate::model::TopLevel) -> Self {
|
7451 + | self.top_level = Some(input);
|
7452 + | self
|
7453 + | }
|
7454 + | /// Consumes the builder and constructs a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
|
7455 + | ///
|
7456 + | /// The builder fails to construct a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput) if you do not provide a value for all non-`Option`al members.
|
7457 + | ///
|
7458 + | pub fn build(
|
7459 + | self,
|
7460 + | ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
|
7461 + | self.build_enforcing_required_and_enum_traits()
|
7462 + | }
|
7463 + | fn build_enforcing_required_and_enum_traits(
|
7464 + | self,
|
7465 + | ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
|
7466 + | Ok(crate::input::OperationWithNestedStructureInput {
|
7467 + | top_level: self.top_level.ok_or(ConstraintViolation::MissingTopLevel)?,
|
7468 + | })
|
7469 + | }
|
7470 + | }
|
7471 + | }
|
7472 + | /// See [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7473 + | ///
|
7474 + | pub(crate) mod operation_with_defaults_input_internal {
|
7475 + |
|
7476 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
7477 + | /// Holds one variant for each of the ways the builder can fail.
|
7478 + | #[non_exhaustive]
|
7479 + | #[allow(clippy::enum_variant_names)]
|
7480 + | pub(crate) enum ConstraintViolation {
|
7481 + | /// Constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`.
|
7482 + | #[doc(hidden)]
|
7483 + | Defaults(crate::model::defaults_internal::ConstraintViolation),
|
7484 + | }
|
7485 + | impl ::std::fmt::Display for ConstraintViolation {
|
7486 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
7487 + | match self {
|
7488 + | ConstraintViolation::Defaults(_) => write!(f, "constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`"),
|
7489 + | }
|
7490 + | }
|
7491 + | }
|
7492 + | impl ::std::error::Error for ConstraintViolation {}
|
7493 + | impl ConstraintViolation {
|
7494 + | pub(crate) fn as_validation_exception_field(
|
7495 + | self,
|
7496 + | path: ::std::string::String,
|
7497 + | ) -> crate::model::ValidationExceptionField {
|
7498 + | match self {
|
7499 + | ConstraintViolation::Defaults(inner) => {
|
7500 + | inner.as_validation_exception_field(path + "/defaults")
|
7501 + | }
|
7502 + | }
|
7503 + | }
|
7504 + | }
|
7505 + | impl ::std::convert::From<ConstraintViolation>
|
7506 + | for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
7507 + | {
|
7508 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
7509 + | let first_validation_exception_field =
|
7510 + | constraint_violation.as_validation_exception_field("".to_owned());
|
7511 + | let validation_exception = crate::error::ValidationException {
|
7512 + | message: format!(
|
7513 + | "1 validation error detected. {}",
|
7514 + | &first_validation_exception_field.message
|
7515 + | ),
|
7516 + | field_list: Some(vec![first_validation_exception_field]),
|
7517 + | };
|
7518 + | Self::ConstraintViolation(
|
7519 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
7520 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
7521 + | )
|
7522 + | }
|
7523 + | }
|
7524 + | impl ::std::convert::From<Builder>
|
7525 + | for crate::constrained::MaybeConstrained<crate::input::OperationWithDefaultsInput>
|
7526 + | {
|
7527 + | fn from(builder: Builder) -> Self {
|
7528 + | Self::Unconstrained(builder)
|
7529 + | }
|
7530 + | }
|
7531 + | impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithDefaultsInput {
|
7532 + | type Error = ConstraintViolation;
|
7533 + |
|
7534 + | fn try_from(builder: Builder) -> Result<Self, Self::Error> {
|
7535 + | builder.build()
|
7536 + | }
|
7537 + | }
|
7538 + | /// A builder for [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7539 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7540 + | pub(crate) struct Builder {
|
7541 + | pub(crate) defaults:
|
7542 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
|
7543 + | pub(crate) client_optional_defaults:
|
7544 + | ::std::option::Option<crate::model::ClientOptionalDefaults>,
|
7545 + | pub(crate) top_level_default: ::std::option::Option<::std::string::String>,
|
7546 + | pub(crate) other_top_level_default: ::std::option::Option<i32>,
|
7547 + | }
|
7548 + | impl Builder {
|
7549 + | #[allow(missing_docs)] // documentation missing in model
|
7550 + | pub(crate) fn set_defaults(
|
7551 + | mut self,
|
7552 + | input: Option<
|
7553 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
|
7554 + | >,
|
7555 + | ) -> Self {
|
7556 + | self.defaults = input.map(|v| v.into());
|
7557 + | self
|
7558 + | }
|
7559 + | #[allow(missing_docs)] // documentation missing in model
|
7560 + | pub(crate) fn set_client_optional_defaults(
|
7561 + | mut self,
|
7562 + | input: Option<impl ::std::convert::Into<crate::model::ClientOptionalDefaults>>,
|
7563 + | ) -> Self {
|
7564 + | self.client_optional_defaults = input.map(|v| v.into());
|
7565 + | self
|
7566 + | }
|
7567 + | #[allow(missing_docs)] // documentation missing in model
|
7568 + | pub(crate) fn set_top_level_default(
|
7569 + | mut self,
|
7570 + | input: impl ::std::convert::Into<::std::string::String>,
|
7571 + | ) -> Self {
|
7572 + | self.top_level_default = Some(input.into());
|
7573 + | self
|
7574 + | }
|
7575 + | #[allow(missing_docs)] // documentation missing in model
|
7576 + | pub(crate) fn set_other_top_level_default(
|
7577 + | mut self,
|
7578 + | input: impl ::std::convert::Into<i32>,
|
7579 + | ) -> Self {
|
7580 + | self.other_top_level_default = Some(input.into());
|
7581 + | self
|
7582 + | }
|
7583 + | /// Consumes the builder and constructs a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7584 + | ///
|
7585 + | /// The builder fails to construct a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput) if a [`ConstraintViolation`] occurs.
|
7586 + | ///
|
7587 + | pub fn build(
|
7588 + | self,
|
7589 + | ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
|
7590 + | self.build_enforcing_all_constraints()
|
7591 + | }
|
7592 + | fn build_enforcing_all_constraints(
|
7593 + | self,
|
7594 + | ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
|
7595 + | Ok(crate::input::OperationWithDefaultsInput {
|
7596 + | defaults: self
|
7597 + | .defaults
|
7598 + | .map(|v| match v {
|
7599 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
7600 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
7601 + | })
|
7602 + | .map(|res| res.map_err(ConstraintViolation::Defaults))
|
7603 + | .transpose()?,
|
7604 + | client_optional_defaults: self.client_optional_defaults,
|
7605 + | top_level_default: self.top_level_default.unwrap_or_else(
|
7606 + | #[allow(clippy::redundant_closure)]
|
7607 + | || String::from("hi"),
|
7608 + | ),
|
7609 + | other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
|
7610 + | })
|
7611 + | }
|
7612 + | }
|
7613 + | }
|
7614 + | /// See [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7615 + | ///
|
7616 + | pub mod operation_with_defaults_input {
|
7617 + |
|
7618 + | impl ::std::convert::From<Builder> for crate::input::OperationWithDefaultsInput {
|
7619 + | fn from(builder: Builder) -> Self {
|
7620 + | builder.build()
|
7621 + | }
|
7622 + | }
|
7623 + | /// A builder for [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7624 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7625 + | pub struct Builder {
|
7626 + | pub(crate) defaults: ::std::option::Option<crate::model::Defaults>,
|
7627 + | pub(crate) client_optional_defaults:
|
7628 + | ::std::option::Option<crate::model::ClientOptionalDefaults>,
|
7629 + | pub(crate) top_level_default: ::std::option::Option<::std::string::String>,
|
7630 + | pub(crate) other_top_level_default: ::std::option::Option<i32>,
|
7631 + | }
|
7632 + | impl Builder {
|
7633 + | #[allow(missing_docs)] // documentation missing in model
|
7634 + | pub fn defaults(mut self, input: ::std::option::Option<crate::model::Defaults>) -> Self {
|
7635 + | self.defaults = input;
|
7636 + | self
|
7637 + | }
|
7638 + | #[allow(missing_docs)] // documentation missing in model
|
7639 + | pub fn client_optional_defaults(
|
7640 + | mut self,
|
7641 + | input: ::std::option::Option<crate::model::ClientOptionalDefaults>,
|
7642 + | ) -> Self {
|
7643 + | self.client_optional_defaults = input;
|
7644 + | self
|
7645 + | }
|
7646 + | #[allow(missing_docs)] // documentation missing in model
|
7647 + | pub fn top_level_default(mut self, input: ::std::string::String) -> Self {
|
7648 + | self.top_level_default = Some(input);
|
7649 + | self
|
7650 + | }
|
7651 + | #[allow(missing_docs)] // documentation missing in model
|
7652 + | pub fn other_top_level_default(mut self, input: i32) -> Self {
|
7653 + | self.other_top_level_default = Some(input);
|
7654 + | self
|
7655 + | }
|
7656 + | /// Consumes the builder and constructs a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
|
7657 + | pub fn build(self) -> crate::input::OperationWithDefaultsInput {
|
7658 + | self.build_enforcing_required_and_enum_traits()
|
7659 + | }
|
7660 + | fn build_enforcing_required_and_enum_traits(
|
7661 + | self,
|
7662 + | ) -> crate::input::OperationWithDefaultsInput {
|
7663 + | crate::input::OperationWithDefaultsInput {
|
7664 + | defaults: self.defaults,
|
7665 + | client_optional_defaults: self.client_optional_defaults,
|
7666 + | top_level_default: self.top_level_default.unwrap_or_else(
|
7667 + | #[allow(clippy::redundant_closure)]
|
7668 + | || String::from("hi"),
|
7669 + | ),
|
7670 + | other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
|
7671 + | }
|
7672 + | }
|
7673 + | }
|
7674 + | }
|
7675 + | /// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7676 + | ///
|
7677 + | pub(crate) mod content_type_parameters_input_internal {
|
7678 + |
|
7679 + | impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
|
7680 + | fn from(builder: Builder) -> Self {
|
7681 + | builder.build()
|
7682 + | }
|
7683 + | }
|
7684 + | /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7685 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7686 + | pub(crate) struct Builder {
|
7687 + | pub(crate) value: ::std::option::Option<i32>,
|
7688 + | }
|
7689 + | impl Builder {
|
7690 + | #[allow(missing_docs)] // documentation missing in model
|
7691 + | pub(crate) fn set_value(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
|
7692 + | self.value = input.map(|v| v.into());
|
7693 + | self
|
7694 + | }
|
7695 + | /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7696 + | pub fn build(self) -> crate::input::ContentTypeParametersInput {
|
7697 + | self.build_enforcing_all_constraints()
|
7698 + | }
|
7699 + | fn build_enforcing_all_constraints(self) -> crate::input::ContentTypeParametersInput {
|
7700 + | crate::input::ContentTypeParametersInput { value: self.value }
|
7701 + | }
|
7702 + | }
|
7703 + | }
|
7704 + | /// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7705 + | ///
|
7706 + | pub mod content_type_parameters_input {
|
7707 + |
|
7708 + | impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
|
7709 + | fn from(builder: Builder) -> Self {
|
7710 + | builder.build()
|
7711 + | }
|
7712 + | }
|
7713 + | /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7714 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
7715 + | pub struct Builder {
|
7716 + | pub(crate) value: ::std::option::Option<i32>,
|
7717 + | }
|
7718 + | impl Builder {
|
7719 + | #[allow(missing_docs)] // documentation missing in model
|
7720 + | pub fn value(mut self, input: ::std::option::Option<i32>) -> Self {
|
7721 + | self.value = input;
|
7722 + | self
|
7723 + | }
|
7724 + | /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
|
7725 + | pub fn build(self) -> crate::input::ContentTypeParametersInput {
|
7726 + | self.build_enforcing_required_and_enum_traits()
|
7727 + | }
|
7728 + | fn build_enforcing_required_and_enum_traits(
|
7729 + | self,
|
7730 + | ) -> crate::input::ContentTypeParametersInput {
|
7731 + | crate::input::ContentTypeParametersInput { value: self.value }
|
7732 + | }
|
7733 + | }
|
7734 + | }
|
7056 7735 | /// See [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
|
7057 7736 | ///
|
7058 7737 | pub(crate) mod put_with_content_encoding_input_internal {
|
7059 7738 |
|
7060 7739 | impl ::std::convert::From<Builder> for crate::input::PutWithContentEncodingInput {
|
7061 7740 | fn from(builder: Builder) -> Self {
|
7062 7741 | builder.build()
|
7063 7742 | }
|
7064 7743 | }
|
7065 7744 | /// A builder for [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
|