aws_sdk_efs/types/error/
_access_point_already_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Returned if the access point that you are trying to create already exists, with the creation token you provided in the request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AccessPointAlreadyExists {
7    /// <p>The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.</p>
8    pub error_code: ::std::string::String,
9    /// <p>The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.</p>
10    pub message: ::std::option::Option<::std::string::String>,
11    #[allow(missing_docs)] // documentation missing in model
12    pub access_point_id: ::std::string::String,
13    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
14}
15impl AccessPointAlreadyExists {
16    /// <p>The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.</p>
17    pub fn error_code(&self) -> &str {
18        use std::ops::Deref;
19        self.error_code.deref()
20    }
21    #[allow(missing_docs)] // documentation missing in model
22    pub fn access_point_id(&self) -> &str {
23        use std::ops::Deref;
24        self.access_point_id.deref()
25    }
26}
27impl AccessPointAlreadyExists {
28    /// Returns the error message.
29    pub fn message(&self) -> ::std::option::Option<&str> {
30        self.message.as_deref()
31    }
32}
33impl ::std::fmt::Display for AccessPointAlreadyExists {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        ::std::write!(f, "AccessPointAlreadyExists")?;
36        if let ::std::option::Option::Some(inner_1) = &self.message {
37            {
38                ::std::write!(f, ": {inner_1}")?;
39            }
40        }
41        Ok(())
42    }
43}
44impl ::std::error::Error for AccessPointAlreadyExists {}
45impl ::aws_types::request_id::RequestId for crate::types::error::AccessPointAlreadyExists {
46    fn request_id(&self) -> Option<&str> {
47        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
48        self.meta().request_id()
49    }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for AccessPointAlreadyExists {
52    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
53        &self.meta
54    }
55}
56impl AccessPointAlreadyExists {
57    /// Creates a new builder-style object to manufacture [`AccessPointAlreadyExists`](crate::types::error::AccessPointAlreadyExists).
58    pub fn builder() -> crate::types::error::builders::AccessPointAlreadyExistsBuilder {
59        crate::types::error::builders::AccessPointAlreadyExistsBuilder::default()
60    }
61}
62
63/// A builder for [`AccessPointAlreadyExists`](crate::types::error::AccessPointAlreadyExists).
64#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
65#[non_exhaustive]
66pub struct AccessPointAlreadyExistsBuilder {
67    pub(crate) error_code: ::std::option::Option<::std::string::String>,
68    pub(crate) message: ::std::option::Option<::std::string::String>,
69    pub(crate) access_point_id: ::std::option::Option<::std::string::String>,
70    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
71}
72impl AccessPointAlreadyExistsBuilder {
73    /// <p>The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.</p>
74    /// This field is required.
75    pub fn error_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.error_code = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.</p>
80    pub fn set_error_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.error_code = input;
82        self
83    }
84    /// <p>The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.</p>
85    pub fn get_error_code(&self) -> &::std::option::Option<::std::string::String> {
86        &self.error_code
87    }
88    /// <p>The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.</p>
89    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.message = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.</p>
94    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.message = input;
96        self
97    }
98    /// <p>The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.</p>
99    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
100        &self.message
101    }
102    #[allow(missing_docs)] // documentation missing in model
103    /// This field is required.
104    pub fn access_point_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.access_point_id = ::std::option::Option::Some(input.into());
106        self
107    }
108    #[allow(missing_docs)] // documentation missing in model
109    pub fn set_access_point_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.access_point_id = input;
111        self
112    }
113    #[allow(missing_docs)] // documentation missing in model
114    pub fn get_access_point_id(&self) -> &::std::option::Option<::std::string::String> {
115        &self.access_point_id
116    }
117    /// Sets error metadata
118    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
119        self.meta = Some(meta);
120        self
121    }
122
123    /// Sets error metadata
124    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
125        self.meta = meta;
126        self
127    }
128    /// Consumes the builder and constructs a [`AccessPointAlreadyExists`](crate::types::error::AccessPointAlreadyExists).
129    /// This method will fail if any of the following fields are not set:
130    /// - [`error_code`](crate::types::error::builders::AccessPointAlreadyExistsBuilder::error_code)
131    /// - [`access_point_id`](crate::types::error::builders::AccessPointAlreadyExistsBuilder::access_point_id)
132    pub fn build(self) -> ::std::result::Result<crate::types::error::AccessPointAlreadyExists, ::aws_smithy_types::error::operation::BuildError> {
133        ::std::result::Result::Ok(crate::types::error::AccessPointAlreadyExists {
134            error_code: self.error_code.ok_or_else(|| {
135                ::aws_smithy_types::error::operation::BuildError::missing_field(
136                    "error_code",
137                    "error_code was not specified but it is required when building AccessPointAlreadyExists",
138                )
139            })?,
140            message: self.message,
141            access_point_id: self.access_point_id.ok_or_else(|| {
142                ::aws_smithy_types::error::operation::BuildError::missing_field(
143                    "access_point_id",
144                    "access_point_id was not specified but it is required when building AccessPointAlreadyExists",
145                )
146            })?,
147            meta: self.meta.unwrap_or_default(),
148        })
149    }
150}