aws_sdk_sagemaker/protocol_serde/
shape_send_pipeline_execution_step_success.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_send_pipeline_execution_step_success_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::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessOutput,
9 crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError,
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::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::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::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "ConflictException" => crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::ConflictException({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
28 output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
29 .map_err(crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::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 "ResourceLimitExceeded" => {
39 crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::ResourceLimitExceeded({
40 #[allow(unused_mut)]
41 let mut tmp = {
42 #[allow(unused_mut)]
43 let mut output = crate::types::error::builders::ResourceLimitExceededBuilder::default();
44 output = crate::protocol_serde::shape_resource_limit_exceeded::de_resource_limit_exceeded_json_err(_response_body, output)
45 .map_err(crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::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 }
55 "ResourceNotFound" => crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::ResourceNotFound({
56 #[allow(unused_mut)]
57 let mut tmp = {
58 #[allow(unused_mut)]
59 let mut output = crate::types::error::builders::ResourceNotFoundBuilder::default();
60 output = crate::protocol_serde::shape_resource_not_found::de_resource_not_found_json_err(_response_body, output)
61 .map_err(crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::unhandled)?;
62 let output = output.meta(generic);
63 output.build()
64 };
65 if tmp.message.is_none() {
66 tmp.message = _error_message;
67 }
68 tmp
69 }),
70 _ => crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::generic(generic),
71 })
72}
73
74#[allow(clippy::unnecessary_wraps)]
75pub fn de_send_pipeline_execution_step_success_http_response(
76 _response_status: u16,
77 _response_headers: &::aws_smithy_runtime_api::http::Headers,
78 _response_body: &[u8],
79) -> std::result::Result<
80 crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessOutput,
81 crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError,
82> {
83 Ok({
84 #[allow(unused_mut)]
85 let mut output = crate::operation::send_pipeline_execution_step_success::builders::SendPipelineExecutionStepSuccessOutputBuilder::default();
86 output = crate::protocol_serde::shape_send_pipeline_execution_step_success::de_send_pipeline_execution_step_success(_response_body, output)
87 .map_err(crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessError::unhandled)?;
88 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
89 output.build()
90 })
91}
92
93pub fn ser_send_pipeline_execution_step_success_input(
94 input: &crate::operation::send_pipeline_execution_step_success::SendPipelineExecutionStepSuccessInput,
95) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
96 let mut out = String::new();
97 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
98 crate::protocol_serde::shape_send_pipeline_execution_step_success_input::ser_send_pipeline_execution_step_success_input_input(
99 &mut object,
100 input,
101 )?;
102 object.finish();
103 Ok(::aws_smithy_types::body::SdkBody::from(out))
104}
105
106pub(crate) fn de_send_pipeline_execution_step_success(
107 value: &[u8],
108 mut builder: crate::operation::send_pipeline_execution_step_success::builders::SendPipelineExecutionStepSuccessOutputBuilder,
109) -> ::std::result::Result<
110 crate::operation::send_pipeline_execution_step_success::builders::SendPipelineExecutionStepSuccessOutputBuilder,
111 ::aws_smithy_json::deserialize::error::DeserializeError,
112> {
113 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
114 let tokens = &mut tokens_owned;
115 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
116 loop {
117 match tokens.next().transpose()? {
118 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
119 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
120 "PipelineExecutionArn" => {
121 builder = builder.set_pipeline_execution_arn(
122 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
123 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
124 .transpose()?,
125 );
126 }
127 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
128 },
129 other => {
130 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
131 "expected object key or end object, found: {:?}",
132 other
133 )))
134 }
135 }
136 }
137 if tokens.next().is_some() {
138 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
139 "found more JSON tokens after completing parsing",
140 ));
141 }
142 Ok(builder)
143}