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