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