Skip to main content

aws_sdk_amp/types/error/
_service_quota_exceeded_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Completing the request would cause a service quota to be exceeded.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ServiceQuotaExceededException {
7    /// <p>Description of the error.</p>
8    pub message: ::std::string::String,
9    /// <p>Identifier of the resource affected.</p>
10    pub resource_id: ::std::string::String,
11    /// <p>Type of the resource affected.</p>
12    pub resource_type: ::std::string::String,
13    /// <p>Service quotas code for the originating service.</p>
14    pub service_code: ::std::string::String,
15    /// <p>Service quotas code of the originating quota.</p>
16    pub quota_code: ::std::string::String,
17    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
18}
19impl ServiceQuotaExceededException {
20    /// <p>Identifier of the resource affected.</p>
21    pub fn resource_id(&self) -> &str {
22        use std::ops::Deref;
23        self.resource_id.deref()
24    }
25    /// <p>Type of the resource affected.</p>
26    pub fn resource_type(&self) -> &str {
27        use std::ops::Deref;
28        self.resource_type.deref()
29    }
30    /// <p>Service quotas code for the originating service.</p>
31    pub fn service_code(&self) -> &str {
32        use std::ops::Deref;
33        self.service_code.deref()
34    }
35    /// <p>Service quotas code of the originating quota.</p>
36    pub fn quota_code(&self) -> &str {
37        use std::ops::Deref;
38        self.quota_code.deref()
39    }
40}
41impl ServiceQuotaExceededException {
42    /// Returns the error message.
43    pub fn message(&self) -> &str {
44        &self.message
45    }
46}
47impl ::std::fmt::Display for ServiceQuotaExceededException {
48    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
49        ::std::write!(f, "ServiceQuotaExceededException")?;
50        {
51            ::std::write!(f, ": {}", &self.message)?;
52        }
53        Ok(())
54    }
55}
56impl ::std::error::Error for ServiceQuotaExceededException {}
57impl ::aws_types::request_id::RequestId for crate::types::error::ServiceQuotaExceededException {
58    fn request_id(&self) -> Option<&str> {
59        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
60        self.meta().request_id()
61    }
62}
63impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ServiceQuotaExceededException {
64    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
65        &self.meta
66    }
67}
68impl ServiceQuotaExceededException {
69    /// Creates a new builder-style object to manufacture [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
70    pub fn builder() -> crate::types::error::builders::ServiceQuotaExceededExceptionBuilder {
71        crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default()
72    }
73}
74
75/// A builder for [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
76#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
77#[non_exhaustive]
78pub struct ServiceQuotaExceededExceptionBuilder {
79    pub(crate) message: ::std::option::Option<::std::string::String>,
80    pub(crate) resource_id: ::std::option::Option<::std::string::String>,
81    pub(crate) resource_type: ::std::option::Option<::std::string::String>,
82    pub(crate) service_code: ::std::option::Option<::std::string::String>,
83    pub(crate) quota_code: ::std::option::Option<::std::string::String>,
84    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
85}
86impl ServiceQuotaExceededExceptionBuilder {
87    /// <p>Description of the error.</p>
88    /// This field is required.
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>Description of the error.</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>Description of the error.</p>
99    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
100        &self.message
101    }
102    /// <p>Identifier of the resource affected.</p>
103    /// This field is required.
104    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.resource_id = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>Identifier of the resource affected.</p>
109    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.resource_id = input;
111        self
112    }
113    /// <p>Identifier of the resource affected.</p>
114    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
115        &self.resource_id
116    }
117    /// <p>Type of the resource affected.</p>
118    /// This field is required.
119    pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.resource_type = ::std::option::Option::Some(input.into());
121        self
122    }
123    /// <p>Type of the resource affected.</p>
124    pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.resource_type = input;
126        self
127    }
128    /// <p>Type of the resource affected.</p>
129    pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
130        &self.resource_type
131    }
132    /// <p>Service quotas code for the originating service.</p>
133    /// This field is required.
134    pub fn service_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.service_code = ::std::option::Option::Some(input.into());
136        self
137    }
138    /// <p>Service quotas code for the originating service.</p>
139    pub fn set_service_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.service_code = input;
141        self
142    }
143    /// <p>Service quotas code for the originating service.</p>
144    pub fn get_service_code(&self) -> &::std::option::Option<::std::string::String> {
145        &self.service_code
146    }
147    /// <p>Service quotas code of the originating quota.</p>
148    /// This field is required.
149    pub fn quota_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.quota_code = ::std::option::Option::Some(input.into());
151        self
152    }
153    /// <p>Service quotas code of the originating quota.</p>
154    pub fn set_quota_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.quota_code = input;
156        self
157    }
158    /// <p>Service quotas code of the originating quota.</p>
159    pub fn get_quota_code(&self) -> &::std::option::Option<::std::string::String> {
160        &self.quota_code
161    }
162    /// Sets error metadata
163    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
164        self.meta = Some(meta);
165        self
166    }
167
168    /// Sets error metadata
169    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
170        self.meta = meta;
171        self
172    }
173    /// Consumes the builder and constructs a [`ServiceQuotaExceededException`](crate::types::error::ServiceQuotaExceededException).
174    /// This method will fail if any of the following fields are not set:
175    /// - [`message`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::message)
176    /// - [`resource_id`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::resource_id)
177    /// - [`resource_type`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::resource_type)
178    /// - [`service_code`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::service_code)
179    /// - [`quota_code`](crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::quota_code)
180    pub fn build(
181        self,
182    ) -> ::std::result::Result<crate::types::error::ServiceQuotaExceededException, ::aws_smithy_types::error::operation::BuildError> {
183        ::std::result::Result::Ok(crate::types::error::ServiceQuotaExceededException {
184            message: self.message.ok_or_else(|| {
185                ::aws_smithy_types::error::operation::BuildError::missing_field(
186                    "message",
187                    "message was not specified but it is required when building ServiceQuotaExceededException",
188                )
189            })?,
190            resource_id: self.resource_id.ok_or_else(|| {
191                ::aws_smithy_types::error::operation::BuildError::missing_field(
192                    "resource_id",
193                    "resource_id was not specified but it is required when building ServiceQuotaExceededException",
194                )
195            })?,
196            resource_type: self.resource_type.ok_or_else(|| {
197                ::aws_smithy_types::error::operation::BuildError::missing_field(
198                    "resource_type",
199                    "resource_type was not specified but it is required when building ServiceQuotaExceededException",
200                )
201            })?,
202            service_code: self.service_code.ok_or_else(|| {
203                ::aws_smithy_types::error::operation::BuildError::missing_field(
204                    "service_code",
205                    "service_code was not specified but it is required when building ServiceQuotaExceededException",
206                )
207            })?,
208            quota_code: self.quota_code.ok_or_else(|| {
209                ::aws_smithy_types::error::operation::BuildError::missing_field(
210                    "quota_code",
211                    "quota_code was not specified but it is required when building ServiceQuotaExceededException",
212                )
213            })?,
214            meta: self.meta.unwrap_or_default(),
215        })
216    }
217}