1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_put_lexicon_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<crate::operation::put_lexicon::PutLexiconOutput, crate::operation::put_lexicon::PutLexiconError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
11 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 - | let generic = generic_builder.build();
|
13 - | let error_code = match generic.code() {
|
14 - | Some(code) => code,
|
15 - | None => return Err(crate::operation::put_lexicon::PutLexiconError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidLexiconException" => crate::operation::put_lexicon::PutLexiconError::InvalidLexiconException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InvalidLexiconExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_invalid_lexicon_exception::de_invalid_lexicon_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | output.build()
|
29 - | };
|
30 - | if tmp.message.is_none() {
|
31 - | tmp.message = _error_message;
|
32 - | }
|
33 - | tmp
|
34 - | }),
|
35 - | "LexiconSizeExceededException" => crate::operation::put_lexicon::PutLexiconError::LexiconSizeExceededException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::LexiconSizeExceededExceptionBuilder::default();
|
40 - | output =
|
41 - | crate::protocol_serde::shape_lexicon_size_exceeded_exception::de_lexicon_size_exceeded_exception_json_err(_response_body, output)
|
42 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
43 - | let output = output.meta(generic);
|
44 - | output.build()
|
45 - | };
|
46 - | if tmp.message.is_none() {
|
47 - | tmp.message = _error_message;
|
48 - | }
|
49 - | tmp
|
50 - | }),
|
51 - | "MaxLexemeLengthExceededException" => crate::operation::put_lexicon::PutLexiconError::MaxLexemeLengthExceededException({
|
52 - | #[allow(unused_mut)]
|
53 - | let mut tmp = {
|
54 - | #[allow(unused_mut)]
|
55 - | let mut output = crate::types::error::builders::MaxLexemeLengthExceededExceptionBuilder::default();
|
56 - | output = crate::protocol_serde::shape_max_lexeme_length_exceeded_exception::de_max_lexeme_length_exceeded_exception_json_err(
|
57 - | _response_body,
|
58 - | output,
|
59 - | )
|
60 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
61 - | let output = output.meta(generic);
|
62 - | output.build()
|
63 - | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 - | tmp
|
68 - | }),
|
69 - | "MaxLexiconsNumberExceededException" => crate::operation::put_lexicon::PutLexiconError::MaxLexiconsNumberExceededException({
|
70 - | #[allow(unused_mut)]
|
71 - | let mut tmp = {
|
72 - | #[allow(unused_mut)]
|
73 - | let mut output = crate::types::error::builders::MaxLexiconsNumberExceededExceptionBuilder::default();
|
74 - | output = crate::protocol_serde::shape_max_lexicons_number_exceeded_exception::de_max_lexicons_number_exceeded_exception_json_err(
|
75 - | _response_body,
|
76 - | output,
|
77 - | )
|
78 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
79 - | let output = output.meta(generic);
|
80 - | output.build()
|
81 - | };
|
82 - | if tmp.message.is_none() {
|
83 - | tmp.message = _error_message;
|
84 - | }
|
85 - | tmp
|
86 - | }),
|
87 - | "ServiceFailureException" => crate::operation::put_lexicon::PutLexiconError::ServiceFailureException({
|
88 - | #[allow(unused_mut)]
|
89 - | let mut tmp = {
|
90 - | #[allow(unused_mut)]
|
91 - | let mut output = crate::types::error::builders::ServiceFailureExceptionBuilder::default();
|
92 - | output = crate::protocol_serde::shape_service_failure_exception::de_service_failure_exception_json_err(_response_body, output)
|
93 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
94 - | let output = output.meta(generic);
|
95 - | output.build()
|
96 - | };
|
97 - | if tmp.message.is_none() {
|
98 - | tmp.message = _error_message;
|
99 - | }
|
100 - | tmp
|
101 - | }),
|
102 - | "UnsupportedPlsAlphabetException" => crate::operation::put_lexicon::PutLexiconError::UnsupportedPlsAlphabetException({
|
103 - | #[allow(unused_mut)]
|
104 - | let mut tmp = {
|
105 - | #[allow(unused_mut)]
|
106 - | let mut output = crate::types::error::builders::UnsupportedPlsAlphabetExceptionBuilder::default();
|
107 - | output = crate::protocol_serde::shape_unsupported_pls_alphabet_exception::de_unsupported_pls_alphabet_exception_json_err(
|
108 - | _response_body,
|
109 - | output,
|
110 - | )
|
111 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
112 - | let output = output.meta(generic);
|
113 - | output.build()
|
114 - | };
|
115 - | if tmp.message.is_none() {
|
116 - | tmp.message = _error_message;
|
117 - | }
|
118 - | tmp
|
119 - | }),
|
120 - | "UnsupportedPlsLanguageException" => crate::operation::put_lexicon::PutLexiconError::UnsupportedPlsLanguageException({
|
121 - | #[allow(unused_mut)]
|
122 - | let mut tmp = {
|
123 - | #[allow(unused_mut)]
|
124 - | let mut output = crate::types::error::builders::UnsupportedPlsLanguageExceptionBuilder::default();
|
125 - | output = crate::protocol_serde::shape_unsupported_pls_language_exception::de_unsupported_pls_language_exception_json_err(
|
126 - | _response_body,
|
127 - | output,
|
128 - | )
|
129 - | .map_err(crate::operation::put_lexicon::PutLexiconError::unhandled)?;
|
130 - | let output = output.meta(generic);
|
131 - | output.build()
|
132 - | };
|
133 - | if tmp.message.is_none() {
|
134 - | tmp.message = _error_message;
|
135 - | }
|
136 - | tmp
|
137 - | }),
|
138 - | _ => crate::operation::put_lexicon::PutLexiconError::generic(generic),
|
139 - | })
|
140 - | }
|
141 - |
|
142 - | #[allow(clippy::unnecessary_wraps)]
|
143 - | pub fn de_put_lexicon_http_response(
|
144 - | _response_status: u16,
|
145 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
146 - | _response_body: &[u8],
|
147 - | ) -> std::result::Result<crate::operation::put_lexicon::PutLexiconOutput, crate::operation::put_lexicon::PutLexiconError> {
|
148 - | Ok({
|
149 - | #[allow(unused_mut)]
|
150 - | let mut output = crate::operation::put_lexicon::builders::PutLexiconOutputBuilder::default();
|
151 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
152 - | output.build()
|
153 - | })
|
154 - | }
|
155 - |
|
156 - | pub fn ser_put_lexicon_input(
|
157 - | input: &crate::operation::put_lexicon::PutLexiconInput,
|
158 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
159 - | let mut out = String::new();
|
160 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
161 - | crate::protocol_serde::shape_put_lexicon_input::ser_put_lexicon_input_input(&mut object, input)?;
|
162 - | object.finish();
|
163 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
164 - | }
|