645 645 | impl ::std::convert::From<SetOfLengthString> for ::std::vec::Vec<crate::model::LengthString> {
|
646 646 | fn from(value: SetOfLengthString) -> Self {
|
647 647 | value.into_inner()
|
648 648 | }
|
649 649 | }
|
650 650 | impl crate::constrained::Constrained for SetOfLengthString {
|
651 651 | type Unconstrained =
|
652 652 | crate::unconstrained::set_of_length_string_unconstrained::SetOfLengthStringUnconstrained;
|
653 653 | }
|
654 654 |
|
655 + | #[allow(missing_docs)] // documentation missing in model
|
656 + | ///
|
657 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
658 + | /// [constraint traits]. Use [`ListWithIndirectlyConstrainedMap::try_from`] to construct values of this type.
|
659 + | ///
|
660 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
661 + | ///
|
662 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
663 + | pub struct ListWithIndirectlyConstrainedMap(
|
664 + | pub(crate) ::std::vec::Vec<
|
665 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
666 + | >,
|
667 + | );
|
668 + | impl ListWithIndirectlyConstrainedMap {
|
669 + | /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`].
|
670 + | pub fn inner(
|
671 + | &self,
|
672 + | ) -> &::std::vec::Vec<
|
673 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
674 + | > {
|
675 + | &self.0
|
676 + | }
|
677 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`].
|
678 + | pub fn into_inner(
|
679 + | self,
|
680 + | ) -> ::std::vec::Vec<
|
681 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
682 + | > {
|
683 + | self.0
|
684 + | }
|
685 + |
|
686 + | fn check_length(
|
687 + | length: usize,
|
688 + | ) -> Result<(), crate::model::list_with_indirectly_constrained_map::ConstraintViolation> {
|
689 + | if (1..=10).contains(&length) {
|
690 + | Ok(())
|
691 + | } else {
|
692 + | Err(
|
693 + | crate::model::list_with_indirectly_constrained_map::ConstraintViolation::Length(
|
694 + | length,
|
695 + | ),
|
696 + | )
|
697 + | }
|
698 + | }
|
699 + | }
|
700 + | impl
|
701 + | ::std::convert::TryFrom<
|
702 + | ::std::vec::Vec<
|
703 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
704 + | >,
|
705 + | > for ListWithIndirectlyConstrainedMap
|
706 + | {
|
707 + | type Error = crate::model::list_with_indirectly_constrained_map::ConstraintViolation;
|
708 + |
|
709 + | /// Constructs a `ListWithIndirectlyConstrainedMap` from an [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`], failing when the provided value does not satisfy the modeled constraints.
|
710 + | fn try_from(
|
711 + | value: ::std::vec::Vec<
|
712 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
713 + | >,
|
714 + | ) -> Result<Self, Self::Error> {
|
715 + | Self::check_length(value.len())?;
|
716 + |
|
717 + | Ok(Self(value))
|
718 + | }
|
719 + | }
|
720 + |
|
721 + | impl ::std::convert::From<ListWithIndirectlyConstrainedMap>
|
722 + | for ::std::vec::Vec<
|
723 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
|
724 + | >
|
725 + | {
|
726 + | fn from(value: ListWithIndirectlyConstrainedMap) -> Self {
|
727 + | value.into_inner()
|
728 + | }
|
729 + | }
|
730 + | impl crate::constrained::Constrained for ListWithIndirectlyConstrainedMap {
|
731 + | type Unconstrained = crate::unconstrained::list_with_indirectly_constrained_map_unconstrained::ListWithIndirectlyConstrainedMapUnconstrained;
|
732 + | }
|
733 + |
|
734 + | #[allow(missing_docs)] // documentation missing in model
|
735 + | ///
|
736 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
737 + | /// [constraint traits]. Use [`ListWithIndirectlyConstrainedList::try_from`] to construct values of this type.
|
738 + | ///
|
739 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
740 + | ///
|
741 + | #[derive(
|
742 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
743 + | )]
|
744 + | pub struct ListWithIndirectlyConstrainedList(
|
745 + | pub(crate) ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>,
|
746 + | );
|
747 + | impl ListWithIndirectlyConstrainedList {
|
748 + | /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`].
|
749 + | pub fn inner(&self) -> &::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>> {
|
750 + | &self.0
|
751 + | }
|
752 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`].
|
753 + | pub fn into_inner(self) -> ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>> {
|
754 + | self.0
|
755 + | }
|
756 + |
|
757 + | fn check_length(
|
758 + | length: usize,
|
759 + | ) -> Result<(), crate::model::list_with_indirectly_constrained_list::ConstraintViolation> {
|
760 + | if (1..=10).contains(&length) {
|
761 + | Ok(())
|
762 + | } else {
|
763 + | Err(
|
764 + | crate::model::list_with_indirectly_constrained_list::ConstraintViolation::Length(
|
765 + | length,
|
766 + | ),
|
767 + | )
|
768 + | }
|
769 + | }
|
770 + | }
|
771 + | impl ::std::convert::TryFrom<::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>>
|
772 + | for ListWithIndirectlyConstrainedList
|
773 + | {
|
774 + | type Error = crate::model::list_with_indirectly_constrained_list::ConstraintViolation;
|
775 + |
|
776 + | /// Constructs a `ListWithIndirectlyConstrainedList` from an [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`], failing when the provided value does not satisfy the modeled constraints.
|
777 + | fn try_from(
|
778 + | value: ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>,
|
779 + | ) -> Result<Self, Self::Error> {
|
780 + | Self::check_length(value.len())?;
|
781 + |
|
782 + | Ok(Self(value))
|
783 + | }
|
784 + | }
|
785 + |
|
786 + | impl ::std::convert::From<ListWithIndirectlyConstrainedList>
|
787 + | for ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>
|
788 + | {
|
789 + | fn from(value: ListWithIndirectlyConstrainedList) -> Self {
|
790 + | value.into_inner()
|
791 + | }
|
792 + | }
|
793 + | impl crate::constrained::Constrained for ListWithIndirectlyConstrainedList {
|
794 + | type Unconstrained = crate::unconstrained::list_with_indirectly_constrained_list_unconstrained::ListWithIndirectlyConstrainedListUnconstrained;
|
795 + | }
|
796 + |
|
655 797 | #[allow(missing_docs)] // documentation missing in model
|
656 798 | #[derive(
|
657 799 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
658 800 | )]
|
659 801 | pub struct RecursiveShapesInputOutputNested1 {
|
660 802 | #[allow(missing_docs)] // documentation missing in model
|
661 803 | pub recursive_member: ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
662 804 | }
|
663 805 | impl RecursiveShapesInputOutputNested1 {
|
664 806 | #[allow(missing_docs)] // documentation missing in model
|
5127 5269 | match self {
|
5128 5270 | Self::Key(key_constraint_violation) => {
|
5129 5271 | key_constraint_violation.as_validation_exception_field(path)
|
5130 5272 | }
|
5131 5273 | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
5132 5274 | .as_validation_exception_field(path + "/" + key.as_str()),
|
5133 5275 | }
|
5134 5276 | }
|
5135 5277 | }
|
5136 5278 | }
|
5279 + | /// See [`ListWithIndirectlyConstrainedMap`](crate::model::ListWithIndirectlyConstrainedMap).
|
5280 + | pub mod list_with_indirectly_constrained_map {
|
5281 + |
|
5282 + | #[allow(clippy::enum_variant_names)]
|
5283 + | #[derive(Debug, PartialEq)]
|
5284 + | pub enum ConstraintViolation {
|
5285 + | /// Constraint violation error when the list doesn't have the required length
|
5286 + | Length(usize),
|
5287 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
5288 + | /// The first component of the tuple is the index in the collection where the
|
5289 + | /// first constraint violation was found.
|
5290 + | #[doc(hidden)]
|
5291 + | Member(
|
5292 + | usize,
|
5293 + | crate::model::indirectly_constrained_map::ConstraintViolation,
|
5294 + | ),
|
5295 + | }
|
5296 + |
|
5297 + | impl ::std::fmt::Display for ConstraintViolation {
|
5298 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5299 + | let message = match self {
|
5300 + | Self::Length(length) => {
|
5301 + | format!("Value with length {} provided for 'com.amazonaws.constraints#ListWithIndirectlyConstrainedMap' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length)
|
5302 + | }
|
5303 + | Self::Member(index, failing_member) => format!(
|
5304 + | "Value at index {index} failed to satisfy constraint. {}",
|
5305 + | failing_member
|
5306 + | ),
|
5307 + | };
|
5308 + | write!(f, "{message}")
|
5309 + | }
|
5310 + | }
|
5311 + |
|
5312 + | impl ::std::error::Error for ConstraintViolation {}
|
5313 + | impl ConstraintViolation {
|
5314 + | pub(crate) fn as_validation_exception_field(
|
5315 + | self,
|
5316 + | path: ::std::string::String,
|
5317 + | ) -> crate::model::ValidationExceptionField {
|
5318 + | match self {
|
5319 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
5320 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length, &path),
|
5321 + | path,
|
5322 + | },
|
5323 + | Self::Member(index, member_constraint_violation) =>
|
5324 + | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
5325 + | }
|
5326 + | }
|
5327 + | }
|
5328 + | }
|
5329 + | pub mod indirectly_constrained_map {
|
5330 + |
|
5331 + | #[allow(clippy::enum_variant_names)]
|
5332 + | #[derive(Debug, PartialEq)]
|
5333 + | pub enum ConstraintViolation {
|
5334 + | #[doc(hidden)]
|
5335 + | Key(crate::model::length_string::ConstraintViolation),
|
5336 + | #[doc(hidden)]
|
5337 + | Value(
|
5338 + | crate::model::LengthString,
|
5339 + | crate::model::length_string::ConstraintViolation,
|
5340 + | ),
|
5341 + | }
|
5342 + |
|
5343 + | impl ::std::fmt::Display for ConstraintViolation {
|
5344 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5345 + | match self {
|
5346 + | Self::Key(key_constraint_violation) => write!(f, "{}", key_constraint_violation),
|
5347 + | Self::Value(_, value_constraint_violation) => {
|
5348 + | write!(f, "{}", value_constraint_violation)
|
5349 + | }
|
5350 + | }
|
5351 + | }
|
5352 + | }
|
5353 + |
|
5354 + | impl ::std::error::Error for ConstraintViolation {}
|
5355 + | impl ConstraintViolation {
|
5356 + | pub(crate) fn as_validation_exception_field(
|
5357 + | self,
|
5358 + | path: ::std::string::String,
|
5359 + | ) -> crate::model::ValidationExceptionField {
|
5360 + | match self {
|
5361 + | Self::Key(key_constraint_violation) => {
|
5362 + | key_constraint_violation.as_validation_exception_field(path)
|
5363 + | }
|
5364 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
5365 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
5366 + | }
|
5367 + | }
|
5368 + | }
|
5369 + | }
|
5370 + | /// See [`ListWithIndirectlyConstrainedList`](crate::model::ListWithIndirectlyConstrainedList).
|
5371 + | pub mod list_with_indirectly_constrained_list {
|
5372 + |
|
5373 + | #[allow(clippy::enum_variant_names)]
|
5374 + | #[derive(Debug, PartialEq)]
|
5375 + | pub enum ConstraintViolation {
|
5376 + | /// Constraint violation error when the list doesn't have the required length
|
5377 + | Length(usize),
|
5378 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
5379 + | /// The first component of the tuple is the index in the collection where the
|
5380 + | /// first constraint violation was found.
|
5381 + | #[doc(hidden)]
|
5382 + | Member(
|
5383 + | usize,
|
5384 + | crate::model::indirectly_constrained_list::ConstraintViolation,
|
5385 + | ),
|
5386 + | }
|
5387 + |
|
5388 + | impl ::std::fmt::Display for ConstraintViolation {
|
5389 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5390 + | let message = match self {
|
5391 + | Self::Length(length) => {
|
5392 + | format!("Value with length {} provided for 'com.amazonaws.constraints#ListWithIndirectlyConstrainedList' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length)
|
5393 + | }
|
5394 + | Self::Member(index, failing_member) => format!(
|
5395 + | "Value at index {index} failed to satisfy constraint. {}",
|
5396 + | failing_member
|
5397 + | ),
|
5398 + | };
|
5399 + | write!(f, "{message}")
|
5400 + | }
|
5401 + | }
|
5402 + |
|
5403 + | impl ::std::error::Error for ConstraintViolation {}
|
5404 + | impl ConstraintViolation {
|
5405 + | pub(crate) fn as_validation_exception_field(
|
5406 + | self,
|
5407 + | path: ::std::string::String,
|
5408 + | ) -> crate::model::ValidationExceptionField {
|
5409 + | match self {
|
5410 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
5411 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length, &path),
|
5412 + | path,
|
5413 + | },
|
5414 + | Self::Member(index, member_constraint_violation) =>
|
5415 + | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
5416 + | }
|
5417 + | }
|
5418 + | }
|
5419 + | }
|
5420 + | pub mod indirectly_constrained_list {
|
5421 + |
|
5422 + | #[allow(clippy::enum_variant_names)]
|
5423 + | #[derive(Debug, PartialEq)]
|
5424 + | pub enum ConstraintViolation {
|
5425 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
5426 + | /// The first component of the tuple is the index in the collection where the
|
5427 + | /// first constraint violation was found.
|
5428 + | #[doc(hidden)]
|
5429 + | Member(usize, crate::model::length_string::ConstraintViolation),
|
5430 + | }
|
5431 + |
|
5432 + | impl ::std::fmt::Display for ConstraintViolation {
|
5433 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5434 + | let message = match self {
|
5435 + | Self::Member(index, failing_member) => format!(
|
5436 + | "Value at index {index} failed to satisfy constraint. {}",
|
5437 + | failing_member
|
5438 + | ),
|
5439 + | };
|
5440 + | write!(f, "{message}")
|
5441 + | }
|
5442 + | }
|
5443 + |
|
5444 + | impl ::std::error::Error for ConstraintViolation {}
|
5445 + | impl ConstraintViolation {
|
5446 + | pub(crate) fn as_validation_exception_field(
|
5447 + | self,
|
5448 + | path: ::std::string::String,
|
5449 + | ) -> crate::model::ValidationExceptionField {
|
5450 + | match self {
|
5451 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
5452 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
5453 + | }
|
5454 + | }
|
5455 + | }
|
5456 + | }
|
5137 5457 | pub mod recursive_list {
|
5138 5458 |
|
5139 5459 | #[allow(clippy::enum_variant_names)]
|
5140 5460 | #[derive(Debug, PartialEq)]
|
5141 5461 | pub enum ConstraintViolation {
|
5142 5462 | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
5143 5463 | /// The first component of the tuple is the index in the collection where the
|
5144 5464 | /// first constraint violation was found.
|
5145 5465 | #[doc(hidden)]
|
5146 5466 | Member(
|