aws_sdk_config/types/error/_validation_exception.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.</p>
4/// <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutStoredQuery.html">PutStoredQuery</a>, one of the following errors:</p>
5/// <ul>
6/// <li>
7/// <p>There are missing required fields.</p></li>
8/// <li>
9/// <p>The input value fails the validation.</p></li>
10/// <li>
11/// <p>You are trying to create more than 300 queries.</p></li>
12/// </ul>
13/// <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html">DescribeConfigurationRecorders</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorderStatus.html">DescribeConfigurationRecorderStatus</a>, one of the following errors:</p>
14/// <ul>
15/// <li>
16/// <p>You have specified more than one configuration recorder.</p></li>
17/// <li>
18/// <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p></li>
19/// </ul>
20/// <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html">AssociateResourceTypes</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html">DisassociateResourceTypes</a>, one of the following errors:</p>
21/// <ul>
22/// <li>
23/// <p>Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.</p></li>
24/// <li>
25/// <p>One or more of the specified resource types are already associated or disassociated with the configuration recorder.</p></li>
26/// <li>
27/// <p>For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.</p></li>
28/// </ul>
29#[non_exhaustive]
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
31pub struct ValidationException {
32 /// <p>Error executing the command</p>
33 pub message: ::std::option::Option<::std::string::String>,
34 pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
35}
36impl ValidationException {
37 /// Returns the error message.
38 pub fn message(&self) -> ::std::option::Option<&str> {
39 self.message.as_deref()
40 }
41}
42impl ::std::fmt::Display for ValidationException {
43 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44 ::std::write!(f, "ValidationException")?;
45 if let ::std::option::Option::Some(inner_1) = &self.message {
46 {
47 ::std::write!(f, ": {inner_1}")?;
48 }
49 }
50 Ok(())
51 }
52}
53impl ::std::error::Error for ValidationException {}
54impl ::aws_types::request_id::RequestId for crate::types::error::ValidationException {
55 fn request_id(&self) -> Option<&str> {
56 use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
57 self.meta().request_id()
58 }
59}
60impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ValidationException {
61 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
62 &self.meta
63 }
64}
65impl ValidationException {
66 /// Creates a new builder-style object to manufacture [`ValidationException`](crate::types::error::ValidationException).
67 pub fn builder() -> crate::types::error::builders::ValidationExceptionBuilder {
68 crate::types::error::builders::ValidationExceptionBuilder::default()
69 }
70}
71
72/// A builder for [`ValidationException`](crate::types::error::ValidationException).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
74#[non_exhaustive]
75pub struct ValidationExceptionBuilder {
76 pub(crate) message: ::std::option::Option<::std::string::String>,
77 meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
78}
79impl ValidationExceptionBuilder {
80 /// <p>Error executing the command</p>
81 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 /// <p>Error executing the command</p>
86 pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.message = input;
88 self
89 }
90 /// <p>Error executing the command</p>
91 pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
92 &self.message
93 }
94 /// Sets error metadata
95 pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
96 self.meta = Some(meta);
97 self
98 }
99
100 /// Sets error metadata
101 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 /// Consumes the builder and constructs a [`ValidationException`](crate::types::error::ValidationException).
106 pub fn build(self) -> crate::types::error::ValidationException {
107 crate::types::error::ValidationException {
108 message: self.message,
109 meta: self.meta.unwrap_or_default(),
110 }
111 }
112}