aws_sdk_chimesdkmediapipelines/types/error/
_forbidden_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The client is permanently forbidden from making the request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ForbiddenException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub code: ::std::option::Option<crate::types::ErrorCode>,
9    #[allow(missing_docs)] // documentation missing in model
10    pub message: ::std::option::Option<::std::string::String>,
11    /// <p>The request id associated with the call responsible for the exception.</p>
12    pub request_id: ::std::option::Option<::std::string::String>,
13    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
14}
15impl ForbiddenException {
16    #[allow(missing_docs)] // documentation missing in model
17    pub fn code(&self) -> ::std::option::Option<&crate::types::ErrorCode> {
18        self.code.as_ref()
19    }
20    /// <p>The request id associated with the call responsible for the exception.</p>
21    pub fn request_id(&self) -> ::std::option::Option<&str> {
22        self.request_id.as_deref()
23    }
24}
25impl ForbiddenException {
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 ForbiddenException {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        ::std::write!(f, "ForbiddenException")?;
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 ForbiddenException {}
43impl ::aws_types::request_id::RequestId for crate::types::error::ForbiddenException {
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 ForbiddenException {
50    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
51        &self.meta
52    }
53}
54impl ForbiddenException {
55    /// Creates a new builder-style object to manufacture [`ForbiddenException`](crate::types::error::ForbiddenException).
56    pub fn builder() -> crate::types::error::builders::ForbiddenExceptionBuilder {
57        crate::types::error::builders::ForbiddenExceptionBuilder::default()
58    }
59}
60
61/// A builder for [`ForbiddenException`](crate::types::error::ForbiddenException).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct ForbiddenExceptionBuilder {
65    pub(crate) code: ::std::option::Option<crate::types::ErrorCode>,
66    pub(crate) message: ::std::option::Option<::std::string::String>,
67    pub(crate) request_id: ::std::option::Option<::std::string::String>,
68    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
69}
70impl ForbiddenExceptionBuilder {
71    #[allow(missing_docs)] // documentation missing in model
72    pub fn code(mut self, input: crate::types::ErrorCode) -> Self {
73        self.code = ::std::option::Option::Some(input);
74        self
75    }
76    #[allow(missing_docs)] // documentation missing in model
77    pub fn set_code(mut self, input: ::std::option::Option<crate::types::ErrorCode>) -> Self {
78        self.code = input;
79        self
80    }
81    #[allow(missing_docs)] // documentation missing in model
82    pub fn get_code(&self) -> &::std::option::Option<crate::types::ErrorCode> {
83        &self.code
84    }
85    #[allow(missing_docs)] // documentation missing in model
86    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.message = ::std::option::Option::Some(input.into());
88        self
89    }
90    #[allow(missing_docs)] // documentation missing in model
91    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.message = input;
93        self
94    }
95    #[allow(missing_docs)] // documentation missing in model
96    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
97        &self.message
98    }
99    /// <p>The request id associated with the call responsible for the exception.</p>
100    pub fn request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.request_id = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The request id associated with the call responsible for the exception.</p>
105    pub fn set_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.request_id = input;
107        self
108    }
109    /// <p>The request id associated with the call responsible for the exception.</p>
110    pub fn get_request_id(&self) -> &::std::option::Option<::std::string::String> {
111        &self.request_id
112    }
113    /// Sets error metadata
114    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
115        self.meta = Some(meta);
116        self
117    }
118
119    /// Sets error metadata
120    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
121        self.meta = meta;
122        self
123    }
124    /// Consumes the builder and constructs a [`ForbiddenException`](crate::types::error::ForbiddenException).
125    pub fn build(self) -> crate::types::error::ForbiddenException {
126        crate::types::error::ForbiddenException {
127            code: self.code,
128            message: self.message,
129            request_id: self.request_id,
130            meta: self.meta.unwrap_or_default(),
131        }
132    }
133}