80 80 | output.build()
|
81 81 | })
|
82 82 | }
|
83 83 |
|
84 84 | pub fn ser_upload_part_copy_headers(
|
85 85 | input: &crate::operation::upload_part_copy::UploadPartCopyInput,
|
86 86 | mut builder: ::http::request::Builder,
|
87 87 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
88 88 | if let ::std::option::Option::Some(inner_1) = &input.copy_source {
|
89 89 | let formatted_2 = inner_1.as_str();
|
90 - | let header_value = formatted_2;
|
91 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
92 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
93 - | "copy_source",
|
94 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
95 - | )
|
96 - | })?;
|
97 - | builder = builder.header("x-amz-copy-source", header_value);
|
90 + | if !formatted_2.is_empty() {
|
91 + | let header_value = formatted_2;
|
92 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
93 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
94 + | "copy_source",
|
95 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
96 + | )
|
97 + | })?;
|
98 + | builder = builder.header("x-amz-copy-source", header_value);
|
99 + | }
|
98 100 | }
|
99 101 | if let ::std::option::Option::Some(inner_3) = &input.copy_source_if_match {
|
100 102 | let formatted_4 = inner_3.as_str();
|
101 - | let header_value = formatted_4;
|
102 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
103 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
104 - | "copy_source_if_match",
|
105 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
106 - | )
|
107 - | })?;
|
108 - | builder = builder.header("x-amz-copy-source-if-match", header_value);
|
103 + | if !formatted_4.is_empty() {
|
104 + | let header_value = formatted_4;
|
105 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
106 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
107 + | "copy_source_if_match",
|
108 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
109 + | )
|
110 + | })?;
|
111 + | builder = builder.header("x-amz-copy-source-if-match", header_value);
|
112 + | }
|
109 113 | }
|
110 114 | if let ::std::option::Option::Some(inner_5) = &input.copy_source_if_modified_since {
|
111 115 | let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
112 - | let header_value = formatted_6;
|
113 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
114 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
115 - | "copy_source_if_modified_since",
|
116 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
117 - | )
|
118 - | })?;
|
119 - | builder = builder.header("x-amz-copy-source-if-modified-since", header_value);
|
116 + | if !formatted_6.is_empty() {
|
117 + | let header_value = formatted_6;
|
118 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
119 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
120 + | "copy_source_if_modified_since",
|
121 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
122 + | )
|
123 + | })?;
|
124 + | builder = builder.header("x-amz-copy-source-if-modified-since", header_value);
|
125 + | }
|
120 126 | }
|
121 127 | if let ::std::option::Option::Some(inner_7) = &input.copy_source_if_none_match {
|
122 128 | let formatted_8 = inner_7.as_str();
|
123 - | let header_value = formatted_8;
|
124 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
125 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
126 - | "copy_source_if_none_match",
|
127 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
128 - | )
|
129 - | })?;
|
130 - | builder = builder.header("x-amz-copy-source-if-none-match", header_value);
|
129 + | if !formatted_8.is_empty() {
|
130 + | let header_value = formatted_8;
|
131 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
132 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
133 + | "copy_source_if_none_match",
|
134 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
135 + | )
|
136 + | })?;
|
137 + | builder = builder.header("x-amz-copy-source-if-none-match", header_value);
|
138 + | }
|
131 139 | }
|
132 140 | if let ::std::option::Option::Some(inner_9) = &input.copy_source_if_unmodified_since {
|
133 141 | let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
134 - | let header_value = formatted_10;
|
135 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
136 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
137 - | "copy_source_if_unmodified_since",
|
138 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
139 - | )
|
140 - | })?;
|
141 - | builder = builder.header("x-amz-copy-source-if-unmodified-since", header_value);
|
142 + | if !formatted_10.is_empty() {
|
143 + | let header_value = formatted_10;
|
144 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
145 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
146 + | "copy_source_if_unmodified_since",
|
147 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
148 + | )
|
149 + | })?;
|
150 + | builder = builder.header("x-amz-copy-source-if-unmodified-since", header_value);
|
151 + | }
|
142 152 | }
|
143 153 | if let ::std::option::Option::Some(inner_11) = &input.copy_source_range {
|
144 154 | let formatted_12 = inner_11.as_str();
|
145 - | let header_value = formatted_12;
|
146 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
147 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
148 - | "copy_source_range",
|
149 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
150 - | )
|
151 - | })?;
|
152 - | builder = builder.header("x-amz-copy-source-range", header_value);
|
155 + | if !formatted_12.is_empty() {
|
156 + | let header_value = formatted_12;
|
157 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
158 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
159 + | "copy_source_range",
|
160 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
161 + | )
|
162 + | })?;
|
163 + | builder = builder.header("x-amz-copy-source-range", header_value);
|
164 + | }
|
153 165 | }
|
154 166 | if let ::std::option::Option::Some(inner_13) = &input.sse_customer_algorithm {
|
155 167 | let formatted_14 = inner_13.as_str();
|
156 - | let header_value = formatted_14;
|
157 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
158 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
159 - | "sse_customer_algorithm",
|
160 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
161 - | )
|
162 - | })?;
|
163 - | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
168 + | if !formatted_14.is_empty() {
|
169 + | let header_value = formatted_14;
|
170 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
171 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
172 + | "sse_customer_algorithm",
|
173 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
174 + | )
|
175 + | })?;
|
176 + | builder = builder.header("x-amz-server-side-encryption-customer-algorithm", header_value);
|
177 + | }
|
164 178 | }
|
165 179 | if let ::std::option::Option::Some(inner_15) = &input.sse_customer_key {
|
166 180 | let formatted_16 = inner_15.as_str();
|
167 - | let header_value = formatted_16;
|
168 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
169 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
170 - | "sse_customer_key",
|
171 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
172 - | )
|
173 - | })?;
|
174 - | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
181 + | if !formatted_16.is_empty() {
|
182 + | let header_value = formatted_16;
|
183 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
184 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 + | "sse_customer_key",
|
186 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
187 + | )
|
188 + | })?;
|
189 + | builder = builder.header("x-amz-server-side-encryption-customer-key", header_value);
|
190 + | }
|
175 191 | }
|
176 192 | if let ::std::option::Option::Some(inner_17) = &input.sse_customer_key_md5 {
|
177 193 | let formatted_18 = inner_17.as_str();
|
178 - | let header_value = formatted_18;
|
179 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
180 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
181 - | "sse_customer_key_md5",
|
182 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
183 - | )
|
184 - | })?;
|
185 - | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
194 + | if !formatted_18.is_empty() {
|
195 + | let header_value = formatted_18;
|
196 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
197 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
198 + | "sse_customer_key_md5",
|
199 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
200 + | )
|
201 + | })?;
|
202 + | builder = builder.header("x-amz-server-side-encryption-customer-key-MD5", header_value);
|
203 + | }
|
186 204 | }
|
187 205 | if let ::std::option::Option::Some(inner_19) = &input.copy_source_sse_customer_algorithm {
|
188 206 | let formatted_20 = inner_19.as_str();
|
189 - | let header_value = formatted_20;
|
190 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
191 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
192 - | "copy_source_sse_customer_algorithm",
|
193 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
194 - | )
|
195 - | })?;
|
196 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-algorithm", header_value);
|
207 + | if !formatted_20.is_empty() {
|
208 + | let header_value = formatted_20;
|
209 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
210 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
211 + | "copy_source_sse_customer_algorithm",
|
212 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
213 + | )
|
214 + | })?;
|
215 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-algorithm", header_value);
|
216 + | }
|
197 217 | }
|
198 218 | if let ::std::option::Option::Some(inner_21) = &input.copy_source_sse_customer_key {
|
199 219 | let formatted_22 = inner_21.as_str();
|
200 - | let header_value = formatted_22;
|
201 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
202 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
203 - | "copy_source_sse_customer_key",
|
204 - | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
205 - | )
|
206 - | })?;
|
207 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key", header_value);
|
220 + | if !formatted_22.is_empty() {
|
221 + | let header_value = formatted_22;
|
222 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
223 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
224 + | "copy_source_sse_customer_key",
|
225 + | format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
|
226 + | )
|
227 + | })?;
|
228 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key", header_value);
|
229 + | }
|
208 230 | }
|
209 231 | if let ::std::option::Option::Some(inner_23) = &input.copy_source_sse_customer_key_md5 {
|
210 232 | let formatted_24 = inner_23.as_str();
|
211 - | let header_value = formatted_24;
|
212 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
213 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
214 - | "copy_source_sse_customer_key_md5",
|
215 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
216 - | )
|
217 - | })?;
|
218 - | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key-MD5", header_value);
|
233 + | if !formatted_24.is_empty() {
|
234 + | let header_value = formatted_24;
|
235 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
236 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
237 + | "copy_source_sse_customer_key_md5",
|
238 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
239 + | )
|
240 + | })?;
|
241 + | builder = builder.header("x-amz-copy-source-server-side-encryption-customer-key-MD5", header_value);
|
242 + | }
|
219 243 | }
|
220 244 | if let ::std::option::Option::Some(inner_25) = &input.request_payer {
|
221 245 | let formatted_26 = inner_25.as_str();
|
222 - | let header_value = formatted_26;
|
223 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
224 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
225 - | "request_payer",
|
226 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
227 - | )
|
228 - | })?;
|
229 - | builder = builder.header("x-amz-request-payer", header_value);
|
246 + | if !formatted_26.is_empty() {
|
247 + | let header_value = formatted_26;
|
248 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
249 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
250 + | "request_payer",
|
251 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
252 + | )
|
253 + | })?;
|
254 + | builder = builder.header("x-amz-request-payer", header_value);
|
255 + | }
|
230 256 | }
|
231 257 | if let ::std::option::Option::Some(inner_27) = &input.expected_bucket_owner {
|
232 258 | let formatted_28 = inner_27.as_str();
|
233 - | let header_value = formatted_28;
|
234 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
235 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
236 - | "expected_bucket_owner",
|
237 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
238 - | )
|
239 - | })?;
|
240 - | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
259 + | if !formatted_28.is_empty() {
|
260 + | let header_value = formatted_28;
|
261 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
262 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
263 + | "expected_bucket_owner",
|
264 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
265 + | )
|
266 + | })?;
|
267 + | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
268 + | }
|
241 269 | }
|
242 270 | if let ::std::option::Option::Some(inner_29) = &input.expected_source_bucket_owner {
|
243 271 | let formatted_30 = inner_29.as_str();
|
244 - | let header_value = formatted_30;
|
245 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
246 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
247 - | "expected_source_bucket_owner",
|
248 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
249 - | )
|
250 - | })?;
|
251 - | builder = builder.header("x-amz-source-expected-bucket-owner", header_value);
|
272 + | if !formatted_30.is_empty() {
|
273 + | let header_value = formatted_30;
|
274 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
275 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
276 + | "expected_source_bucket_owner",
|
277 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
278 + | )
|
279 + | })?;
|
280 + | builder = builder.header("x-amz-source-expected-bucket-owner", header_value);
|
281 + | }
|
252 282 | }
|
253 283 | Ok(builder)
|
254 284 | }
|