aws_sdk_backupgateway/types/error/
_throttling_exception.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ThrottlingException {
7 pub error_code: ::std::string::String,
9 #[allow(missing_docs)] pub message: ::std::option::Option<::std::string::String>,
11 pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl ThrottlingException {
14 pub fn error_code(&self) -> &str {
16 use std::ops::Deref;
17 self.error_code.deref()
18 }
19}
20impl ThrottlingException {
21 pub fn message(&self) -> ::std::option::Option<&str> {
23 self.message.as_deref()
24 }
25}
26impl ::std::fmt::Display for ThrottlingException {
27 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 ::std::write!(f, "ThrottlingException")?;
29 if let ::std::option::Option::Some(inner_1) = &self.message {
30 {
31 ::std::write!(f, ": {inner_1}")?;
32 }
33 }
34 Ok(())
35 }
36}
37impl ::std::error::Error for ThrottlingException {}
38impl ::aws_types::request_id::RequestId for crate::types::error::ThrottlingException {
39 fn request_id(&self) -> Option<&str> {
40 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
41 self.meta().request_id()
42 }
43}
44impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ThrottlingException {
45 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
46 &self.meta
47 }
48}
49impl ThrottlingException {
50 pub fn builder() -> crate::types::error::builders::ThrottlingExceptionBuilder {
52 crate::types::error::builders::ThrottlingExceptionBuilder::default()
53 }
54}
55
56#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct ThrottlingExceptionBuilder {
60 pub(crate) error_code: ::std::option::Option<::std::string::String>,
61 pub(crate) message: ::std::option::Option<::std::string::String>,
62 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
63}
64impl ThrottlingExceptionBuilder {
65 pub fn error_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68 self.error_code = ::std::option::Option::Some(input.into());
69 self
70 }
71 pub fn set_error_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73 self.error_code = input;
74 self
75 }
76 pub fn get_error_code(&self) -> &::std::option::Option<::std::string::String> {
78 &self.error_code
79 }
80 #[allow(missing_docs)] pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82 self.message = ::std::option::Option::Some(input.into());
83 self
84 }
85 #[allow(missing_docs)] pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.message = input;
88 self
89 }
90 #[allow(missing_docs)] pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
92 &self.message
93 }
94 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
96 self.meta = Some(meta);
97 self
98 }
99
100 pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
102 self.meta = meta;
103 self
104 }
105 pub fn build(self) -> ::std::result::Result<crate::types::error::ThrottlingException, ::aws_smithy_types::error::operation::BuildError> {
109 ::std::result::Result::Ok(crate::types::error::ThrottlingException {
110 error_code: self.error_code.ok_or_else(|| {
111 ::aws_smithy_types::error::operation::BuildError::missing_field(
112 "error_code",
113 "error_code was not specified but it is required when building ThrottlingException",
114 )
115 })?,
116 message: self.message,
117 meta: self.meta.unwrap_or_default(),
118 })
119 }
120}