1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[cfg(test)]
|
3 - | #[allow(unreachable_code, unused_variables)]
|
4 - | mod server_get_bucket_location_test {
|
5 - | /// S3 clients should use the @s3UnwrappedXmlOutput trait to determine
|
6 - | /// that the response shape is not wrapped in a restxml operation-level XML node.
|
7 - | ///
|
8 - | /// Test ID: GetBucketLocationUnwrappedOutput
|
9 - | #[::tokio::test]
|
10 - | #[should_panic]
|
11 - | async fn get_bucket_location_unwrapped_output_response() {
|
12 - | let output = crate::output::GetBucketLocationOutput {
|
13 - | location_constraint: ::std::option::Option::Some(
|
14 - | "us-west-2"
|
15 - | .parse::<crate::model::BucketLocationConstraint>()
|
16 - | .expect("static value validated to member"),
|
17 - | ),
|
18 - | };
|
19 - | use ::aws_smithy_http_server::response::IntoResponse;
|
20 - | let http_response = output.into_response();
|
21 - | ::pretty_assertions::assert_eq!(
|
22 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
23 - | http_response.status()
|
24 - | );
|
25 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
26 - | .await
|
27 - | .expect("unable to extract body to bytes");
|
28 - | ::aws_smithy_protocol_test::assert_ok(
|
29 - | ::aws_smithy_protocol_test::validate_body(&body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LocationConstraint xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">us-west-2</LocationConstraint>", ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
30 - | );
|
31 - | }
|
32 - | }
|
33 - | #[cfg(test)]
|
34 - | #[allow(unreachable_code, unused_variables)]
|
35 - | mod server_list_objects_v2_test {
|
36 - | /// S3 clients should map the default addressing style to virtual host.
|
37 - | /// Test ID: S3DefaultAddressing
|
38 - | #[::tokio::test]
|
39 - | #[should_panic]
|
40 - | async fn s3_default_addressing_request() {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut http_request = http::Request::builder()
|
43 - | .uri("/")
|
44 - | .method("GET")
|
45 - | .body(::aws_smithy_http_server::body::Body::from(
|
46 - | ::bytes::Bytes::from_static("".as_bytes()),
|
47 - | ))
|
48 - | .unwrap();
|
49 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
50 - | todo!("endpoint trait not supported yet");
|
51 - | #[allow(unused_mut)]
|
52 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
53 - | let config = crate::service::AmazonS3Config::builder().build();
|
54 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
55 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
56 - | let sender = sender.clone();
|
57 - | async move {
|
58 - | let result = {
|
59 - | let expected = crate::input::ListObjectsV2Input {
|
60 - | bucket: "mybucket".to_owned(),
|
61 - | delimiter: ::std::option::Option::None,
|
62 - | encoding_type: ::std::option::Option::None,
|
63 - | max_keys: ::std::option::Option::None,
|
64 - | prefix: ::std::option::Option::None,
|
65 - | continuation_token: ::std::option::Option::None,
|
66 - | fetch_owner: ::std::option::Option::None,
|
67 - | start_after: ::std::option::Option::None,
|
68 - | request_payer: ::std::option::Option::None,
|
69 - | expected_bucket_owner: ::std::option::Option::None,
|
70 - | };
|
71 - | ::pretty_assertions::assert_eq!(input, expected);
|
72 - | let response = crate::output::ListObjectsV2Output {
|
73 - | is_truncated: ::std::option::Option::None,
|
74 - | contents: ::std::option::Option::None,
|
75 - | name: ::std::option::Option::None,
|
76 - | prefix: ::std::option::Option::None,
|
77 - | delimiter: ::std::option::Option::None,
|
78 - | max_keys: ::std::option::Option::None,
|
79 - | common_prefixes: ::std::option::Option::None,
|
80 - | encoding_type: ::std::option::Option::None,
|
81 - | key_count: ::std::option::Option::None,
|
82 - | continuation_token: ::std::option::Option::None,
|
83 - | next_continuation_token: ::std::option::Option::None,
|
84 - | start_after: ::std::option::Option::None,
|
85 - | };
|
86 - | Ok(response)
|
87 - | };
|
88 - | sender.send(()).await.expect("receiver dropped early");
|
89 - | result
|
90 - | }
|
91 - | })
|
92 - | .build_unchecked();
|
93 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
94 - | .await
|
95 - | .expect("unable to make an HTTP request");
|
96 - | assert!(receiver.recv().await.is_some());
|
97 - | }
|
98 - | /// S3 clients should support the explicit virtual host addressing style.
|
99 - | /// Test ID: S3VirtualHostAddressing
|
100 - | #[::tokio::test]
|
101 - | #[should_panic]
|
102 - | async fn s3_virtual_host_addressing_request() {
|
103 - | #[allow(unused_mut)]
|
104 - | let mut http_request = http::Request::builder()
|
105 - | .uri("/")
|
106 - | .method("GET")
|
107 - | .body(::aws_smithy_http_server::body::Body::from(
|
108 - | ::bytes::Bytes::from_static("".as_bytes()),
|
109 - | ))
|
110 - | .unwrap();
|
111 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
112 - | todo!("endpoint trait not supported yet");
|
113 - | #[allow(unused_mut)]
|
114 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
115 - | let config = crate::service::AmazonS3Config::builder().build();
|
116 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
117 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
118 - | let sender = sender.clone();
|
119 - | async move {
|
120 - | let result = {
|
121 - | let expected = crate::input::ListObjectsV2Input {
|
122 - | bucket: "mybucket".to_owned(),
|
123 - | delimiter: ::std::option::Option::None,
|
124 - | encoding_type: ::std::option::Option::None,
|
125 - | max_keys: ::std::option::Option::None,
|
126 - | prefix: ::std::option::Option::None,
|
127 - | continuation_token: ::std::option::Option::None,
|
128 - | fetch_owner: ::std::option::Option::None,
|
129 - | start_after: ::std::option::Option::None,
|
130 - | request_payer: ::std::option::Option::None,
|
131 - | expected_bucket_owner: ::std::option::Option::None,
|
132 - | };
|
133 - | ::pretty_assertions::assert_eq!(input, expected);
|
134 - | let response = crate::output::ListObjectsV2Output {
|
135 - | is_truncated: ::std::option::Option::None,
|
136 - | contents: ::std::option::Option::None,
|
137 - | name: ::std::option::Option::None,
|
138 - | prefix: ::std::option::Option::None,
|
139 - | delimiter: ::std::option::Option::None,
|
140 - | max_keys: ::std::option::Option::None,
|
141 - | common_prefixes: ::std::option::Option::None,
|
142 - | encoding_type: ::std::option::Option::None,
|
143 - | key_count: ::std::option::Option::None,
|
144 - | continuation_token: ::std::option::Option::None,
|
145 - | next_continuation_token: ::std::option::Option::None,
|
146 - | start_after: ::std::option::Option::None,
|
147 - | };
|
148 - | Ok(response)
|
149 - | };
|
150 - | sender.send(()).await.expect("receiver dropped early");
|
151 - | result
|
152 - | }
|
153 - | })
|
154 - | .build_unchecked();
|
155 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
156 - | .await
|
157 - | .expect("unable to make an HTTP request");
|
158 - | assert!(receiver.recv().await.is_some());
|
159 - | }
|
160 - | /// S3 clients should support the explicit path addressing style.
|
161 - | /// Test ID: S3PathAddressing
|
162 - | #[::tokio::test]
|
163 - | #[should_panic]
|
164 - | async fn s3_path_addressing_request() {
|
165 - | #[allow(unused_mut)]
|
166 - | let mut http_request = http::Request::builder()
|
167 - | .uri("/mybucket")
|
168 - | .method("GET")
|
169 - | .body(::aws_smithy_http_server::body::Body::from(
|
170 - | ::bytes::Bytes::from_static("".as_bytes()),
|
171 - | ))
|
172 - | .unwrap();
|
173 - | *http_request.uri_mut() = "/mybucket?list-type=2".parse().unwrap();
|
174 - | todo!("endpoint trait not supported yet");
|
175 - | #[allow(unused_mut)]
|
176 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
177 - | let config = crate::service::AmazonS3Config::builder().build();
|
178 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
179 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
180 - | let sender = sender.clone();
|
181 - | async move {
|
182 - | let result = {
|
183 - | let expected = crate::input::ListObjectsV2Input {
|
184 - | bucket: "mybucket".to_owned(),
|
185 - | delimiter: ::std::option::Option::None,
|
186 - | encoding_type: ::std::option::Option::None,
|
187 - | max_keys: ::std::option::Option::None,
|
188 - | prefix: ::std::option::Option::None,
|
189 - | continuation_token: ::std::option::Option::None,
|
190 - | fetch_owner: ::std::option::Option::None,
|
191 - | start_after: ::std::option::Option::None,
|
192 - | request_payer: ::std::option::Option::None,
|
193 - | expected_bucket_owner: ::std::option::Option::None,
|
194 - | };
|
195 - | ::pretty_assertions::assert_eq!(input, expected);
|
196 - | let response = crate::output::ListObjectsV2Output {
|
197 - | is_truncated: ::std::option::Option::None,
|
198 - | contents: ::std::option::Option::None,
|
199 - | name: ::std::option::Option::None,
|
200 - | prefix: ::std::option::Option::None,
|
201 - | delimiter: ::std::option::Option::None,
|
202 - | max_keys: ::std::option::Option::None,
|
203 - | common_prefixes: ::std::option::Option::None,
|
204 - | encoding_type: ::std::option::Option::None,
|
205 - | key_count: ::std::option::Option::None,
|
206 - | continuation_token: ::std::option::Option::None,
|
207 - | next_continuation_token: ::std::option::Option::None,
|
208 - | start_after: ::std::option::Option::None,
|
209 - | };
|
210 - | Ok(response)
|
211 - | };
|
212 - | sender.send(()).await.expect("receiver dropped early");
|
213 - | result
|
214 - | }
|
215 - | })
|
216 - | .build_unchecked();
|
217 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
218 - | .await
|
219 - | .expect("unable to make an HTTP request");
|
220 - | assert!(receiver.recv().await.is_some());
|
221 - | }
|
222 - | /// S3 clients should support the explicit virtual host
|
223 - | /// addressing style with Dualstack.
|
224 - | /// Test ID: S3VirtualHostDualstackAddressing
|
225 - | #[::tokio::test]
|
226 - | #[should_panic]
|
227 - | async fn s3_virtual_host_dualstack_addressing_request() {
|
228 - | #[allow(unused_mut)]
|
229 - | let mut http_request = http::Request::builder()
|
230 - | .uri("/")
|
231 - | .method("GET")
|
232 - | .body(::aws_smithy_http_server::body::Body::from(
|
233 - | ::bytes::Bytes::from_static("".as_bytes()),
|
234 - | ))
|
235 - | .unwrap();
|
236 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
237 - | todo!("endpoint trait not supported yet");
|
238 - | #[allow(unused_mut)]
|
239 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
240 - | let config = crate::service::AmazonS3Config::builder().build();
|
241 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
242 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
243 - | let sender = sender.clone();
|
244 - | async move {
|
245 - | let result = {
|
246 - | let expected = crate::input::ListObjectsV2Input {
|
247 - | bucket: "mybucket".to_owned(),
|
248 - | delimiter: ::std::option::Option::None,
|
249 - | encoding_type: ::std::option::Option::None,
|
250 - | max_keys: ::std::option::Option::None,
|
251 - | prefix: ::std::option::Option::None,
|
252 - | continuation_token: ::std::option::Option::None,
|
253 - | fetch_owner: ::std::option::Option::None,
|
254 - | start_after: ::std::option::Option::None,
|
255 - | request_payer: ::std::option::Option::None,
|
256 - | expected_bucket_owner: ::std::option::Option::None,
|
257 - | };
|
258 - | ::pretty_assertions::assert_eq!(input, expected);
|
259 - | let response = crate::output::ListObjectsV2Output {
|
260 - | is_truncated: ::std::option::Option::None,
|
261 - | contents: ::std::option::Option::None,
|
262 - | name: ::std::option::Option::None,
|
263 - | prefix: ::std::option::Option::None,
|
264 - | delimiter: ::std::option::Option::None,
|
265 - | max_keys: ::std::option::Option::None,
|
266 - | common_prefixes: ::std::option::Option::None,
|
267 - | encoding_type: ::std::option::Option::None,
|
268 - | key_count: ::std::option::Option::None,
|
269 - | continuation_token: ::std::option::Option::None,
|
270 - | next_continuation_token: ::std::option::Option::None,
|
271 - | start_after: ::std::option::Option::None,
|
272 - | };
|
273 - | Ok(response)
|
274 - | };
|
275 - | sender.send(()).await.expect("receiver dropped early");
|
276 - | result
|
277 - | }
|
278 - | })
|
279 - | .build_unchecked();
|
280 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
281 - | .await
|
282 - | .expect("unable to make an HTTP request");
|
283 - | assert!(receiver.recv().await.is_some());
|
284 - | }
|
285 - | /// S3 clients should support the explicit virtual host
|
286 - | /// addressing style with S3 Accelerate.
|
287 - | /// Test ID: S3VirtualHostAccelerateAddressing
|
288 - | #[::tokio::test]
|
289 - | #[should_panic]
|
290 - | async fn s3_virtual_host_accelerate_addressing_request() {
|
291 - | #[allow(unused_mut)]
|
292 - | let mut http_request = http::Request::builder()
|
293 - | .uri("/")
|
294 - | .method("GET")
|
295 - | .body(::aws_smithy_http_server::body::Body::from(
|
296 - | ::bytes::Bytes::from_static("".as_bytes()),
|
297 - | ))
|
298 - | .unwrap();
|
299 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
300 - | todo!("endpoint trait not supported yet");
|
301 - | #[allow(unused_mut)]
|
302 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
303 - | let config = crate::service::AmazonS3Config::builder().build();
|
304 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
305 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
306 - | let sender = sender.clone();
|
307 - | async move {
|
308 - | let result = {
|
309 - | let expected = crate::input::ListObjectsV2Input {
|
310 - | bucket: "mybucket".to_owned(),
|
311 - | delimiter: ::std::option::Option::None,
|
312 - | encoding_type: ::std::option::Option::None,
|
313 - | max_keys: ::std::option::Option::None,
|
314 - | prefix: ::std::option::Option::None,
|
315 - | continuation_token: ::std::option::Option::None,
|
316 - | fetch_owner: ::std::option::Option::None,
|
317 - | start_after: ::std::option::Option::None,
|
318 - | request_payer: ::std::option::Option::None,
|
319 - | expected_bucket_owner: ::std::option::Option::None,
|
320 - | };
|
321 - | ::pretty_assertions::assert_eq!(input, expected);
|
322 - | let response = crate::output::ListObjectsV2Output {
|
323 - | is_truncated: ::std::option::Option::None,
|
324 - | contents: ::std::option::Option::None,
|
325 - | name: ::std::option::Option::None,
|
326 - | prefix: ::std::option::Option::None,
|
327 - | delimiter: ::std::option::Option::None,
|
328 - | max_keys: ::std::option::Option::None,
|
329 - | common_prefixes: ::std::option::Option::None,
|
330 - | encoding_type: ::std::option::Option::None,
|
331 - | key_count: ::std::option::Option::None,
|
332 - | continuation_token: ::std::option::Option::None,
|
333 - | next_continuation_token: ::std::option::Option::None,
|
334 - | start_after: ::std::option::Option::None,
|
335 - | };
|
336 - | Ok(response)
|
337 - | };
|
338 - | sender.send(()).await.expect("receiver dropped early");
|
339 - | result
|
340 - | }
|
341 - | })
|
342 - | .build_unchecked();
|
343 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
344 - | .await
|
345 - | .expect("unable to make an HTTP request");
|
346 - | assert!(receiver.recv().await.is_some());
|
347 - | }
|
348 - | /// S3 clients should support the explicit virtual host
|
349 - | /// addressing style with Dualstack and S3 Accelerate.
|
350 - | /// Test ID: S3VirtualHostDualstackAccelerateAddressing
|
351 - | #[::tokio::test]
|
352 - | #[should_panic]
|
353 - | async fn s3_virtual_host_dualstack_accelerate_addressing_request() {
|
354 - | #[allow(unused_mut)]
|
355 - | let mut http_request = http::Request::builder()
|
356 - | .uri("/")
|
357 - | .method("GET")
|
358 - | .body(::aws_smithy_http_server::body::Body::from(
|
359 - | ::bytes::Bytes::from_static("".as_bytes()),
|
360 - | ))
|
361 - | .unwrap();
|
362 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
363 - | todo!("endpoint trait not supported yet");
|
364 - | #[allow(unused_mut)]
|
365 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
366 - | let config = crate::service::AmazonS3Config::builder().build();
|
367 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
368 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
369 - | let sender = sender.clone();
|
370 - | async move {
|
371 - | let result = {
|
372 - | let expected = crate::input::ListObjectsV2Input {
|
373 - | bucket: "mybucket".to_owned(),
|
374 - | delimiter: ::std::option::Option::None,
|
375 - | encoding_type: ::std::option::Option::None,
|
376 - | max_keys: ::std::option::Option::None,
|
377 - | prefix: ::std::option::Option::None,
|
378 - | continuation_token: ::std::option::Option::None,
|
379 - | fetch_owner: ::std::option::Option::None,
|
380 - | start_after: ::std::option::Option::None,
|
381 - | request_payer: ::std::option::Option::None,
|
382 - | expected_bucket_owner: ::std::option::Option::None,
|
383 - | };
|
384 - | ::pretty_assertions::assert_eq!(input, expected);
|
385 - | let response = crate::output::ListObjectsV2Output {
|
386 - | is_truncated: ::std::option::Option::None,
|
387 - | contents: ::std::option::Option::None,
|
388 - | name: ::std::option::Option::None,
|
389 - | prefix: ::std::option::Option::None,
|
390 - | delimiter: ::std::option::Option::None,
|
391 - | max_keys: ::std::option::Option::None,
|
392 - | common_prefixes: ::std::option::Option::None,
|
393 - | encoding_type: ::std::option::Option::None,
|
394 - | key_count: ::std::option::Option::None,
|
395 - | continuation_token: ::std::option::Option::None,
|
396 - | next_continuation_token: ::std::option::Option::None,
|
397 - | start_after: ::std::option::Option::None,
|
398 - | };
|
399 - | Ok(response)
|
400 - | };
|
401 - | sender.send(()).await.expect("receiver dropped early");
|
402 - | result
|
403 - | }
|
404 - | })
|
405 - | .build_unchecked();
|
406 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
407 - | .await
|
408 - | .expect("unable to make an HTTP request");
|
409 - | assert!(receiver.recv().await.is_some());
|
410 - | }
|
411 - | /// S3 clients should resolve to the addressing style of the
|
412 - | /// operation if defined on both the client and operation.
|
413 - | /// Test ID: S3OperationAddressingPreferred
|
414 - | #[::tokio::test]
|
415 - | #[should_panic]
|
416 - | async fn s3_operation_addressing_preferred_request() {
|
417 - | #[allow(unused_mut)]
|
418 - | let mut http_request = http::Request::builder()
|
419 - | .uri("/")
|
420 - | .method("GET")
|
421 - | .body(::aws_smithy_http_server::body::Body::from(
|
422 - | ::bytes::Bytes::from_static("".as_bytes()),
|
423 - | ))
|
424 - | .unwrap();
|
425 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
426 - | todo!("endpoint trait not supported yet");
|
427 - | #[allow(unused_mut)]
|
428 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
429 - | let config = crate::service::AmazonS3Config::builder().build();
|
430 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
431 - | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
432 - | let sender = sender.clone();
|
433 - | async move {
|
434 - | let result = {
|
435 - | let expected = crate::input::ListObjectsV2Input {
|
436 - | bucket: "mybucket".to_owned(),
|
437 - | delimiter: ::std::option::Option::None,
|
438 - | encoding_type: ::std::option::Option::None,
|
439 - | max_keys: ::std::option::Option::None,
|
440 - | prefix: ::std::option::Option::None,
|
441 - | continuation_token: ::std::option::Option::None,
|
442 - | fetch_owner: ::std::option::Option::None,
|
443 - | start_after: ::std::option::Option::None,
|
444 - | request_payer: ::std::option::Option::None,
|
445 - | expected_bucket_owner: ::std::option::Option::None,
|
446 - | };
|
447 - | ::pretty_assertions::assert_eq!(input, expected);
|
448 - | let response = crate::output::ListObjectsV2Output {
|
449 - | is_truncated: ::std::option::Option::None,
|
450 - | contents: ::std::option::Option::None,
|
451 - | name: ::std::option::Option::None,
|
452 - | prefix: ::std::option::Option::None,
|
453 - | delimiter: ::std::option::Option::None,
|
454 - | max_keys: ::std::option::Option::None,
|
455 - | common_prefixes: ::std::option::Option::None,
|
456 - | encoding_type: ::std::option::Option::None,
|
457 - | key_count: ::std::option::Option::None,
|
458 - | continuation_token: ::std::option::Option::None,
|
459 - | next_continuation_token: ::std::option::Option::None,
|
460 - | start_after: ::std::option::Option::None,
|
461 - | };
|
462 - | Ok(response)
|
463 - | };
|
464 - | sender.send(()).await.expect("receiver dropped early");
|
465 - | result
|
466 - | }
|
467 - | })
|
468 - | .build_unchecked();
|
469 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
470 - | .await
|
471 - | .expect("unable to make an HTTP request");
|
472 - | assert!(receiver.recv().await.is_some());
|
473 - | }
|
474 - | /// S3 operations return Error XML nodes unwrapped by
|
475 - | /// the ErrorResponse XML node.
|
476 - | ///
|
477 - | /// Test ID: S3OperationNoErrorWrappingResponse
|
478 - | #[::tokio::test]
|
479 - | #[should_panic]
|
480 - | async fn s3_operation_no_error_wrapping_response_response() {
|
481 - | let output = crate::error::NoSuchBucket {};
|
482 - | let output = crate::error::ListObjectsV2Error::NoSuchBucket(output);
|
483 - | use ::aws_smithy_http_server::response::IntoResponse;
|
484 - | let http_response = output.into_response();
|
485 - | ::pretty_assertions::assert_eq!(
|
486 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
487 - | http_response.status()
|
488 - | );
|
489 - | let expected_headers = [("Content-Type", "application/xml")];
|
490 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
491 - | http_response.headers(),
|
492 - | expected_headers,
|
493 - | ));
|
494 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
495 - | .await
|
496 - | .expect("unable to extract body to bytes");
|
497 - | ::aws_smithy_protocol_test::assert_ok(
|
498 - | ::aws_smithy_protocol_test::validate_body(&body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error>\n\t<Type>Sender</Type>\n\t<Code>NoSuchBucket</Code>\n</Error>", ::aws_smithy_protocol_test::MediaType::from("application/xml"))
|
499 - | );
|
500 - | }
|
501 - | }
|
502 2 |
|
503 3 | ::pin_project_lite::pin_project! {
|
504 4 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
505 5 | /// [`GetObjectInput`](crate::input::GetObjectInput) using modelled bindings.
|
506 6 | pub struct GetObjectInputFuture {
|
507 7 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GetObjectInput, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
508 8 | }
|
509 9 | }
|
510 10 |
|
511 11 | impl std::future::Future for GetObjectInputFuture {
|
625 125 | ) -> std::task::Poll<Self::Output> {
|
626 126 | let this = self.project();
|
627 127 | this.inner.as_mut().poll(cx)
|
628 128 | }
|
629 129 | }
|
630 130 |
|
631 131 | impl<B>
|
632 132 | ::aws_smithy_http_server::request::FromRequest<
|
633 133 | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
634 134 | B,
|
635 - | > for crate::input::DeleteObjectTaggingInput
|
135 + | > for crate::input::DeleteObjectTaggingInput
|
136 + | where
|
137 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
138 + | B: 'static,
|
139 + |
|
140 + | B::Data: Send,
|
141 + | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
142 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
143 + | {
|
144 + | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
145 + | type Future = DeleteObjectTaggingInputFuture;
|
146 + |
|
147 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
148 + | let fut = async move {
|
149 + | crate::protocol_serde::shape_delete_object_tagging::de_delete_object_tagging_http_request(request)
|
150 + | .await
|
151 + | .map_err(Into::into)
|
152 + | };
|
153 + | use ::futures_util::future::TryFutureExt;
|
154 + | let fut = fut.map_err(
|
155 + | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
156 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
157 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
158 + | },
|
159 + | );
|
160 + | DeleteObjectTaggingInputFuture {
|
161 + | inner: Box::pin(fut),
|
162 + | }
|
163 + | }
|
164 + | }
|
165 + | impl
|
166 + | ::aws_smithy_http_server::response::IntoResponse<
|
167 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
168 + | > for crate::output::DeleteObjectTaggingOutput
|
169 + | {
|
170 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
171 + | match crate::protocol_serde::shape_delete_object_tagging::ser_delete_object_tagging_http_response(self) {
|
172 + | Ok(response) => response,
|
173 + | Err(e) => {
|
174 + | ::tracing::error!(error = %e, "failed to serialize response");
|
175 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_xml::RestXml>::into_response(::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e))
|
176 + | }
|
177 + | }
|
178 + | }
|
179 + | }
|
180 + | impl
|
181 + | ::aws_smithy_http_server::response::IntoResponse<
|
182 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
183 + | > for crate::error::DeleteObjectTaggingError
|
184 + | {
|
185 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
186 + | match crate::protocol_serde::shape_delete_object_tagging::ser_delete_object_tagging_http_error(&self) {
|
187 + | Ok(mut response) => {
|
188 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
189 + | response
|
190 + | },
|
191 + | Err(e) => {
|
192 + | ::tracing::error!(error = %e, "failed to serialize response");
|
193 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_xml::RestXml>::into_response(::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e))
|
194 + | }
|
195 + | }
|
196 + | }
|
197 + | }
|
198 + |
|
199 + | static CONTENT_TYPE_GETBUCKETLOCATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
200 + | ::once_cell::sync::Lazy::new(|| {
|
201 + | "application/xml"
|
202 + | .parse::<::mime::Mime>()
|
203 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
204 + | });
|
205 + | ::pin_project_lite::pin_project! {
|
206 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
207 + | /// [`GetBucketLocationInput`](crate::input::GetBucketLocationInput) using modelled bindings.
|
208 + | pub struct GetBucketLocationInputFuture {
|
209 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GetBucketLocationInput, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
210 + | }
|
211 + | }
|
212 + |
|
213 + | impl std::future::Future for GetBucketLocationInputFuture {
|
214 + | type Output = Result<
|
215 + | crate::input::GetBucketLocationInput,
|
216 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
217 + | >;
|
218 + |
|
219 + | fn poll(
|
220 + | self: std::pin::Pin<&mut Self>,
|
221 + | cx: &mut std::task::Context<'_>,
|
222 + | ) -> std::task::Poll<Self::Output> {
|
223 + | let this = self.project();
|
224 + | this.inner.as_mut().poll(cx)
|
225 + | }
|
226 + | }
|
227 + |
|
228 + | impl<B>
|
229 + | ::aws_smithy_http_server::request::FromRequest<
|
230 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
231 + | B,
|
232 + | > for crate::input::GetBucketLocationInput
|
636 233 | where
|
637 234 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
638 235 | B: 'static,
|
639 236 |
|
640 237 | B::Data: Send,
|
641 238 | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
642 239 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
643 240 | {
|
644 241 | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
645 - | type Future = DeleteObjectTaggingInputFuture;
|
242 + | type Future = GetBucketLocationInputFuture;
|
646 243 |
|
647 244 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
648 245 | let fut = async move {
|
649 - | crate::protocol_serde::shape_delete_object_tagging::de_delete_object_tagging_http_request(request)
|
246 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
247 + | request.headers(),
|
248 + | &CONTENT_TYPE_GETBUCKETLOCATION,
|
249 + | ) {
|
250 + | return Err(::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection::NotAcceptable);
|
251 + | }
|
252 + | crate::protocol_serde::shape_get_bucket_location::de_get_bucket_location_http_request(
|
253 + | request,
|
254 + | )
|
650 255 | .await
|
651 256 | .map_err(Into::into)
|
652 257 | };
|
653 258 | use ::futures_util::future::TryFutureExt;
|
654 259 | let fut = fut.map_err(
|
655 260 | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
656 261 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
657 262 | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
658 263 | },
|
659 264 | );
|
660 - | DeleteObjectTaggingInputFuture {
|
265 + | GetBucketLocationInputFuture {
|
661 266 | inner: Box::pin(fut),
|
662 267 | }
|
663 268 | }
|
664 269 | }
|
665 270 | impl
|
666 271 | ::aws_smithy_http_server::response::IntoResponse<
|
667 272 | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
668 - | > for crate::output::DeleteObjectTaggingOutput
|
273 + | > for crate::output::GetBucketLocationOutput
|
669 274 | {
|
670 275 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
671 - | match crate::protocol_serde::shape_delete_object_tagging::ser_delete_object_tagging_http_response(self) {
|
276 + | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_response(self) {
|
672 277 | Ok(response) => response,
|
673 278 | Err(e) => {
|
674 279 | ::tracing::error!(error = %e, "failed to serialize response");
|
675 280 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_xml::RestXml>::into_response(::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e))
|
676 281 | }
|
677 282 | }
|
678 283 | }
|
679 284 | }
|
680 285 | impl
|
681 286 | ::aws_smithy_http_server::response::IntoResponse<
|
682 287 | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
683 - | > for crate::error::DeleteObjectTaggingError
|
288 + | > for crate::error::GetBucketLocationError
|
684 289 | {
|
685 290 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
686 - | match crate::protocol_serde::shape_delete_object_tagging::ser_delete_object_tagging_http_error(&self) {
|
291 + | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_error(
|
292 + | &self,
|
293 + | ) {
|
687 294 | Ok(mut response) => {
|
688 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
295 + | response.extensions_mut().insert(
|
296 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
297 + | );
|
689 298 | response
|
690 - | },
|
299 + | }
|
691 300 | Err(e) => {
|
692 301 | ::tracing::error!(error = %e, "failed to serialize response");
|
693 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_xml::RestXml>::into_response(::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e))
|
302 + | ::aws_smithy_http_server::response::IntoResponse::<
|
303 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
304 + | >::into_response(
|
305 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
306 + | e,
|
307 + | ),
|
308 + | )
|
694 309 | }
|
695 310 | }
|
696 311 | }
|
697 312 | }
|
698 313 |
|
699 - | static CONTENT_TYPE_GETBUCKETLOCATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
314 + | #[allow(unreachable_code, unused_variables)]
|
315 + | #[cfg(test)]
|
316 + | mod get_bucket_location_test {
|
317 + |
|
318 + | /// S3 clients should use the @s3UnwrappedXmlOutput trait to determine
|
319 + | /// that the response shape is not wrapped in a restxml operation-level XML node.
|
320 + | ///
|
321 + | /// Test ID: GetBucketLocationUnwrappedOutput
|
322 + | #[::tokio::test]
|
323 + | #[::tracing_test::traced_test]
|
324 + | #[should_panic]
|
325 + | async fn get_bucket_location_unwrapped_output_response() {
|
326 + | let output = crate::output::GetBucketLocationOutput {
|
327 + | location_constraint: ::std::option::Option::Some(
|
328 + | "us-west-2"
|
329 + | .parse::<crate::model::BucketLocationConstraint>()
|
330 + | .expect("static value validated to member"),
|
331 + | ),
|
332 + | };
|
333 + | use ::aws_smithy_http_server::response::IntoResponse;
|
334 + | let http_response = output.into_response();
|
335 + | ::pretty_assertions::assert_eq!(
|
336 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
337 + | http_response.status()
|
338 + | );
|
339 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
340 + | .await
|
341 + | .expect("unable to extract body to bytes");
|
342 + | ::aws_smithy_protocol_test::assert_ok(
|
343 + | ::aws_smithy_protocol_test::validate_body(&body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LocationConstraint xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">us-west-2</LocationConstraint>", ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
344 + | );
|
345 + | }
|
346 + | }
|
347 + |
|
348 + | static CONTENT_TYPE_LISTOBJECTSV2: ::once_cell::sync::Lazy<::mime::Mime> =
|
700 349 | ::once_cell::sync::Lazy::new(|| {
|
701 350 | "application/xml"
|
702 351 | .parse::<::mime::Mime>()
|
703 352 | .expect("BUG: MIME parsing failed, content_type is not valid")
|
704 353 | });
|
705 354 | ::pin_project_lite::pin_project! {
|
706 355 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
707 - | /// [`GetBucketLocationInput`](crate::input::GetBucketLocationInput) using modelled bindings.
|
708 - | pub struct GetBucketLocationInputFuture {
|
709 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GetBucketLocationInput, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
356 + | /// [`ListObjectsV2Input`](crate::input::ListObjectsV2Input) using modelled bindings.
|
357 + | pub struct ListObjectsV2InputFuture {
|
358 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ListObjectsV2Input, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
710 359 | }
|
711 360 | }
|
712 361 |
|
713 - | impl std::future::Future for GetBucketLocationInputFuture {
|
362 + | impl std::future::Future for ListObjectsV2InputFuture {
|
714 363 | type Output = Result<
|
715 - | crate::input::GetBucketLocationInput,
|
364 + | crate::input::ListObjectsV2Input,
|
716 365 | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
717 366 | >;
|
718 367 |
|
719 368 | fn poll(
|
720 369 | self: std::pin::Pin<&mut Self>,
|
721 370 | cx: &mut std::task::Context<'_>,
|
722 371 | ) -> std::task::Poll<Self::Output> {
|
723 372 | let this = self.project();
|
724 373 | this.inner.as_mut().poll(cx)
|
725 374 | }
|
726 375 | }
|
727 376 |
|
728 377 | impl<B>
|
729 378 | ::aws_smithy_http_server::request::FromRequest<
|
730 379 | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
731 380 | B,
|
732 - | > for crate::input::GetBucketLocationInput
|
381 + | > for crate::input::ListObjectsV2Input
|
733 382 | where
|
734 383 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
735 384 | B: 'static,
|
736 385 |
|
737 386 | B::Data: Send,
|
738 387 | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
739 388 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
740 389 | {
|
741 390 | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
742 - | type Future = GetBucketLocationInputFuture;
|
391 + | type Future = ListObjectsV2InputFuture;
|
743 392 |
|
744 393 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
745 394 | let fut = async move {
|
746 395 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
747 396 | request.headers(),
|
748 - | &CONTENT_TYPE_GETBUCKETLOCATION,
|
397 + | &CONTENT_TYPE_LISTOBJECTSV2,
|
749 398 | ) {
|
750 399 | return Err(::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection::NotAcceptable);
|
751 400 | }
|
752 - | crate::protocol_serde::shape_get_bucket_location::de_get_bucket_location_http_request(
|
753 - | request,
|
754 - | )
|
401 + | crate::protocol_serde::shape_list_objects_v2::de_list_objects_v2_http_request(request)
|
402 + | .await
|
403 + | .map_err(Into::into)
|
404 + | };
|
405 + | use ::futures_util::future::TryFutureExt;
|
406 + | let fut = fut.map_err(
|
407 + | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
408 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
409 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
410 + | },
|
411 + | );
|
412 + | ListObjectsV2InputFuture {
|
413 + | inner: Box::pin(fut),
|
414 + | }
|
415 + | }
|
416 + | }
|
417 + | impl
|
418 + | ::aws_smithy_http_server::response::IntoResponse<
|
419 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
420 + | > for crate::output::ListObjectsV2Output
|
421 + | {
|
422 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
423 + | match crate::protocol_serde::shape_list_objects_v2::ser_list_objects_v2_http_response(self)
|
424 + | {
|
425 + | Ok(response) => response,
|
426 + | Err(e) => {
|
427 + | ::tracing::error!(error = %e, "failed to serialize response");
|
428 + | ::aws_smithy_http_server::response::IntoResponse::<
|
429 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
430 + | >::into_response(
|
431 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
432 + | e,
|
433 + | ),
|
434 + | )
|
435 + | }
|
436 + | }
|
437 + | }
|
438 + | }
|
439 + | impl
|
440 + | ::aws_smithy_http_server::response::IntoResponse<
|
441 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
442 + | > for crate::error::ListObjectsV2Error
|
443 + | {
|
444 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
445 + | match crate::protocol_serde::shape_list_objects_v2::ser_list_objects_v2_http_error(&self) {
|
446 + | Ok(mut response) => {
|
447 + | response.extensions_mut().insert(
|
448 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
449 + | );
|
450 + | response
|
451 + | }
|
452 + | Err(e) => {
|
453 + | ::tracing::error!(error = %e, "failed to serialize response");
|
454 + | ::aws_smithy_http_server::response::IntoResponse::<
|
455 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
456 + | >::into_response(
|
457 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
458 + | e,
|
459 + | ),
|
460 + | )
|
461 + | }
|
462 + | }
|
463 + | }
|
464 + | }
|
465 + |
|
466 + | #[allow(unreachable_code, unused_variables)]
|
467 + | #[cfg(test)]
|
468 + | mod list_objects_v2_test {
|
469 + |
|
470 + | /// S3 clients should map the default addressing style to virtual host.
|
471 + | /// Test ID: S3DefaultAddressing
|
472 + | #[::tokio::test]
|
473 + | #[::tracing_test::traced_test]
|
474 + | #[should_panic]
|
475 + | async fn s3_default_addressing_request() {
|
476 + | #[allow(unused_mut)]
|
477 + | let mut http_request = http::Request::builder()
|
478 + | .uri("/")
|
479 + | .method("GET")
|
480 + | .body(::aws_smithy_http_server::body::Body::from(
|
481 + | ::bytes::Bytes::from_static("".as_bytes()),
|
482 + | ))
|
483 + | .unwrap();
|
484 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
485 + | todo!("endpoint trait not supported yet");
|
486 + | #[allow(unused_mut)]
|
487 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
488 + | let config = crate::service::AmazonS3Config::builder().build();
|
489 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
490 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
491 + | let sender = sender.clone();
|
492 + | async move {
|
493 + | let result = {
|
494 + | let expected = crate::input::ListObjectsV2Input {
|
495 + | bucket: "mybucket".to_owned(),
|
496 + | delimiter: ::std::option::Option::None,
|
497 + | encoding_type: ::std::option::Option::None,
|
498 + | max_keys: ::std::option::Option::None,
|
499 + | prefix: ::std::option::Option::None,
|
500 + | continuation_token: ::std::option::Option::None,
|
501 + | fetch_owner: ::std::option::Option::None,
|
502 + | start_after: ::std::option::Option::None,
|
503 + | request_payer: ::std::option::Option::None,
|
504 + | expected_bucket_owner: ::std::option::Option::None,
|
505 + | };
|
506 + | ::pretty_assertions::assert_eq!(input, expected);
|
507 + | let response = crate::output::ListObjectsV2Output {
|
508 + | is_truncated: ::std::option::Option::None,
|
509 + | contents: ::std::option::Option::None,
|
510 + | name: ::std::option::Option::None,
|
511 + | prefix: ::std::option::Option::None,
|
512 + | delimiter: ::std::option::Option::None,
|
513 + | max_keys: ::std::option::Option::None,
|
514 + | common_prefixes: ::std::option::Option::None,
|
515 + | encoding_type: ::std::option::Option::None,
|
516 + | key_count: ::std::option::Option::None,
|
517 + | continuation_token: ::std::option::Option::None,
|
518 + | next_continuation_token: ::std::option::Option::None,
|
519 + | start_after: ::std::option::Option::None,
|
520 + | };
|
521 + | Ok(response)
|
522 + | };
|
523 + | sender.send(()).await.expect("receiver dropped early");
|
524 + | result
|
525 + | }
|
526 + | })
|
527 + | .build_unchecked();
|
528 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
529 + | .await
|
530 + | .expect("unable to make an HTTP request");
|
531 + | assert!(
|
532 + | receiver.recv().await.is_some(),
|
533 + | "we expected operation handler to be invoked but it was not entered"
|
534 + | );
|
535 + | }
|
536 + | /// S3 clients should support the explicit virtual host addressing style.
|
537 + | /// Test ID: S3VirtualHostAddressing
|
538 + | #[::tokio::test]
|
539 + | #[::tracing_test::traced_test]
|
540 + | #[should_panic]
|
541 + | async fn s3_virtual_host_addressing_request() {
|
542 + | #[allow(unused_mut)]
|
543 + | let mut http_request = http::Request::builder()
|
544 + | .uri("/")
|
545 + | .method("GET")
|
546 + | .body(::aws_smithy_http_server::body::Body::from(
|
547 + | ::bytes::Bytes::from_static("".as_bytes()),
|
548 + | ))
|
549 + | .unwrap();
|
550 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
551 + | todo!("endpoint trait not supported yet");
|
552 + | #[allow(unused_mut)]
|
553 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
554 + | let config = crate::service::AmazonS3Config::builder().build();
|
555 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
556 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
557 + | let sender = sender.clone();
|
558 + | async move {
|
559 + | let result = {
|
560 + | let expected = crate::input::ListObjectsV2Input {
|
561 + | bucket: "mybucket".to_owned(),
|
562 + | delimiter: ::std::option::Option::None,
|
563 + | encoding_type: ::std::option::Option::None,
|
564 + | max_keys: ::std::option::Option::None,
|
565 + | prefix: ::std::option::Option::None,
|
566 + | continuation_token: ::std::option::Option::None,
|
567 + | fetch_owner: ::std::option::Option::None,
|
568 + | start_after: ::std::option::Option::None,
|
569 + | request_payer: ::std::option::Option::None,
|
570 + | expected_bucket_owner: ::std::option::Option::None,
|
571 + | };
|
572 + | ::pretty_assertions::assert_eq!(input, expected);
|
573 + | let response = crate::output::ListObjectsV2Output {
|
574 + | is_truncated: ::std::option::Option::None,
|
575 + | contents: ::std::option::Option::None,
|
576 + | name: ::std::option::Option::None,
|
577 + | prefix: ::std::option::Option::None,
|
578 + | delimiter: ::std::option::Option::None,
|
579 + | max_keys: ::std::option::Option::None,
|
580 + | common_prefixes: ::std::option::Option::None,
|
581 + | encoding_type: ::std::option::Option::None,
|
582 + | key_count: ::std::option::Option::None,
|
583 + | continuation_token: ::std::option::Option::None,
|
584 + | next_continuation_token: ::std::option::Option::None,
|
585 + | start_after: ::std::option::Option::None,
|
586 + | };
|
587 + | Ok(response)
|
588 + | };
|
589 + | sender.send(()).await.expect("receiver dropped early");
|
590 + | result
|
591 + | }
|
592 + | })
|
593 + | .build_unchecked();
|
594 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
755 595 | .await
|
756 - | .map_err(Into::into)
|
757 - | };
|
758 - | use ::futures_util::future::TryFutureExt;
|
759 - | let fut = fut.map_err(
|
760 - | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
761 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
762 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
763 - | },
|
596 + | .expect("unable to make an HTTP request");
|
597 + | assert!(
|
598 + | receiver.recv().await.is_some(),
|
599 + | "we expected operation handler to be invoked but it was not entered"
|
764 600 | );
|
765 - | GetBucketLocationInputFuture {
|
766 - | inner: Box::pin(fut),
|
767 - | }
|
768 - | }
|
769 - | }
|
770 - | impl
|
771 - | ::aws_smithy_http_server::response::IntoResponse<
|
772 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
773 - | > for crate::output::GetBucketLocationOutput
|
774 - | {
|
775 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
776 - | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_response(self) {
|
777 - | Ok(response) => response,
|
778 - | Err(e) => {
|
779 - | ::tracing::error!(error = %e, "failed to serialize response");
|
780 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_xml::RestXml>::into_response(::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e))
|
781 - | }
|
782 601 | }
|
602 + | /// S3 clients should support the explicit path addressing style.
|
603 + | /// Test ID: S3PathAddressing
|
604 + | #[::tokio::test]
|
605 + | #[::tracing_test::traced_test]
|
606 + | #[should_panic]
|
607 + | async fn s3_path_addressing_request() {
|
608 + | #[allow(unused_mut)]
|
609 + | let mut http_request = http::Request::builder()
|
610 + | .uri("/mybucket")
|
611 + | .method("GET")
|
612 + | .body(::aws_smithy_http_server::body::Body::from(
|
613 + | ::bytes::Bytes::from_static("".as_bytes()),
|
614 + | ))
|
615 + | .unwrap();
|
616 + | *http_request.uri_mut() = "/mybucket?list-type=2".parse().unwrap();
|
617 + | todo!("endpoint trait not supported yet");
|
618 + | #[allow(unused_mut)]
|
619 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
620 + | let config = crate::service::AmazonS3Config::builder().build();
|
621 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
622 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
623 + | let sender = sender.clone();
|
624 + | async move {
|
625 + | let result = {
|
626 + | let expected = crate::input::ListObjectsV2Input {
|
627 + | bucket: "mybucket".to_owned(),
|
628 + | delimiter: ::std::option::Option::None,
|
629 + | encoding_type: ::std::option::Option::None,
|
630 + | max_keys: ::std::option::Option::None,
|
631 + | prefix: ::std::option::Option::None,
|
632 + | continuation_token: ::std::option::Option::None,
|
633 + | fetch_owner: ::std::option::Option::None,
|
634 + | start_after: ::std::option::Option::None,
|
635 + | request_payer: ::std::option::Option::None,
|
636 + | expected_bucket_owner: ::std::option::Option::None,
|
637 + | };
|
638 + | ::pretty_assertions::assert_eq!(input, expected);
|
639 + | let response = crate::output::ListObjectsV2Output {
|
640 + | is_truncated: ::std::option::Option::None,
|
641 + | contents: ::std::option::Option::None,
|
642 + | name: ::std::option::Option::None,
|
643 + | prefix: ::std::option::Option::None,
|
644 + | delimiter: ::std::option::Option::None,
|
645 + | max_keys: ::std::option::Option::None,
|
646 + | common_prefixes: ::std::option::Option::None,
|
647 + | encoding_type: ::std::option::Option::None,
|
648 + | key_count: ::std::option::Option::None,
|
649 + | continuation_token: ::std::option::Option::None,
|
650 + | next_continuation_token: ::std::option::Option::None,
|
651 + | start_after: ::std::option::Option::None,
|
652 + | };
|
653 + | Ok(response)
|
654 + | };
|
655 + | sender.send(()).await.expect("receiver dropped early");
|
656 + | result
|
783 657 | }
|
784 - | }
|
785 - | impl
|
786 - | ::aws_smithy_http_server::response::IntoResponse<
|
787 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
788 - | > for crate::error::GetBucketLocationError
|
789 - | {
|
790 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
791 - | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_error(
|
792 - | &self,
|
793 - | ) {
|
794 - | Ok(mut response) => {
|
795 - | response.extensions_mut().insert(
|
796 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
658 + | })
|
659 + | .build_unchecked();
|
660 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
661 + | .await
|
662 + | .expect("unable to make an HTTP request");
|
663 + | assert!(
|
664 + | receiver.recv().await.is_some(),
|
665 + | "we expected operation handler to be invoked but it was not entered"
|
797 666 | );
|
798 - | response
|
799 - | }
|
800 - | Err(e) => {
|
801 - | ::tracing::error!(error = %e, "failed to serialize response");
|
802 - | ::aws_smithy_http_server::response::IntoResponse::<
|
803 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
804 - | >::into_response(
|
805 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
806 - | e,
|
807 - | ),
|
808 - | )
|
809 - | }
|
810 - | }
|
811 - | }
|
812 - | }
|
813 - |
|
814 - | static CONTENT_TYPE_LISTOBJECTSV2: ::once_cell::sync::Lazy<::mime::Mime> =
|
815 - | ::once_cell::sync::Lazy::new(|| {
|
816 - | "application/xml"
|
817 - | .parse::<::mime::Mime>()
|
818 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
819 - | });
|
820 - | ::pin_project_lite::pin_project! {
|
821 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
822 - | /// [`ListObjectsV2Input`](crate::input::ListObjectsV2Input) using modelled bindings.
|
823 - | pub struct ListObjectsV2InputFuture {
|
824 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ListObjectsV2Input, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
825 - | }
|
826 - | }
|
827 - |
|
828 - | impl std::future::Future for ListObjectsV2InputFuture {
|
829 - | type Output = Result<
|
830 - | crate::input::ListObjectsV2Input,
|
831 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
832 - | >;
|
833 - |
|
834 - | fn poll(
|
835 - | self: std::pin::Pin<&mut Self>,
|
836 - | cx: &mut std::task::Context<'_>,
|
837 - | ) -> std::task::Poll<Self::Output> {
|
838 - | let this = self.project();
|
839 - | this.inner.as_mut().poll(cx)
|
840 - | }
|
841 - | }
|
842 - |
|
843 - | impl<B>
|
844 - | ::aws_smithy_http_server::request::FromRequest<
|
845 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
846 - | B,
|
847 - | > for crate::input::ListObjectsV2Input
|
848 - | where
|
849 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
850 - | B: 'static,
|
851 - |
|
852 - | B::Data: Send,
|
853 - | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
854 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
855 - | {
|
856 - | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
857 - | type Future = ListObjectsV2InputFuture;
|
858 - |
|
859 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
860 - | let fut = async move {
|
861 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
862 - | request.headers(),
|
863 - | &CONTENT_TYPE_LISTOBJECTSV2,
|
864 - | ) {
|
865 - | return Err(::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection::NotAcceptable);
|
866 667 | }
|
867 - | crate::protocol_serde::shape_list_objects_v2::de_list_objects_v2_http_request(request)
|
868 - | .await
|
869 - | .map_err(Into::into)
|
668 + | /// S3 clients should support the explicit virtual host
|
669 + | /// addressing style with Dualstack.
|
670 + | /// Test ID: S3VirtualHostDualstackAddressing
|
671 + | #[::tokio::test]
|
672 + | #[::tracing_test::traced_test]
|
673 + | #[should_panic]
|
674 + | async fn s3_virtual_host_dualstack_addressing_request() {
|
675 + | #[allow(unused_mut)]
|
676 + | let mut http_request = http::Request::builder()
|
677 + | .uri("/")
|
678 + | .method("GET")
|
679 + | .body(::aws_smithy_http_server::body::Body::from(
|
680 + | ::bytes::Bytes::from_static("".as_bytes()),
|
681 + | ))
|
682 + | .unwrap();
|
683 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
684 + | todo!("endpoint trait not supported yet");
|
685 + | #[allow(unused_mut)]
|
686 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
687 + | let config = crate::service::AmazonS3Config::builder().build();
|
688 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
689 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
690 + | let sender = sender.clone();
|
691 + | async move {
|
692 + | let result = {
|
693 + | let expected = crate::input::ListObjectsV2Input {
|
694 + | bucket: "mybucket".to_owned(),
|
695 + | delimiter: ::std::option::Option::None,
|
696 + | encoding_type: ::std::option::Option::None,
|
697 + | max_keys: ::std::option::Option::None,
|
698 + | prefix: ::std::option::Option::None,
|
699 + | continuation_token: ::std::option::Option::None,
|
700 + | fetch_owner: ::std::option::Option::None,
|
701 + | start_after: ::std::option::Option::None,
|
702 + | request_payer: ::std::option::Option::None,
|
703 + | expected_bucket_owner: ::std::option::Option::None,
|
870 704 | };
|
871 - | use ::futures_util::future::TryFutureExt;
|
872 - | let fut = fut.map_err(
|
873 - | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
874 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
875 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
876 - | },
|
877 - | );
|
878 - | ListObjectsV2InputFuture {
|
879 - | inner: Box::pin(fut),
|
705 + | ::pretty_assertions::assert_eq!(input, expected);
|
706 + | let response = crate::output::ListObjectsV2Output {
|
707 + | is_truncated: ::std::option::Option::None,
|
708 + | contents: ::std::option::Option::None,
|
709 + | name: ::std::option::Option::None,
|
710 + | prefix: ::std::option::Option::None,
|
711 + | delimiter: ::std::option::Option::None,
|
712 + | max_keys: ::std::option::Option::None,
|
713 + | common_prefixes: ::std::option::Option::None,
|
714 + | encoding_type: ::std::option::Option::None,
|
715 + | key_count: ::std::option::Option::None,
|
716 + | continuation_token: ::std::option::Option::None,
|
717 + | next_continuation_token: ::std::option::Option::None,
|
718 + | start_after: ::std::option::Option::None,
|
719 + | };
|
720 + | Ok(response)
|
721 + | };
|
722 + | sender.send(()).await.expect("receiver dropped early");
|
723 + | result
|
880 724 | }
|
725 + | })
|
726 + | .build_unchecked();
|
727 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
728 + | .await
|
729 + | .expect("unable to make an HTTP request");
|
730 + | assert!(
|
731 + | receiver.recv().await.is_some(),
|
732 + | "we expected operation handler to be invoked but it was not entered"
|
733 + | );
|
881 734 | }
|
882 - | }
|
883 - | impl
|
884 - | ::aws_smithy_http_server::response::IntoResponse<
|
885 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
886 - | > for crate::output::ListObjectsV2Output
|
887 - | {
|
888 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
889 - | match crate::protocol_serde::shape_list_objects_v2::ser_list_objects_v2_http_response(self)
|
890 - | {
|
891 - | Ok(response) => response,
|
892 - | Err(e) => {
|
893 - | ::tracing::error!(error = %e, "failed to serialize response");
|
894 - | ::aws_smithy_http_server::response::IntoResponse::<
|
895 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
896 - | >::into_response(
|
897 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
898 - | e,
|
899 - | ),
|
900 - | )
|
735 + | /// S3 clients should support the explicit virtual host
|
736 + | /// addressing style with S3 Accelerate.
|
737 + | /// Test ID: S3VirtualHostAccelerateAddressing
|
738 + | #[::tokio::test]
|
739 + | #[::tracing_test::traced_test]
|
740 + | #[should_panic]
|
741 + | async fn s3_virtual_host_accelerate_addressing_request() {
|
742 + | #[allow(unused_mut)]
|
743 + | let mut http_request = http::Request::builder()
|
744 + | .uri("/")
|
745 + | .method("GET")
|
746 + | .body(::aws_smithy_http_server::body::Body::from(
|
747 + | ::bytes::Bytes::from_static("".as_bytes()),
|
748 + | ))
|
749 + | .unwrap();
|
750 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
751 + | todo!("endpoint trait not supported yet");
|
752 + | #[allow(unused_mut)]
|
753 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
754 + | let config = crate::service::AmazonS3Config::builder().build();
|
755 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
756 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
757 + | let sender = sender.clone();
|
758 + | async move {
|
759 + | let result = {
|
760 + | let expected = crate::input::ListObjectsV2Input {
|
761 + | bucket: "mybucket".to_owned(),
|
762 + | delimiter: ::std::option::Option::None,
|
763 + | encoding_type: ::std::option::Option::None,
|
764 + | max_keys: ::std::option::Option::None,
|
765 + | prefix: ::std::option::Option::None,
|
766 + | continuation_token: ::std::option::Option::None,
|
767 + | fetch_owner: ::std::option::Option::None,
|
768 + | start_after: ::std::option::Option::None,
|
769 + | request_payer: ::std::option::Option::None,
|
770 + | expected_bucket_owner: ::std::option::Option::None,
|
771 + | };
|
772 + | ::pretty_assertions::assert_eq!(input, expected);
|
773 + | let response = crate::output::ListObjectsV2Output {
|
774 + | is_truncated: ::std::option::Option::None,
|
775 + | contents: ::std::option::Option::None,
|
776 + | name: ::std::option::Option::None,
|
777 + | prefix: ::std::option::Option::None,
|
778 + | delimiter: ::std::option::Option::None,
|
779 + | max_keys: ::std::option::Option::None,
|
780 + | common_prefixes: ::std::option::Option::None,
|
781 + | encoding_type: ::std::option::Option::None,
|
782 + | key_count: ::std::option::Option::None,
|
783 + | continuation_token: ::std::option::Option::None,
|
784 + | next_continuation_token: ::std::option::Option::None,
|
785 + | start_after: ::std::option::Option::None,
|
786 + | };
|
787 + | Ok(response)
|
788 + | };
|
789 + | sender.send(()).await.expect("receiver dropped early");
|
790 + | result
|
901 791 | }
|
792 + | })
|
793 + | .build_unchecked();
|
794 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
795 + | .await
|
796 + | .expect("unable to make an HTTP request");
|
797 + | assert!(
|
798 + | receiver.recv().await.is_some(),
|
799 + | "we expected operation handler to be invoked but it was not entered"
|
800 + | );
|
902 801 | }
|
802 + | /// S3 clients should support the explicit virtual host
|
803 + | /// addressing style with Dualstack and S3 Accelerate.
|
804 + | /// Test ID: S3VirtualHostDualstackAccelerateAddressing
|
805 + | #[::tokio::test]
|
806 + | #[::tracing_test::traced_test]
|
807 + | #[should_panic]
|
808 + | async fn s3_virtual_host_dualstack_accelerate_addressing_request() {
|
809 + | #[allow(unused_mut)]
|
810 + | let mut http_request = http::Request::builder()
|
811 + | .uri("/")
|
812 + | .method("GET")
|
813 + | .body(::aws_smithy_http_server::body::Body::from(
|
814 + | ::bytes::Bytes::from_static("".as_bytes()),
|
815 + | ))
|
816 + | .unwrap();
|
817 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
818 + | todo!("endpoint trait not supported yet");
|
819 + | #[allow(unused_mut)]
|
820 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
821 + | let config = crate::service::AmazonS3Config::builder().build();
|
822 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
823 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
824 + | let sender = sender.clone();
|
825 + | async move {
|
826 + | let result = {
|
827 + | let expected = crate::input::ListObjectsV2Input {
|
828 + | bucket: "mybucket".to_owned(),
|
829 + | delimiter: ::std::option::Option::None,
|
830 + | encoding_type: ::std::option::Option::None,
|
831 + | max_keys: ::std::option::Option::None,
|
832 + | prefix: ::std::option::Option::None,
|
833 + | continuation_token: ::std::option::Option::None,
|
834 + | fetch_owner: ::std::option::Option::None,
|
835 + | start_after: ::std::option::Option::None,
|
836 + | request_payer: ::std::option::Option::None,
|
837 + | expected_bucket_owner: ::std::option::Option::None,
|
838 + | };
|
839 + | ::pretty_assertions::assert_eq!(input, expected);
|
840 + | let response = crate::output::ListObjectsV2Output {
|
841 + | is_truncated: ::std::option::Option::None,
|
842 + | contents: ::std::option::Option::None,
|
843 + | name: ::std::option::Option::None,
|
844 + | prefix: ::std::option::Option::None,
|
845 + | delimiter: ::std::option::Option::None,
|
846 + | max_keys: ::std::option::Option::None,
|
847 + | common_prefixes: ::std::option::Option::None,
|
848 + | encoding_type: ::std::option::Option::None,
|
849 + | key_count: ::std::option::Option::None,
|
850 + | continuation_token: ::std::option::Option::None,
|
851 + | next_continuation_token: ::std::option::Option::None,
|
852 + | start_after: ::std::option::Option::None,
|
853 + | };
|
854 + | Ok(response)
|
855 + | };
|
856 + | sender.send(()).await.expect("receiver dropped early");
|
857 + | result
|
903 858 | }
|
904 - | }
|
905 - | impl
|
906 - | ::aws_smithy_http_server::response::IntoResponse<
|
907 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
908 - | > for crate::error::ListObjectsV2Error
|
909 - | {
|
910 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
911 - | match crate::protocol_serde::shape_list_objects_v2::ser_list_objects_v2_http_error(&self) {
|
912 - | Ok(mut response) => {
|
913 - | response.extensions_mut().insert(
|
914 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
859 + | })
|
860 + | .build_unchecked();
|
861 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
862 + | .await
|
863 + | .expect("unable to make an HTTP request");
|
864 + | assert!(
|
865 + | receiver.recv().await.is_some(),
|
866 + | "we expected operation handler to be invoked but it was not entered"
|
915 867 | );
|
916 - | response
|
917 868 | }
|
918 - | Err(e) => {
|
919 - | ::tracing::error!(error = %e, "failed to serialize response");
|
920 - | ::aws_smithy_http_server::response::IntoResponse::<
|
921 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
922 - | >::into_response(
|
923 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
924 - | e,
|
925 - | ),
|
926 - | )
|
869 + | /// S3 clients should resolve to the addressing style of the
|
870 + | /// operation if defined on both the client and operation.
|
871 + | /// Test ID: S3OperationAddressingPreferred
|
872 + | #[::tokio::test]
|
873 + | #[::tracing_test::traced_test]
|
874 + | #[should_panic]
|
875 + | async fn s3_operation_addressing_preferred_request() {
|
876 + | #[allow(unused_mut)]
|
877 + | let mut http_request = http::Request::builder()
|
878 + | .uri("/")
|
879 + | .method("GET")
|
880 + | .body(::aws_smithy_http_server::body::Body::from(
|
881 + | ::bytes::Bytes::from_static("".as_bytes()),
|
882 + | ))
|
883 + | .unwrap();
|
884 + | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
885 + | todo!("endpoint trait not supported yet");
|
886 + | #[allow(unused_mut)]
|
887 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
888 + | let config = crate::service::AmazonS3Config::builder().build();
|
889 + | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
890 + | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
891 + | let sender = sender.clone();
|
892 + | async move {
|
893 + | let result = {
|
894 + | let expected = crate::input::ListObjectsV2Input {
|
895 + | bucket: "mybucket".to_owned(),
|
896 + | delimiter: ::std::option::Option::None,
|
897 + | encoding_type: ::std::option::Option::None,
|
898 + | max_keys: ::std::option::Option::None,
|
899 + | prefix: ::std::option::Option::None,
|
900 + | continuation_token: ::std::option::Option::None,
|
901 + | fetch_owner: ::std::option::Option::None,
|
902 + | start_after: ::std::option::Option::None,
|
903 + | request_payer: ::std::option::Option::None,
|
904 + | expected_bucket_owner: ::std::option::Option::None,
|
905 + | };
|
906 + | ::pretty_assertions::assert_eq!(input, expected);
|
907 + | let response = crate::output::ListObjectsV2Output {
|
908 + | is_truncated: ::std::option::Option::None,
|
909 + | contents: ::std::option::Option::None,
|
910 + | name: ::std::option::Option::None,
|
911 + | prefix: ::std::option::Option::None,
|
912 + | delimiter: ::std::option::Option::None,
|
913 + | max_keys: ::std::option::Option::None,
|
914 + | common_prefixes: ::std::option::Option::None,
|
915 + | encoding_type: ::std::option::Option::None,
|
916 + | key_count: ::std::option::Option::None,
|
917 + | continuation_token: ::std::option::Option::None,
|
918 + | next_continuation_token: ::std::option::Option::None,
|
919 + | start_after: ::std::option::Option::None,
|
920 + | };
|
921 + | Ok(response)
|
922 + | };
|
923 + | sender.send(()).await.expect("receiver dropped early");
|
924 + | result
|
927 925 | }
|
926 + | })
|
927 + | .build_unchecked();
|
928 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
929 + | .await
|
930 + | .expect("unable to make an HTTP request");
|
931 + | assert!(
|
932 + | receiver.recv().await.is_some(),
|
933 + | "we expected operation handler to be invoked but it was not entered"
|
934 + | );
|
928 935 | }
|
936 + | /// S3 operations return Error XML nodes unwrapped by
|
937 + | /// the ErrorResponse XML node.
|
938 + | ///
|
939 + | /// Test ID: S3OperationNoErrorWrappingResponse
|
940 + | #[::tokio::test]
|
941 + | #[::tracing_test::traced_test]
|
942 + | #[should_panic]
|
943 + | async fn s3_operation_no_error_wrapping_response_response() {
|
944 + | let output = crate::error::NoSuchBucket {};
|
945 + | let output = crate::error::ListObjectsV2Error::NoSuchBucket(output);
|
946 + | use ::aws_smithy_http_server::response::IntoResponse;
|
947 + | let http_response = output.into_response();
|
948 + | ::pretty_assertions::assert_eq!(
|
949 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
950 + | http_response.status()
|
951 + | );
|
952 + | let expected_headers = [("Content-Type", "application/xml")];
|
953 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
954 + | http_response.headers(),
|
955 + | expected_headers,
|
956 + | ));
|
957 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
958 + | .await
|
959 + | .expect("unable to extract body to bytes");
|
960 + | ::aws_smithy_protocol_test::assert_ok(
|
961 + | ::aws_smithy_protocol_test::validate_body(&body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error>\n\t<Type>Sender</Type>\n\t<Code>NoSuchBucket</Code>\n</Error>", ::aws_smithy_protocol_test::MediaType::from("application/xml"))
|
962 + | );
|
929 963 | }
|
930 964 | }
|