1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_describe_job_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::describe_job::DescribeJobOutput, crate::operation::describe_job::DescribeJobError> {
|
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::describe_job::DescribeJobError::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::describe_job::DescribeJobError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidParameterValueException" => crate::operation::describe_job::DescribeJobError::InvalidParameterValueException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
|
26 - | _response_body,
|
27 - | output,
|
28 - | )
|
29 - | .map_err(crate::operation::describe_job::DescribeJobError::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 - | "MissingParameterValueException" => crate::operation::describe_job::DescribeJobError::MissingParameterValueException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::MissingParameterValueExceptionBuilder::default();
|
43 - | output = crate::protocol_serde::shape_missing_parameter_value_exception::de_missing_parameter_value_exception_json_err(
|
44 - | _response_body,
|
45 - | output,
|
46 - | )
|
47 - | .map_err(crate::operation::describe_job::DescribeJobError::unhandled)?;
|
48 - | let output = output.meta(generic);
|
49 - | output.build()
|
50 - | };
|
51 - | if tmp.message.is_none() {
|
52 - | tmp.message = _error_message;
|
53 - | }
|
54 - | tmp
|
55 - | }),
|
56 - | "ResourceNotFoundException" => crate::operation::describe_job::DescribeJobError::ResourceNotFoundException({
|
57 - | #[allow(unused_mut)]
|
58 - | let mut tmp = {
|
59 - | #[allow(unused_mut)]
|
60 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
61 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
62 - | .map_err(crate::operation::describe_job::DescribeJobError::unhandled)?;
|
63 - | let output = output.meta(generic);
|
64 - | output.build()
|
65 - | };
|
66 - | if tmp.message.is_none() {
|
67 - | tmp.message = _error_message;
|
68 - | }
|
69 - | tmp
|
70 - | }),
|
71 - | "ServiceUnavailableException" => crate::operation::describe_job::DescribeJobError::ServiceUnavailableException({
|
72 - | #[allow(unused_mut)]
|
73 - | let mut tmp = {
|
74 - | #[allow(unused_mut)]
|
75 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
76 - | output =
|
77 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
78 - | .map_err(crate::operation::describe_job::DescribeJobError::unhandled)?;
|
79 - | let output = output.meta(generic);
|
80 - | output.build()
|
81 - | };
|
82 - | if tmp.message.is_none() {
|
83 - | tmp.message = _error_message;
|
84 - | }
|
85 - | tmp
|
86 - | }),
|
87 - | _ => crate::operation::describe_job::DescribeJobError::generic(generic),
|
88 - | })
|
89 - | }
|
90 - |
|
91 - | #[allow(clippy::unnecessary_wraps)]
|
92 - | pub fn de_describe_job_http_response(
|
93 - | _response_status: u16,
|
94 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
95 - | _response_body: &[u8],
|
96 - | ) -> std::result::Result<crate::operation::describe_job::DescribeJobOutput, crate::operation::describe_job::DescribeJobError> {
|
97 - | Ok({
|
98 - | #[allow(unused_mut)]
|
99 - | let mut output = crate::operation::describe_job::builders::DescribeJobOutputBuilder::default();
|
100 - | output = crate::protocol_serde::shape_describe_job::de_describe_job(_response_body, output)
|
101 - | .map_err(crate::operation::describe_job::DescribeJobError::unhandled)?;
|
102 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
103 - | output.build()
|
104 - | })
|
105 - | }
|
106 - |
|
107 - | pub(crate) fn de_describe_job(
|
108 - | _value: &[u8],
|
109 - | mut builder: crate::operation::describe_job::builders::DescribeJobOutputBuilder,
|
110 - | ) -> ::std::result::Result<crate::operation::describe_job::builders::DescribeJobOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
|
111 - | {
|
112 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
113 - | let tokens = &mut tokens_owned;
|
114 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
115 - | loop {
|
116 - | match tokens.next().transpose()? {
|
117 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
118 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
119 - | "Action" => {
|
120 - | builder = builder.set_action(
|
121 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
122 - | .map(|s| s.to_unescaped().map(|u| crate::types::ActionCode::from(u.as_ref())))
|
123 - | .transpose()?,
|
124 - | );
|
125 - | }
|
126 - | "ArchiveId" => {
|
127 - | builder = builder.set_archive_id(
|
128 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
129 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
130 - | .transpose()?,
|
131 - | );
|
132 - | }
|
133 - | "ArchiveSHA256TreeHash" => {
|
134 - | builder = builder.set_archive_sha256_tree_hash(
|
135 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
136 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
137 - | .transpose()?,
|
138 - | );
|
139 - | }
|
140 - | "ArchiveSizeInBytes" => {
|
141 - | builder = builder.set_archive_size_in_bytes(
|
142 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
143 - | .map(i64::try_from)
|
144 - | .transpose()?,
|
145 - | );
|
146 - | }
|
147 - | "Completed" => {
|
148 - | builder = builder.set_completed(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
149 - | }
|
150 - | "CompletionDate" => {
|
151 - | builder = builder.set_completion_date(
|
152 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
153 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
154 - | .transpose()?,
|
155 - | );
|
156 - | }
|
157 - | "CreationDate" => {
|
158 - | builder = builder.set_creation_date(
|
159 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
160 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
161 - | .transpose()?,
|
162 - | );
|
163 - | }
|
164 - | "InventoryRetrievalParameters" => {
|
165 - | builder = builder.set_inventory_retrieval_parameters(
|
166 - | crate::protocol_serde::shape_inventory_retrieval_job_description::de_inventory_retrieval_job_description(tokens, _value)?,
|
167 - | );
|
168 - | }
|
169 - | "InventorySizeInBytes" => {
|
170 - | builder = builder.set_inventory_size_in_bytes(
|
171 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
172 - | .map(i64::try_from)
|
173 - | .transpose()?,
|
174 - | );
|
175 - | }
|
176 - | "JobDescription" => {
|
177 - | builder = builder.set_job_description(
|
178 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
179 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
180 - | .transpose()?,
|
181 - | );
|
182 - | }
|
183 - | "JobId" => {
|
184 - | builder = builder.set_job_id(
|
185 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
186 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
187 - | .transpose()?,
|
188 - | );
|
189 - | }
|
190 - | "JobOutputPath" => {
|
191 - | builder = builder.set_job_output_path(
|
192 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
193 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
194 - | .transpose()?,
|
195 - | );
|
196 - | }
|
197 - | "OutputLocation" => {
|
198 - | builder = builder.set_output_location(crate::protocol_serde::shape_output_location::de_output_location(tokens, _value)?);
|
199 - | }
|
200 - | "RetrievalByteRange" => {
|
201 - | builder = builder.set_retrieval_byte_range(
|
202 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
203 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
204 - | .transpose()?,
|
205 - | );
|
206 - | }
|
207 - | "SHA256TreeHash" => {
|
208 - | builder = builder.set_sha256_tree_hash(
|
209 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
210 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
211 - | .transpose()?,
|
212 - | );
|
213 - | }
|
214 - | "SNSTopic" => {
|
215 - | builder = builder.set_sns_topic(
|
216 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
217 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
218 - | .transpose()?,
|
219 - | );
|
220 - | }
|
221 - | "SelectParameters" => {
|
222 - | builder = builder.set_select_parameters(crate::protocol_serde::shape_select_parameters::de_select_parameters(tokens, _value)?);
|
223 - | }
|
224 - | "StatusCode" => {
|
225 - | builder = builder.set_status_code(
|
226 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
227 - | .map(|s| s.to_unescaped().map(|u| crate::types::StatusCode::from(u.as_ref())))
|
228 - | .transpose()?,
|
229 - | );
|
230 - | }
|
231 - | "StatusMessage" => {
|
232 - | builder = builder.set_status_message(
|
233 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
234 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
235 - | .transpose()?,
|
236 - | );
|
237 - | }
|
238 - | "Tier" => {
|
239 - | builder = builder.set_tier(
|
240 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
241 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
242 - | .transpose()?,
|
243 - | );
|
244 - | }
|
245 - | "VaultARN" => {
|
246 - | builder = builder.set_vault_arn(
|
247 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
248 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
249 - | .transpose()?,
|
250 - | );
|
251 - | }
|
252 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
253 - | },
|
254 - | other => {
|
255 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
256 - | "expected object key or end object, found: {other:?}"
|
257 - | )))
|
258 - | }
|
259 - | }
|
260 - | }
|
261 - | if tokens.next().is_some() {
|
262 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
263 - | "found more JSON tokens after completing parsing",
|
264 - | ));
|
265 - | }
|
266 - | Ok(builder)
|
267 - | }
|