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 - | ),
|
2 + |
|
3 + | ::pin_project_lite::pin_project! {
|
4 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5 + | /// [`GetObjectInput`](crate::input::GetObjectInput) using modelled bindings.
|
6 + | pub struct GetObjectInputFuture {
|
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>>
|
8 + | }
|
9 + | }
|
10 + |
|
11 + | impl std::future::Future for GetObjectInputFuture {
|
12 + | type Output = Result<
|
13 + | crate::input::GetObjectInput,
|
14 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
15 + | >;
|
16 + |
|
17 + | fn poll(
|
18 + | self: std::pin::Pin<&mut Self>,
|
19 + | cx: &mut std::task::Context<'_>,
|
20 + | ) -> std::task::Poll<Self::Output> {
|
21 + | let this = self.project();
|
22 + | this.inner.as_mut().poll(cx)
|
23 + | }
|
24 + | }
|
25 + |
|
26 + | impl<B>
|
27 + | ::aws_smithy_http_server::request::FromRequest<
|
28 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
29 + | B,
|
30 + | > for crate::input::GetObjectInput
|
31 + | where
|
32 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
33 + | B: 'static,
|
34 + |
|
35 + | B::Data: Send,
|
36 + | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
37 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
38 + | {
|
39 + | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
40 + | type Future = GetObjectInputFuture;
|
41 + |
|
42 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 + | let fut = async move {
|
44 + | crate::protocol_serde::shape_get_object::de_get_object_http_request(request)
|
45 + | .await
|
46 + | .map_err(Into::into)
|
18 47 | };
|
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"))
|
48 + | use ::futures_util::future::TryFutureExt;
|
49 + | let fut = fut.map_err(
|
50 + | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
51 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
52 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
53 + | },
|
30 54 | );
|
55 + | GetObjectInputFuture {
|
56 + | inner: Box::pin(fut),
|
57 + | }
|
31 58 | }
|
32 59 | }
|
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());
|
60 + | impl
|
61 + | ::aws_smithy_http_server::response::IntoResponse<
|
62 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
63 + | > for crate::output::GetObjectOutput
|
64 + | {
|
65 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
66 + | match crate::protocol_serde::shape_get_object::ser_get_object_http_response(self) {
|
67 + | Ok(response) => response,
|
68 + | Err(e) => {
|
69 + | ::tracing::error!(error = %e, "failed to serialize response");
|
70 + | ::aws_smithy_http_server::response::IntoResponse::<
|
71 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
72 + | >::into_response(
|
73 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
74 + | e,
|
75 + | ),
|
76 + | )
|
77 + | }
|
78 + | }
|
97 79 | }
|
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());
|
80 + | }
|
81 + | impl
|
82 + | ::aws_smithy_http_server::response::IntoResponse<
|
83 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
84 + | > for crate::error::GetObjectError
|
85 + | {
|
86 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
87 + | match crate::protocol_serde::shape_get_object::ser_get_object_http_error(&self) {
|
88 + | Ok(mut response) => {
|
89 + | response.extensions_mut().insert(
|
90 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
91 + | );
|
92 + | response
|
93 + | }
|
94 + | Err(e) => {
|
95 + | ::tracing::error!(error = %e, "failed to serialize response");
|
96 + | ::aws_smithy_http_server::response::IntoResponse::<
|
97 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
98 + | >::into_response(
|
99 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
100 + | e,
|
101 + | ),
|
102 + | )
|
103 + | }
|
104 + | }
|
159 105 | }
|
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)
|
106 + | }
|
107 + |
|
108 + | ::pin_project_lite::pin_project! {
|
109 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
110 + | /// [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput) using modelled bindings.
|
111 + | pub struct DeleteObjectTaggingInputFuture {
|
112 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DeleteObjectTaggingInput, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
113 + | }
|
114 + | }
|
115 + |
|
116 + | impl std::future::Future for DeleteObjectTaggingInputFuture {
|
117 + | type Output = Result<
|
118 + | crate::input::DeleteObjectTaggingInput,
|
119 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
120 + | >;
|
121 + |
|
122 + | fn poll(
|
123 + | self: std::pin::Pin<&mut Self>,
|
124 + | cx: &mut std::task::Context<'_>,
|
125 + | ) -> std::task::Poll<Self::Output> {
|
126 + | let this = self.project();
|
127 + | this.inner.as_mut().poll(cx)
|
128 + | }
|
129 + | }
|
130 + |
|
131 + | impl<B>
|
132 + | ::aws_smithy_http_server::request::FromRequest<
|
133 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
134 + | B,
|
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
|
233 + | where
|
234 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
235 + | B: 'static,
|
236 + |
|
237 + | B::Data: Send,
|
238 + | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
239 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
240 + | {
|
241 + | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
242 + | type Future = GetBucketLocationInputFuture;
|
243 + |
|
244 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
245 + | let fut = async move {
|
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 + | )
|
218 255 | .await
|
219 - | .expect("unable to make an HTTP request");
|
220 - | assert!(receiver.recv().await.is_some());
|
256 + | .map_err(Into::into)
|
257 + | };
|
258 + | use ::futures_util::future::TryFutureExt;
|
259 + | let fut = fut.map_err(
|
260 + | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
261 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
262 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
263 + | },
|
264 + | );
|
265 + | GetBucketLocationInputFuture {
|
266 + | inner: Box::pin(fut),
|
267 + | }
|
221 268 | }
|
222 - | /// S3 clients should support the explicit virtual host
|
223 - | /// addressing style with Dualstack.
|
224 - | /// Test ID: S3VirtualHostDualstackAddressing
|
269 + | }
|
270 + | impl
|
271 + | ::aws_smithy_http_server::response::IntoResponse<
|
272 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
273 + | > for crate::output::GetBucketLocationOutput
|
274 + | {
|
275 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
276 + | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_response(self) {
|
277 + | Ok(response) => response,
|
278 + | Err(e) => {
|
279 + | ::tracing::error!(error = %e, "failed to serialize response");
|
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))
|
281 + | }
|
282 + | }
|
283 + | }
|
284 + | }
|
285 + | impl
|
286 + | ::aws_smithy_http_server::response::IntoResponse<
|
287 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
288 + | > for crate::error::GetBucketLocationError
|
289 + | {
|
290 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
291 + | match crate::protocol_serde::shape_get_bucket_location::ser_get_bucket_location_http_error(
|
292 + | &self,
|
293 + | ) {
|
294 + | Ok(mut response) => {
|
295 + | response.extensions_mut().insert(
|
296 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
297 + | );
|
298 + | response
|
299 + | }
|
300 + | Err(e) => {
|
301 + | ::tracing::error!(error = %e, "failed to serialize response");
|
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 + | )
|
309 + | }
|
310 + | }
|
311 + | }
|
312 + | }
|
313 + |
|
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
|
225 322 | #[::tokio::test]
|
323 + | #[::tracing_test::traced_test]
|
226 324 | #[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)
|
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())
|
281 340 | .await
|
282 - | .expect("unable to make an HTTP request");
|
283 - | assert!(receiver.recv().await.is_some());
|
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 + | );
|
284 345 | }
|
285 - | /// S3 clients should support the explicit virtual host
|
286 - | /// addressing style with S3 Accelerate.
|
287 - | /// Test ID: S3VirtualHostAccelerateAddressing
|
346 + | }
|
347 + |
|
348 + | static CONTENT_TYPE_LISTOBJECTSV2: ::once_cell::sync::Lazy<::mime::Mime> =
|
349 + | ::once_cell::sync::Lazy::new(|| {
|
350 + | "application/xml"
|
351 + | .parse::<::mime::Mime>()
|
352 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
353 + | });
|
354 + | ::pin_project_lite::pin_project! {
|
355 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
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>>
|
359 + | }
|
360 + | }
|
361 + |
|
362 + | impl std::future::Future for ListObjectsV2InputFuture {
|
363 + | type Output = Result<
|
364 + | crate::input::ListObjectsV2Input,
|
365 + | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
366 + | >;
|
367 + |
|
368 + | fn poll(
|
369 + | self: std::pin::Pin<&mut Self>,
|
370 + | cx: &mut std::task::Context<'_>,
|
371 + | ) -> std::task::Poll<Self::Output> {
|
372 + | let this = self.project();
|
373 + | this.inner.as_mut().poll(cx)
|
374 + | }
|
375 + | }
|
376 + |
|
377 + | impl<B>
|
378 + | ::aws_smithy_http_server::request::FromRequest<
|
379 + | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
380 + | B,
|
381 + | > for crate::input::ListObjectsV2Input
|
382 + | where
|
383 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
384 + | B: 'static,
|
385 + |
|
386 + | B::Data: Send,
|
387 + | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
388 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
389 + | {
|
390 + | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
391 + | type Future = ListObjectsV2InputFuture;
|
392 + |
|
393 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
394 + | let fut = async move {
|
395 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
396 + | request.headers(),
|
397 + | &CONTENT_TYPE_LISTOBJECTSV2,
|
398 + | ) {
|
399 + | return Err(::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection::NotAcceptable);
|
400 + | }
|
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
|
288 472 | #[::tokio::test]
|
473 + | #[::tracing_test::traced_test]
|
289 474 | #[should_panic]
|
290 - | async fn s3_virtual_host_accelerate_addressing_request() {
|
475 + | async fn s3_default_addressing_request() {
|
291 476 | #[allow(unused_mut)]
|
292 477 | let mut http_request = http::Request::builder()
|
293 478 | .uri("/")
|
294 479 | .method("GET")
|
295 480 | .body(::aws_smithy_http_server::body::Body::from(
|
296 481 | ::bytes::Bytes::from_static("".as_bytes()),
|
297 482 | ))
|
298 483 | .unwrap();
|
299 484 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
300 485 | todo!("endpoint trait not supported yet");
|
301 486 | #[allow(unused_mut)]
|
302 487 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
303 488 | let config = crate::service::AmazonS3Config::builder().build();
|
304 489 | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
305 490 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
306 491 | let sender = sender.clone();
|
307 492 | async move {
|
308 493 | let result = {
|
309 494 | let expected = crate::input::ListObjectsV2Input {
|
310 495 | bucket: "mybucket".to_owned(),
|
311 496 | delimiter: ::std::option::Option::None,
|
312 497 | encoding_type: ::std::option::Option::None,
|
313 498 | max_keys: ::std::option::Option::None,
|
314 499 | prefix: ::std::option::Option::None,
|
315 500 | continuation_token: ::std::option::Option::None,
|
316 501 | fetch_owner: ::std::option::Option::None,
|
317 502 | start_after: ::std::option::Option::None,
|
318 503 | request_payer: ::std::option::Option::None,
|
319 504 | expected_bucket_owner: ::std::option::Option::None,
|
320 505 | };
|
321 506 | ::pretty_assertions::assert_eq!(input, expected);
|
322 507 | let response = crate::output::ListObjectsV2Output {
|
323 508 | is_truncated: ::std::option::Option::None,
|
324 509 | contents: ::std::option::Option::None,
|
325 510 | name: ::std::option::Option::None,
|
326 511 | prefix: ::std::option::Option::None,
|
327 512 | delimiter: ::std::option::Option::None,
|
328 513 | max_keys: ::std::option::Option::None,
|
329 514 | common_prefixes: ::std::option::Option::None,
|
330 515 | encoding_type: ::std::option::Option::None,
|
331 516 | key_count: ::std::option::Option::None,
|
332 517 | continuation_token: ::std::option::Option::None,
|
333 518 | next_continuation_token: ::std::option::Option::None,
|
334 519 | start_after: ::std::option::Option::None,
|
335 520 | };
|
336 521 | Ok(response)
|
337 522 | };
|
338 523 | sender.send(()).await.expect("receiver dropped early");
|
339 524 | result
|
340 525 | }
|
341 526 | })
|
342 527 | .build_unchecked();
|
343 528 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
344 529 | .await
|
345 530 | .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
|
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
|
351 538 | #[::tokio::test]
|
539 + | #[::tracing_test::traced_test]
|
352 540 | #[should_panic]
|
353 - | async fn s3_virtual_host_dualstack_accelerate_addressing_request() {
|
541 + | async fn s3_virtual_host_addressing_request() {
|
354 542 | #[allow(unused_mut)]
|
355 543 | let mut http_request = http::Request::builder()
|
356 544 | .uri("/")
|
357 545 | .method("GET")
|
358 546 | .body(::aws_smithy_http_server::body::Body::from(
|
359 547 | ::bytes::Bytes::from_static("".as_bytes()),
|
360 548 | ))
|
361 549 | .unwrap();
|
362 550 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
363 551 | todo!("endpoint trait not supported yet");
|
364 552 | #[allow(unused_mut)]
|
365 553 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
366 554 | let config = crate::service::AmazonS3Config::builder().build();
|
367 555 | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
368 556 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
369 557 | let sender = sender.clone();
|
370 558 | async move {
|
371 559 | let result = {
|
372 560 | let expected = crate::input::ListObjectsV2Input {
|
373 561 | bucket: "mybucket".to_owned(),
|
374 562 | delimiter: ::std::option::Option::None,
|
375 563 | encoding_type: ::std::option::Option::None,
|
376 564 | max_keys: ::std::option::Option::None,
|
377 565 | prefix: ::std::option::Option::None,
|
378 566 | continuation_token: ::std::option::Option::None,
|
379 567 | fetch_owner: ::std::option::Option::None,
|
380 568 | start_after: ::std::option::Option::None,
|
381 569 | request_payer: ::std::option::Option::None,
|
382 570 | expected_bucket_owner: ::std::option::Option::None,
|
383 571 | };
|
384 572 | ::pretty_assertions::assert_eq!(input, expected);
|
385 573 | let response = crate::output::ListObjectsV2Output {
|
386 574 | is_truncated: ::std::option::Option::None,
|
387 575 | contents: ::std::option::Option::None,
|
388 576 | name: ::std::option::Option::None,
|
389 577 | prefix: ::std::option::Option::None,
|
390 578 | delimiter: ::std::option::Option::None,
|
391 579 | max_keys: ::std::option::Option::None,
|
392 580 | common_prefixes: ::std::option::Option::None,
|
393 581 | encoding_type: ::std::option::Option::None,
|
394 582 | key_count: ::std::option::Option::None,
|
395 583 | continuation_token: ::std::option::Option::None,
|
396 584 | next_continuation_token: ::std::option::Option::None,
|
397 585 | start_after: ::std::option::Option::None,
|
398 586 | };
|
399 587 | Ok(response)
|
400 588 | };
|
401 589 | sender.send(()).await.expect("receiver dropped early");
|
402 590 | result
|
403 591 | }
|
404 592 | })
|
405 593 | .build_unchecked();
|
406 594 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
407 595 | .await
|
408 596 | .expect("unable to make an HTTP request");
|
409 - | assert!(receiver.recv().await.is_some());
|
597 + | assert!(
|
598 + | receiver.recv().await.is_some(),
|
599 + | "we expected operation handler to be invoked but it was not entered"
|
600 + | );
|
410 601 | }
|
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
|
602 + | /// S3 clients should support the explicit path addressing style.
|
603 + | /// Test ID: S3PathAddressing
|
414 604 | #[::tokio::test]
|
605 + | #[::tracing_test::traced_test]
|
415 606 | #[should_panic]
|
416 - | async fn s3_operation_addressing_preferred_request() {
|
607 + | async fn s3_path_addressing_request() {
|
417 608 | #[allow(unused_mut)]
|
418 609 | let mut http_request = http::Request::builder()
|
419 - | .uri("/")
|
610 + | .uri("/mybucket")
|
420 611 | .method("GET")
|
421 612 | .body(::aws_smithy_http_server::body::Body::from(
|
422 613 | ::bytes::Bytes::from_static("".as_bytes()),
|
423 614 | ))
|
424 615 | .unwrap();
|
425 - | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
616 + | *http_request.uri_mut() = "/mybucket?list-type=2".parse().unwrap();
|
426 617 | todo!("endpoint trait not supported yet");
|
427 618 | #[allow(unused_mut)]
|
428 619 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
429 620 | let config = crate::service::AmazonS3Config::builder().build();
|
430 621 | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
431 622 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
432 623 | let sender = sender.clone();
|
433 624 | async move {
|
434 625 | let result = {
|
435 626 | let expected = crate::input::ListObjectsV2Input {
|
436 627 | bucket: "mybucket".to_owned(),
|
437 628 | delimiter: ::std::option::Option::None,
|
438 629 | encoding_type: ::std::option::Option::None,
|
439 630 | max_keys: ::std::option::Option::None,
|
440 631 | prefix: ::std::option::Option::None,
|
441 632 | continuation_token: ::std::option::Option::None,
|
442 633 | fetch_owner: ::std::option::Option::None,
|
443 634 | start_after: ::std::option::Option::None,
|
444 635 | request_payer: ::std::option::Option::None,
|
445 636 | expected_bucket_owner: ::std::option::Option::None,
|
446 637 | };
|
447 638 | ::pretty_assertions::assert_eq!(input, expected);
|
448 639 | let response = crate::output::ListObjectsV2Output {
|
449 640 | is_truncated: ::std::option::Option::None,
|
450 641 | contents: ::std::option::Option::None,
|
451 642 | name: ::std::option::Option::None,
|
452 643 | prefix: ::std::option::Option::None,
|
453 644 | delimiter: ::std::option::Option::None,
|
454 645 | 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 - |
|
503 - | ::pin_project_lite::pin_project! {
|
504 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
505 - | /// [`GetObjectInput`](crate::input::GetObjectInput) using modelled bindings.
|
506 - | pub struct GetObjectInputFuture {
|
507 - | 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 - | }
|
509 - | }
|
510 - |
|
511 - | impl std::future::Future for GetObjectInputFuture {
|
512 - | type Output = Result<
|
513 - | crate::input::GetObjectInput,
|
514 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
515 - | >;
|
516 - |
|
517 - | fn poll(
|
518 - | self: std::pin::Pin<&mut Self>,
|
519 - | cx: &mut std::task::Context<'_>,
|
520 - | ) -> std::task::Poll<Self::Output> {
|
521 - | let this = self.project();
|
522 - | this.inner.as_mut().poll(cx)
|
523 - | }
|
524 - | }
|
525 - |
|
526 - | impl<B>
|
527 - | ::aws_smithy_http_server::request::FromRequest<
|
528 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
529 - | B,
|
530 - | > for crate::input::GetObjectInput
|
531 - | where
|
532 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
533 - | B: 'static,
|
534 - |
|
535 - | B::Data: Send,
|
536 - | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
537 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
538 - | {
|
539 - | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
540 - | type Future = GetObjectInputFuture;
|
541 - |
|
542 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
543 - | let fut = async move {
|
544 - | crate::protocol_serde::shape_get_object::de_get_object_http_request(request)
|
545 - | .await
|
546 - | .map_err(Into::into)
|
547 - | };
|
548 - | use ::futures_util::future::TryFutureExt;
|
549 - | let fut = fut.map_err(
|
550 - | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
551 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
552 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
553 - | },
|
554 - | );
|
555 - | GetObjectInputFuture {
|
556 - | inner: Box::pin(fut),
|
557 - | }
|
558 - | }
|
559 - | }
|
560 - | impl
|
561 - | ::aws_smithy_http_server::response::IntoResponse<
|
562 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
563 - | > for crate::output::GetObjectOutput
|
564 - | {
|
565 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
566 - | match crate::protocol_serde::shape_get_object::ser_get_object_http_response(self) {
|
567 - | Ok(response) => response,
|
568 - | Err(e) => {
|
569 - | ::tracing::error!(error = %e, "failed to serialize response");
|
570 - | ::aws_smithy_http_server::response::IntoResponse::<
|
571 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
572 - | >::into_response(
|
573 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
574 - | e,
|
575 - | ),
|
576 - | )
|
577 - | }
|
578 - | }
|
579 - | }
|
580 - | }
|
581 - | impl
|
582 - | ::aws_smithy_http_server::response::IntoResponse<
|
583 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
584 - | > for crate::error::GetObjectError
|
585 - | {
|
586 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
587 - | match crate::protocol_serde::shape_get_object::ser_get_object_http_error(&self) {
|
588 - | Ok(mut response) => {
|
589 - | response.extensions_mut().insert(
|
590 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
591 - | );
|
592 - | response
|
593 - | }
|
594 - | Err(e) => {
|
595 - | ::tracing::error!(error = %e, "failed to serialize response");
|
596 - | ::aws_smithy_http_server::response::IntoResponse::<
|
597 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
598 - | >::into_response(
|
599 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(
|
600 - | e,
|
601 - | ),
|
602 - | )
|
603 - | }
|
604 - | }
|
605 - | }
|
606 - | }
|
607 - |
|
608 - | ::pin_project_lite::pin_project! {
|
609 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
610 - | /// [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput) using modelled bindings.
|
611 - | pub struct DeleteObjectTaggingInputFuture {
|
612 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DeleteObjectTaggingInput, ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError>> + Send>>
|
613 - | }
|
614 - | }
|
615 - |
|
616 - | impl std::future::Future for DeleteObjectTaggingInputFuture {
|
617 - | type Output = Result<
|
618 - | crate::input::DeleteObjectTaggingInput,
|
619 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
620 - | >;
|
621 - |
|
622 - | fn poll(
|
623 - | self: std::pin::Pin<&mut Self>,
|
624 - | cx: &mut std::task::Context<'_>,
|
625 - | ) -> std::task::Poll<Self::Output> {
|
626 - | let this = self.project();
|
627 - | this.inner.as_mut().poll(cx)
|
628 - | }
|
629 - | }
|
630 - |
|
631 - | impl<B>
|
632 - | ::aws_smithy_http_server::request::FromRequest<
|
633 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
634 - | B,
|
635 - | > for crate::input::DeleteObjectTaggingInput
|
636 - | where
|
637 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
638 - | B: 'static,
|
639 - |
|
640 - | B::Data: Send,
|
641 - | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
642 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
643 - | {
|
644 - | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
645 - | type Future = DeleteObjectTaggingInputFuture;
|
646 - |
|
647 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
648 - | let fut = async move {
|
649 - | crate::protocol_serde::shape_delete_object_tagging::de_delete_object_tagging_http_request(request)
|
650 - | .await
|
651 - | .map_err(Into::into)
|
652 - | };
|
653 - | use ::futures_util::future::TryFutureExt;
|
654 - | let fut = fut.map_err(
|
655 - | |e: ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection| {
|
656 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
657 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError::from(e)
|
658 - | },
|
659 - | );
|
660 - | DeleteObjectTaggingInputFuture {
|
661 - | inner: Box::pin(fut),
|
662 - | }
|
663 - | }
|
664 - | }
|
665 - | impl
|
666 - | ::aws_smithy_http_server::response::IntoResponse<
|
667 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
668 - | > for crate::output::DeleteObjectTaggingOutput
|
669 - | {
|
670 - | 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) {
|
672 - | Ok(response) => response,
|
673 - | Err(e) => {
|
674 - | ::tracing::error!(error = %e, "failed to serialize response");
|
675 - | ::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 - | }
|
677 - | }
|
678 - | }
|
679 - | }
|
680 - | impl
|
681 - | ::aws_smithy_http_server::response::IntoResponse<
|
682 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
683 - | > for crate::error::DeleteObjectTaggingError
|
684 - | {
|
685 - | 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) {
|
687 - | Ok(mut response) => {
|
688 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
689 - | response
|
690 - | },
|
691 - | Err(e) => {
|
692 - | ::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))
|
694 - | }
|
695 - | }
|
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
|
657 + | }
|
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"
|
666 + | );
|
696 667 | }
|
697 - | }
|
698 - |
|
699 - | static CONTENT_TYPE_GETBUCKETLOCATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
700 - | ::once_cell::sync::Lazy::new(|| {
|
701 - | "application/xml"
|
702 - | .parse::<::mime::Mime>()
|
703 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
704 - | });
|
705 - | ::pin_project_lite::pin_project! {
|
706 - | /// 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>>
|
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,
|
704 + | };
|
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
|
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 + | );
|
710 734 | }
|
711 - | }
|
712 - |
|
713 - | impl std::future::Future for GetBucketLocationInputFuture {
|
714 - | type Output = Result<
|
715 - | crate::input::GetBucketLocationInput,
|
716 - | ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError,
|
717 - | >;
|
718 - |
|
719 - | fn poll(
|
720 - | self: std::pin::Pin<&mut Self>,
|
721 - | cx: &mut std::task::Context<'_>,
|
722 - | ) -> std::task::Poll<Self::Output> {
|
723 - | let this = self.project();
|
724 - | this.inner.as_mut().poll(cx)
|
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
|
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 + | );
|
725 801 | }
|
726 - | }
|
727 - |
|
728 - | impl<B>
|
729 - | ::aws_smithy_http_server::request::FromRequest<
|
730 - | ::aws_smithy_http_server::protocol::rest_xml::RestXml,
|
731 - | B,
|
732 - | > for crate::input::GetBucketLocationInput
|
733 - | where
|
734 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
735 - | B: 'static,
|
736 - |
|
737 - | B::Data: Send,
|
738 - | ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
|
739 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
740 - | {
|
741 - | type Rejection = ::aws_smithy_http_server::protocol::rest_xml::runtime_error::RuntimeError;
|
742 - | type Future = GetBucketLocationInputFuture;
|
743 - |
|
744 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
745 - | let fut = async move {
|
746 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
747 - | request.headers(),
|
748 - | &CONTENT_TYPE_GETBUCKETLOCATION,
|
749 - | ) {
|
750 - | return Err(::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection::NotAcceptable);
|
751 - | }
|
752 - | crate::protocol_serde::shape_get_bucket_location::de_get_bucket_location_http_request(
|
753 - | request,
|
754 - | )
|
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
|
858 + | }
|
859 + | })
|
860 + | .build_unchecked();
|
861 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
755 862 | .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 - | },
|
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"
|
764 867 | );
|
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 - | }
|
783 - | }
|
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()),
|
797 - | );
|
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 868 | }
|
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 - | }
|
867 - | crate::protocol_serde::shape_list_objects_v2::de_list_objects_v2_http_request(request)
|
868 - | .await
|
869 - | .map_err(Into::into)
|
870 - | };
|
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 - | },
|
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
|
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"
|
877 934 | );
|
878 - | ListObjectsV2InputFuture {
|
879 - | inner: Box::pin(fut),
|
880 - | }
|
881 - | }
|
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 - | )
|
901 - | }
|
902 - | }
|
903 935 | }
|
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()),
|
915 - | );
|
916 - | response
|
917 - | }
|
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 - | )
|
927 - | }
|
928 - | }
|
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 | }
|