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_pair_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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput,
|
9 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
|
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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::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 = crate::protocol_serde::shape_dependency_timeout_exception::de_dependency_timeout_exception_json_err(
|
30 - | _response_body,
|
31 - | output,
|
32 - | )
|
33 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
34 - | let output = output.meta(generic);
|
35 - | output.build()
|
36 - | };
|
37 - | if tmp.message.is_none() {
|
38 - | tmp.message = _error_message;
|
39 - | }
|
40 - | tmp
|
41 - | })
|
42 - | }
|
43 - | "DisabledException" => {
|
44 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::DisabledException({
|
45 - | #[allow(unused_mut)]
|
46 - | let mut tmp = {
|
47 - | #[allow(unused_mut)]
|
48 - | let mut output = crate::types::error::builders::DisabledExceptionBuilder::default();
|
49 - | output = crate::protocol_serde::shape_disabled_exception::de_disabled_exception_json_err(_response_body, output)
|
50 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
51 - | let output = output.meta(generic);
|
52 - | output.build()
|
53 - | };
|
54 - | if tmp.message.is_none() {
|
55 - | tmp.message = _error_message;
|
56 - | }
|
57 - | tmp
|
58 - | })
|
59 - | }
|
60 - | "DryRunOperationException" => {
|
61 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::DryRunOperationException({
|
62 - | #[allow(unused_mut)]
|
63 - | let mut tmp = {
|
64 - | #[allow(unused_mut)]
|
65 - | let mut output = crate::types::error::builders::DryRunOperationExceptionBuilder::default();
|
66 - | output =
|
67 - | crate::protocol_serde::shape_dry_run_operation_exception::de_dry_run_operation_exception_json_err(_response_body, output)
|
68 - | .map_err(
|
69 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled,
|
70 - | )?;
|
71 - | let output = output.meta(generic);
|
72 - | output.build()
|
73 - | };
|
74 - | if tmp.message.is_none() {
|
75 - | tmp.message = _error_message;
|
76 - | }
|
77 - | tmp
|
78 - | })
|
79 - | }
|
80 - | "InvalidGrantTokenException" => {
|
81 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::InvalidGrantTokenException({
|
82 - | #[allow(unused_mut)]
|
83 - | let mut tmp = {
|
84 - | #[allow(unused_mut)]
|
85 - | let mut output = crate::types::error::builders::InvalidGrantTokenExceptionBuilder::default();
|
86 - | output =
|
87 - | crate::protocol_serde::shape_invalid_grant_token_exception::de_invalid_grant_token_exception_json_err(_response_body, output)
|
88 - | .map_err(
|
89 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled,
|
90 - | )?;
|
91 - | let output = output.meta(generic);
|
92 - | output.build()
|
93 - | };
|
94 - | if tmp.message.is_none() {
|
95 - | tmp.message = _error_message;
|
96 - | }
|
97 - | tmp
|
98 - | })
|
99 - | }
|
100 - | "InvalidKeyUsageException" => {
|
101 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::InvalidKeyUsageException({
|
102 - | #[allow(unused_mut)]
|
103 - | let mut tmp = {
|
104 - | #[allow(unused_mut)]
|
105 - | let mut output = crate::types::error::builders::InvalidKeyUsageExceptionBuilder::default();
|
106 - | output =
|
107 - | crate::protocol_serde::shape_invalid_key_usage_exception::de_invalid_key_usage_exception_json_err(_response_body, output)
|
108 - | .map_err(
|
109 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled,
|
110 - | )?;
|
111 - | let output = output.meta(generic);
|
112 - | output.build()
|
113 - | };
|
114 - | if tmp.message.is_none() {
|
115 - | tmp.message = _error_message;
|
116 - | }
|
117 - | tmp
|
118 - | })
|
119 - | }
|
120 - | "KeyUnavailableException" => {
|
121 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KeyUnavailableException({
|
122 - | #[allow(unused_mut)]
|
123 - | let mut tmp = {
|
124 - | #[allow(unused_mut)]
|
125 - | let mut output = crate::types::error::builders::KeyUnavailableExceptionBuilder::default();
|
126 - | output = crate::protocol_serde::shape_key_unavailable_exception::de_key_unavailable_exception_json_err(_response_body, output)
|
127 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
128 - | let output = output.meta(generic);
|
129 - | output.build()
|
130 - | };
|
131 - | if tmp.message.is_none() {
|
132 - | tmp.message = _error_message;
|
133 - | }
|
134 - | tmp
|
135 - | })
|
136 - | }
|
137 - | "KMSInternalException" => {
|
138 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KmsInternalException({
|
139 - | #[allow(unused_mut)]
|
140 - | let mut tmp = {
|
141 - | #[allow(unused_mut)]
|
142 - | let mut output = crate::types::error::builders::KmsInternalExceptionBuilder::default();
|
143 - | output = crate::protocol_serde::shape_kms_internal_exception::de_kms_internal_exception_json_err(_response_body, output)
|
144 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
145 - | let output = output.meta(generic);
|
146 - | output.build()
|
147 - | };
|
148 - | if tmp.message.is_none() {
|
149 - | tmp.message = _error_message;
|
150 - | }
|
151 - | tmp
|
152 - | })
|
153 - | }
|
154 - | "KMSInvalidStateException" => {
|
155 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KmsInvalidStateException({
|
156 - | #[allow(unused_mut)]
|
157 - | let mut tmp = {
|
158 - | #[allow(unused_mut)]
|
159 - | let mut output = crate::types::error::builders::KmsInvalidStateExceptionBuilder::default();
|
160 - | output =
|
161 - | crate::protocol_serde::shape_kms_invalid_state_exception::de_kms_invalid_state_exception_json_err(_response_body, output)
|
162 - | .map_err(
|
163 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled,
|
164 - | )?;
|
165 - | let output = output.meta(generic);
|
166 - | output.build()
|
167 - | };
|
168 - | if tmp.message.is_none() {
|
169 - | tmp.message = _error_message;
|
170 - | }
|
171 - | tmp
|
172 - | })
|
173 - | }
|
174 - | "NotFoundException" => {
|
175 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::NotFoundException({
|
176 - | #[allow(unused_mut)]
|
177 - | let mut tmp = {
|
178 - | #[allow(unused_mut)]
|
179 - | let mut output = crate::types::error::builders::NotFoundExceptionBuilder::default();
|
180 - | output = crate::protocol_serde::shape_not_found_exception::de_not_found_exception_json_err(_response_body, output)
|
181 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
182 - | let output = output.meta(generic);
|
183 - | output.build()
|
184 - | };
|
185 - | if tmp.message.is_none() {
|
186 - | tmp.message = _error_message;
|
187 - | }
|
188 - | tmp
|
189 - | })
|
190 - | }
|
191 - | "UnsupportedOperationException" => {
|
192 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::UnsupportedOperationException({
|
193 - | #[allow(unused_mut)]
|
194 - | let mut tmp = {
|
195 - | #[allow(unused_mut)]
|
196 - | let mut output = crate::types::error::builders::UnsupportedOperationExceptionBuilder::default();
|
197 - | output = crate::protocol_serde::shape_unsupported_operation_exception::de_unsupported_operation_exception_json_err(
|
198 - | _response_body,
|
199 - | output,
|
200 - | )
|
201 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
202 - | let output = output.meta(generic);
|
203 - | output.build()
|
204 - | };
|
205 - | if tmp.message.is_none() {
|
206 - | tmp.message = _error_message;
|
207 - | }
|
208 - | tmp
|
209 - | })
|
210 - | }
|
211 - | _ => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::generic(generic),
|
212 - | })
|
213 - | }
|
214 - |
|
215 - | #[allow(clippy::unnecessary_wraps)]
|
216 - | pub fn de_generate_data_key_pair_without_plaintext_http_response(
|
217 - | _response_status: u16,
|
218 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
219 - | _response_body: &[u8],
|
220 - | ) -> std::result::Result<
|
221 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput,
|
222 - | crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
|
223 - | > {
|
224 - | Ok({
|
225 - | #[allow(unused_mut)]
|
226 - | let mut output =
|
227 - | crate::operation::generate_data_key_pair_without_plaintext::builders::GenerateDataKeyPairWithoutPlaintextOutputBuilder::default();
|
228 - | output = crate::protocol_serde::shape_generate_data_key_pair_without_plaintext::de_generate_data_key_pair_without_plaintext(
|
229 - | _response_body,
|
230 - | output,
|
231 - | )
|
232 - | .map_err(crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled)?;
|
233 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
234 - | output.build()
|
235 - | })
|
236 - | }
|
237 - |
|
238 - | pub fn ser_generate_data_key_pair_without_plaintext_input(
|
239 - | input: &crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
|
240 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
241 - | let mut out = String::new();
|
242 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
243 - | crate::protocol_serde::shape_generate_data_key_pair_without_plaintext_input::ser_generate_data_key_pair_without_plaintext_input_input(
|
244 - | &mut object,
|
245 - | input,
|
246 - | )?;
|
247 - | object.finish();
|
248 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
249 - | }
|
250 - |
|
251 - | pub(crate) fn de_generate_data_key_pair_without_plaintext(
|
252 - | _value: &[u8],
|
253 - | mut builder: crate::operation::generate_data_key_pair_without_plaintext::builders::GenerateDataKeyPairWithoutPlaintextOutputBuilder,
|
254 - | ) -> ::std::result::Result<
|
255 - | crate::operation::generate_data_key_pair_without_plaintext::builders::GenerateDataKeyPairWithoutPlaintextOutputBuilder,
|
256 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
257 - | > {
|
258 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
259 - | let tokens = &mut tokens_owned;
|
260 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
261 - | loop {
|
262 - | match tokens.next().transpose()? {
|
263 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
264 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
265 - | "PrivateKeyCiphertextBlob" => {
|
266 - | builder = builder.set_private_key_ciphertext_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
|
267 - | }
|
268 - | "PublicKey" => {
|
269 - | builder = builder.set_public_key(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
|
270 - | }
|
271 - | "KeyId" => {
|
272 - | builder = builder.set_key_id(
|
273 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
274 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
275 - | .transpose()?,
|
276 - | );
|
277 - | }
|
278 - | "KeyPairSpec" => {
|
279 - | builder = builder.set_key_pair_spec(
|
280 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
281 - | .map(|s| s.to_unescaped().map(|u| crate::types::DataKeyPairSpec::from(u.as_ref())))
|
282 - | .transpose()?,
|
283 - | );
|
284 - | }
|
285 - | "KeyMaterialId" => {
|
286 - | builder = builder.set_key_material_id(
|
287 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
288 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
289 - | .transpose()?,
|
290 - | );
|
291 - | }
|
292 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
293 - | },
|
294 - | other => {
|
295 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
296 - | "expected object key or end object, found: {other:?}"
|
297 - | )))
|
298 - | }
|
299 - | }
|
300 - | }
|
301 - | if tokens.next().is_some() {
|
302 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
303 - | "found more JSON tokens after completing parsing",
|
304 - | ));
|
305 - | }
|
306 - | Ok(builder)
|
307 - | }
|