aws_sdk_datasync/protocol_serde/
shape_update_location_fsx_open_zfs.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_location_fsx_open_zfs_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::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsOutput,
9    crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError,
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::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::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 => {
19            return Err(crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::unhandled(
20                generic,
21            ))
22        }
23    };
24
25    let _error_message = generic.message().map(|msg| msg.to_owned());
26    Err(match error_code {
27        "InternalException" => crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::InternalException({
28            #[allow(unused_mut)]
29            let mut tmp = {
30                #[allow(unused_mut)]
31                let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
32                output = crate::protocol_serde::shape_internal_exception::de_internal_exception_json_err(_response_body, output)
33                    .map_err(crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::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        "InvalidRequestException" => crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::InvalidRequestException({
43            #[allow(unused_mut)]
44            let mut tmp = {
45                #[allow(unused_mut)]
46                let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
47                output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
48                    .map_err(crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::unhandled)?;
49                let output = output.meta(generic);
50                output.build()
51            };
52            if tmp.message.is_none() {
53                tmp.message = _error_message;
54            }
55            tmp
56        }),
57        _ => crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError::generic(generic),
58    })
59}
60
61#[allow(clippy::unnecessary_wraps)]
62pub fn de_update_location_fsx_open_zfs_http_response(
63    _response_status: u16,
64    _response_headers: &::aws_smithy_runtime_api::http::Headers,
65    _response_body: &[u8],
66) -> std::result::Result<
67    crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsOutput,
68    crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsError,
69> {
70    Ok({
71        #[allow(unused_mut)]
72        let mut output = crate::operation::update_location_fsx_open_zfs::builders::UpdateLocationFsxOpenZfsOutputBuilder::default();
73        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
74        output.build()
75    })
76}
77
78pub fn ser_update_location_fsx_open_zfs_input(
79    input: &crate::operation::update_location_fsx_open_zfs::UpdateLocationFsxOpenZfsInput,
80) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
81    let mut out = String::new();
82    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
83    crate::protocol_serde::shape_update_location_fsx_open_zfs_input::ser_update_location_fsx_open_zfs_input_input(&mut object, input)?;
84    object.finish();
85    Ok(::aws_smithy_types::body::SdkBody::from(out))
86}