1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_generate_data_key_without_plaintext_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput,
|
9 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
14 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
15 - | let generic = generic_builder.build();
|
16 - | let error_code = match generic.code() {
|
17 - | Some(code) => code,
|
18 - | None => return Err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "DependencyTimeoutException" => {
|
24 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DependencyTimeoutException({
|
25 - | #[allow(unused_mut)]
|
26 - | let mut tmp = {
|
27 - | #[allow(unused_mut)]
|
28 - | let mut output = crate::types::error::builders::DependencyTimeoutExceptionBuilder::default();
|
29 - | output =
|
30 - | crate::protocol_serde::shape_dependency_timeout_exception::de_dependency_timeout_exception_json_err(_response_body, output)
|
31 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
32 - | let output = output.meta(generic);
|
33 - | output.build()
|
34 - | };
|
35 - | if tmp.message.is_none() {
|
36 - | tmp.message = _error_message;
|
37 - | }
|
38 - | tmp
|
39 - | })
|
40 - | }
|
41 - | "DisabledException" => crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DisabledException({
|
42 - | #[allow(unused_mut)]
|
43 - | let mut tmp = {
|
44 - | #[allow(unused_mut)]
|
45 - | let mut output = crate::types::error::builders::DisabledExceptionBuilder::default();
|
46 - | output = crate::protocol_serde::shape_disabled_exception::de_disabled_exception_json_err(_response_body, output)
|
47 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
48 - | let output = output.meta(generic);
|
49 - | output.build()
|
50 - | };
|
51 - | if tmp.message.is_none() {
|
52 - | tmp.message = _error_message;
|
53 - | }
|
54 - | tmp
|
55 - | }),
|
56 - | "DryRunOperationException" => {
|
57 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DryRunOperationException({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::DryRunOperationExceptionBuilder::default();
|
62 - | output =
|
63 - | crate::protocol_serde::shape_dry_run_operation_exception::de_dry_run_operation_exception_json_err(_response_body, output)
|
64 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
65 - | let output = output.meta(generic);
|
66 - | output.build()
|
67 - | };
|
68 - | if tmp.message.is_none() {
|
69 - | tmp.message = _error_message;
|
70 - | }
|
71 - | tmp
|
72 - | })
|
73 - | }
|
74 - | "InvalidGrantTokenException" => {
|
75 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidGrantTokenException({
|
76 - | #[allow(unused_mut)]
|
77 - | let mut tmp = {
|
78 - | #[allow(unused_mut)]
|
79 - | let mut output = crate::types::error::builders::InvalidGrantTokenExceptionBuilder::default();
|
80 - | output =
|
81 - | crate::protocol_serde::shape_invalid_grant_token_exception::de_invalid_grant_token_exception_json_err(_response_body, output)
|
82 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
83 - | let output = output.meta(generic);
|
84 - | output.build()
|
85 - | };
|
86 - | if tmp.message.is_none() {
|
87 - | tmp.message = _error_message;
|
88 - | }
|
89 - | tmp
|
90 - | })
|
91 - | }
|
92 - | "InvalidKeyUsageException" => {
|
93 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidKeyUsageException({
|
94 - | #[allow(unused_mut)]
|
95 - | let mut tmp = {
|
96 - | #[allow(unused_mut)]
|
97 - | let mut output = crate::types::error::builders::InvalidKeyUsageExceptionBuilder::default();
|
98 - | output =
|
99 - | crate::protocol_serde::shape_invalid_key_usage_exception::de_invalid_key_usage_exception_json_err(_response_body, output)
|
100 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
101 - | let output = output.meta(generic);
|
102 - | output.build()
|
103 - | };
|
104 - | if tmp.message.is_none() {
|
105 - | tmp.message = _error_message;
|
106 - | }
|
107 - | tmp
|
108 - | })
|
109 - | }
|
110 - | "KeyUnavailableException" => {
|
111 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KeyUnavailableException({
|
112 - | #[allow(unused_mut)]
|
113 - | let mut tmp = {
|
114 - | #[allow(unused_mut)]
|
115 - | let mut output = crate::types::error::builders::KeyUnavailableExceptionBuilder::default();
|
116 - | output = crate::protocol_serde::shape_key_unavailable_exception::de_key_unavailable_exception_json_err(_response_body, output)
|
117 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
118 - | let output = output.meta(generic);
|
119 - | output.build()
|
120 - | };
|
121 - | if tmp.message.is_none() {
|
122 - | tmp.message = _error_message;
|
123 - | }
|
124 - | tmp
|
125 - | })
|
126 - | }
|
127 - | "KMSInternalException" => {
|
128 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInternalException({
|
129 - | #[allow(unused_mut)]
|
130 - | let mut tmp = {
|
131 - | #[allow(unused_mut)]
|
132 - | let mut output = crate::types::error::builders::KmsInternalExceptionBuilder::default();
|
133 - | output = crate::protocol_serde::shape_kms_internal_exception::de_kms_internal_exception_json_err(_response_body, output)
|
134 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
135 - | let output = output.meta(generic);
|
136 - | output.build()
|
137 - | };
|
138 - | if tmp.message.is_none() {
|
139 - | tmp.message = _error_message;
|
140 - | }
|
141 - | tmp
|
142 - | })
|
143 - | }
|
144 - | "KMSInvalidStateException" => {
|
145 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInvalidStateException({
|
146 - | #[allow(unused_mut)]
|
147 - | let mut tmp = {
|
148 - | #[allow(unused_mut)]
|
149 - | let mut output = crate::types::error::builders::KmsInvalidStateExceptionBuilder::default();
|
150 - | output =
|
151 - | crate::protocol_serde::shape_kms_invalid_state_exception::de_kms_invalid_state_exception_json_err(_response_body, output)
|
152 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
153 - | let output = output.meta(generic);
|
154 - | output.build()
|
155 - | };
|
156 - | if tmp.message.is_none() {
|
157 - | tmp.message = _error_message;
|
158 - | }
|
159 - | tmp
|
160 - | })
|
161 - | }
|
162 - | "NotFoundException" => crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::NotFoundException({
|
163 - | #[allow(unused_mut)]
|
164 - | let mut tmp = {
|
165 - | #[allow(unused_mut)]
|
166 - | let mut output = crate::types::error::builders::NotFoundExceptionBuilder::default();
|
167 - | output = crate::protocol_serde::shape_not_found_exception::de_not_found_exception_json_err(_response_body, output)
|
168 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
169 - | let output = output.meta(generic);
|
170 - | output.build()
|
171 - | };
|
172 - | if tmp.message.is_none() {
|
173 - | tmp.message = _error_message;
|
174 - | }
|
175 - | tmp
|
176 - | }),
|
177 - | _ => crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::generic(generic),
|
178 - | })
|
179 - | }
|
180 - |
|
181 - | #[allow(clippy::unnecessary_wraps)]
|
182 - | pub fn de_generate_data_key_without_plaintext_http_response(
|
183 - | _response_status: u16,
|
184 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
185 - | _response_body: &[u8],
|
186 - | ) -> std::result::Result<
|
187 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput,
|
188 - | crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
|
189 - | > {
|
190 - | Ok({
|
191 - | #[allow(unused_mut)]
|
192 - | let mut output = crate::operation::generate_data_key_without_plaintext::builders::GenerateDataKeyWithoutPlaintextOutputBuilder::default();
|
193 - | output = crate::protocol_serde::shape_generate_data_key_without_plaintext::de_generate_data_key_without_plaintext(_response_body, output)
|
194 - | .map_err(crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled)?;
|
195 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
196 - | output.build()
|
197 - | })
|
198 - | }
|
199 - |
|
200 - | pub fn ser_generate_data_key_without_plaintext_input(
|
201 - | input: &crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput,
|
202 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
203 - | let mut out = String::new();
|
204 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
205 - | crate::protocol_serde::shape_generate_data_key_without_plaintext_input::ser_generate_data_key_without_plaintext_input_input(&mut object, input)?;
|
206 - | object.finish();
|
207 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
208 - | }
|
209 - |
|
210 - | pub(crate) fn de_generate_data_key_without_plaintext(
|
211 - | _value: &[u8],
|
212 - | mut builder: crate::operation::generate_data_key_without_plaintext::builders::GenerateDataKeyWithoutPlaintextOutputBuilder,
|
213 - | ) -> ::std::result::Result<
|
214 - | crate::operation::generate_data_key_without_plaintext::builders::GenerateDataKeyWithoutPlaintextOutputBuilder,
|
215 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
216 - | > {
|
217 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
218 - | let tokens = &mut tokens_owned;
|
219 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
220 - | loop {
|
221 - | match tokens.next().transpose()? {
|
222 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
223 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
224 - | "CiphertextBlob" => {
|
225 - | builder = builder.set_ciphertext_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
|
226 - | }
|
227 - | "KeyId" => {
|
228 - | builder = builder.set_key_id(
|
229 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
230 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
231 - | .transpose()?,
|
232 - | );
|
233 - | }
|
234 - | "KeyMaterialId" => {
|
235 - | builder = builder.set_key_material_id(
|
236 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
237 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
238 - | .transpose()?,
|
239 - | );
|
240 - | }
|
241 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
242 - | },
|
243 - | other => {
|
244 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
245 - | "expected object key or end object, found: {other:?}"
|
246 - | )))
|
247 - | }
|
248 - | }
|
249 - | }
|
250 - | if tokens.next().is_some() {
|
251 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
252 - | "found more JSON tokens after completing parsing",
|
253 - | ));
|
254 - | }
|
255 - | Ok(builder)
|
256 - | }
|