aws_sdk_route53resolver/types/error/
_invalid_parameter_exception.rs

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