aws_sdk_neptunedata/types/error/
_bad_request_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Raised when a request is submitted that cannot be processed.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BadRequestException {
7    /// <p>A detailed message describing the problem.</p>
8    pub detailed_message: ::std::string::String,
9    /// <p>The ID of the bad request.</p>
10    pub request_id: ::std::string::String,
11    /// <p>The HTTP status code returned with the exception.</p>
12    pub code: ::std::string::String,
13    #[allow(missing_docs)] // documentation missing in model
14    pub message: ::std::option::Option<::std::string::String>,
15    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
16}
17impl BadRequestException {
18    /// <p>A detailed message describing the problem.</p>
19    pub fn detailed_message(&self) -> &str {
20        use std::ops::Deref;
21        self.detailed_message.deref()
22    }
23    /// <p>The ID of the bad request.</p>
24    pub fn request_id(&self) -> &str {
25        use std::ops::Deref;
26        self.request_id.deref()
27    }
28    /// <p>The HTTP status code returned with the exception.</p>
29    pub fn code(&self) -> &str {
30        use std::ops::Deref;
31        self.code.deref()
32    }
33}
34impl BadRequestException {
35    /// Returns the error message.
36    pub fn message(&self) -> ::std::option::Option<&str> {
37        self.message.as_deref()
38    }
39}
40impl ::std::fmt::Display for BadRequestException {
41    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42        ::std::write!(f, "BadRequestException")?;
43        if let ::std::option::Option::Some(inner_1) = &self.message {
44            {
45                ::std::write!(f, ": {}", inner_1)?;
46            }
47        }
48        Ok(())
49    }
50}
51impl ::std::error::Error for BadRequestException {}
52impl ::aws_types::request_id::RequestId for crate::types::error::BadRequestException {
53    fn request_id(&self) -> Option<&str> {
54        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
55        self.meta().request_id()
56    }
57}
58impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for BadRequestException {
59    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
60        &self.meta
61    }
62}
63impl BadRequestException {
64    /// Creates a new builder-style object to manufacture [`BadRequestException`](crate::types::error::BadRequestException).
65    pub fn builder() -> crate::types::error::builders::BadRequestExceptionBuilder {
66        crate::types::error::builders::BadRequestExceptionBuilder::default()
67    }
68}
69
70/// A builder for [`BadRequestException`](crate::types::error::BadRequestException).
71#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
72#[non_exhaustive]
73pub struct BadRequestExceptionBuilder {
74    pub(crate) detailed_message: ::std::option::Option<::std::string::String>,
75    pub(crate) request_id: ::std::option::Option<::std::string::String>,
76    pub(crate) code: ::std::option::Option<::std::string::String>,
77    pub(crate) message: ::std::option::Option<::std::string::String>,
78    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
79}
80impl BadRequestExceptionBuilder {
81    /// <p>A detailed message describing the problem.</p>
82    /// This field is required.
83    pub fn detailed_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.detailed_message = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>A detailed message describing the problem.</p>
88    pub fn set_detailed_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.detailed_message = input;
90        self
91    }
92    /// <p>A detailed message describing the problem.</p>
93    pub fn get_detailed_message(&self) -> &::std::option::Option<::std::string::String> {
94        &self.detailed_message
95    }
96    /// <p>The ID of the bad request.</p>
97    /// This field is required.
98    pub fn request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.request_id = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The ID of the bad request.</p>
103    pub fn set_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.request_id = input;
105        self
106    }
107    /// <p>The ID of the bad request.</p>
108    pub fn get_request_id(&self) -> &::std::option::Option<::std::string::String> {
109        &self.request_id
110    }
111    /// <p>The HTTP status code returned with the exception.</p>
112    /// This field is required.
113    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.code = ::std::option::Option::Some(input.into());
115        self
116    }
117    /// <p>The HTTP status code returned with the exception.</p>
118    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.code = input;
120        self
121    }
122    /// <p>The HTTP status code returned with the exception.</p>
123    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
124        &self.code
125    }
126    #[allow(missing_docs)] // documentation missing in model
127    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.message = ::std::option::Option::Some(input.into());
129        self
130    }
131    #[allow(missing_docs)] // documentation missing in model
132    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.message = input;
134        self
135    }
136    #[allow(missing_docs)] // documentation missing in model
137    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
138        &self.message
139    }
140    /// Sets error metadata
141    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
142        self.meta = Some(meta);
143        self
144    }
145
146    /// Sets error metadata
147    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
148        self.meta = meta;
149        self
150    }
151    /// Consumes the builder and constructs a [`BadRequestException`](crate::types::error::BadRequestException).
152    /// This method will fail if any of the following fields are not set:
153    /// - [`detailed_message`](crate::types::error::builders::BadRequestExceptionBuilder::detailed_message)
154    /// - [`request_id`](crate::types::error::builders::BadRequestExceptionBuilder::request_id)
155    /// - [`code`](crate::types::error::builders::BadRequestExceptionBuilder::code)
156    pub fn build(self) -> ::std::result::Result<crate::types::error::BadRequestException, ::aws_smithy_types::error::operation::BuildError> {
157        ::std::result::Result::Ok(crate::types::error::BadRequestException {
158            detailed_message: self.detailed_message.ok_or_else(|| {
159                ::aws_smithy_types::error::operation::BuildError::missing_field(
160                    "detailed_message",
161                    "detailed_message was not specified but it is required when building BadRequestException",
162                )
163            })?,
164            request_id: self.request_id.ok_or_else(|| {
165                ::aws_smithy_types::error::operation::BuildError::missing_field(
166                    "request_id",
167                    "request_id was not specified but it is required when building BadRequestException",
168                )
169            })?,
170            code: self.code.ok_or_else(|| {
171                ::aws_smithy_types::error::operation::BuildError::missing_field(
172                    "code",
173                    "code was not specified but it is required when building BadRequestException",
174                )
175            })?,
176            message: self.message,
177            meta: self.meta.unwrap_or_default(),
178        })
179    }
180}