aws_sdk_connectcampaigns/types/error/
_invalid_state_exception.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct InvalidStateException {
7 #[allow(missing_docs)] pub message: ::std::string::String,
9 pub x_amz_error_type: ::std::option::Option<::std::string::String>,
11 pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl InvalidStateException {
14 pub fn x_amz_error_type(&self) -> ::std::option::Option<&str> {
16 self.x_amz_error_type.as_deref()
17 }
18}
19impl InvalidStateException {
20 pub fn message(&self) -> &str {
22 &self.message
23 }
24}
25impl ::std::fmt::Display for InvalidStateException {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 ::std::write!(f, "InvalidStateException")?;
28 {
29 ::std::write!(f, ": {}", &self.message)?;
30 }
31 Ok(())
32 }
33}
34impl ::std::error::Error for InvalidStateException {}
35impl ::aws_types::request_id::RequestId for crate::types::error::InvalidStateException {
36 fn request_id(&self) -> Option<&str> {
37 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
38 self.meta().request_id()
39 }
40}
41impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InvalidStateException {
42 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
43 &self.meta
44 }
45}
46impl InvalidStateException {
47 pub fn builder() -> crate::types::error::builders::InvalidStateExceptionBuilder {
49 crate::types::error::builders::InvalidStateExceptionBuilder::default()
50 }
51}
52
53#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
55#[non_exhaustive]
56pub struct InvalidStateExceptionBuilder {
57 pub(crate) message: ::std::option::Option<::std::string::String>,
58 pub(crate) x_amz_error_type: ::std::option::Option<::std::string::String>,
59 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
60}
61impl InvalidStateExceptionBuilder {
62 #[allow(missing_docs)] pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
65 self.message = ::std::option::Option::Some(input.into());
66 self
67 }
68 #[allow(missing_docs)] pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
70 self.message = input;
71 self
72 }
73 #[allow(missing_docs)] pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
75 &self.message
76 }
77 pub fn x_amz_error_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79 self.x_amz_error_type = ::std::option::Option::Some(input.into());
80 self
81 }
82 pub fn set_x_amz_error_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84 self.x_amz_error_type = input;
85 self
86 }
87 pub fn get_x_amz_error_type(&self) -> &::std::option::Option<::std::string::String> {
89 &self.x_amz_error_type
90 }
91 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
93 self.meta = Some(meta);
94 self
95 }
96
97 pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
99 self.meta = meta;
100 self
101 }
102 pub fn build(self) -> ::std::result::Result<crate::types::error::InvalidStateException, ::aws_smithy_types::error::operation::BuildError> {
106 ::std::result::Result::Ok(crate::types::error::InvalidStateException {
107 message: self.message.ok_or_else(|| {
108 ::aws_smithy_types::error::operation::BuildError::missing_field(
109 "message",
110 "message was not specified but it is required when building InvalidStateException",
111 )
112 })?,
113 x_amz_error_type: self.x_amz_error_type,
114 meta: self.meta.unwrap_or_default(),
115 })
116 }
117}