Skip to main content

aws_sdk_appfabric/types/error/
_internal_server_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The request processing has failed because of an unknown error, exception, or failure with an internal server.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct InternalServerException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::string::String,
9    /// <p>The period of time after which you should retry your request.</p>
10    pub retry_after_seconds: ::std::option::Option<i32>,
11    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl InternalServerException {
14    /// <p>The period of time after which you should retry your request.</p>
15    pub fn retry_after_seconds(&self) -> ::std::option::Option<i32> {
16        self.retry_after_seconds
17    }
18}
19impl InternalServerException {
20    /// Returns `Some(ErrorKind)` if the error is retryable. Otherwise, returns `None`.
21    pub fn retryable_error_kind(&self) -> ::aws_smithy_types::retry::ErrorKind {
22        ::aws_smithy_types::retry::ErrorKind::ServerError
23    }
24    /// Returns the error message.
25    pub fn message(&self) -> &str {
26        &self.message
27    }
28}
29impl ::std::fmt::Display for InternalServerException {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        ::std::write!(f, "InternalServerException")?;
32        {
33            ::std::write!(f, ": {}", &self.message)?;
34        }
35        Ok(())
36    }
37}
38impl ::std::error::Error for InternalServerException {}
39impl ::aws_types::request_id::RequestId for crate::types::error::InternalServerException {
40    fn request_id(&self) -> Option<&str> {
41        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
42        self.meta().request_id()
43    }
44}
45impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InternalServerException {
46    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
47        &self.meta
48    }
49}
50impl InternalServerException {
51    /// Creates a new builder-style object to manufacture [`InternalServerException`](crate::types::error::InternalServerException).
52    pub fn builder() -> crate::types::error::builders::InternalServerExceptionBuilder {
53        crate::types::error::builders::InternalServerExceptionBuilder::default()
54    }
55}
56
57/// A builder for [`InternalServerException`](crate::types::error::InternalServerException).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct InternalServerExceptionBuilder {
61    pub(crate) message: ::std::option::Option<::std::string::String>,
62    pub(crate) retry_after_seconds: ::std::option::Option<i32>,
63    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
64}
65impl InternalServerExceptionBuilder {
66    #[allow(missing_docs)] // documentation missing in model
67    /// This field is required.
68    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.message = ::std::option::Option::Some(input.into());
70        self
71    }
72    #[allow(missing_docs)] // documentation missing in model
73    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.message = input;
75        self
76    }
77    #[allow(missing_docs)] // documentation missing in model
78    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
79        &self.message
80    }
81    /// <p>The period of time after which you should retry your request.</p>
82    pub fn retry_after_seconds(mut self, input: i32) -> Self {
83        self.retry_after_seconds = ::std::option::Option::Some(input);
84        self
85    }
86    /// <p>The period of time after which you should retry your request.</p>
87    pub fn set_retry_after_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
88        self.retry_after_seconds = input;
89        self
90    }
91    /// <p>The period of time after which you should retry your request.</p>
92    pub fn get_retry_after_seconds(&self) -> &::std::option::Option<i32> {
93        &self.retry_after_seconds
94    }
95    /// Sets error metadata
96    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
97        self.meta = Some(meta);
98        self
99    }
100
101    /// Sets error metadata
102    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
103        self.meta = meta;
104        self
105    }
106    /// Consumes the builder and constructs a [`InternalServerException`](crate::types::error::InternalServerException).
107    /// This method will fail if any of the following fields are not set:
108    /// - [`message`](crate::types::error::builders::InternalServerExceptionBuilder::message)
109    pub fn build(self) -> ::std::result::Result<crate::types::error::InternalServerException, ::aws_smithy_types::error::operation::BuildError> {
110        ::std::result::Result::Ok(crate::types::error::InternalServerException {
111            message: self.message.ok_or_else(|| {
112                ::aws_smithy_types::error::operation::BuildError::missing_field(
113                    "message",
114                    "message was not specified but it is required when building InternalServerException",
115                )
116            })?,
117            retry_after_seconds: self.retry_after_seconds,
118            meta: self.meta.unwrap_or_default(),
119        })
120    }
121}