aws_sdk_codepipeline/protocol_serde/
shape_get_third_party_job_details.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_third_party_job_details_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::get_third_party_job_details::GetThirdPartyJobDetailsOutput,
9 crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError,
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::get_third_party_job_details::GetThirdPartyJobDetailsError::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::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled(
20 generic,
21 ))
22 }
23 };
24
25 let _error_message = generic.message().map(|msg| msg.to_owned());
26 Err(match error_code {
27 "InvalidClientTokenException" => crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::InvalidClientTokenException({
28 #[allow(unused_mut)]
29 let mut tmp = {
30 #[allow(unused_mut)]
31 let mut output = crate::types::error::builders::InvalidClientTokenExceptionBuilder::default();
32 output =
33 crate::protocol_serde::shape_invalid_client_token_exception::de_invalid_client_token_exception_json_err(_response_body, output)
34 .map_err(crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled)?;
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 "InvalidJobException" => crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::InvalidJobException({
44 #[allow(unused_mut)]
45 let mut tmp = {
46 #[allow(unused_mut)]
47 let mut output = crate::types::error::builders::InvalidJobExceptionBuilder::default();
48 output = crate::protocol_serde::shape_invalid_job_exception::de_invalid_job_exception_json_err(_response_body, output)
49 .map_err(crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled)?;
50 let output = output.meta(generic);
51 output.build()
52 };
53 if tmp.message.is_none() {
54 tmp.message = _error_message;
55 }
56 tmp
57 }),
58 "JobNotFoundException" => crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::JobNotFoundException({
59 #[allow(unused_mut)]
60 let mut tmp = {
61 #[allow(unused_mut)]
62 let mut output = crate::types::error::builders::JobNotFoundExceptionBuilder::default();
63 output = crate::protocol_serde::shape_job_not_found_exception::de_job_not_found_exception_json_err(_response_body, output)
64 .map_err(crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled)?;
65 let output = output.meta(generic);
66 output.build()
67 };
68 if tmp.message.is_none() {
69 tmp.message = _error_message;
70 }
71 tmp
72 }),
73 "ValidationException" => crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::ValidationException({
74 #[allow(unused_mut)]
75 let mut tmp = {
76 #[allow(unused_mut)]
77 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
78 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
79 .map_err(crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled)?;
80 let output = output.meta(generic);
81 output.build()
82 };
83 if tmp.message.is_none() {
84 tmp.message = _error_message;
85 }
86 tmp
87 }),
88 _ => crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::generic(generic),
89 })
90}
91
92#[allow(clippy::unnecessary_wraps)]
93pub fn de_get_third_party_job_details_http_response(
94 _response_status: u16,
95 _response_headers: &::aws_smithy_runtime_api::http::Headers,
96 _response_body: &[u8],
97) -> std::result::Result<
98 crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsOutput,
99 crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError,
100> {
101 Ok({
102 #[allow(unused_mut)]
103 let mut output = crate::operation::get_third_party_job_details::builders::GetThirdPartyJobDetailsOutputBuilder::default();
104 output = crate::protocol_serde::shape_get_third_party_job_details::de_get_third_party_job_details(_response_body, output)
105 .map_err(crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsError::unhandled)?;
106 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
107 output.build()
108 })
109}
110
111pub fn ser_get_third_party_job_details_input(
112 input: &crate::operation::get_third_party_job_details::GetThirdPartyJobDetailsInput,
113) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
114 let mut out = String::new();
115 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
116 crate::protocol_serde::shape_get_third_party_job_details_input::ser_get_third_party_job_details_input_input(&mut object, input)?;
117 object.finish();
118 Ok(::aws_smithy_types::body::SdkBody::from(out))
119}
120
121pub(crate) fn de_get_third_party_job_details(
122 value: &[u8],
123 mut builder: crate::operation::get_third_party_job_details::builders::GetThirdPartyJobDetailsOutputBuilder,
124) -> ::std::result::Result<
125 crate::operation::get_third_party_job_details::builders::GetThirdPartyJobDetailsOutputBuilder,
126 ::aws_smithy_json::deserialize::error::DeserializeError,
127> {
128 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
129 let tokens = &mut tokens_owned;
130 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
131 loop {
132 match tokens.next().transpose()? {
133 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
134 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
135 "jobDetails" => {
136 builder = builder.set_job_details(crate::protocol_serde::shape_third_party_job_details::de_third_party_job_details(tokens)?);
137 }
138 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
139 },
140 other => {
141 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
142 "expected object key or end object, found: {:?}",
143 other
144 )))
145 }
146 }
147 }
148 if tokens.next().is_some() {
149 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
150 "found more JSON tokens after completing parsing",
151 ));
152 }
153 Ok(builder)
154}