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