aws_sdk_secretsmanager/types/error/
_invalid_request_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A parameter value is not valid for the current state of the resource.</p>
4/// <p>Possible causes:</p>
5/// <ul>
6/// <li>
7/// <p>The secret is scheduled for deletion.</p></li>
8/// <li>
9/// <p>You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call.</p></li>
10/// <li>
11/// <p>The secret is managed by another service, and you must use that service to update it. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html">Secrets managed by other Amazon Web Services services</a>.</p></li>
12/// </ul>
13#[non_exhaustive]
14#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
15pub struct InvalidRequestException {
16    #[allow(missing_docs)] // documentation missing in model
17    pub message: ::std::option::Option<::std::string::String>,
18    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
19}
20impl InvalidRequestException {
21    /// Returns the error message.
22    pub fn message(&self) -> ::std::option::Option<&str> {
23        self.message.as_deref()
24    }
25}
26impl ::std::fmt::Display for InvalidRequestException {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28        ::std::write!(f, "InvalidRequestException")?;
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 InvalidRequestException {}
38impl ::aws_types::request_id::RequestId for crate::types::error::InvalidRequestException {
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 InvalidRequestException {
45    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
46        &self.meta
47    }
48}
49impl InvalidRequestException {
50    /// Creates a new builder-style object to manufacture [`InvalidRequestException`](crate::types::error::InvalidRequestException).
51    pub fn builder() -> crate::types::error::builders::InvalidRequestExceptionBuilder {
52        crate::types::error::builders::InvalidRequestExceptionBuilder::default()
53    }
54}
55
56/// A builder for [`InvalidRequestException`](crate::types::error::InvalidRequestException).
57#[non_exhaustive]
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59pub struct InvalidRequestExceptionBuilder {
60    pub(crate) message: ::std::option::Option<::std::string::String>,
61    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
62}
63impl InvalidRequestExceptionBuilder {
64    #[allow(missing_docs)] // documentation missing in model
65    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.message = ::std::option::Option::Some(input.into());
67        self
68    }
69    #[allow(missing_docs)] // documentation missing in model
70    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.message = input;
72        self
73    }
74    #[allow(missing_docs)] // documentation missing in model
75    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
76        &self.message
77    }
78    /// Sets error metadata
79    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
80        self.meta = Some(meta);
81        self
82    }
83
84    /// Sets error metadata
85    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
86        self.meta = meta;
87        self
88    }
89    /// Consumes the builder and constructs a [`InvalidRequestException`](crate::types::error::InvalidRequestException).
90    pub fn build(self) -> crate::types::error::InvalidRequestException {
91        crate::types::error::InvalidRequestException {
92            message: self.message,
93            meta: self.meta.unwrap_or_default(),
94        }
95    }
96}