1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_create_function_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::create_function::CreateFunctionOutput, crate::operation::create_function::CreateFunctionError> {
|
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::create_function::CreateFunctionError::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::create_function::CreateFunctionError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "CodeSigningConfigNotFoundException" => crate::operation::create_function::CreateFunctionError::CodeSigningConfigNotFoundException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::CodeSigningConfigNotFoundExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_code_signing_config_not_found_exception::de_code_signing_config_not_found_exception_json_err(
|
26 - | _response_body,
|
27 - | output,
|
28 - | )
|
29 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
30 - | let output = output.meta(generic);
|
31 - | output.build()
|
32 - | };
|
33 - | if tmp.message.is_none() {
|
34 - | tmp.message = _error_message;
|
35 - | }
|
36 - | tmp
|
37 - | }),
|
38 - | "CodeStorageExceededException" => crate::operation::create_function::CreateFunctionError::CodeStorageExceededException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::CodeStorageExceededExceptionBuilder::default();
|
43 - | output =
|
44 - | crate::protocol_serde::shape_code_storage_exceeded_exception::de_code_storage_exceeded_exception_json_err(_response_body, output)
|
45 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
46 - | let output = output.meta(generic);
|
47 - | output.build()
|
48 - | };
|
49 - | if tmp.message.is_none() {
|
50 - | tmp.message = _error_message;
|
51 - | }
|
52 - | tmp
|
53 - | }),
|
54 - | "CodeVerificationFailedException" => crate::operation::create_function::CreateFunctionError::CodeVerificationFailedException({
|
55 - | #[allow(unused_mut)]
|
56 - | let mut tmp = {
|
57 - | #[allow(unused_mut)]
|
58 - | let mut output = crate::types::error::builders::CodeVerificationFailedExceptionBuilder::default();
|
59 - | output = crate::protocol_serde::shape_code_verification_failed_exception::de_code_verification_failed_exception_json_err(
|
60 - | _response_body,
|
61 - | output,
|
62 - | )
|
63 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
64 - | let output = output.meta(generic);
|
65 - | output.build()
|
66 - | };
|
67 - | if tmp.message.is_none() {
|
68 - | tmp.message = _error_message;
|
69 - | }
|
70 - | tmp
|
71 - | }),
|
72 - | "InvalidCodeSignatureException" => crate::operation::create_function::CreateFunctionError::InvalidCodeSignatureException({
|
73 - | #[allow(unused_mut)]
|
74 - | let mut tmp = {
|
75 - | #[allow(unused_mut)]
|
76 - | let mut output = crate::types::error::builders::InvalidCodeSignatureExceptionBuilder::default();
|
77 - | output = crate::protocol_serde::shape_invalid_code_signature_exception::de_invalid_code_signature_exception_json_err(
|
78 - | _response_body,
|
79 - | output,
|
80 - | )
|
81 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
82 - | let output = output.meta(generic);
|
83 - | output.build()
|
84 - | };
|
85 - | if tmp.message.is_none() {
|
86 - | tmp.message = _error_message;
|
87 - | }
|
88 - | tmp
|
89 - | }),
|
90 - | "InvalidParameterValueException" => crate::operation::create_function::CreateFunctionError::InvalidParameterValueException({
|
91 - | #[allow(unused_mut)]
|
92 - | let mut tmp = {
|
93 - | #[allow(unused_mut)]
|
94 - | let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
|
95 - | output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
|
96 - | _response_body,
|
97 - | output,
|
98 - | )
|
99 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
100 - | let output = output.meta(generic);
|
101 - | output.build()
|
102 - | };
|
103 - | if tmp.message.is_none() {
|
104 - | tmp.message = _error_message;
|
105 - | }
|
106 - | tmp
|
107 - | }),
|
108 - | "ResourceConflictException" => crate::operation::create_function::CreateFunctionError::ResourceConflictException({
|
109 - | #[allow(unused_mut)]
|
110 - | let mut tmp = {
|
111 - | #[allow(unused_mut)]
|
112 - | let mut output = crate::types::error::builders::ResourceConflictExceptionBuilder::default();
|
113 - | output = crate::protocol_serde::shape_resource_conflict_exception::de_resource_conflict_exception_json_err(_response_body, output)
|
114 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
115 - | let output = output.meta(generic);
|
116 - | output.build()
|
117 - | };
|
118 - | if tmp.message.is_none() {
|
119 - | tmp.message = _error_message;
|
120 - | }
|
121 - | tmp
|
122 - | }),
|
123 - | "ResourceNotFoundException" => crate::operation::create_function::CreateFunctionError::ResourceNotFoundException({
|
124 - | #[allow(unused_mut)]
|
125 - | let mut tmp = {
|
126 - | #[allow(unused_mut)]
|
127 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
128 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
129 - | .map_err(crate::operation::create_function::CreateFunctionError::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 - | "ServiceException" => crate::operation::create_function::CreateFunctionError::ServiceException({
|
139 - | #[allow(unused_mut)]
|
140 - | let mut tmp = {
|
141 - | #[allow(unused_mut)]
|
142 - | let mut output = crate::types::error::builders::ServiceExceptionBuilder::default();
|
143 - | output = crate::protocol_serde::shape_service_exception::de_service_exception_json_err(_response_body, output)
|
144 - | .map_err(crate::operation::create_function::CreateFunctionError::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 - | "TooManyRequestsException" => crate::operation::create_function::CreateFunctionError::TooManyRequestsException({
|
154 - | #[allow(unused_mut)]
|
155 - | let mut tmp = {
|
156 - | #[allow(unused_mut)]
|
157 - | let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
|
158 - | output = crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
|
159 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
160 - | output = output.set_retry_after_seconds(
|
161 - | crate::protocol_serde::shape_too_many_requests_exception::de_retry_after_seconds_header(_response_headers).map_err(|_| {
|
162 - | crate::operation::create_function::CreateFunctionError::unhandled(
|
163 - | "Failed to parse retryAfterSeconds from header `Retry-After",
|
164 - | )
|
165 - | })?,
|
166 - | );
|
167 - | let output = output.meta(generic);
|
168 - | output.build()
|
169 - | };
|
170 - | if tmp.message.is_none() {
|
171 - | tmp.message = _error_message;
|
172 - | }
|
173 - | tmp
|
174 - | }),
|
175 - | _ => crate::operation::create_function::CreateFunctionError::generic(generic),
|
176 - | })
|
177 - | }
|
178 - |
|
179 - | #[allow(clippy::unnecessary_wraps)]
|
180 - | pub fn de_create_function_http_response(
|
181 - | _response_status: u16,
|
182 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
183 - | _response_body: &[u8],
|
184 - | ) -> std::result::Result<crate::operation::create_function::CreateFunctionOutput, crate::operation::create_function::CreateFunctionError> {
|
185 - | Ok({
|
186 - | #[allow(unused_mut)]
|
187 - | let mut output = crate::operation::create_function::builders::CreateFunctionOutputBuilder::default();
|
188 - | output = crate::protocol_serde::shape_create_function::de_create_function(_response_body, output)
|
189 - | .map_err(crate::operation::create_function::CreateFunctionError::unhandled)?;
|
190 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
191 - | output.build()
|
192 - | })
|
193 - | }
|
194 - |
|
195 - | pub fn ser_create_function_input(
|
196 - | input: &crate::operation::create_function::CreateFunctionInput,
|
197 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
198 - | let mut out = String::new();
|
199 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
200 - | crate::protocol_serde::shape_create_function_input::ser_create_function_input_input(&mut object, input)?;
|
201 - | object.finish();
|
202 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
203 - | }
|
204 - |
|
205 - | pub(crate) fn de_create_function(
|
206 - | _value: &[u8],
|
207 - | mut builder: crate::operation::create_function::builders::CreateFunctionOutputBuilder,
|
208 - | ) -> ::std::result::Result<
|
209 - | crate::operation::create_function::builders::CreateFunctionOutputBuilder,
|
210 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
211 - | > {
|
212 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
213 - | let tokens = &mut tokens_owned;
|
214 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
215 - | loop {
|
216 - | match tokens.next().transpose()? {
|
217 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
218 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
219 - | "Architectures" => {
|
220 - | builder = builder.set_architectures(crate::protocol_serde::shape_architectures_list::de_architectures_list(tokens, _value)?);
|
221 - | }
|
222 - | "CodeSha256" => {
|
223 - | builder = builder.set_code_sha256(
|
224 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
225 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
226 - | .transpose()?,
|
227 - | );
|
228 - | }
|
229 - | "CodeSize" => {
|
230 - | builder = builder.set_code_size(
|
231 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
232 - | .map(i64::try_from)
|
233 - | .transpose()?,
|
234 - | );
|
235 - | }
|
236 - | "DeadLetterConfig" => {
|
237 - | builder = builder.set_dead_letter_config(crate::protocol_serde::shape_dead_letter_config::de_dead_letter_config(tokens, _value)?);
|
238 - | }
|
239 - | "Description" => {
|
240 - | builder = builder.set_description(
|
241 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
242 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
243 - | .transpose()?,
|
244 - | );
|
245 - | }
|
246 - | "Environment" => {
|
247 - | builder = builder.set_environment(crate::protocol_serde::shape_environment_response::de_environment_response(
|
248 - | tokens, _value,
|
249 - | )?);
|
250 - | }
|
251 - | "EphemeralStorage" => {
|
252 - | builder = builder.set_ephemeral_storage(crate::protocol_serde::shape_ephemeral_storage::de_ephemeral_storage(tokens, _value)?);
|
253 - | }
|
254 - | "FileSystemConfigs" => {
|
255 - | builder = builder.set_file_system_configs(crate::protocol_serde::shape_file_system_config_list::de_file_system_config_list(
|
256 - | tokens, _value,
|
257 - | )?);
|
258 - | }
|
259 - | "FunctionArn" => {
|
260 - | builder = builder.set_function_arn(
|
261 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
262 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
263 - | .transpose()?,
|
264 - | );
|
265 - | }
|
266 - | "FunctionName" => {
|
267 - | builder = builder.set_function_name(
|
268 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
269 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
270 - | .transpose()?,
|
271 - | );
|
272 - | }
|
273 - | "Handler" => {
|
274 - | builder = builder.set_handler(
|
275 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
276 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
277 - | .transpose()?,
|
278 - | );
|
279 - | }
|
280 - | "ImageConfigResponse" => {
|
281 - | builder = builder.set_image_config_response(crate::protocol_serde::shape_image_config_response::de_image_config_response(
|
282 - | tokens, _value,
|
283 - | )?);
|
284 - | }
|
285 - | "KMSKeyArn" => {
|
286 - | builder = builder.set_kms_key_arn(
|
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 - | "LastModified" => {
|
293 - | builder = builder.set_last_modified(
|
294 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
295 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
296 - | .transpose()?,
|
297 - | );
|
298 - | }
|
299 - | "LastUpdateStatus" => {
|
300 - | builder = builder.set_last_update_status(
|
301 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
302 - | .map(|s| s.to_unescaped().map(|u| crate::types::LastUpdateStatus::from(u.as_ref())))
|
303 - | .transpose()?,
|
304 - | );
|
305 - | }
|
306 - | "LastUpdateStatusReason" => {
|
307 - | builder = builder.set_last_update_status_reason(
|
308 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
309 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
310 - | .transpose()?,
|
311 - | );
|
312 - | }
|
313 - | "LastUpdateStatusReasonCode" => {
|
314 - | builder = builder.set_last_update_status_reason_code(
|
315 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
316 - | .map(|s| s.to_unescaped().map(|u| crate::types::LastUpdateStatusReasonCode::from(u.as_ref())))
|
317 - | .transpose()?,
|
318 - | );
|
319 - | }
|
320 - | "Layers" => {
|
321 - | builder = builder.set_layers(crate::protocol_serde::shape_layers_reference_list::de_layers_reference_list(
|
322 - | tokens, _value,
|
323 - | )?);
|
324 - | }
|
325 - | "LoggingConfig" => {
|
326 - | builder = builder.set_logging_config(crate::protocol_serde::shape_logging_config::de_logging_config(tokens, _value)?);
|
327 - | }
|
328 - | "MasterArn" => {
|
329 - | builder = builder.set_master_arn(
|
330 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
331 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
332 - | .transpose()?,
|
333 - | );
|
334 - | }
|
335 - | "MemorySize" => {
|
336 - | builder = builder.set_memory_size(
|
337 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
338 - | .map(i32::try_from)
|
339 - | .transpose()?,
|
340 - | );
|
341 - | }
|
342 - | "PackageType" => {
|
343 - | builder = builder.set_package_type(
|
344 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
345 - | .map(|s| s.to_unescaped().map(|u| crate::types::PackageType::from(u.as_ref())))
|
346 - | .transpose()?,
|
347 - | );
|
348 - | }
|
349 - | "RevisionId" => {
|
350 - | builder = builder.set_revision_id(
|
351 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
352 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
353 - | .transpose()?,
|
354 - | );
|
355 - | }
|
356 - | "Role" => {
|
357 - | builder = builder.set_role(
|
358 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
359 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
360 - | .transpose()?,
|
361 - | );
|
362 - | }
|
363 - | "Runtime" => {
|
364 - | builder = builder.set_runtime(
|
365 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
366 - | .map(|s| s.to_unescaped().map(|u| crate::types::Runtime::from(u.as_ref())))
|
367 - | .transpose()?,
|
368 - | );
|
369 - | }
|
370 - | "RuntimeVersionConfig" => {
|
371 - | builder = builder.set_runtime_version_config(crate::protocol_serde::shape_runtime_version_config::de_runtime_version_config(
|
372 - | tokens, _value,
|
373 - | )?);
|
374 - | }
|
375 - | "SigningJobArn" => {
|
376 - | builder = builder.set_signing_job_arn(
|
377 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
378 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
379 - | .transpose()?,
|
380 - | );
|
381 - | }
|
382 - | "SigningProfileVersionArn" => {
|
383 - | builder = builder.set_signing_profile_version_arn(
|
384 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
385 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
386 - | .transpose()?,
|
387 - | );
|
388 - | }
|
389 - | "SnapStart" => {
|
390 - | builder = builder.set_snap_start(crate::protocol_serde::shape_snap_start_response::de_snap_start_response(tokens, _value)?);
|
391 - | }
|
392 - | "State" => {
|
393 - | builder = builder.set_state(
|
394 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
395 - | .map(|s| s.to_unescaped().map(|u| crate::types::State::from(u.as_ref())))
|
396 - | .transpose()?,
|
397 - | );
|
398 - | }
|
399 - | "StateReason" => {
|
400 - | builder = builder.set_state_reason(
|
401 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
402 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
403 - | .transpose()?,
|
404 - | );
|
405 - | }
|
406 - | "StateReasonCode" => {
|
407 - | builder = builder.set_state_reason_code(
|
408 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
409 - | .map(|s| s.to_unescaped().map(|u| crate::types::StateReasonCode::from(u.as_ref())))
|
410 - | .transpose()?,
|
411 - | );
|
412 - | }
|
413 - | "Timeout" => {
|
414 - | builder = builder.set_timeout(
|
415 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
416 - | .map(i32::try_from)
|
417 - | .transpose()?,
|
418 - | );
|
419 - | }
|
420 - | "TracingConfig" => {
|
421 - | builder = builder.set_tracing_config(crate::protocol_serde::shape_tracing_config_response::de_tracing_config_response(
|
422 - | tokens, _value,
|
423 - | )?);
|
424 - | }
|
425 - | "Version" => {
|
426 - | builder = builder.set_version(
|
427 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
428 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
429 - | .transpose()?,
|
430 - | );
|
431 - | }
|
432 - | "VpcConfig" => {
|
433 - | builder = builder.set_vpc_config(crate::protocol_serde::shape_vpc_config_response::de_vpc_config_response(tokens, _value)?);
|
434 - | }
|
435 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
436 - | },
|
437 - | other => {
|
438 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
439 - | "expected object key or end object, found: {other:?}"
|
440 - | )))
|
441 - | }
|
442 - | }
|
443 - | }
|
444 - | if tokens.next().is_some() {
|
445 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
446 - | "found more JSON tokens after completing parsing",
|
447 - | ));
|
448 - | }
|
449 - | Ok(builder)
|
450 - | }
|