aws_sdk_sagemaker/protocol_serde/
shape_update_notebook_instance_lifecycle_config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_notebook_instance_lifecycle_config_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_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigOutput,
9    crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError,
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_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError::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_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError::unhandled(generic))
20        }
21    };
22
23    let _error_message = generic.message().map(|msg| msg.to_owned());
24    Err(match error_code {
25        "ResourceLimitExceeded" => {
26            crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError::ResourceLimitExceeded({
27                #[allow(unused_mut)]
28                let mut tmp = {
29                    #[allow(unused_mut)]
30                    let mut output = crate::types::error::builders::ResourceLimitExceededBuilder::default();
31                    output = crate::protocol_serde::shape_resource_limit_exceeded::de_resource_limit_exceeded_json_err(_response_body, output)
32                        .map_err(
33                            crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError::unhandled,
34                        )?;
35                    let output = output.meta(generic);
36                    output.build()
37                };
38                if tmp.message.is_none() {
39                    tmp.message = _error_message;
40                }
41                tmp
42            })
43        }
44        _ => crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError::generic(generic),
45    })
46}
47
48#[allow(clippy::unnecessary_wraps)]
49pub fn de_update_notebook_instance_lifecycle_config_http_response(
50    _response_status: u16,
51    _response_headers: &::aws_smithy_runtime_api::http::Headers,
52    _response_body: &[u8],
53) -> std::result::Result<
54    crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigOutput,
55    crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigError,
56> {
57    Ok({
58        #[allow(unused_mut)]
59        let mut output =
60            crate::operation::update_notebook_instance_lifecycle_config::builders::UpdateNotebookInstanceLifecycleConfigOutputBuilder::default();
61        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
62        output.build()
63    })
64}
65
66pub fn ser_update_notebook_instance_lifecycle_config_input(
67    input: &crate::operation::update_notebook_instance_lifecycle_config::UpdateNotebookInstanceLifecycleConfigInput,
68) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
69    let mut out = String::new();
70    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
71    crate::protocol_serde::shape_update_notebook_instance_lifecycle_config_input::ser_update_notebook_instance_lifecycle_config_input_input(
72        &mut object,
73        input,
74    )?;
75    object.finish();
76    Ok(::aws_smithy_types::body::SdkBody::from(out))
77}