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