aws_sdk_pinpointsmsvoicev2/types/
_text_validation.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct TextValidation {
7 pub min_length: i32,
9 pub max_length: i32,
11 pub pattern: ::std::string::String,
13}
14impl TextValidation {
15 pub fn min_length(&self) -> i32 {
17 self.min_length
18 }
19 pub fn max_length(&self) -> i32 {
21 self.max_length
22 }
23 pub fn pattern(&self) -> &str {
25 use std::ops::Deref;
26 self.pattern.deref()
27 }
28}
29impl TextValidation {
30 pub fn builder() -> crate::types::builders::TextValidationBuilder {
32 crate::types::builders::TextValidationBuilder::default()
33 }
34}
35
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct TextValidationBuilder {
40 pub(crate) min_length: ::std::option::Option<i32>,
41 pub(crate) max_length: ::std::option::Option<i32>,
42 pub(crate) pattern: ::std::option::Option<::std::string::String>,
43}
44impl TextValidationBuilder {
45 pub fn min_length(mut self, input: i32) -> Self {
48 self.min_length = ::std::option::Option::Some(input);
49 self
50 }
51 pub fn set_min_length(mut self, input: ::std::option::Option<i32>) -> Self {
53 self.min_length = input;
54 self
55 }
56 pub fn get_min_length(&self) -> &::std::option::Option<i32> {
58 &self.min_length
59 }
60 pub fn max_length(mut self, input: i32) -> Self {
63 self.max_length = ::std::option::Option::Some(input);
64 self
65 }
66 pub fn set_max_length(mut self, input: ::std::option::Option<i32>) -> Self {
68 self.max_length = input;
69 self
70 }
71 pub fn get_max_length(&self) -> &::std::option::Option<i32> {
73 &self.max_length
74 }
75 pub fn pattern(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78 self.pattern = ::std::option::Option::Some(input.into());
79 self
80 }
81 pub fn set_pattern(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83 self.pattern = input;
84 self
85 }
86 pub fn get_pattern(&self) -> &::std::option::Option<::std::string::String> {
88 &self.pattern
89 }
90 pub fn build(self) -> ::std::result::Result<crate::types::TextValidation, ::aws_smithy_types::error::operation::BuildError> {
96 ::std::result::Result::Ok(crate::types::TextValidation {
97 min_length: self.min_length.ok_or_else(|| {
98 ::aws_smithy_types::error::operation::BuildError::missing_field(
99 "min_length",
100 "min_length was not specified but it is required when building TextValidation",
101 )
102 })?,
103 max_length: self.max_length.ok_or_else(|| {
104 ::aws_smithy_types::error::operation::BuildError::missing_field(
105 "max_length",
106 "max_length was not specified but it is required when building TextValidation",
107 )
108 })?,
109 pattern: self.pattern.ok_or_else(|| {
110 ::aws_smithy_types::error::operation::BuildError::missing_field(
111 "pattern",
112 "pattern was not specified but it is required when building TextValidation",
113 )
114 })?,
115 })
116 }
117}