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