1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub async fn de_constrained_http_bound_shapes_operation_http_request<B>(
|
4 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 + | ) -> std::result::Result<
|
6 + | crate::input::ConstrainedHttpBoundShapesOperationInput,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 + | >
|
9 + | where
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 + | B::Data: Send,
|
12 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
14 + | {
|
15 + | Ok({
|
16 + | #[allow(unused_mut)]
|
17 + | let mut input =
|
18 + | crate::input::constrained_http_bound_shapes_operation_input_internal::Builder::default(
|
19 + | );
|
20 + | #[allow(unused_variables)]
|
21 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
22 + | uri, headers, body, ..
|
23 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
24 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_list_pattern_string_header_header(&headers)? {
|
25 + | input = input.set_length_list_pattern_string_header(Some(value))
|
26 + | }
|
27 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_set_pattern_string_header_header(&headers)? {
|
28 + | input = input.set_length_set_pattern_string_header(Some(value))
|
29 + | }
|
30 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_header_header(&headers)? {
|
31 + | input = input.set_length_string_header(Some(value))
|
32 + | }
|
33 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_header_map_prefix_header(&headers)? {
|
34 + | input = input.set_length_string_header_map(value)
|
35 + | }
|
36 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_set_header_header(&headers)? {
|
37 + | input = input.set_length_string_set_header(Some(value))
|
38 + | }
|
39 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_list_length_string_header_header(&headers)? {
|
40 + | input = input.set_list_length_string_header(Some(value))
|
41 + | }
|
42 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_byte_header_header(&headers)? {
|
43 + | input = input.set_range_byte_header(value)
|
44 + | }
|
45 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_byte_list_header_header(&headers)? {
|
46 + | input = input.set_range_byte_list_header(Some(value))
|
47 + | }
|
48 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_byte_set_header_header(&headers)? {
|
49 + | input = input.set_range_byte_set_header(Some(value))
|
50 + | }
|
51 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_integer_header_header(&headers)? {
|
52 + | input = input.set_range_integer_header(value)
|
53 + | }
|
54 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_integer_list_header_header(&headers)? {
|
55 + | input = input.set_range_integer_list_header(Some(value))
|
56 + | }
|
57 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_integer_set_header_header(&headers)? {
|
58 + | input = input.set_range_integer_set_header(Some(value))
|
59 + | }
|
60 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_long_header_header(&headers)? {
|
61 + | input = input.set_range_long_header(value)
|
62 + | }
|
63 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_long_list_header_header(&headers)? {
|
64 + | input = input.set_range_long_list_header(Some(value))
|
65 + | }
|
66 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_long_set_header_header(&headers)? {
|
67 + | input = input.set_range_long_set_header(Some(value))
|
68 + | }
|
69 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_short_header_header(&headers)? {
|
70 + | input = input.set_range_short_header(value)
|
71 + | }
|
72 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_short_list_header_header(&headers)? {
|
73 + | input = input.set_range_short_list_header(Some(value))
|
74 + | }
|
75 + | if let Some(value) = crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_short_set_header_header(&headers)? {
|
76 + | input = input.set_range_short_set_header(Some(value))
|
77 + | }
|
78 + | let input_string = uri.path();
|
79 + | let (input_string, (_, m1, m2, m3, m4, m5, m6)) =
|
80 + | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
81 + | ::nom::sequence::preceded(
|
82 + | ::nom::bytes::complete::tag("/"),
|
83 + | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
84 + | "constrained-http-bound-shapes-operation",
|
85 + | ),
|
86 + | ),
|
87 + | ::nom::sequence::preceded(
|
88 + | ::nom::bytes::complete::tag("/"),
|
89 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
90 + | ::nom::bytes::complete::take_until("/"),
|
91 + | ::nom::combinator::rest,
|
92 + | )),
|
93 + | ),
|
94 + | ::nom::sequence::preceded(
|
95 + | ::nom::bytes::complete::tag("/"),
|
96 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
97 + | ::nom::bytes::complete::take_until("/"),
|
98 + | ::nom::combinator::rest,
|
99 + | )),
|
100 + | ),
|
101 + | ::nom::sequence::preceded(
|
102 + | ::nom::bytes::complete::tag("/"),
|
103 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
104 + | ::nom::bytes::complete::take_until("/"),
|
105 + | ::nom::combinator::rest,
|
106 + | )),
|
107 + | ),
|
108 + | ::nom::sequence::preceded(
|
109 + | ::nom::bytes::complete::tag("/"),
|
110 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
111 + | ::nom::bytes::complete::take_until("/"),
|
112 + | ::nom::combinator::rest,
|
113 + | )),
|
114 + | ),
|
115 + | ::nom::sequence::preceded(
|
116 + | ::nom::bytes::complete::tag("/"),
|
117 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
118 + | ::nom::bytes::complete::take_until("/"),
|
119 + | ::nom::combinator::rest,
|
120 + | )),
|
121 + | ),
|
122 + | ::nom::sequence::preceded(
|
123 + | ::nom::bytes::complete::tag("/"),
|
124 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
125 + | ::nom::bytes::complete::take_until("/"),
|
126 + | ::nom::combinator::rest,
|
127 + | )),
|
128 + | ),
|
129 + | ))(input_string)?;
|
130 + | debug_assert_eq!("", input_string);
|
131 + | input = input.set_range_integer_label(
|
132 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_integer_label(m1)?
|
133 + | );
|
134 + | input = input.set_range_short_label(
|
135 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_short_label(m2)?
|
136 + | );
|
137 + | input = input.set_range_long_label(
|
138 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_long_label(m3)?
|
139 + | );
|
140 + | input = input.set_range_byte_label(
|
141 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_byte_label(m4)?
|
142 + | );
|
143 + | input = input.set_length_string_label(
|
144 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_label(m5)?
|
145 + | );
|
146 + | input = input.set_enum_string_label(
|
147 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_enum_string_label(m6)?
|
148 + | );
|
149 + | let query_string = uri.query().unwrap_or("");
|
150 + | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
151 + | let mut enum_string_query_seen = false;
|
152 + | let mut length_string_query_seen = false;
|
153 + | let mut range_byte_query_seen = false;
|
154 + | let mut range_integer_query_seen = false;
|
155 + | let mut range_long_query_seen = false;
|
156 + | let mut range_short_query_seen = false;
|
157 + | let mut enum_string_list_query = Vec::new();
|
158 + | let mut length_list_pattern_string_query = Vec::new();
|
159 + | let mut length_string_list_query = Vec::new();
|
160 + | let mut length_string_set_query = Vec::new();
|
161 + | let mut range_byte_list_query = Vec::new();
|
162 + | let mut range_byte_set_query = Vec::new();
|
163 + | let mut range_integer_list_query = Vec::new();
|
164 + | let mut range_integer_set_query = Vec::new();
|
165 + | let mut range_long_list_query = Vec::new();
|
166 + | let mut range_long_set_query = Vec::new();
|
167 + | let mut range_short_list_query = Vec::new();
|
168 + | let mut range_short_set_query = Vec::new();
|
169 + | for (k, v) in pairs {
|
170 + | if !enum_string_query_seen && k == "enumString" {
|
171 + | input = input.set_enum_string_query(
|
172 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_enum_string_query(&v)?
|
173 + | );
|
174 + | enum_string_query_seen = true;
|
175 + | }
|
176 + | if !length_string_query_seen && k == "lengthString" {
|
177 + | input = input.set_length_string_query(
|
178 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_query(&v)?
|
179 + | );
|
180 + | length_string_query_seen = true;
|
181 + | }
|
182 + | if !range_byte_query_seen && k == "rangeByte" {
|
183 + | input = input.set_range_byte_query(
|
184 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_byte_query(&v)?
|
185 + | );
|
186 + | range_byte_query_seen = true;
|
187 + | }
|
188 + | if !range_integer_query_seen && k == "rangeInteger" {
|
189 + | input = input.set_range_integer_query(
|
190 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_integer_query(&v)?
|
191 + | );
|
192 + | range_integer_query_seen = true;
|
193 + | }
|
194 + | if !range_long_query_seen && k == "rangeLong" {
|
195 + | input = input.set_range_long_query(
|
196 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_long_query(&v)?
|
197 + | );
|
198 + | range_long_query_seen = true;
|
199 + | }
|
200 + | if !range_short_query_seen && k == "rangeShort" {
|
201 + | input = input.set_range_short_query(
|
202 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_range_short_query(&v)?
|
203 + | );
|
204 + | range_short_query_seen = true;
|
205 + | }
|
206 + | if k == "enumStringList" {
|
207 + | let v = v.into_owned();
|
208 + | enum_string_list_query.push(v);
|
209 + | } else if k == "lengthListPatternString" {
|
210 + | let v = v.into_owned();
|
211 + | length_list_pattern_string_query.push(v);
|
212 + | } else if k == "lengthStringList" {
|
213 + | let v = v.into_owned();
|
214 + | length_string_list_query.push(v);
|
215 + | } else if k == "lengthStringSet" {
|
216 + | let v = v.into_owned();
|
217 + | length_string_set_query.push(v);
|
218 + | } else if k == "rangeByteList" {
|
219 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
220 + | range_byte_list_query.push(v);
|
221 + | } else if k == "rangeByteSet" {
|
222 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
223 + | range_byte_set_query.push(v);
|
224 + | } else if k == "rangeIntegerList" {
|
225 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
226 + | range_integer_list_query.push(v);
|
227 + | } else if k == "rangeIntegerSet" {
|
228 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
229 + | range_integer_set_query.push(v);
|
230 + | } else if k == "rangeLongList" {
|
231 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
232 + | range_long_list_query.push(v);
|
233 + | } else if k == "rangeLongSet" {
|
234 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
235 + | range_long_set_query.push(v);
|
236 + | } else if k == "rangeShortList" {
|
237 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
238 + | range_short_list_query.push(v);
|
239 + | } else if k == "rangeShortSet" {
|
240 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
241 + | range_short_set_query.push(v);
|
242 + | }
|
243 + | }
|
244 + | if !enum_string_list_query.is_empty() {
|
245 + | input = input.set_enum_string_list_query(
|
246 + | Some(
|
247 + | crate::unconstrained::list_of_enum_string_unconstrained::ListOfEnumStringUnconstrained(
|
248 + | enum_string_list_query
|
249 + | )
|
250 + | )
|
251 + | );
|
252 + | }
|
253 + | if !length_list_pattern_string_query.is_empty() {
|
254 + | input = input.set_length_list_pattern_string_query(
|
255 + | Some(
|
256 + | crate::unconstrained::length_list_of_pattern_string_unconstrained::LengthListOfPatternStringUnconstrained(
|
257 + | length_list_pattern_string_query
|
258 + | )
|
259 + | )
|
260 + | );
|
261 + | }
|
262 + | if !length_string_list_query.is_empty() {
|
263 + | input = input.set_length_string_list_query(
|
264 + | Some(
|
265 + | crate::unconstrained::list_of_length_string_unconstrained::ListOfLengthStringUnconstrained(
|
266 + | length_string_list_query
|
267 + | )
|
268 + | )
|
269 + | );
|
270 + | }
|
271 + | if !length_string_set_query.is_empty() {
|
272 + | input = input.set_length_string_set_query(
|
273 + | Some(
|
274 + | crate::unconstrained::set_of_length_string_unconstrained::SetOfLengthStringUnconstrained(
|
275 + | length_string_set_query
|
276 + | )
|
277 + | )
|
278 + | );
|
279 + | }
|
280 + | if !range_byte_list_query.is_empty() {
|
281 + | input = input.set_range_byte_list_query(
|
282 + | Some(
|
283 + | crate::unconstrained::list_of_range_byte_unconstrained::ListOfRangeByteUnconstrained(
|
284 + | range_byte_list_query
|
285 + | )
|
286 + | )
|
287 + | );
|
288 + | }
|
289 + | if !range_byte_set_query.is_empty() {
|
290 + | input = input.set_range_byte_set_query(Some(
|
291 + | crate::unconstrained::set_of_range_byte_unconstrained::SetOfRangeByteUnconstrained(
|
292 + | range_byte_set_query,
|
293 + | ),
|
294 + | ));
|
295 + | }
|
296 + | if !range_integer_list_query.is_empty() {
|
297 + | input = input.set_range_integer_list_query(
|
298 + | Some(
|
299 + | crate::unconstrained::list_of_range_integer_unconstrained::ListOfRangeIntegerUnconstrained(
|
300 + | range_integer_list_query
|
301 + | )
|
302 + | )
|
303 + | );
|
304 + | }
|
305 + | if !range_integer_set_query.is_empty() {
|
306 + | input = input.set_range_integer_set_query(
|
307 + | Some(
|
308 + | crate::unconstrained::set_of_range_integer_unconstrained::SetOfRangeIntegerUnconstrained(
|
309 + | range_integer_set_query
|
310 + | )
|
311 + | )
|
312 + | );
|
313 + | }
|
314 + | if !range_long_list_query.is_empty() {
|
315 + | input = input.set_range_long_list_query(
|
316 + | Some(
|
317 + | crate::unconstrained::list_of_range_long_unconstrained::ListOfRangeLongUnconstrained(
|
318 + | range_long_list_query
|
319 + | )
|
320 + | )
|
321 + | );
|
322 + | }
|
323 + | if !range_long_set_query.is_empty() {
|
324 + | input = input.set_range_long_set_query(Some(
|
325 + | crate::unconstrained::set_of_range_long_unconstrained::SetOfRangeLongUnconstrained(
|
326 + | range_long_set_query,
|
327 + | ),
|
328 + | ));
|
329 + | }
|
330 + | if !range_short_list_query.is_empty() {
|
331 + | input = input.set_range_short_list_query(
|
332 + | Some(
|
333 + | crate::unconstrained::list_of_range_short_unconstrained::ListOfRangeShortUnconstrained(
|
334 + | range_short_list_query
|
335 + | )
|
336 + | )
|
337 + | );
|
338 + | }
|
339 + | if !range_short_set_query.is_empty() {
|
340 + | input = input.set_range_short_set_query(
|
341 + | Some(
|
342 + | crate::unconstrained::set_of_range_short_unconstrained::SetOfRangeShortUnconstrained(
|
343 + | range_short_set_query
|
344 + | )
|
345 + | )
|
346 + | );
|
347 + | }
|
348 + | input.build()?
|
349 + | })
|
350 + | }
|
351 + |
|
352 + | #[allow(clippy::unnecessary_wraps)]
|
353 + | pub fn ser_constrained_http_bound_shapes_operation_http_response(
|
354 + | #[allow(unused_variables)] output: crate::output::ConstrainedHttpBoundShapesOperationOutput,
|
355 + | ) -> std::result::Result<
|
356 + | ::aws_smithy_legacy_http_server::response::Response,
|
357 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
358 + | > {
|
359 + | Ok({
|
360 + | #[allow(unused_mut)]
|
361 + | let mut builder = ::http::Response::builder();
|
362 + | builder = crate::protocol_serde::shape_constrained_http_bound_shapes_operation::ser_constrained_http_bound_shapes_operation_headers(&output, builder)?;
|
363 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
364 + | builder,
|
365 + | ::http::header::CONTENT_TYPE,
|
366 + | "application/json",
|
367 + | );
|
368 + | let http_status: u16 = 200;
|
369 + | builder = builder.status(http_status);
|
370 + | let payload =
|
371 + | crate::protocol_serde::shape_constrained_http_bound_shapes_operation_output::ser_constrained_http_bound_shapes_operation_output_output_output(&output)?
|
372 + | ;
|
373 + | let content_length = payload.len();
|
374 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
375 + | builder,
|
376 + | ::http::header::CONTENT_LENGTH,
|
377 + | content_length,
|
378 + | );
|
379 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
380 + | builder.body(body)?
|
381 + | })
|
382 + | }
|
383 + |
|
384 + | #[allow(clippy::unnecessary_wraps)]
|
385 + | pub fn ser_constrained_http_bound_shapes_operation_http_error(
|
386 + | error: &crate::error::ConstrainedHttpBoundShapesOperationError,
|
387 + | ) -> std::result::Result<
|
388 + | ::aws_smithy_legacy_http_server::response::Response,
|
389 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
390 + | > {
|
391 + | Ok({
|
392 + | match error {
|
393 + | crate::error::ConstrainedHttpBoundShapesOperationError::ValidationException(output) => {
|
394 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
395 + | #[allow(unused_mut)]
|
396 + | let mut builder = ::http::Response::builder();
|
397 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
398 + | builder,
|
399 + | ::http::header::CONTENT_TYPE,
|
400 + | "application/json",
|
401 + | );
|
402 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
403 + | builder,
|
404 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
405 + | "ValidationException",
|
406 + | );
|
407 + | let content_length = payload.len();
|
408 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
409 + | builder,
|
410 + | ::http::header::CONTENT_LENGTH,
|
411 + | content_length,
|
412 + | );
|
413 + | builder
|
414 + | .status(400)
|
415 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
416 + | }
|
417 + | }
|
418 + | })
|
419 + | }
|
420 + |
|
421 + | pub fn ser_constrained_http_bound_shapes_operation_headers(
|
422 + | input: &crate::output::ConstrainedHttpBoundShapesOperationOutput,
|
423 + | mut builder: ::http::response::Builder,
|
424 + | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
425 + | {
|
426 + | if let ::std::option::Option::Some(inner_1) = &input.length_string_header {
|
427 + | let formatted_2 = inner_1.as_str();
|
428 + | if !formatted_2.is_empty() {
|
429 + | let header_value = formatted_2;
|
430 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
431 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
432 + | "length_string_header",
|
433 + | format!(
|
434 + | "`{}` cannot be used as a header value: {}",
|
435 + | &header_value, err
|
436 + | ),
|
437 + | )
|
438 + | })?;
|
439 + | builder = builder.header("X-Length", header_value);
|
440 + | }
|
441 + | }
|
442 + | if input.range_integer_header != 0 {
|
443 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.range_integer_header);
|
444 + | let formatted_3 = encoder.encode();
|
445 + | if !formatted_3.is_empty() {
|
446 + | let header_value = formatted_3;
|
447 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
448 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
449 + | "range_integer_header",
|
450 + | format!(
|
451 + | "`{}` cannot be used as a header value: {}",
|
452 + | &header_value, err
|
453 + | ),
|
454 + | )
|
455 + | })?;
|
456 + | builder = builder.header("X-Range-Integer", header_value);
|
457 + | }
|
458 + | }
|
459 + | if input.range_short_header != 0 {
|
460 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.range_short_header);
|
461 + | let formatted_4 = encoder.encode();
|
462 + | if !formatted_4.is_empty() {
|
463 + | let header_value = formatted_4;
|
464 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
465 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
466 + | "range_short_header",
|
467 + | format!(
|
468 + | "`{}` cannot be used as a header value: {}",
|
469 + | &header_value, err
|
470 + | ),
|
471 + | )
|
472 + | })?;
|
473 + | builder = builder.header("X-Range-Short", header_value);
|
474 + | }
|
475 + | }
|
476 + | if input.range_long_header != 0 {
|
477 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.range_long_header);
|
478 + | let formatted_5 = encoder.encode();
|
479 + | if !formatted_5.is_empty() {
|
480 + | let header_value = formatted_5;
|
481 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
482 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
483 + | "range_long_header",
|
484 + | format!(
|
485 + | "`{}` cannot be used as a header value: {}",
|
486 + | &header_value, err
|
487 + | ),
|
488 + | )
|
489 + | })?;
|
490 + | builder = builder.header("X-Range-Long", header_value);
|
491 + | }
|
492 + | }
|
493 + | if input.range_byte_header != 0 {
|
494 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.range_byte_header);
|
495 + | let formatted_6 = encoder.encode();
|
496 + | if !formatted_6.is_empty() {
|
497 + | let header_value = formatted_6;
|
498 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
499 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
500 + | "range_byte_header",
|
501 + | format!(
|
502 + | "`{}` cannot be used as a header value: {}",
|
503 + | &header_value, err
|
504 + | ),
|
505 + | )
|
506 + | })?;
|
507 + | builder = builder.header("X-Range-Byte", header_value);
|
508 + | }
|
509 + | }
|
510 + | if let ::std::option::Option::Some(inner_7) = &input.length_string_set_header {
|
511 + | for inner_8 in inner_7 {
|
512 + | let formatted_9 =
|
513 + | ::aws_smithy_legacy_http::header::quote_header_value(inner_8.as_str());
|
514 + | if !formatted_9.is_empty() {
|
515 + | let header_value = formatted_9;
|
516 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
517 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
518 + | "length_string_set_header",
|
519 + | format!(
|
520 + | "`{}` cannot be used as a header value: {}",
|
521 + | &header_value, err
|
522 + | ),
|
523 + | )
|
524 + | })?;
|
525 + | builder = builder.header("X-Length-Set", header_value);
|
526 + | }
|
527 + | }
|
528 + | }
|
529 + | if let ::std::option::Option::Some(inner_10) = &input.list_length_string_header {
|
530 + | for inner_11 in inner_10 {
|
531 + | let formatted_12 =
|
532 + | ::aws_smithy_legacy_http::header::quote_header_value(inner_11.as_str());
|
533 + | if !formatted_12.is_empty() {
|
534 + | let header_value = formatted_12;
|
535 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
536 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
537 + | "list_length_string_header",
|
538 + | format!(
|
539 + | "`{}` cannot be used as a header value: {}",
|
540 + | &header_value, err
|
541 + | ),
|
542 + | )
|
543 + | })?;
|
544 + | builder = builder.header("X-List-Length-String", header_value);
|
545 + | }
|
546 + | }
|
547 + | }
|
548 + | if let ::std::option::Option::Some(inner_13) = &input.length_list_pattern_string_header {
|
549 + | for inner_14 in inner_13 {
|
550 + | let formatted_15 =
|
551 + | ::aws_smithy_legacy_http::header::quote_header_value(inner_14.as_str());
|
552 + | if !formatted_15.is_empty() {
|
553 + | let header_value = formatted_15;
|
554 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
555 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
556 + | "length_list_pattern_string_header",
|
557 + | format!(
|
558 + | "`{}` cannot be used as a header value: {}",
|
559 + | &header_value, err
|
560 + | ),
|
561 + | )
|
562 + | })?;
|
563 + | builder = builder.header("X-Length-List-Pattern-String", header_value);
|
564 + | }
|
565 + | }
|
566 + | }
|
567 + | if let ::std::option::Option::Some(inner_16) = &input.length_set_pattern_string_header {
|
568 + | for inner_17 in inner_16 {
|
569 + | let formatted_18 =
|
570 + | ::aws_smithy_legacy_http::header::quote_header_value(inner_17.as_str());
|
571 + | if !formatted_18.is_empty() {
|
572 + | let header_value = formatted_18;
|
573 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
574 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
575 + | "length_set_pattern_string_header",
|
576 + | format!(
|
577 + | "`{}` cannot be used as a header value: {}",
|
578 + | &header_value, err
|
579 + | ),
|
580 + | )
|
581 + | })?;
|
582 + | builder = builder.header("X-Length-Set-Pattern-String", header_value);
|
583 + | }
|
584 + | }
|
585 + | }
|
586 + | if let ::std::option::Option::Some(inner_19) = &input.range_byte_set_header {
|
587 + | for inner_20 in inner_19 {
|
588 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_20);
|
589 + | let formatted_21 = encoder.encode();
|
590 + | if !formatted_21.is_empty() {
|
591 + | let header_value = formatted_21;
|
592 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
593 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
594 + | "range_byte_set_header",
|
595 + | format!(
|
596 + | "`{}` cannot be used as a header value: {}",
|
597 + | &header_value, err
|
598 + | ),
|
599 + | )
|
600 + | })?;
|
601 + | builder = builder.header("X-Range-Byte-Set", header_value);
|
602 + | }
|
603 + | }
|
604 + | }
|
605 + | if let ::std::option::Option::Some(inner_22) = &input.range_short_set_header {
|
606 + | for inner_23 in inner_22 {
|
607 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_23);
|
608 + | let formatted_24 = encoder.encode();
|
609 + | if !formatted_24.is_empty() {
|
610 + | let header_value = formatted_24;
|
611 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
612 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
613 + | "range_short_set_header",
|
614 + | format!(
|
615 + | "`{}` cannot be used as a header value: {}",
|
616 + | &header_value, err
|
617 + | ),
|
618 + | )
|
619 + | })?;
|
620 + | builder = builder.header("X-Range-Short-Set", header_value);
|
621 + | }
|
622 + | }
|
623 + | }
|
624 + | if let ::std::option::Option::Some(inner_25) = &input.range_integer_set_header {
|
625 + | for inner_26 in inner_25 {
|
626 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
|
627 + | let formatted_27 = encoder.encode();
|
628 + | if !formatted_27.is_empty() {
|
629 + | let header_value = formatted_27;
|
630 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
631 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
632 + | "range_integer_set_header",
|
633 + | format!(
|
634 + | "`{}` cannot be used as a header value: {}",
|
635 + | &header_value, err
|
636 + | ),
|
637 + | )
|
638 + | })?;
|
639 + | builder = builder.header("X-Range-Integer-Set", header_value);
|
640 + | }
|
641 + | }
|
642 + | }
|
643 + | if let ::std::option::Option::Some(inner_28) = &input.range_long_set_header {
|
644 + | for inner_29 in inner_28 {
|
645 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
|
646 + | let formatted_30 = encoder.encode();
|
647 + | if !formatted_30.is_empty() {
|
648 + | let header_value = formatted_30;
|
649 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
650 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
651 + | "range_long_set_header",
|
652 + | format!(
|
653 + | "`{}` cannot be used as a header value: {}",
|
654 + | &header_value, err
|
655 + | ),
|
656 + | )
|
657 + | })?;
|
658 + | builder = builder.header("X-Range-Long-Set", header_value);
|
659 + | }
|
660 + | }
|
661 + | }
|
662 + | if let ::std::option::Option::Some(inner_31) = &input.range_byte_list_header {
|
663 + | for inner_32 in inner_31 {
|
664 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_32);
|
665 + | let formatted_33 = encoder.encode();
|
666 + | if !formatted_33.is_empty() {
|
667 + | let header_value = formatted_33;
|
668 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
669 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
670 + | "range_byte_list_header",
|
671 + | format!(
|
672 + | "`{}` cannot be used as a header value: {}",
|
673 + | &header_value, err
|
674 + | ),
|
675 + | )
|
676 + | })?;
|
677 + | builder = builder.header("X-Range-Byte-List", header_value);
|
678 + | }
|
679 + | }
|
680 + | }
|
681 + | if let ::std::option::Option::Some(inner_34) = &input.range_short_list_header {
|
682 + | for inner_35 in inner_34 {
|
683 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_35);
|
684 + | let formatted_36 = encoder.encode();
|
685 + | if !formatted_36.is_empty() {
|
686 + | let header_value = formatted_36;
|
687 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
688 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
689 + | "range_short_list_header",
|
690 + | format!(
|
691 + | "`{}` cannot be used as a header value: {}",
|
692 + | &header_value, err
|
693 + | ),
|
694 + | )
|
695 + | })?;
|
696 + | builder = builder.header("X-Range-Short-List", header_value);
|
697 + | }
|
698 + | }
|
699 + | }
|
700 + | if let ::std::option::Option::Some(inner_37) = &input.range_integer_list_header {
|
701 + | for inner_38 in inner_37 {
|
702 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_38);
|
703 + | let formatted_39 = encoder.encode();
|
704 + | if !formatted_39.is_empty() {
|
705 + | let header_value = formatted_39;
|
706 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
707 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
708 + | "range_integer_list_header",
|
709 + | format!(
|
710 + | "`{}` cannot be used as a header value: {}",
|
711 + | &header_value, err
|
712 + | ),
|
713 + | )
|
714 + | })?;
|
715 + | builder = builder.header("X-Range-Integer-List", header_value);
|
716 + | }
|
717 + | }
|
718 + | }
|
719 + | if let ::std::option::Option::Some(inner_40) = &input.range_long_list_header {
|
720 + | for inner_41 in inner_40 {
|
721 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_41);
|
722 + | let formatted_42 = encoder.encode();
|
723 + | if !formatted_42.is_empty() {
|
724 + | let header_value = formatted_42;
|
725 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
726 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
727 + | "range_long_list_header",
|
728 + | format!(
|
729 + | "`{}` cannot be used as a header value: {}",
|
730 + | &header_value, err
|
731 + | ),
|
732 + | )
|
733 + | })?;
|
734 + | builder = builder.header("X-Range-Long-List", header_value);
|
735 + | }
|
736 + | }
|
737 + | }
|
738 + | {
|
739 + | for (k, v) in &input.length_string_header_map {
|
740 + | use std::str::FromStr;
|
741 + | let header_name = ::http::HeaderName::from_str(&format!(
|
742 + | "{}{}",
|
743 + | "X-Length-String-Prefix-Headers-", &k
|
744 + | ))
|
745 + | .map_err(|err| {
|
746 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
747 + | "length_string_header_map",
|
748 + | format!("`{k}` cannot be used as a header name: {err}"),
|
749 + | )
|
750 + | })?;
|
751 + | let header_value = v.as_str();
|
752 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
753 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
754 + | "length_string_header_map",
|
755 + | format!("`{v}` cannot be used as a header value: {err}"),
|
756 + | )
|
757 + | })?;
|
758 + | builder = builder.header(header_name, header_value);
|
759 + | }
|
760 + | }
|
761 + | Ok(builder)
|
762 + | }
|