Skip to main content

aws_sdk_fsx/types/error/
_active_directory_error.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An Active Directory error.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ActiveDirectoryError {
7    /// <p>The directory ID of the directory that an error pertains to.</p>
8    pub active_directory_id: ::std::option::Option<::std::string::String>,
9    /// <p>The type of Active Directory error.</p>
10    pub r#type: ::std::option::Option<crate::types::ActiveDirectoryErrorType>,
11    /// <p>A detailed error message.</p>
12    pub message: ::std::option::Option<::std::string::String>,
13    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
14}
15impl ActiveDirectoryError {
16    /// <p>The directory ID of the directory that an error pertains to.</p>
17    pub fn active_directory_id(&self) -> ::std::option::Option<&str> {
18        self.active_directory_id.as_deref()
19    }
20    /// <p>The type of Active Directory error.</p>
21    pub fn r#type(&self) -> ::std::option::Option<&crate::types::ActiveDirectoryErrorType> {
22        self.r#type.as_ref()
23    }
24}
25impl ActiveDirectoryError {
26    /// Returns the error message.
27    pub fn message(&self) -> ::std::option::Option<&str> {
28        self.message.as_deref()
29    }
30}
31impl ::std::fmt::Display for ActiveDirectoryError {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        ::std::write!(f, "ActiveDirectoryError")?;
34        if let ::std::option::Option::Some(inner_1) = &self.message {
35            {
36                ::std::write!(f, ": {inner_1}")?;
37            }
38        }
39        Ok(())
40    }
41}
42impl ::std::error::Error for ActiveDirectoryError {}
43impl ::aws_types::request_id::RequestId for crate::types::error::ActiveDirectoryError {
44    fn request_id(&self) -> Option<&str> {
45        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
46        self.meta().request_id()
47    }
48}
49impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ActiveDirectoryError {
50    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
51        &self.meta
52    }
53}
54impl ActiveDirectoryError {
55    /// Creates a new builder-style object to manufacture [`ActiveDirectoryError`](crate::types::error::ActiveDirectoryError).
56    pub fn builder() -> crate::types::error::builders::ActiveDirectoryErrorBuilder {
57        crate::types::error::builders::ActiveDirectoryErrorBuilder::default()
58    }
59}
60
61/// A builder for [`ActiveDirectoryError`](crate::types::error::ActiveDirectoryError).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct ActiveDirectoryErrorBuilder {
65    pub(crate) active_directory_id: ::std::option::Option<::std::string::String>,
66    pub(crate) r#type: ::std::option::Option<crate::types::ActiveDirectoryErrorType>,
67    pub(crate) message: ::std::option::Option<::std::string::String>,
68    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
69}
70impl ActiveDirectoryErrorBuilder {
71    /// <p>The directory ID of the directory that an error pertains to.</p>
72    /// This field is required.
73    pub fn active_directory_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.active_directory_id = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The directory ID of the directory that an error pertains to.</p>
78    pub fn set_active_directory_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.active_directory_id = input;
80        self
81    }
82    /// <p>The directory ID of the directory that an error pertains to.</p>
83    pub fn get_active_directory_id(&self) -> &::std::option::Option<::std::string::String> {
84        &self.active_directory_id
85    }
86    /// <p>The type of Active Directory error.</p>
87    pub fn r#type(mut self, input: crate::types::ActiveDirectoryErrorType) -> Self {
88        self.r#type = ::std::option::Option::Some(input);
89        self
90    }
91    /// <p>The type of Active Directory error.</p>
92    pub fn set_type(mut self, input: ::std::option::Option<crate::types::ActiveDirectoryErrorType>) -> Self {
93        self.r#type = input;
94        self
95    }
96    /// <p>The type of Active Directory error.</p>
97    pub fn get_type(&self) -> &::std::option::Option<crate::types::ActiveDirectoryErrorType> {
98        &self.r#type
99    }
100    /// <p>A detailed error message.</p>
101    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        self.message = ::std::option::Option::Some(input.into());
103        self
104    }
105    /// <p>A detailed error message.</p>
106    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107        self.message = input;
108        self
109    }
110    /// <p>A detailed error message.</p>
111    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
112        &self.message
113    }
114    /// Sets error metadata
115    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
116        self.meta = Some(meta);
117        self
118    }
119
120    /// Sets error metadata
121    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
122        self.meta = meta;
123        self
124    }
125    /// Consumes the builder and constructs a [`ActiveDirectoryError`](crate::types::error::ActiveDirectoryError).
126    pub fn build(self) -> crate::types::error::ActiveDirectoryError {
127        crate::types::error::ActiveDirectoryError {
128            active_directory_id: self.active_directory_id,
129            r#type: self.r#type,
130            message: self.message,
131            meta: self.meta.unwrap_or_default(),
132        }
133    }
134}