aws_sdk_ivschat/types/error/
_service_quota_exceeded_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p></p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ServiceQuotaExceededException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::string::String,
9    /// <p></p>
10    pub resource_id: ::std::string::String,
11    /// <p></p>
12    pub resource_type: crate::types::ResourceType,
13    /// <p></p>
14    pub limit: i32,
15    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
16}
17impl ServiceQuotaExceededException {
18    /// <p></p>
19    pub fn resource_id(&self) -> &str {
20        use std::ops::Deref;
21        self.resource_id.deref()
22    }
23    /// <p></p>
24    pub fn resource_type(&self) -> &crate::types::ResourceType {
25        &self.resource_type
26    }
27    /// <p></p>
28    pub fn limit(&self) -> i32 {
29        self.limit
30    }
31}
32impl ServiceQuotaExceededException {
33    /// Returns the error message.
34    pub fn message(&self) -> &str {
35        &self.message
36    }
37}
38impl ::std::fmt::Display for ServiceQuotaExceededException {
39    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40        ::std::write!(f, "ServiceQuotaExceededException")?;
41        {
42            ::std::write!(f, ": {}", &self.message)?;
43        }
44        Ok(())
45    }
46}
47impl ::std::error::Error for ServiceQuotaExceededException {}
48impl ::aws_types::request_id::RequestId for crate::types::error::ServiceQuotaExceededException {
49    fn request_id(&self) -> Option<&str> {
50        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
51        self.meta().request_id()
52    }
53}
54impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ServiceQuotaExceededException {
55    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
56        &self.meta
57    }
58}
59impl ServiceQuotaExceededException {
60    /// Creates a new builder-style object to manufacture [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
61    pub fn builder() -> crate::types::error::builders::ServiceQuotaExceededExceptionBuilder {
62        crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default()
63    }
64}
65
66/// A builder for [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct ServiceQuotaExceededExceptionBuilder {
70    pub(crate) message: ::std::option::Option<::std::string::String>,
71    pub(crate) resource_id: ::std::option::Option<::std::string::String>,
72    pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
73    pub(crate) limit: ::std::option::Option<i32>,
74    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
75}
76impl ServiceQuotaExceededExceptionBuilder {
77    #[allow(missing_docs)] // documentation missing in model
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    #[allow(missing_docs)] // documentation missing in model
84    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
85        self.message = input;
86        self
87    }
88    #[allow(missing_docs)] // documentation missing in model
89    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
90        &self.message
91    }
92    /// <p></p>
93    /// This field is required.
94    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95        self.resource_id = ::std::option::Option::Some(input.into());
96        self
97    }
98    /// <p></p>
99    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100        self.resource_id = input;
101        self
102    }
103    /// <p></p>
104    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
105        &self.resource_id
106    }
107    /// <p></p>
108    /// This field is required.
109    pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
110        self.resource_type = ::std::option::Option::Some(input);
111        self
112    }
113    /// <p></p>
114    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
115        self.resource_type = input;
116        self
117    }
118    /// <p></p>
119    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
120        &self.resource_type
121    }
122    /// <p></p>
123    /// This field is required.
124    pub fn limit(mut self, input: i32) -> Self {
125        self.limit = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p></p>
129    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
130        self.limit = input;
131        self
132    }
133    /// <p></p>
134    pub fn get_limit(&self) -> &::std::option::Option<i32> {
135        &self.limit
136    }
137    /// Sets error metadata
138    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
139        self.meta = Some(meta);
140        self
141    }
142
143    /// Sets error metadata
144    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
145        self.meta = meta;
146        self
147    }
148    /// Consumes the builder and constructs a [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
149    /// This method will fail if any of the following fields are not set:
150    /// - [`message`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::message)
151    /// - [`resource_id`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::resource_id)
152    /// - [`resource_type`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::resource_type)
153    pub fn build(
154        self,
155    ) -> ::std::result::Result<crate::types::error::ServiceQuotaExceededException, ::aws_smithy_types::error::operation::BuildError> {
156        ::std::result::Result::Ok(crate::types::error::ServiceQuotaExceededException {
157            message: self.message.ok_or_else(|| {
158                ::aws_smithy_types::error::operation::BuildError::missing_field(
159                    "message",
160                    "message was not specified but it is required when building ServiceQuotaExceededException",
161                )
162            })?,
163            resource_id: self.resource_id.ok_or_else(|| {
164                ::aws_smithy_types::error::operation::BuildError::missing_field(
165                    "resource_id",
166                    "resource_id was not specified but it is required when building ServiceQuotaExceededException",
167                )
168            })?,
169            resource_type: self.resource_type.ok_or_else(|| {
170                ::aws_smithy_types::error::operation::BuildError::missing_field(
171                    "resource_type",
172                    "resource_type was not specified but it is required when building ServiceQuotaExceededException",
173                )
174            })?,
175            limit: self.limit.unwrap_or_default(),
176            meta: self.meta.unwrap_or_default(),
177        })
178    }
179}