Skip to main content

aws_sdk_sns/types/error/
_verification_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Indicates that the one-time password (OTP) used for verification is invalid.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct VerificationException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::string::String,
9    /// <p>The status of the verification error.</p>
10    pub status: ::std::string::String,
11    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl VerificationException {
14    /// <p>The status of the verification error.</p>
15    pub fn status(&self) -> &str {
16        use std::ops::Deref;
17        self.status.deref()
18    }
19}
20impl VerificationException {
21    /// Returns the error message.
22    pub fn message(&self) -> &str {
23        &self.message
24    }
25}
26impl ::std::fmt::Display for VerificationException {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28        ::std::write!(f, "VerificationException")?;
29        {
30            ::std::write!(f, ": {}", &self.message)?;
31        }
32        Ok(())
33    }
34}
35impl ::std::error::Error for VerificationException {}
36impl ::aws_types::request_id::RequestId for crate::types::error::VerificationException {
37    fn request_id(&self) -> Option<&str> {
38        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
39        self.meta().request_id()
40    }
41}
42impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for VerificationException {
43    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
44        &self.meta
45    }
46}
47impl VerificationException {
48    /// Creates a new builder-style object to manufacture [`VerificationException`](crate::types::error::VerificationException).
49    pub fn builder() -> crate::types::error::builders::VerificationExceptionBuilder {
50        crate::types::error::builders::VerificationExceptionBuilder::default()
51    }
52}
53
54/// A builder for [`VerificationException`](crate::types::error::VerificationException).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct VerificationExceptionBuilder {
58    pub(crate) message: ::std::option::Option<::std::string::String>,
59    pub(crate) status: ::std::option::Option<::std::string::String>,
60    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
61}
62impl VerificationExceptionBuilder {
63    #[allow(missing_docs)] // documentation missing in model
64    /// This field is required.
65    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.message = ::std::option::Option::Some(input.into());
67        self
68    }
69    #[allow(missing_docs)] // documentation missing in model
70    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.message = input;
72        self
73    }
74    #[allow(missing_docs)] // documentation missing in model
75    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
76        &self.message
77    }
78    /// <p>The status of the verification error.</p>
79    /// This field is required.
80    pub fn status(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.status = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// <p>The status of the verification error.</p>
85    pub fn set_status(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.status = input;
87        self
88    }
89    /// <p>The status of the verification error.</p>
90    pub fn get_status(&self) -> &::std::option::Option<::std::string::String> {
91        &self.status
92    }
93    /// Sets error metadata
94    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
95        self.meta = Some(meta);
96        self
97    }
98
99    /// Sets error metadata
100    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
101        self.meta = meta;
102        self
103    }
104    /// Consumes the builder and constructs a [`VerificationException`](crate::types::error::VerificationException).
105    /// This method will fail if any of the following fields are not set:
106    /// - [`message`](crate::types::error::builders::VerificationExceptionBuilder::message)
107    /// - [`status`](crate::types::error::builders::VerificationExceptionBuilder::status)
108    pub fn build(self) -> ::std::result::Result<crate::types::error::VerificationException, ::aws_smithy_types::error::operation::BuildError> {
109        ::std::result::Result::Ok(crate::types::error::VerificationException {
110            message: self.message.ok_or_else(|| {
111                ::aws_smithy_types::error::operation::BuildError::missing_field(
112                    "message",
113                    "message was not specified but it is required when building VerificationException",
114                )
115            })?,
116            status: self.status.ok_or_else(|| {
117                ::aws_smithy_types::error::operation::BuildError::missing_field(
118                    "status",
119                    "status was not specified but it is required when building VerificationException",
120                )
121            })?,
122            meta: self.meta.unwrap_or_default(),
123        })
124    }
125}