aws_sdk_geomaps/types/error/
_access_denied_exception.rs

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