Skip to main content

aws_sdk_cloudwatch/types/error/
_dashboard_invalid_input_error.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Some part of the dashboard data is invalid.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DashboardInvalidInputError {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::option::Option<::std::string::String>,
9    #[allow(missing_docs)] // documentation missing in model
10    pub dashboard_validation_messages: ::std::option::Option<::std::vec::Vec<crate::types::DashboardValidationMessage>>,
11    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
12}
13impl DashboardInvalidInputError {
14    #[allow(missing_docs)] // documentation missing in model
15    ///
16    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.dashboard_validation_messages.is_none()`.
17    pub fn dashboard_validation_messages(&self) -> &[crate::types::DashboardValidationMessage] {
18        self.dashboard_validation_messages.as_deref().unwrap_or_default()
19    }
20}
21impl DashboardInvalidInputError {
22    /// Returns the error message.
23    pub fn message(&self) -> ::std::option::Option<&str> {
24        self.message.as_deref()
25    }
26}
27impl ::std::fmt::Display for DashboardInvalidInputError {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        ::std::write!(f, "DashboardInvalidInputError")?;
30        if let ::std::option::Option::Some(inner_1) = &self.message {
31            {
32                ::std::write!(f, ": {inner_1}")?;
33            }
34        }
35        Ok(())
36    }
37}
38impl ::std::error::Error for DashboardInvalidInputError {}
39impl ::aws_types::request_id::RequestId for crate::types::error::DashboardInvalidInputError {
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 DashboardInvalidInputError {
46    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
47        &self.meta
48    }
49}
50impl DashboardInvalidInputError {
51    /// Creates a new builder-style object to manufacture [`DashboardInvalidInputError`](crate::types::error::DashboardInvalidInputError).
52    pub fn builder() -> crate::types::error::builders::DashboardInvalidInputErrorBuilder {
53        crate::types::error::builders::DashboardInvalidInputErrorBuilder::default()
54    }
55}
56
57/// A builder for [`DashboardInvalidInputError`](crate::types::error::DashboardInvalidInputError).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct DashboardInvalidInputErrorBuilder {
61    pub(crate) message: ::std::option::Option<::std::string::String>,
62    pub(crate) dashboard_validation_messages: ::std::option::Option<::std::vec::Vec<crate::types::DashboardValidationMessage>>,
63    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
64}
65impl DashboardInvalidInputErrorBuilder {
66    #[allow(missing_docs)] // documentation missing in model
67    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.message = ::std::option::Option::Some(input.into());
69        self
70    }
71    #[allow(missing_docs)] // documentation missing in model
72    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.message = input;
74        self
75    }
76    #[allow(missing_docs)] // documentation missing in model
77    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
78        &self.message
79    }
80    /// Appends an item to `dashboard_validation_messages`.
81    ///
82    /// To override the contents of this collection use [`set_dashboard_validation_messages`](Self::set_dashboard_validation_messages).
83    ///
84    pub fn dashboard_validation_messages(mut self, input: crate::types::DashboardValidationMessage) -> Self {
85        let mut v = self.dashboard_validation_messages.unwrap_or_default();
86        v.push(input);
87        self.dashboard_validation_messages = ::std::option::Option::Some(v);
88        self
89    }
90    #[allow(missing_docs)] // documentation missing in model
91    pub fn set_dashboard_validation_messages(
92        mut self,
93        input: ::std::option::Option<::std::vec::Vec<crate::types::DashboardValidationMessage>>,
94    ) -> Self {
95        self.dashboard_validation_messages = input;
96        self
97    }
98    #[allow(missing_docs)] // documentation missing in model
99    pub fn get_dashboard_validation_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DashboardValidationMessage>> {
100        &self.dashboard_validation_messages
101    }
102    /// Sets error metadata
103    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
104        self.meta = Some(meta);
105        self
106    }
107
108    /// Sets error metadata
109    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
110        self.meta = meta;
111        self
112    }
113    /// Consumes the builder and constructs a [`DashboardInvalidInputError`](crate::types::error::DashboardInvalidInputError).
114    pub fn build(self) -> crate::types::error::DashboardInvalidInputError {
115        crate::types::error::DashboardInvalidInputError {
116            message: self.message,
117            dashboard_validation_messages: self.dashboard_validation_messages,
118            meta: self.meta.unwrap_or_default(),
119        }
120    }
121}