aws_sdk_sagemaker/protocol_serde/
shape_describe_inference_component.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_inference_component_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::describe_inference_component::DescribeInferenceComponentOutput,
9 crate::operation::describe_inference_component::DescribeInferenceComponentError,
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::describe_inference_component::DescribeInferenceComponentError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 Err(crate::operation::describe_inference_component::DescribeInferenceComponentError::generic(
17 generic,
18 ))
19}
20
21#[allow(clippy::unnecessary_wraps)]
22pub fn de_describe_inference_component_http_response(
23 _response_status: u16,
24 _response_headers: &::aws_smithy_runtime_api::http::Headers,
25 _response_body: &[u8],
26) -> std::result::Result<
27 crate::operation::describe_inference_component::DescribeInferenceComponentOutput,
28 crate::operation::describe_inference_component::DescribeInferenceComponentError,
29> {
30 Ok({
31 #[allow(unused_mut)]
32 let mut output = crate::operation::describe_inference_component::builders::DescribeInferenceComponentOutputBuilder::default();
33 output = crate::protocol_serde::shape_describe_inference_component::de_describe_inference_component(_response_body, output)
34 .map_err(crate::operation::describe_inference_component::DescribeInferenceComponentError::unhandled)?;
35 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
36 crate::serde_util::describe_inference_component_output_output_correct_errors(output).build()
37 })
38}
39
40pub fn ser_describe_inference_component_input(
41 input: &crate::operation::describe_inference_component::DescribeInferenceComponentInput,
42) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
43 let mut out = String::new();
44 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
45 crate::protocol_serde::shape_describe_inference_component_input::ser_describe_inference_component_input_input(&mut object, input)?;
46 object.finish();
47 Ok(::aws_smithy_types::body::SdkBody::from(out))
48}
49
50pub(crate) fn de_describe_inference_component(
51 value: &[u8],
52 mut builder: crate::operation::describe_inference_component::builders::DescribeInferenceComponentOutputBuilder,
53) -> ::std::result::Result<
54 crate::operation::describe_inference_component::builders::DescribeInferenceComponentOutputBuilder,
55 ::aws_smithy_json::deserialize::error::DeserializeError,
56> {
57 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
58 let tokens = &mut tokens_owned;
59 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
60 loop {
61 match tokens.next().transpose()? {
62 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
63 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
64 "InferenceComponentName" => {
65 builder = builder.set_inference_component_name(
66 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
67 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
68 .transpose()?,
69 );
70 }
71 "InferenceComponentArn" => {
72 builder = builder.set_inference_component_arn(
73 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
74 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
75 .transpose()?,
76 );
77 }
78 "EndpointName" => {
79 builder = builder.set_endpoint_name(
80 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
81 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
82 .transpose()?,
83 );
84 }
85 "EndpointArn" => {
86 builder = builder.set_endpoint_arn(
87 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
88 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
89 .transpose()?,
90 );
91 }
92 "VariantName" => {
93 builder = builder.set_variant_name(
94 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
95 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
96 .transpose()?,
97 );
98 }
99 "FailureReason" => {
100 builder = builder.set_failure_reason(
101 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
102 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
103 .transpose()?,
104 );
105 }
106 "Specification" => {
107 builder = builder.set_specification(
108 crate::protocol_serde::shape_inference_component_specification_summary::de_inference_component_specification_summary(tokens)?,
109 );
110 }
111 "RuntimeConfig" => {
112 builder = builder.set_runtime_config(
113 crate::protocol_serde::shape_inference_component_runtime_config_summary::de_inference_component_runtime_config_summary(
114 tokens,
115 )?,
116 );
117 }
118 "CreationTime" => {
119 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
120 tokens.next(),
121 ::aws_smithy_types::date_time::Format::EpochSeconds,
122 )?);
123 }
124 "LastModifiedTime" => {
125 builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
126 tokens.next(),
127 ::aws_smithy_types::date_time::Format::EpochSeconds,
128 )?);
129 }
130 "InferenceComponentStatus" => {
131 builder = builder.set_inference_component_status(
132 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
133 .map(|s| s.to_unescaped().map(|u| crate::types::InferenceComponentStatus::from(u.as_ref())))
134 .transpose()?,
135 );
136 }
137 "LastDeploymentConfig" => {
138 builder = builder.set_last_deployment_config(
139 crate::protocol_serde::shape_inference_component_deployment_config::de_inference_component_deployment_config(tokens)?,
140 );
141 }
142 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
143 },
144 other => {
145 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
146 "expected object key or end object, found: {:?}",
147 other
148 )))
149 }
150 }
151 }
152 if tokens.next().is_some() {
153 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
154 "found more JSON tokens after completing parsing",
155 ));
156 }
157 Ok(builder)
158}