1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_parts_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::list_parts::ListPartsOutput, crate::operation::list_parts::ListPartsError> {
|
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::list_parts::ListPartsError::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::list_parts::ListPartsError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidParameterValueException" => crate::operation::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::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::list_parts::ListPartsError::generic(generic),
|
88 - | })
|
89 - | }
|
90 - |
|
91 - | #[allow(clippy::unnecessary_wraps)]
|
92 - | pub fn de_list_parts_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::list_parts::ListPartsOutput, crate::operation::list_parts::ListPartsError> {
|
97 - | Ok({
|
98 - | #[allow(unused_mut)]
|
99 - | let mut output = crate::operation::list_parts::builders::ListPartsOutputBuilder::default();
|
100 - | output = crate::protocol_serde::shape_list_parts::de_list_parts(_response_body, output)
|
101 - | .map_err(crate::operation::list_parts::ListPartsError::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_list_parts(
|
108 - | _value: &[u8],
|
109 - | mut builder: crate::operation::list_parts::builders::ListPartsOutputBuilder,
|
110 - | ) -> ::std::result::Result<crate::operation::list_parts::builders::ListPartsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
|
111 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
112 - | let tokens = &mut tokens_owned;
|
113 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
114 - | loop {
|
115 - | match tokens.next().transpose()? {
|
116 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
117 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
118 - | "ArchiveDescription" => {
|
119 - | builder = builder.set_archive_description(
|
120 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
121 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
122 - | .transpose()?,
|
123 - | );
|
124 - | }
|
125 - | "CreationDate" => {
|
126 - | builder = builder.set_creation_date(
|
127 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
128 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
129 - | .transpose()?,
|
130 - | );
|
131 - | }
|
132 - | "Marker" => {
|
133 - | builder = builder.set_marker(
|
134 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
135 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
136 - | .transpose()?,
|
137 - | );
|
138 - | }
|
139 - | "MultipartUploadId" => {
|
140 - | builder = builder.set_multipart_upload_id(
|
141 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
142 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
143 - | .transpose()?,
|
144 - | );
|
145 - | }
|
146 - | "PartSizeInBytes" => {
|
147 - | builder = builder.set_part_size_in_bytes(
|
148 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
149 - | .map(i64::try_from)
|
150 - | .transpose()?,
|
151 - | );
|
152 - | }
|
153 - | "Parts" => {
|
154 - | builder = builder.set_parts(crate::protocol_serde::shape_part_list::de_part_list(tokens, _value)?);
|
155 - | }
|
156 - | "VaultARN" => {
|
157 - | builder = builder.set_vault_arn(
|
158 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
159 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
160 - | .transpose()?,
|
161 - | );
|
162 - | }
|
163 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
164 - | },
|
165 - | other => {
|
166 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
167 - | "expected object key or end object, found: {other:?}"
|
168 - | )))
|
169 - | }
|
170 - | }
|
171 - | }
|
172 - | if tokens.next().is_some() {
|
173 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
174 - | "found more JSON tokens after completing parsing",
|
175 - | ));
|
176 - | }
|
177 - | Ok(builder)
|
178 - | }
|