117 117 | output.build()
|
118 118 | })
|
119 119 | }
|
120 120 |
|
121 121 | pub fn ser_copy_object_headers(
|
122 122 | input: &crate::operation::copy_object::CopyObjectInput,
|
123 123 | mut builder: ::http::request::Builder,
|
124 124 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
125 125 | if let ::std::option::Option::Some(inner_1) = &input.acl {
|
126 126 | let formatted_2 = inner_1.as_str();
|
127 - | let header_value = formatted_2;
|
128 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
129 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
130 - | "acl",
|
131 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
132 - | )
|
133 - | })?;
|
134 - | builder = builder.header("x-amz-acl", header_value);
|
127 + | if !formatted_2.is_empty() {
|
128 + | let header_value = formatted_2;
|
129 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
130 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
131 + | "acl",
|
132 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
133 + | )
|
134 + | })?;
|
135 + | builder = builder.header("x-amz-acl", header_value);
|
136 + | }
|
135 137 | }
|
136 138 | if let ::std::option::Option::Some(inner_3) = &input.cache_control {
|
137 139 | let formatted_4 = inner_3.as_str();
|
138 - | let header_value = formatted_4;
|
139 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
140 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
141 - | "cache_control",
|
142 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
143 - | )
|
144 - | })?;
|
145 - | builder = builder.header("Cache-Control", header_value);
|
140 + | if !formatted_4.is_empty() {
|
141 + | let header_value = formatted_4;
|
142 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
143 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
144 + | "cache_control",
|
145 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
146 + | )
|
147 + | })?;
|
148 + | builder = builder.header("Cache-Control", header_value);
|
149 + | }
|
146 150 | }
|
147 151 | if let ::std::option::Option::Some(inner_5) = &input.checksum_algorithm {
|
148 152 | let formatted_6 = inner_5.as_str();
|
149 - | let header_value = formatted_6;
|
150 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
151 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
152 - | "checksum_algorithm",
|
153 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
154 - | )
|
155 - | })?;
|
156 - | builder = builder.header("x-amz-checksum-algorithm", header_value);
|
153 + | if !formatted_6.is_empty() {
|
154 + | let header_value = formatted_6;
|
155 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
156 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
157 + | "checksum_algorithm",
|
158 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
159 + | )
|
160 + | })?;
|
161 + | builder = builder.header("x-amz-checksum-algorithm", header_value);
|
162 + | }
|
157 163 | }
|
158 164 | if let ::std::option::Option::Some(inner_7) = &input.content_disposition {
|
159 165 | let formatted_8 = inner_7.as_str();
|
160 - | let header_value = formatted_8;
|
161 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
162 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
163 - | "content_disposition",
|
164 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
165 - | )
|
166 - | })?;
|
167 - | builder = builder.header("Content-Disposition", header_value);
|
166 + | if !formatted_8.is_empty() {
|
167 + | let header_value = formatted_8;
|
168 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
169 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
170 + | "content_disposition",
|
171 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
172 + | )
|
173 + | })?;
|
174 + | builder = builder.header("Content-Disposition", header_value);
|
175 + | }
|
168 176 | }
|
169 177 | if let ::std::option::Option::Some(inner_9) = &input.content_encoding {
|
170 178 | let formatted_10 = inner_9.as_str();
|
171 - | let header_value = formatted_10;
|
172 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
173 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
174 - | "content_encoding",
|
175 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
176 - | )
|
177 - | })?;
|
178 - | builder = builder.header("Content-Encoding", header_value);
|
179 + | if !formatted_10.is_empty() {
|
180 + | let header_value = formatted_10;
|
181 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
182 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
183 + | "content_encoding",
|
184 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
185 + | )
|
186 + | })?;
|
187 + | builder = builder.header("Content-Encoding", header_value);
|
188 + | }
|
179 189 | }
|
180 190 | if let ::std::option::Option::Some(inner_11) = &input.content_language {
|
181 191 | let formatted_12 = inner_11.as_str();
|
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_language",
|
186 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 - | )
|
188 - | })?;
|
189 - | builder = builder.header("Content-Language", header_value);
|
192 + | if !formatted_12.is_empty() {
|
193 + | let header_value = formatted_12;
|
194 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
195 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
196 + | "content_language",
|
197 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
198 + | )
|
199 + | })?;
|
200 + | builder = builder.header("Content-Language", header_value);
|
201 + | }
|
190 202 | }
|
191 203 | if let ::std::option::Option::Some(inner_13) = &input.content_type {
|
192 204 | let formatted_14 = inner_13.as_str();
|
193 - | let header_value = formatted_14;
|
194 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
195 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
196 - | "content_type",
|
197 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
198 - | )
|
199 - | })?;
|
200 - | builder = builder.header("Content-Type", header_value);
|
205 + | if !formatted_14.is_empty() {
|
206 + | let header_value = formatted_14;
|
207 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
208 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
209 + | "content_type",
|
210 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
211 + | )
|
212 + | })?;
|
213 + | builder = builder.header("Content-Type", header_value);
|
214 + | }
|
201 215 | }
|
202 216 | if let ::std::option::Option::Some(inner_15) = &input.copy_source {
|
203 217 | let formatted_16 = inner_15.as_str();
|
204 - | let header_value = formatted_16;
|
205 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
206 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
207 - | "copy_source",
|
208 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
209 - | )
|
210 - | })?;
|
211 - | builder = builder.header("x-amz-copy-source", header_value);
|
218 + | if !formatted_16.is_empty() {
|
219 + | let header_value = formatted_16;
|
220 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
221 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
222 + | "copy_source",
|
223 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
224 + | )
|
225 + | })?;
|
226 + | builder = builder.header("x-amz-copy-source", header_value);
|
227 + | }
|
212 228 | }
|
213 229 | if let ::std::option::Option::Some(inner_17) = &input.copy_source_if_match {
|
214 230 | let formatted_18 = inner_17.as_str();
|
215 - | let header_value = formatted_18;
|
216 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
217 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
218 - | "copy_source_if_match",
|
219 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
220 - | )
|
221 - | })?;
|
222 - | builder = builder.header("x-amz-copy-source-if-match", header_value);
|
231 + | if !formatted_18.is_empty() {
|
232 + | let header_value = formatted_18;
|
233 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
234 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
235 + | "copy_source_if_match",
|
236 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
237 + | )
|
238 + | })?;
|
239 + | builder = builder.header("x-amz-copy-source-if-match", header_value);
|
240 + | }
|
223 241 | }
|
224 242 | if let ::std::option::Option::Some(inner_19) = &input.copy_source_if_modified_since {
|
225 243 | let formatted_20 = inner_19.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
226 - | let header_value = formatted_20;
|
227 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
228 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
229 - | "copy_source_if_modified_since",
|
230 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
231 - | )
|
232 - | })?;
|
233 - | builder = builder.header("x-amz-copy-source-if-modified-since", header_value);
|
244 + | if !formatted_20.is_empty() {
|
245 + | let header_value = formatted_20;
|
246 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
247 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
248 + | "copy_source_if_modified_since",
|
249 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
250 + | )
|
251 + | })?;
|
252 + | builder = builder.header("x-amz-copy-source-if-modified-since", header_value);
|
253 + | }
|
234 254 | }
|
235 255 | if let ::std::option::Option::Some(inner_21) = &input.copy_source_if_none_match {
|
236 256 | let formatted_22 = inner_21.as_str();
|
237 - | let header_value = formatted_22;
|
238 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
239 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
240 - | "copy_source_if_none_match",
|
241 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
242 - | )
|
243 - | })?;
|
244 - | builder = builder.header("x-amz-copy-source-if-none-match", header_value);
|
257 + | if !formatted_22.is_empty() {
|
258 + | let header_value = formatted_22;
|
259 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
260 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
261 + | "copy_source_if_none_match",
|
262 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
263 + | )
|
264 + | })?;
|
265 + | builder = builder.header("x-amz-copy-source-if-none-match", header_value);
|
266 + | }
|
245 267 | }
|
246 268 | if let ::std::option::Option::Some(inner_23) = &input.copy_source_if_unmodified_since {
|
247 269 | let formatted_24 = inner_23.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
248 - | let header_value = formatted_24;
|
249 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
250 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
251 - | "copy_source_if_unmodified_since",
|
252 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
253 - | )
|
254 - | })?;
|
255 - | builder = builder.header("x-amz-copy-source-if-unmodified-since", header_value);
|
270 + | if !formatted_24.is_empty() {
|
271 + | let header_value = formatted_24;
|
272 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
273 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
274 + | "copy_source_if_unmodified_since",
|
275 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
276 + | )
|
277 + | })?;
|
278 + | builder = builder.header("x-amz-copy-source-if-unmodified-since", header_value);
|
279 + | }
|
256 280 | }
|
257 281 | if let ::std::option::Option::Some(inner_25) = &input.expires {
|
258 282 | let formatted_26 = inner_25.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
259 - | let header_value = formatted_26;
|
260 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
261 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
262 - | "expires",
|
263 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
264 - | )
|
265 - | })?;
|
266 - | builder = builder.header("Expires", header_value);
|
283 + | if !formatted_26.is_empty() {
|
284 + | let header_value = formatted_26;
|
285 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
286 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
287 + | "expires",
|
288 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
289 + | )
|
290 + | })?;
|
291 + | builder = builder.header("Expires", header_value);
|
292 + | }
|
267 293 | }
|
268 294 | if let ::std::option::Option::Some(inner_27) = &input.grant_full_control {
|
269 295 | let formatted_28 = inner_27.as_str();
|
270 - | let header_value = formatted_28;
|
271 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
272 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
273 - | "grant_full_control",
|
274 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
275 - | )
|
276 - | })?;
|
277 - | builder = builder.header("x-amz-grant-full-control", header_value);
|
296 + | if !formatted_28.is_empty() {
|
297 + | let header_value = formatted_28;
|
298 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
299 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
300 + | "grant_full_control",
|
301 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
302 + | )
|
303 + | })?;
|
304 + | builder = builder.header("x-amz-grant-full-control", header_value);
|
305 + | }
|
278 306 | }
|
279 307 | if let ::std::option::Option::Some(inner_29) = &input.grant_read {
|
280 308 | let formatted_30 = inner_29.as_str();
|
281 - | let header_value = formatted_30;
|
282 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
283 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
284 - | "grant_read",
|
285 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
286 - | )
|
287 - | })?;
|
288 - | builder = builder.header("x-amz-grant-read", header_value);
|
309 + | if !formatted_30.is_empty() {
|
310 + | let header_value = formatted_30;
|
311 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
312 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
313 + | "grant_read",
|
314 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
315 + | )
|
316 + | })?;
|
317 + | builder = builder.header("x-amz-grant-read", header_value);
|
318 + | }
|
289 319 | }
|
290 320 | if let ::std::option::Option::Some(inner_31) = &input.grant_read_acp {
|
291 321 | let formatted_32 = inner_31.as_str();
|
292 - | let header_value = formatted_32;
|
293 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
294 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
295 - | "grant_read_acp",
|
296 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
297 - | )
|
298 - | })?;
|
299 - | builder = builder.header("x-amz-grant-read-acp", header_value);
|
322 + | if !formatted_32.is_empty() {
|
323 + | let header_value = formatted_32;
|
324 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
325 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
326 + | "grant_read_acp",
|
327 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
328 + | )
|
329 + | })?;
|
330 + | builder = builder.header("x-amz-grant-read-acp", header_value);
|
331 + | }
|
300 332 | }
|
301 333 | if let ::std::option::Option::Some(inner_33) = &input.grant_write_acp {
|
302 334 | let formatted_34 = inner_33.as_str();
|
303 - | let header_value = formatted_34;
|
304 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
305 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
306 - | "grant_write_acp",
|
307 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
308 - | )
|
309 - | })?;
|
310 - | builder = builder.header("x-amz-grant-write-acp", header_value);
|
335 + | if !formatted_34.is_empty() {
|
336 + | let header_value = formatted_34;
|
337 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
338 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
339 + | "grant_write_acp",
|
340 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
341 + | )
|
342 + | })?;
|
343 + | builder = builder.header("x-amz-grant-write-acp", header_value);
|
344 + | }
|
311 345 | }
|
312 346 | if let ::std::option::Option::Some(inner_35) = &input.metadata_directive {
|
313 347 | let formatted_36 = inner_35.as_str();
|
314 - | let header_value = formatted_36;
|
315 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
316 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
317 - | "metadata_directive",
|
318 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
319 - | )
|
320 - | })?;
|
321 - | builder = builder.header("x-amz-metadata-directive", header_value);
|
348 + | if !formatted_36.is_empty() {
|
349 + | let header_value = formatted_36;
|
350 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
351 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
352 + | "metadata_directive",
|
353 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
354 + | )
|
355 + | })?;
|
356 + | builder = builder.header("x-amz-metadata-directive", header_value);
|
357 + | }
|
322 358 | }
|
323 359 | if let ::std::option::Option::Some(inner_37) = &input.tagging_directive {
|
324 360 | let formatted_38 = inner_37.as_str();
|
325 - | let header_value = formatted_38;
|
326 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
327 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
328 - | "tagging_directive",
|
329 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
330 - | )
|
331 - | })?;
|
332 - | builder = builder.header("x-amz-tagging-directive", header_value);
|
361 + | if !formatted_38.is_empty() {
|
362 + | let header_value = formatted_38;
|
363 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
364 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
365 + | "tagging_directive",
|
366 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
367 + | )
|
368 + | })?;
|
369 + | builder = builder.header("x-amz-tagging-directive", header_value);
|
370 + | }
|
333 371 | }
|
334 372 | if let ::std::option::Option::Some(inner_39) = &input.server_side_encryption {
|
335 373 | let formatted_40 = inner_39.as_str();
|
336 - | let header_value = formatted_40;
|
337 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
338 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
339 - | "server_side_encryption",
|
340 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
341 - | )
|
342 - | })?;
|
343 - | builder = builder.header("x-amz-server-side-encryption", header_value);
|
374 + | if !formatted_40.is_empty() {
|
375 + | let header_value = formatted_40;
|
376 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
377 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
378 + | "server_side_encryption",
|
379 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
380 + | )
|
381 + | })?;
|
382 + | builder = builder.header("x-amz-server-side-encryption", header_value);
|
383 + | }
|
344 384 | }
|
345 385 | if let ::std::option::Option::Some(inner_41) = &input.storage_class {
|
346 386 | let formatted_42 = inner_41.as_str();
|
347 - | let header_value = formatted_42;
|
348 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
349 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
350 - | "storage_class",
|
351 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
352 - | )
|
353 - | })?;
|
354 - | builder = builder.header("x-amz-storage-class", header_value);
|
387 + | if !formatted_42.is_empty() {
|
388 + | let header_value = formatted_42;
|
389 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
390 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
391 + | "storage_class",
|
392 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
393 + | )
|
394 + | })?;
|
395 + | builder = builder.header("x-amz-storage-class", header_value);
|
396 + | }
|
355 397 | }
|
356 398 | if let ::std::option::Option::Some(inner_43) = &input.website_redirect_location {
|
357 399 | let formatted_44 = inner_43.as_str();
|
358 - | let header_value = formatted_44;
|
359 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
360 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
361 - | "website_redirect_location",
|
362 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
363 - | )
|
364 - | })?;
|
365 - | builder = builder.header("x-amz-website-redirect-location", header_value);
|
400 + | if !formatted_44.is_empty() {
|
401 + | let header_value = formatted_44;
|
402 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
403 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
404 + | "website_redirect_location",
|
405 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
406 + | )
|
407 + | })?;
|
408 + | builder = builder.header("x-amz-website-redirect-location", header_value);
|
409 + | }
|
366 410 | }
|
367 411 | if let ::std::option::Option::Some(inner_45) = &input.sse_customer_algorithm {
|
368 412 | let formatted_46 = inner_45.as_str();
|
369 - | let header_value = formatted_46;
|
370 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
371 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
372 - | "sse_customer_algorithm",
|
373 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
374 - | )
|
375 - | })?;
|
376 - | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
413 + | if !formatted_46.is_empty() {
|
414 + | let header_value = formatted_46;
|
415 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
416 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
417 + | "sse_customer_algorithm",
|
418 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
419 + | )
|
420 + | })?;
|
421 + | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
422 + | }
|
377 423 | }
|
378 424 | if let ::std::option::Option::Some(inner_47) = &input.sse_customer_key {
|
379 425 | let formatted_48 = inner_47.as_str();
|
380 - | let header_value = formatted_48;
|
381 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
382 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
383 - | "sse_customer_key",
|
384 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
385 - | )
|
386 - | })?;
|
387 - | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
426 + | if !formatted_48.is_empty() {
|
427 + | let header_value = formatted_48;
|
428 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
429 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
430 + | "sse_customer_key",
|
431 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
432 + | )
|
433 + | })?;
|
434 + | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
435 + | }
|
388 436 | }
|
389 437 | if let ::std::option::Option::Some(inner_49) = &input.sse_customer_key_md5 {
|
390 438 | let formatted_50 = inner_49.as_str();
|
391 - | let header_value = formatted_50;
|
392 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
393 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
394 - | "sse_customer_key_md5",
|
395 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
396 - | )
|
397 - | })?;
|
398 - | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
439 + | if !formatted_50.is_empty() {
|
440 + | let header_value = formatted_50;
|
441 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
442 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
443 + | "sse_customer_key_md5",
|
444 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
445 + | )
|
446 + | })?;
|
447 + | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
448 + | }
|
399 449 | }
|
400 450 | if let ::std::option::Option::Some(inner_51) = &input.ssekms_key_id {
|
401 451 | let formatted_52 = inner_51.as_str();
|
402 - | let header_value = formatted_52;
|
403 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
404 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
405 - | "ssekms_key_id",
|
406 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
407 - | )
|
408 - | })?;
|
409 - | builder = builder.header("x-amz-server-side-encryption-aws-kms-key-id", header_value);
|
452 + | if !formatted_52.is_empty() {
|
453 + | let header_value = formatted_52;
|
454 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
455 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
456 + | "ssekms_key_id",
|
457 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
458 + | )
|
459 + | })?;
|
460 + | builder = builder.header("x-amz-server-side-encryption-aws-kms-key-id", header_value);
|
461 + | }
|
410 462 | }
|
411 463 | if let ::std::option::Option::Some(inner_53) = &input.ssekms_encryption_context {
|
412 464 | let formatted_54 = inner_53.as_str();
|
413 - | let header_value = formatted_54;
|
414 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
415 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
416 - | "ssekms_encryption_context",
|
417 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
418 - | )
|
419 - | })?;
|
420 - | builder = builder.header("x-amz-server-side-encryption-context", header_value);
|
465 + | if !formatted_54.is_empty() {
|
466 + | let header_value = formatted_54;
|
467 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
468 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
469 + | "ssekms_encryption_context",
|
470 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
471 + | )
|
472 + | })?;
|
473 + | builder = builder.header("x-amz-server-side-encryption-context", header_value);
|
474 + | }
|
421 475 | }
|
422 476 | if let ::std::option::Option::Some(inner_55) = &input.bucket_key_enabled {
|
423 477 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_55);
|
424 478 | let formatted_56 = encoder.encode();
|
425 - | let header_value = formatted_56;
|
426 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
427 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
428 - | "bucket_key_enabled",
|
429 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
430 - | )
|
431 - | })?;
|
432 - | builder = builder.header("x-amz-server-side-encryption-bucket-key-enabled", header_value);
|
479 + | if !formatted_56.is_empty() {
|
480 + | let header_value = formatted_56;
|
481 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
482 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
483 + | "bucket_key_enabled",
|
484 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
485 + | )
|
486 + | })?;
|
487 + | builder = builder.header("x-amz-server-side-encryption-bucket-key-enabled", header_value);
|
488 + | }
|
433 489 | }
|
434 490 | if let ::std::option::Option::Some(inner_57) = &input.copy_source_sse_customer_algorithm {
|
435 491 | let formatted_58 = inner_57.as_str();
|
436 - | let header_value = formatted_58;
|
437 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
438 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
439 - | "copy_source_sse_customer_algorithm",
|
440 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
441 - | )
|
442 - | })?;
|
443 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-algorithm", header_value);
|
492 + | if !formatted_58.is_empty() {
|
493 + | let header_value = formatted_58;
|
494 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
495 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
496 + | "copy_source_sse_customer_algorithm",
|
497 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
498 + | )
|
499 + | })?;
|
500 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-algorithm", header_value);
|
501 + | }
|
444 502 | }
|
445 503 | if let ::std::option::Option::Some(inner_59) = &input.copy_source_sse_customer_key {
|
446 504 | let formatted_60 = inner_59.as_str();
|
447 - | let header_value = formatted_60;
|
448 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
449 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
450 - | "copy_source_sse_customer_key",
|
451 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
452 - | )
|
453 - | })?;
|
454 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key", header_value);
|
505 + | if !formatted_60.is_empty() {
|
506 + | let header_value = formatted_60;
|
507 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
508 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
509 + | "copy_source_sse_customer_key",
|
510 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
511 + | )
|
512 + | })?;
|
513 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key", header_value);
|
514 + | }
|
455 515 | }
|
456 516 | if let ::std::option::Option::Some(inner_61) = &input.copy_source_sse_customer_key_md5 {
|
457 517 | let formatted_62 = inner_61.as_str();
|
458 - | let header_value = formatted_62;
|
459 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
460 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
461 - | "copy_source_sse_customer_key_md5",
|
462 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
463 - | )
|
464 - | })?;
|
465 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key-MD5", header_value);
|
518 + | if !formatted_62.is_empty() {
|
519 + | let header_value = formatted_62;
|
520 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
521 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
522 + | "copy_source_sse_customer_key_md5",
|
523 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
524 + | )
|
525 + | })?;
|
526 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key-MD5", header_value);
|
527 + | }
|
466 528 | }
|
467 529 | if let ::std::option::Option::Some(inner_63) = &input.request_payer {
|
468 530 | let formatted_64 = inner_63.as_str();
|
469 - | let header_value = formatted_64;
|
470 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
471 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
472 - | "request_payer",
|
473 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
474 - | )
|
475 - | })?;
|
476 - | builder = builder.header("x-amz-request-payer", header_value);
|
531 + | if !formatted_64.is_empty() {
|
532 + | let header_value = formatted_64;
|
533 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
534 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
535 + | "request_payer",
|
536 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
537 + | )
|
538 + | })?;
|
539 + | builder = builder.header("x-amz-request-payer", header_value);
|
540 + | }
|
477 541 | }
|
478 542 | if let ::std::option::Option::Some(inner_65) = &input.tagging {
|
479 543 | let formatted_66 = inner_65.as_str();
|
480 - | let header_value = formatted_66;
|
481 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
482 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
483 - | "tagging",
|
484 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
485 - | )
|
486 - | })?;
|
487 - | builder = builder.header("x-amz-tagging", header_value);
|
544 + | if !formatted_66.is_empty() {
|
545 + | let header_value = formatted_66;
|
546 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
547 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
548 + | "tagging",
|
549 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
550 + | )
|
551 + | })?;
|
552 + | builder = builder.header("x-amz-tagging", header_value);
|
553 + | }
|
488 554 | }
|
489 555 | if let ::std::option::Option::Some(inner_67) = &input.object_lock_mode {
|
490 556 | let formatted_68 = inner_67.as_str();
|
491 - | let header_value = formatted_68;
|
492 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
493 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
494 - | "object_lock_mode",
|
495 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
496 - | )
|
497 - | })?;
|
498 - | builder = builder.header("x-amz-object-lock-mode", header_value);
|
557 + | if !formatted_68.is_empty() {
|
558 + | let header_value = formatted_68;
|
559 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
560 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
561 + | "object_lock_mode",
|
562 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
563 + | )
|
564 + | })?;
|
565 + | builder = builder.header("x-amz-object-lock-mode", header_value);
|
566 + | }
|
499 567 | }
|
500 568 | if let ::std::option::Option::Some(inner_69) = &input.object_lock_retain_until_date {
|
501 569 | let formatted_70 = inner_69.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
|
502 - | let header_value = formatted_70;
|
503 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
504 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
505 - | "object_lock_retain_until_date",
|
506 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
507 - | )
|
508 - | })?;
|
509 - | builder = builder.header("x-amz-object-lock-retain-until-date", header_value);
|
570 + | if !formatted_70.is_empty() {
|
571 + | let header_value = formatted_70;
|
572 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
573 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
574 + | "object_lock_retain_until_date",
|
575 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
576 + | )
|
577 + | })?;
|
578 + | builder = builder.header("x-amz-object-lock-retain-until-date", header_value);
|
579 + | }
|
510 580 | }
|
511 581 | if let ::std::option::Option::Some(inner_71) = &input.object_lock_legal_hold_status {
|
512 582 | let formatted_72 = inner_71.as_str();
|
513 - | let header_value = formatted_72;
|
514 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
515 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
516 - | "object_lock_legal_hold_status",
|
517 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
518 - | )
|
519 - | })?;
|
520 - | builder = builder.header("x-amz-object-lock-legal-hold", header_value);
|
583 + | if !formatted_72.is_empty() {
|
584 + | let header_value = formatted_72;
|
585 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
586 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
587 + | "object_lock_legal_hold_status",
|
588 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
589 + | )
|
590 + | })?;
|
591 + | builder = builder.header("x-amz-object-lock-legal-hold", header_value);
|
592 + | }
|
521 593 | }
|
522 594 | if let ::std::option::Option::Some(inner_73) = &input.expected_bucket_owner {
|
523 595 | let formatted_74 = inner_73.as_str();
|
524 - | let header_value = formatted_74;
|
525 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
526 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
527 - | "expected_bucket_owner",
|
528 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
529 - | )
|
530 - | })?;
|
531 - | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
596 + | if !formatted_74.is_empty() {
|
597 + | let header_value = formatted_74;
|
598 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
599 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
600 + | "expected_bucket_owner",
|
601 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
602 + | )
|
603 + | })?;
|
604 + | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
605 + | }
|
532 606 | }
|
533 607 | if let ::std::option::Option::Some(inner_75) = &input.expected_source_bucket_owner {
|
534 608 | let formatted_76 = inner_75.as_str();
|
535 - | let header_value = formatted_76;
|
536 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
537 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
538 - | "expected_source_bucket_owner",
|
539 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
540 - | )
|
541 - | })?;
|
542 - | builder = builder.header("x-amz-source-expected-bucket-owner", header_value);
|
609 + | if !formatted_76.is_empty() {
|
610 + | let header_value = formatted_76;
|
611 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
612 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
613 + | "expected_source_bucket_owner",
|
614 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
615 + | )
|
616 + | })?;
|
617 + | builder = builder.header("x-amz-source-expected-bucket-owner", header_value);
|
618 + | }
|
543 619 | }
|
544 620 | if let ::std::option::Option::Some(inner_77) = &input.metadata {
|
545 621 | {
|
546 622 | for (k, v) in inner_77 {
|
547 623 | use std::str::FromStr;
|
548 624 | let header_name = http::header::HeaderName::from_str(&format!("{}{}", "x-amz-meta-", &k)).map_err(|err| {
|
549 625 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
550 626 | "metadata",
|
551 627 | format!("`{k}` cannot be used as a header name: {err}"),
|
552 628 | )
|