aws_sdk_evidently/types/
_validation_exception_field.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A structure containing an error name and message.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ValidationExceptionField {
7    /// <p>The error name.</p>
8    pub name: ::std::string::String,
9    /// <p>The error message.</p>
10    pub message: ::std::string::String,
11}
12impl ValidationExceptionField {
13    /// <p>The error name.</p>
14    pub fn name(&self) -> &str {
15        use std::ops::Deref;
16        self.name.deref()
17    }
18    /// <p>The error message.</p>
19    pub fn message(&self) -> &str {
20        use std::ops::Deref;
21        self.message.deref()
22    }
23}
24impl ValidationExceptionField {
25    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::types::ValidationExceptionField).
26    pub fn builder() -> crate::types::builders::ValidationExceptionFieldBuilder {
27        crate::types::builders::ValidationExceptionFieldBuilder::default()
28    }
29}
30
31/// A builder for [`ValidationExceptionField`](crate::types::ValidationExceptionField).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct ValidationExceptionFieldBuilder {
35    pub(crate) name: ::std::option::Option<::std::string::String>,
36    pub(crate) message: ::std::option::Option<::std::string::String>,
37}
38impl ValidationExceptionFieldBuilder {
39    /// <p>The error name.</p>
40    /// This field is required.
41    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
42        self.name = ::std::option::Option::Some(input.into());
43        self
44    }
45    /// <p>The error name.</p>
46    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
47        self.name = input;
48        self
49    }
50    /// <p>The error name.</p>
51    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
52        &self.name
53    }
54    /// <p>The error message.</p>
55    /// This field is required.
56    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.message = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The error message.</p>
61    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.message = input;
63        self
64    }
65    /// <p>The error message.</p>
66    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
67        &self.message
68    }
69    /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::types::ValidationExceptionField).
70    /// This method will fail if any of the following fields are not set:
71    /// - [`name`](crate::types::builders::ValidationExceptionFieldBuilder::name)
72    /// - [`message`](crate::types::builders::ValidationExceptionFieldBuilder::message)
73    pub fn build(self) -> ::std::result::Result<crate::types::ValidationExceptionField, ::aws_smithy_types::error::operation::BuildError> {
74        ::std::result::Result::Ok(crate::types::ValidationExceptionField {
75            name: self.name.ok_or_else(|| {
76                ::aws_smithy_types::error::operation::BuildError::missing_field(
77                    "name",
78                    "name was not specified but it is required when building ValidationExceptionField",
79                )
80            })?,
81            message: self.message.ok_or_else(|| {
82                ::aws_smithy_types::error::operation::BuildError::missing_field(
83                    "message",
84                    "message was not specified but it is required when building ValidationExceptionField",
85                )
86            })?,
87        })
88    }
89}