1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub fn de_get_async_invoke_http_error(
|
4 + | _response_status: u16,
|
5 + | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 + | _response_body: &[u8],
|
7 + | ) -> std::result::Result<crate::operation::get_async_invoke::GetAsyncInvokeOutput, crate::operation::get_async_invoke::GetAsyncInvokeError> {
|
8 + | #[allow(unused_mut)]
|
9 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
11 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 + | let generic = generic_builder.build();
|
13 + | let error_code = match generic.code() {
|
14 + | Some(code) => code,
|
15 + | None => return Err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled(generic)),
|
16 + | };
|
17 + |
|
18 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 + | Err(match error_code {
|
20 + | "AccessDeniedException" => crate::operation::get_async_invoke::GetAsyncInvokeError::AccessDeniedException({
|
21 + | #[allow(unused_mut)]
|
22 + | let mut tmp = {
|
23 + | #[allow(unused_mut)]
|
24 + | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
25 + | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
26 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
27 + | let output = output.meta(generic);
|
28 + | output.build()
|
29 + | };
|
30 + | if tmp.message.is_none() {
|
31 + | tmp.message = _error_message;
|
32 + | }
|
33 + | tmp
|
34 + | }),
|
35 + | "InternalServerException" => crate::operation::get_async_invoke::GetAsyncInvokeError::InternalServerException({
|
36 + | #[allow(unused_mut)]
|
37 + | let mut tmp = {
|
38 + | #[allow(unused_mut)]
|
39 + | let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
|
40 + | output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
|
41 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
42 + | let output = output.meta(generic);
|
43 + | output.build()
|
44 + | };
|
45 + | if tmp.message.is_none() {
|
46 + | tmp.message = _error_message;
|
47 + | }
|
48 + | tmp
|
49 + | }),
|
50 + | "ThrottlingException" => crate::operation::get_async_invoke::GetAsyncInvokeError::ThrottlingException({
|
51 + | #[allow(unused_mut)]
|
52 + | let mut tmp = {
|
53 + | #[allow(unused_mut)]
|
54 + | let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
|
55 + | output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
|
56 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
57 + | let output = output.meta(generic);
|
58 + | output.build()
|
59 + | };
|
60 + | if tmp.message.is_none() {
|
61 + | tmp.message = _error_message;
|
62 + | }
|
63 + | tmp
|
64 + | }),
|
65 + | "ValidationException" => crate::operation::get_async_invoke::GetAsyncInvokeError::ValidationException({
|
66 + | #[allow(unused_mut)]
|
67 + | let mut tmp = {
|
68 + | #[allow(unused_mut)]
|
69 + | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
70 + | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
71 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
72 + | let output = output.meta(generic);
|
73 + | output.build()
|
74 + | };
|
75 + | if tmp.message.is_none() {
|
76 + | tmp.message = _error_message;
|
77 + | }
|
78 + | tmp
|
79 + | }),
|
80 + | _ => crate::operation::get_async_invoke::GetAsyncInvokeError::generic(generic),
|
81 + | })
|
82 + | }
|
83 + |
|
84 + | #[allow(clippy::unnecessary_wraps)]
|
85 + | pub fn de_get_async_invoke_http_response(
|
86 + | _response_status: u16,
|
87 + | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
88 + | _response_body: &[u8],
|
89 + | ) -> std::result::Result<crate::operation::get_async_invoke::GetAsyncInvokeOutput, crate::operation::get_async_invoke::GetAsyncInvokeError> {
|
90 + | Ok({
|
91 + | #[allow(unused_mut)]
|
92 + | let mut output = crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder::default();
|
93 + | output = crate::protocol_serde::shape_get_async_invoke::de_get_async_invoke(_response_body, output)
|
94 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
|
95 + | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
96 + | crate::serde_util::get_async_invoke_output_output_correct_errors(output)
|
97 + | .build()
|
98 + | .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?
|
99 + | })
|
100 + | }
|
101 + |
|
102 + | pub(crate) fn de_get_async_invoke(
|
103 + | value: &[u8],
|
104 + | mut builder: crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder,
|
105 + | ) -> ::std::result::Result<
|
106 + | crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder,
|
107 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
108 + | > {
|
109 + | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
|
110 + | let tokens = &mut tokens_owned;
|
111 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
112 + | loop {
|
113 + | match tokens.next().transpose()? {
|
114 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
115 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
116 + | "clientRequestToken" => {
|
117 + | builder = builder.set_client_request_token(
|
118 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
119 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
120 + | .transpose()?,
|
121 + | );
|
122 + | }
|
123 + | "endTime" => {
|
124 + | builder = builder.set_end_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
125 + | tokens.next(),
|
126 + | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
127 + | )?);
|
128 + | }
|
129 + | "failureMessage" => {
|
130 + | builder = builder.set_failure_message(
|
131 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
132 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
133 + | .transpose()?,
|
134 + | );
|
135 + | }
|
136 + | "invocationArn" => {
|
137 + | builder = builder.set_invocation_arn(
|
138 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
139 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
140 + | .transpose()?,
|
141 + | );
|
142 + | }
|
143 + | "lastModifiedTime" => {
|
144 + | builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
145 + | tokens.next(),
|
146 + | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
147 + | )?);
|
148 + | }
|
149 + | "modelArn" => {
|
150 + | builder = builder.set_model_arn(
|
151 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
152 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
153 + | .transpose()?,
|
154 + | );
|
155 + | }
|
156 + | "outputDataConfig" => {
|
157 + | builder = builder.set_output_data_config(
|
158 + | crate::protocol_serde::shape_async_invoke_output_data_config::de_async_invoke_output_data_config(tokens)?,
|
159 + | );
|
160 + | }
|
161 + | "status" => {
|
162 + | builder = builder.set_status(
|
163 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
164 + | .map(|s| s.to_unescaped().map(|u| crate::types::AsyncInvokeStatus::from(u.as_ref())))
|
165 + | .transpose()?,
|
166 + | );
|
167 + | }
|
168 + | "submitTime" => {
|
169 + | builder = builder.set_submit_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
170 + | tokens.next(),
|
171 + | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
172 + | )?);
|
173 + | }
|
174 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
175 + | },
|
176 + | other => {
|
177 + | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
178 + | "expected object key or end object, found: {:?}",
|
179 + | other
|
180 + | )))
|
181 + | }
|
182 + | }
|
183 + | }
|
184 + | if tokens.next().is_some() {
|
185 + | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
186 + | "found more JSON tokens after completing parsing",
|
187 + | ));
|
188 + | }
|
189 + | Ok(builder)
|
190 + | }
|