aws_sdk_cleanrooms/types/
_batch_get_schema_error.rs

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