253 253 | _ => crate::operation::get_object::GetObjectError::generic(generic),
|
254 254 | })
|
255 255 | }
|
256 256 |
|
257 257 | pub fn ser_get_object_headers(
|
258 258 | input: &crate::operation::get_object::GetObjectInput,
|
259 259 | mut builder: ::http::request::Builder,
|
260 260 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
261 261 | if let ::std::option::Option::Some(inner_1) = &input.if_match {
|
262 262 | let formatted_2 = inner_1.as_str();
|
263 - | let header_value = formatted_2;
|
264 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
265 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
266 - | "if_match",
|
267 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
268 - | )
|
269 - | })?;
|
270 - | builder = builder.header("If-Match", header_value);
|
263 + | if !formatted_2.is_empty() {
|
264 + | let header_value = formatted_2;
|
265 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
266 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
267 + | "if_match",
|
268 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
269 + | )
|
270 + | })?;
|
271 + | builder = builder.header("If-Match", header_value);
|
272 + | }
|
271 273 | }
|
272 274 | if let ::std::option::Option::Some(inner_3) = &input.if_modified_since {
|
273 275 | let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
274 - | let header_value = formatted_4;
|
275 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
276 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
277 - | "if_modified_since",
|
278 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
279 - | )
|
280 - | })?;
|
281 - | builder = builder.header("If-Modified-Since", header_value);
|
276 + | if !formatted_4.is_empty() {
|
277 + | let header_value = formatted_4;
|
278 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
279 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
280 + | "if_modified_since",
|
281 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
282 + | )
|
283 + | })?;
|
284 + | builder = builder.header("If-Modified-Since", header_value);
|
285 + | }
|
282 286 | }
|
283 287 | if let ::std::option::Option::Some(inner_5) = &input.if_none_match {
|
284 288 | let formatted_6 = inner_5.as_str();
|
285 - | let header_value = formatted_6;
|
286 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
287 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
288 - | "if_none_match",
|
289 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
290 - | )
|
291 - | })?;
|
292 - | builder = builder.header("If-None-Match", header_value);
|
289 + | if !formatted_6.is_empty() {
|
290 + | let header_value = formatted_6;
|
291 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
292 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
293 + | "if_none_match",
|
294 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
295 + | )
|
296 + | })?;
|
297 + | builder = builder.header("If-None-Match", header_value);
|
298 + | }
|
293 299 | }
|
294 300 | if let ::std::option::Option::Some(inner_7) = &input.if_unmodified_since {
|
295 301 | let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
296 - | let header_value = formatted_8;
|
297 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
298 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
299 - | "if_unmodified_since",
|
300 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
301 - | )
|
302 - | })?;
|
303 - | builder = builder.header("If-Unmodified-Since", header_value);
|
302 + | if !formatted_8.is_empty() {
|
303 + | let header_value = formatted_8;
|
304 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
305 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
306 + | "if_unmodified_since",
|
307 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
308 + | )
|
309 + | })?;
|
310 + | builder = builder.header("If-Unmodified-Since", header_value);
|
311 + | }
|
304 312 | }
|
305 313 | if let ::std::option::Option::Some(inner_9) = &input.range {
|
306 314 | let formatted_10 = inner_9.as_str();
|
307 - | let header_value = formatted_10;
|
308 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
309 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
310 - | "range",
|
311 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
312 - | )
|
313 - | })?;
|
314 - | builder = builder.header("Range", header_value);
|
315 + | if !formatted_10.is_empty() {
|
316 + | let header_value = formatted_10;
|
317 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
318 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
319 + | "range",
|
320 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
321 + | )
|
322 + | })?;
|
323 + | builder = builder.header("Range", header_value);
|
324 + | }
|
315 325 | }
|
316 326 | if let ::std::option::Option::Some(inner_11) = &input.sse_customer_algorithm {
|
317 327 | let formatted_12 = inner_11.as_str();
|
318 - | let header_value = formatted_12;
|
319 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
320 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
321 - | "sse_customer_algorithm",
|
322 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
323 - | )
|
324 - | })?;
|
325 - | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
328 + | if !formatted_12.is_empty() {
|
329 + | let header_value = formatted_12;
|
330 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
331 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
332 + | "sse_customer_algorithm",
|
333 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
334 + | )
|
335 + | })?;
|
336 + | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
337 + | }
|
326 338 | }
|
327 339 | if let ::std::option::Option::Some(inner_13) = &input.sse_customer_key {
|
328 340 | let formatted_14 = inner_13.as_str();
|
329 - | let header_value = formatted_14;
|
330 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
331 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
332 - | "sse_customer_key",
|
333 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
334 - | )
|
335 - | })?;
|
336 - | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
341 + | if !formatted_14.is_empty() {
|
342 + | let header_value = formatted_14;
|
343 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
344 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
345 + | "sse_customer_key",
|
346 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
347 + | )
|
348 + | })?;
|
349 + | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
350 + | }
|
337 351 | }
|
338 352 | if let ::std::option::Option::Some(inner_15) = &input.sse_customer_key_md5 {
|
339 353 | let formatted_16 = inner_15.as_str();
|
340 - | let header_value = formatted_16;
|
341 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
342 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
343 - | "sse_customer_key_md5",
|
344 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
345 - | )
|
346 - | })?;
|
347 - | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
354 + | if !formatted_16.is_empty() {
|
355 + | let header_value = formatted_16;
|
356 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
357 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
358 + | "sse_customer_key_md5",
|
359 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
360 + | )
|
361 + | })?;
|
362 + | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
363 + | }
|
348 364 | }
|
349 365 | if let ::std::option::Option::Some(inner_17) = &input.request_payer {
|
350 366 | let formatted_18 = inner_17.as_str();
|
351 - | let header_value = formatted_18;
|
352 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
353 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
354 - | "request_payer",
|
355 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
356 - | )
|
357 - | })?;
|
358 - | builder = builder.header("x-amz-request-payer", header_value);
|
367 + | if !formatted_18.is_empty() {
|
368 + | let header_value = formatted_18;
|
369 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
370 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
371 + | "request_payer",
|
372 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
373 + | )
|
374 + | })?;
|
375 + | builder = builder.header("x-amz-request-payer", header_value);
|
376 + | }
|
359 377 | }
|
360 378 | if let ::std::option::Option::Some(inner_19) = &input.expected_bucket_owner {
|
361 379 | let formatted_20 = inner_19.as_str();
|
362 - | let header_value = formatted_20;
|
363 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
364 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
365 - | "expected_bucket_owner",
|
366 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
367 - | )
|
368 - | })?;
|
369 - | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
380 + | if !formatted_20.is_empty() {
|
381 + | let header_value = formatted_20;
|
382 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
383 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
384 + | "expected_bucket_owner",
|
385 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
386 + | )
|
387 + | })?;
|
388 + | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
389 + | }
|
370 390 | }
|
371 391 | if let ::std::option::Option::Some(inner_21) = &input.checksum_mode {
|
372 392 | let formatted_22 = inner_21.as_str();
|
373 - | let header_value = formatted_22;
|
374 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
375 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
376 - | "checksum_mode",
|
377 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
378 - | )
|
379 - | })?;
|
380 - | builder = builder.header("x-amz-checksum-mode", header_value);
|
393 + | if !formatted_22.is_empty() {
|
394 + | let header_value = formatted_22;
|
395 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
396 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
397 + | "checksum_mode",
|
398 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
399 + | )
|
400 + | })?;
|
401 + | builder = builder.header("x-amz-checksum-mode", header_value);
|
402 + | }
|
381 403 | }
|
382 404 | Ok(builder)
|
383 405 | }
|