106 106 | output.build()
|
107 107 | })
|
108 108 | }
|
109 109 |
|
110 110 | pub fn ser_create_multipart_upload_headers(
|
111 111 | input: &crate::operation::create_multipart_upload::CreateMultipartUploadInput,
|
112 112 | mut builder: ::http::request::Builder,
|
113 113 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
114 114 | if let ::std::option::Option::Some(inner_1) = &input.acl {
|
115 115 | let formatted_2 = inner_1.as_str();
|
116 - | let header_value = formatted_2;
|
117 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
118 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
119 - | "acl",
|
120 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
121 - | )
|
122 - | })?;
|
123 - | builder = builder.header("x-amz-acl", header_value);
|
116 + | if !formatted_2.is_empty() {
|
117 + | let header_value = formatted_2;
|
118 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
119 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
120 + | "acl",
|
121 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
122 + | )
|
123 + | })?;
|
124 + | builder = builder.header("x-amz-acl", header_value);
|
125 + | }
|
124 126 | }
|
125 127 | if let ::std::option::Option::Some(inner_3) = &input.cache_control {
|
126 128 | let formatted_4 = inner_3.as_str();
|
127 - | let header_value = formatted_4;
|
128 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
129 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
130 - | "cache_control",
|
131 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
132 - | )
|
133 - | })?;
|
134 - | builder = builder.header("Cache-Control", header_value);
|
129 + | if !formatted_4.is_empty() {
|
130 + | let header_value = formatted_4;
|
131 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
132 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
133 + | "cache_control",
|
134 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
135 + | )
|
136 + | })?;
|
137 + | builder = builder.header("Cache-Control", header_value);
|
138 + | }
|
135 139 | }
|
136 140 | if let ::std::option::Option::Some(inner_5) = &input.content_disposition {
|
137 141 | let formatted_6 = inner_5.as_str();
|
138 - | let header_value = formatted_6;
|
139 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
140 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
141 - | "content_disposition",
|
142 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
143 - | )
|
144 - | })?;
|
145 - | builder = builder.header("Content-Disposition", header_value);
|
142 + | if !formatted_6.is_empty() {
|
143 + | let header_value = formatted_6;
|
144 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
145 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
146 + | "content_disposition",
|
147 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
148 + | )
|
149 + | })?;
|
150 + | builder = builder.header("Content-Disposition", header_value);
|
151 + | }
|
146 152 | }
|
147 153 | if let ::std::option::Option::Some(inner_7) = &input.content_encoding {
|
148 154 | let formatted_8 = inner_7.as_str();
|
149 - | let header_value = formatted_8;
|
150 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
151 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
152 - | "content_encoding",
|
153 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
154 - | )
|
155 - | })?;
|
156 - | builder = builder.header("Content-Encoding", header_value);
|
155 + | if !formatted_8.is_empty() {
|
156 + | let header_value = formatted_8;
|
157 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
158 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
159 + | "content_encoding",
|
160 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
161 + | )
|
162 + | })?;
|
163 + | builder = builder.header("Content-Encoding", header_value);
|
164 + | }
|
157 165 | }
|
158 166 | if let ::std::option::Option::Some(inner_9) = &input.content_language {
|
159 167 | let formatted_10 = inner_9.as_str();
|
160 - | let header_value = formatted_10;
|
161 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
162 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
163 - | "content_language",
|
164 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
165 - | )
|
166 - | })?;
|
167 - | builder = builder.header("Content-Language", header_value);
|
168 + | if !formatted_10.is_empty() {
|
169 + | let header_value = formatted_10;
|
170 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
171 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
172 + | "content_language",
|
173 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
174 + | )
|
175 + | })?;
|
176 + | builder = builder.header("Content-Language", header_value);
|
177 + | }
|
168 178 | }
|
169 179 | if let ::std::option::Option::Some(inner_11) = &input.content_type {
|
170 180 | let formatted_12 = inner_11.as_str();
|
171 - | let header_value = formatted_12;
|
172 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
173 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
174 - | "content_type",
|
175 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
176 - | )
|
177 - | })?;
|
178 - | builder = builder.header("Content-Type", header_value);
|
181 + | if !formatted_12.is_empty() {
|
182 + | let header_value = formatted_12;
|
183 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
184 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 + | "content_type",
|
186 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 + | )
|
188 + | })?;
|
189 + | builder = builder.header("Content-Type", header_value);
|
190 + | }
|
179 191 | }
|
180 192 | if let ::std::option::Option::Some(inner_13) = &input.expires {
|
181 193 | let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
182 - | let header_value = formatted_14;
|
183 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
184 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 - | "expires",
|
186 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 - | )
|
188 - | })?;
|
189 - | builder = builder.header("Expires", header_value);
|
194 + | if !formatted_14.is_empty() {
|
195 + | let header_value = formatted_14;
|
196 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
197 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
198 + | "expires",
|
199 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
200 + | )
|
201 + | })?;
|
202 + | builder = builder.header("Expires", header_value);
|
203 + | }
|
190 204 | }
|
191 205 | if let ::std::option::Option::Some(inner_15) = &input.grant_full_control {
|
192 206 | let formatted_16 = inner_15.as_str();
|
193 - | let header_value = formatted_16;
|
194 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
195 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
196 - | "grant_full_control",
|
197 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
198 - | )
|
199 - | })?;
|
200 - | builder = builder.header("x-amz-grant-full-control", header_value);
|
207 + | if !formatted_16.is_empty() {
|
208 + | let header_value = formatted_16;
|
209 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
210 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
211 + | "grant_full_control",
|
212 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
213 + | )
|
214 + | })?;
|
215 + | builder = builder.header("x-amz-grant-full-control", header_value);
|
216 + | }
|
201 217 | }
|
202 218 | if let ::std::option::Option::Some(inner_17) = &input.grant_read {
|
203 219 | let formatted_18 = inner_17.as_str();
|
204 - | let header_value = formatted_18;
|
205 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
206 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
207 - | "grant_read",
|
208 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
209 - | )
|
210 - | })?;
|
211 - | builder = builder.header("x-amz-grant-read", header_value);
|
220 + | if !formatted_18.is_empty() {
|
221 + | let header_value = formatted_18;
|
222 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
223 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
224 + | "grant_read",
|
225 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
226 + | )
|
227 + | })?;
|
228 + | builder = builder.header("x-amz-grant-read", header_value);
|
229 + | }
|
212 230 | }
|
213 231 | if let ::std::option::Option::Some(inner_19) = &input.grant_read_acp {
|
214 232 | let formatted_20 = inner_19.as_str();
|
215 - | let header_value = formatted_20;
|
216 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
217 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
218 - | "grant_read_acp",
|
219 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
220 - | )
|
221 - | })?;
|
222 - | builder = builder.header("x-amz-grant-read-acp", header_value);
|
233 + | if !formatted_20.is_empty() {
|
234 + | let header_value = formatted_20;
|
235 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
236 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
237 + | "grant_read_acp",
|
238 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
239 + | )
|
240 + | })?;
|
241 + | builder = builder.header("x-amz-grant-read-acp", header_value);
|
242 + | }
|
223 243 | }
|
224 244 | if let ::std::option::Option::Some(inner_21) = &input.grant_write_acp {
|
225 245 | let formatted_22 = inner_21.as_str();
|
226 - | let header_value = formatted_22;
|
227 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
228 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
229 - | "grant_write_acp",
|
230 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
231 - | )
|
232 - | })?;
|
233 - | builder = builder.header("x-amz-grant-write-acp", header_value);
|
246 + | if !formatted_22.is_empty() {
|
247 + | let header_value = formatted_22;
|
248 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
249 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
250 + | "grant_write_acp",
|
251 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
252 + | )
|
253 + | })?;
|
254 + | builder = builder.header("x-amz-grant-write-acp", header_value);
|
255 + | }
|
234 256 | }
|
235 257 | if let ::std::option::Option::Some(inner_23) = &input.server_side_encryption {
|
236 258 | let formatted_24 = inner_23.as_str();
|
237 - | let header_value = formatted_24;
|
238 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
239 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
240 - | "server_side_encryption",
|
241 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
242 - | )
|
243 - | })?;
|
244 - | builder = builder.header("x-amz-server-side-encryption", header_value);
|
259 + | if !formatted_24.is_empty() {
|
260 + | let header_value = formatted_24;
|
261 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
262 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
263 + | "server_side_encryption",
|
264 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
265 + | )
|
266 + | })?;
|
267 + | builder = builder.header("x-amz-server-side-encryption", header_value);
|
268 + | }
|
245 269 | }
|
246 270 | if let ::std::option::Option::Some(inner_25) = &input.storage_class {
|
247 271 | let formatted_26 = inner_25.as_str();
|
248 - | let header_value = formatted_26;
|
249 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
250 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
251 - | "storage_class",
|
252 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
253 - | )
|
254 - | })?;
|
255 - | builder = builder.header("x-amz-storage-class", header_value);
|
272 + | if !formatted_26.is_empty() {
|
273 + | let header_value = formatted_26;
|
274 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
275 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
276 + | "storage_class",
|
277 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
278 + | )
|
279 + | })?;
|
280 + | builder = builder.header("x-amz-storage-class", header_value);
|
281 + | }
|
256 282 | }
|
257 283 | if let ::std::option::Option::Some(inner_27) = &input.website_redirect_location {
|
258 284 | let formatted_28 = inner_27.as_str();
|
259 - | let header_value = formatted_28;
|
260 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
261 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
262 - | "website_redirect_location",
|
263 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
264 - | )
|
265 - | })?;
|
266 - | builder = builder.header("x-amz-website-redirect-location", header_value);
|
285 + | if !formatted_28.is_empty() {
|
286 + | let header_value = formatted_28;
|
287 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
288 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
289 + | "website_redirect_location",
|
290 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
291 + | )
|
292 + | })?;
|
293 + | builder = builder.header("x-amz-website-redirect-location", header_value);
|
294 + | }
|
267 295 | }
|
268 296 | if let ::std::option::Option::Some(inner_29) = &input.sse_customer_algorithm {
|
269 297 | let formatted_30 = inner_29.as_str();
|
270 - | let header_value = formatted_30;
|
271 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
272 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
273 - | "sse_customer_algorithm",
|
274 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
275 - | )
|
276 - | })?;
|
277 - | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
298 + | if !formatted_30.is_empty() {
|
299 + | let header_value = formatted_30;
|
300 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
301 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
302 + | "sse_customer_algorithm",
|
303 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
304 + | )
|
305 + | })?;
|
306 + | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
307 + | }
|
278 308 | }
|
279 309 | if let ::std::option::Option::Some(inner_31) = &input.sse_customer_key {
|
280 310 | let formatted_32 = inner_31.as_str();
|
281 - | let header_value = formatted_32;
|
282 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
283 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
284 - | "sse_customer_key",
|
285 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
286 - | )
|
287 - | })?;
|
288 - | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
311 + | if !formatted_32.is_empty() {
|
312 + | let header_value = formatted_32;
|
313 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
314 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
315 + | "sse_customer_key",
|
316 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
317 + | )
|
318 + | })?;
|
319 + | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
320 + | }
|
289 321 | }
|
290 322 | if let ::std::option::Option::Some(inner_33) = &input.sse_customer_key_md5 {
|
291 323 | let formatted_34 = inner_33.as_str();
|
292 - | let header_value = formatted_34;
|
293 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
294 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
295 - | "sse_customer_key_md5",
|
296 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
297 - | )
|
298 - | })?;
|
299 - | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
324 + | if !formatted_34.is_empty() {
|
325 + | let header_value = formatted_34;
|
326 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
327 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
328 + | "sse_customer_key_md5",
|
329 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
330 + | )
|
331 + | })?;
|
332 + | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
333 + | }
|
300 334 | }
|
301 335 | if let ::std::option::Option::Some(inner_35) = &input.ssekms_key_id {
|
302 336 | let formatted_36 = inner_35.as_str();
|
303 - | let header_value = formatted_36;
|
304 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
305 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
306 - | "ssekms_key_id",
|
307 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
308 - | )
|
309 - | })?;
|
310 - | builder = builder.header("x-amz-server-side-encryption-aws-kms-key-id", header_value);
|
337 + | if !formatted_36.is_empty() {
|
338 + | let header_value = formatted_36;
|
339 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
340 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
341 + | "ssekms_key_id",
|
342 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
343 + | )
|
344 + | })?;
|
345 + | builder = builder.header("x-amz-server-side-encryption-aws-kms-key-id", header_value);
|
346 + | }
|
311 347 | }
|
312 348 | if let ::std::option::Option::Some(inner_37) = &input.ssekms_encryption_context {
|
313 349 | let formatted_38 = inner_37.as_str();
|
314 - | let header_value = formatted_38;
|
315 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
316 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
317 - | "ssekms_encryption_context",
|
318 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
319 - | )
|
320 - | })?;
|
321 - | builder = builder.header("x-amz-server-side-encryption-context", header_value);
|
350 + | if !formatted_38.is_empty() {
|
351 + | let header_value = formatted_38;
|
352 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
353 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
354 + | "ssekms_encryption_context",
|
355 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
356 + | )
|
357 + | })?;
|
358 + | builder = builder.header("x-amz-server-side-encryption-context", header_value);
|
359 + | }
|
322 360 | }
|
323 361 | if let ::std::option::Option::Some(inner_39) = &input.bucket_key_enabled {
|
324 362 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
|
325 363 | let formatted_40 = encoder.encode();
|
326 - | let header_value = formatted_40;
|
327 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
328 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
329 - | "bucket_key_enabled",
|
330 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
331 - | )
|
332 - | })?;
|
333 - | builder = builder.header("x-amz-server-side-encryption-bucket-key-enabled", header_value);
|
364 + | if !formatted_40.is_empty() {
|
365 + | let header_value = formatted_40;
|
366 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
367 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
368 + | "bucket_key_enabled",
|
369 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
370 + | )
|
371 + | })?;
|
372 + | builder = builder.header("x-amz-server-side-encryption-bucket-key-enabled", header_value);
|
373 + | }
|
334 374 | }
|
335 375 | if let ::std::option::Option::Some(inner_41) = &input.request_payer {
|
336 376 | let formatted_42 = inner_41.as_str();
|
337 - | let header_value = formatted_42;
|
338 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
339 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
340 - | "request_payer",
|
341 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
342 - | )
|
343 - | })?;
|
344 - | builder = builder.header("x-amz-request-payer", header_value);
|
377 + | if !formatted_42.is_empty() {
|
378 + | let header_value = formatted_42;
|
379 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
380 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
381 + | "request_payer",
|
382 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
383 + | )
|
384 + | })?;
|
385 + | builder = builder.header("x-amz-request-payer", header_value);
|
386 + | }
|
345 387 | }
|
346 388 | if let ::std::option::Option::Some(inner_43) = &input.tagging {
|
347 389 | let formatted_44 = inner_43.as_str();
|
348 - | let header_value = formatted_44;
|
349 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
350 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
351 - | "tagging",
|
352 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
353 - | )
|
354 - | })?;
|
355 - | builder = builder.header("x-amz-tagging", header_value);
|
390 + | if !formatted_44.is_empty() {
|
391 + | let header_value = formatted_44;
|
392 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
393 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
394 + | "tagging",
|
395 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
396 + | )
|
397 + | })?;
|
398 + | builder = builder.header("x-amz-tagging", header_value);
|
399 + | }
|
356 400 | }
|
357 401 | if let ::std::option::Option::Some(inner_45) = &input.object_lock_mode {
|
358 402 | let formatted_46 = inner_45.as_str();
|
359 - | let header_value = formatted_46;
|
360 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
361 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
362 - | "object_lock_mode",
|
363 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
364 - | )
|
365 - | })?;
|
366 - | builder = builder.header("x-amz-object-lock-mode", header_value);
|
403 + | if !formatted_46.is_empty() {
|
404 + | let header_value = formatted_46;
|
405 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
406 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
407 + | "object_lock_mode",
|
408 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
409 + | )
|
410 + | })?;
|
411 + | builder = builder.header("x-amz-object-lock-mode", header_value);
|
412 + | }
|
367 413 | }
|
368 414 | if let ::std::option::Option::Some(inner_47) = &input.object_lock_retain_until_date {
|
369 415 | let formatted_48 = inner_47.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
370 - | let header_value = formatted_48;
|
371 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
372 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
373 - | "object_lock_retain_until_date",
|
374 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
375 - | )
|
376 - | })?;
|
377 - | builder = builder.header("x-amz-object-lock-retain-until-date", header_value);
|
416 + | if !formatted_48.is_empty() {
|
417 + | let header_value = formatted_48;
|
418 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
419 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
420 + | "object_lock_retain_until_date",
|
421 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
422 + | )
|
423 + | })?;
|
424 + | builder = builder.header("x-amz-object-lock-retain-until-date", header_value);
|
425 + | }
|
378 426 | }
|
379 427 | if let ::std::option::Option::Some(inner_49) = &input.object_lock_legal_hold_status {
|
380 428 | let formatted_50 = inner_49.as_str();
|
381 - | let header_value = formatted_50;
|
382 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
383 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
384 - | "object_lock_legal_hold_status",
|
385 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
386 - | )
|
387 - | })?;
|
388 - | builder = builder.header("x-amz-object-lock-legal-hold", header_value);
|
429 + | if !formatted_50.is_empty() {
|
430 + | let header_value = formatted_50;
|
431 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
432 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
433 + | "object_lock_legal_hold_status",
|
434 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
435 + | )
|
436 + | })?;
|
437 + | builder = builder.header("x-amz-object-lock-legal-hold", header_value);
|
438 + | }
|
389 439 | }
|
390 440 | if let ::std::option::Option::Some(inner_51) = &input.expected_bucket_owner {
|
391 441 | let formatted_52 = inner_51.as_str();
|
392 - | let header_value = formatted_52;
|
393 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
394 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
395 - | "expected_bucket_owner",
|
396 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
397 - | )
|
398 - | })?;
|
399 - | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
442 + | if !formatted_52.is_empty() {
|
443 + | let header_value = formatted_52;
|
444 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
445 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
446 + | "expected_bucket_owner",
|
447 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
448 + | )
|
449 + | })?;
|
450 + | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
451 + | }
|
400 452 | }
|
401 453 | if let ::std::option::Option::Some(inner_53) = &input.checksum_algorithm {
|
402 454 | let formatted_54 = inner_53.as_str();
|
403 - | let header_value = formatted_54;
|
404 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
405 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
406 - | "checksum_algorithm",
|
407 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
408 - | )
|
409 - | })?;
|
410 - | builder = builder.header("x-amz-checksum-algorithm", header_value);
|
455 + | if !formatted_54.is_empty() {
|
456 + | let header_value = formatted_54;
|
457 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
458 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
459 + | "checksum_algorithm",
|
460 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
461 + | )
|
462 + | })?;
|
463 + | builder = builder.header("x-amz-checksum-algorithm", header_value);
|
464 + | }
|
411 465 | }
|
412 466 | if let ::std::option::Option::Some(inner_55) = &input.metadata {
|
413 467 | {
|
414 468 | for (k, v) in inner_55 {
|
415 469 | use std::str::FromStr;
|
416 470 | let header_name = http::header::HeaderName::from_str(&format!("{}{}", "x-amz-meta-", &k)).map_err(|err| {
|
417 471 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
418 472 | "metadata",
|
419 473 | format!("`{k}` cannot be used as a header name: {err}"),
|
420 474 | )
|