1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /// The service builder for [`AmazonS3`].
|
3 + | ///
|
4 + | /// Constructed via [`AmazonS3::builder`].
|
5 + | pub struct AmazonS3Builder<Body, L, HttpPl, ModelPl> {
|
6 + | delete_object_tagging: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
7 + | get_bucket_location: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
8 + | get_object: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
9 + | list_objects_v2: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
10 + | layer: L,
|
11 + | http_plugin: HttpPl,
|
12 + | model_plugin: ModelPl,
|
13 + | }
|
14 + |
|
15 + | impl<Body, L, HttpPl, ModelPl> AmazonS3Builder<Body, L, HttpPl, ModelPl> {
|
16 + | /// Sets the [`DeleteObjectTagging`](crate::operation_shape::DeleteObjectTagging) operation.
|
17 + | ///
|
18 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
19 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
20 + | ///
|
21 + | /// # Example
|
22 + | ///
|
23 + | /// ```no_run
|
24 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
25 + | ///
|
26 + | /// use s3_http0x::{input, output, error};
|
27 + | ///
|
28 + | /// async fn handler(input: input::DeleteObjectTaggingInput) -> Result<output::DeleteObjectTaggingOutput, error::DeleteObjectTaggingError> {
|
29 + | /// todo!()
|
30 + | /// }
|
31 + | ///
|
32 + | /// let config = AmazonS3Config::builder().build();
|
33 + | /// let app = AmazonS3::builder(config)
|
34 + | /// .delete_object_tagging(handler)
|
35 + | /// /* Set other handlers */
|
36 + | /// .build()
|
37 + | /// .unwrap();
|
38 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
39 + | /// ```
|
40 + | ///
|
41 + | pub fn delete_object_tagging<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
42 + | where
|
43 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::DeleteObjectTagging, HandlerExtractors>,
|
44 + |
|
45 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
46 + | AmazonS3<L>,
|
47 + | crate::operation_shape::DeleteObjectTagging,
|
48 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::DeleteObjectTagging, HandlerType>
|
49 + | >,
|
50 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
51 + | AmazonS3<L>,
|
52 + | crate::operation_shape::DeleteObjectTagging,
|
53 + | ModelPl::Output
|
54 + | >,
|
55 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
56 + | AmazonS3<L>,
|
57 + | crate::operation_shape::DeleteObjectTagging,
|
58 + | <
|
59 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
60 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
61 + | AmazonS3<L>,
|
62 + | crate::operation_shape::DeleteObjectTagging,
|
63 + | ModelPl::Output
|
64 + | >
|
65 + | >::Output
|
66 + | >,
|
67 + |
|
68 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
69 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
70 + |
|
71 + | {
|
72 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
73 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
74 + | let svc = crate::operation_shape::DeleteObjectTagging::from_handler(handler);
|
75 + | let svc = self.model_plugin.apply(svc);
|
76 + | let svc =
|
77 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
78 + | .apply(svc);
|
79 + | let svc = self.http_plugin.apply(svc);
|
80 + | self.delete_object_tagging_custom(svc)
|
81 + | }
|
82 + |
|
83 + | /// Sets the [`DeleteObjectTagging`](crate::operation_shape::DeleteObjectTagging) operation.
|
84 + | ///
|
85 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
86 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
87 + | ///
|
88 + | /// # Example
|
89 + | ///
|
90 + | /// ```no_run
|
91 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
92 + | ///
|
93 + | /// use s3_http0x::{input, output, error};
|
94 + | ///
|
95 + | /// async fn handler(input: input::DeleteObjectTaggingInput) -> Result<output::DeleteObjectTaggingOutput, error::DeleteObjectTaggingError> {
|
96 + | /// todo!()
|
97 + | /// }
|
98 + | ///
|
99 + | /// let config = AmazonS3Config::builder().build();
|
100 + | /// let svc = ::tower::util::service_fn(handler);
|
101 + | /// let app = AmazonS3::builder(config)
|
102 + | /// .delete_object_tagging_service(svc)
|
103 + | /// /* Set other handlers */
|
104 + | /// .build()
|
105 + | /// .unwrap();
|
106 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
107 + | /// ```
|
108 + | ///
|
109 + | pub fn delete_object_tagging_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
110 + | where
|
111 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::DeleteObjectTagging, ServiceExtractors>,
|
112 + |
|
113 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
114 + | AmazonS3<L>,
|
115 + | crate::operation_shape::DeleteObjectTagging,
|
116 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::DeleteObjectTagging, S>
|
117 + | >,
|
118 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
119 + | AmazonS3<L>,
|
120 + | crate::operation_shape::DeleteObjectTagging,
|
121 + | ModelPl::Output
|
122 + | >,
|
123 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
124 + | AmazonS3<L>,
|
125 + | crate::operation_shape::DeleteObjectTagging,
|
126 + | <
|
127 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
128 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
129 + | AmazonS3<L>,
|
130 + | crate::operation_shape::DeleteObjectTagging,
|
131 + | ModelPl::Output
|
132 + | >
|
133 + | >::Output
|
134 + | >,
|
135 + |
|
136 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
137 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
138 + |
|
139 + | {
|
140 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
141 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
142 + | let svc = crate::operation_shape::DeleteObjectTagging::from_service(service);
|
143 + | let svc = self.model_plugin.apply(svc);
|
144 + | let svc =
|
145 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
146 + | .apply(svc);
|
147 + | let svc = self.http_plugin.apply(svc);
|
148 + | self.delete_object_tagging_custom(svc)
|
149 + | }
|
150 + |
|
151 + | /// Sets the [`DeleteObjectTagging`](crate::operation_shape::DeleteObjectTagging) to a custom [`Service`](tower::Service).
|
152 + | /// not constrained by the Smithy contract.
|
153 + | fn delete_object_tagging_custom<S>(mut self, svc: S) -> Self
|
154 + | where
|
155 + | S: ::tower::Service<
|
156 + | ::http::Request<Body>,
|
157 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
158 + | Error = ::std::convert::Infallible,
|
159 + | > + Clone
|
160 + | + Send
|
161 + | + 'static,
|
162 + | S::Future: Send + 'static,
|
163 + | {
|
164 + | self.delete_object_tagging =
|
165 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
166 + | self
|
167 + | }
|
168 + |
|
169 + | /// Sets the [`GetBucketLocation`](crate::operation_shape::GetBucketLocation) operation.
|
170 + | ///
|
171 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
172 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
173 + | ///
|
174 + | /// # Example
|
175 + | ///
|
176 + | /// ```no_run
|
177 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
178 + | ///
|
179 + | /// use s3_http0x::{input, output, error};
|
180 + | ///
|
181 + | /// async fn handler(input: input::GetBucketLocationInput) -> Result<output::GetBucketLocationOutput, error::GetBucketLocationError> {
|
182 + | /// todo!()
|
183 + | /// }
|
184 + | ///
|
185 + | /// let config = AmazonS3Config::builder().build();
|
186 + | /// let app = AmazonS3::builder(config)
|
187 + | /// .get_bucket_location(handler)
|
188 + | /// /* Set other handlers */
|
189 + | /// .build()
|
190 + | /// .unwrap();
|
191 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
192 + | /// ```
|
193 + | ///
|
194 + | pub fn get_bucket_location<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
195 + | where
|
196 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::GetBucketLocation, HandlerExtractors>,
|
197 + |
|
198 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
199 + | AmazonS3<L>,
|
200 + | crate::operation_shape::GetBucketLocation,
|
201 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::GetBucketLocation, HandlerType>
|
202 + | >,
|
203 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
204 + | AmazonS3<L>,
|
205 + | crate::operation_shape::GetBucketLocation,
|
206 + | ModelPl::Output
|
207 + | >,
|
208 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
209 + | AmazonS3<L>,
|
210 + | crate::operation_shape::GetBucketLocation,
|
211 + | <
|
212 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
213 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
214 + | AmazonS3<L>,
|
215 + | crate::operation_shape::GetBucketLocation,
|
216 + | ModelPl::Output
|
217 + | >
|
218 + | >::Output
|
219 + | >,
|
220 + |
|
221 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
222 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
223 + |
|
224 + | {
|
225 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
226 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
227 + | let svc = crate::operation_shape::GetBucketLocation::from_handler(handler);
|
228 + | let svc = self.model_plugin.apply(svc);
|
229 + | let svc =
|
230 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
231 + | .apply(svc);
|
232 + | let svc = self.http_plugin.apply(svc);
|
233 + | self.get_bucket_location_custom(svc)
|
234 + | }
|
235 + |
|
236 + | /// Sets the [`GetBucketLocation`](crate::operation_shape::GetBucketLocation) operation.
|
237 + | ///
|
238 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
239 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
240 + | ///
|
241 + | /// # Example
|
242 + | ///
|
243 + | /// ```no_run
|
244 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
245 + | ///
|
246 + | /// use s3_http0x::{input, output, error};
|
247 + | ///
|
248 + | /// async fn handler(input: input::GetBucketLocationInput) -> Result<output::GetBucketLocationOutput, error::GetBucketLocationError> {
|
249 + | /// todo!()
|
250 + | /// }
|
251 + | ///
|
252 + | /// let config = AmazonS3Config::builder().build();
|
253 + | /// let svc = ::tower::util::service_fn(handler);
|
254 + | /// let app = AmazonS3::builder(config)
|
255 + | /// .get_bucket_location_service(svc)
|
256 + | /// /* Set other handlers */
|
257 + | /// .build()
|
258 + | /// .unwrap();
|
259 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
260 + | /// ```
|
261 + | ///
|
262 + | pub fn get_bucket_location_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
263 + | where
|
264 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::GetBucketLocation, ServiceExtractors>,
|
265 + |
|
266 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
267 + | AmazonS3<L>,
|
268 + | crate::operation_shape::GetBucketLocation,
|
269 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::GetBucketLocation, S>
|
270 + | >,
|
271 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
272 + | AmazonS3<L>,
|
273 + | crate::operation_shape::GetBucketLocation,
|
274 + | ModelPl::Output
|
275 + | >,
|
276 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
277 + | AmazonS3<L>,
|
278 + | crate::operation_shape::GetBucketLocation,
|
279 + | <
|
280 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
281 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
282 + | AmazonS3<L>,
|
283 + | crate::operation_shape::GetBucketLocation,
|
284 + | ModelPl::Output
|
285 + | >
|
286 + | >::Output
|
287 + | >,
|
288 + |
|
289 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
290 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
291 + |
|
292 + | {
|
293 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
294 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
295 + | let svc = crate::operation_shape::GetBucketLocation::from_service(service);
|
296 + | let svc = self.model_plugin.apply(svc);
|
297 + | let svc =
|
298 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
299 + | .apply(svc);
|
300 + | let svc = self.http_plugin.apply(svc);
|
301 + | self.get_bucket_location_custom(svc)
|
302 + | }
|
303 + |
|
304 + | /// Sets the [`GetBucketLocation`](crate::operation_shape::GetBucketLocation) to a custom [`Service`](tower::Service).
|
305 + | /// not constrained by the Smithy contract.
|
306 + | fn get_bucket_location_custom<S>(mut self, svc: S) -> Self
|
307 + | where
|
308 + | S: ::tower::Service<
|
309 + | ::http::Request<Body>,
|
310 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
311 + | Error = ::std::convert::Infallible,
|
312 + | > + Clone
|
313 + | + Send
|
314 + | + 'static,
|
315 + | S::Future: Send + 'static,
|
316 + | {
|
317 + | self.get_bucket_location = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
318 + | self
|
319 + | }
|
320 + |
|
321 + | /// Sets the [`GetObject`](crate::operation_shape::GetObject) operation.
|
322 + | ///
|
323 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
324 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
325 + | ///
|
326 + | /// # Example
|
327 + | ///
|
328 + | /// ```no_run
|
329 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
330 + | ///
|
331 + | /// use s3_http0x::{input, output, error};
|
332 + | ///
|
333 + | /// async fn handler(input: input::GetObjectInput) -> Result<output::GetObjectOutput, error::GetObjectError> {
|
334 + | /// todo!()
|
335 + | /// }
|
336 + | ///
|
337 + | /// let config = AmazonS3Config::builder().build();
|
338 + | /// let app = AmazonS3::builder(config)
|
339 + | /// .get_object(handler)
|
340 + | /// /* Set other handlers */
|
341 + | /// .build()
|
342 + | /// .unwrap();
|
343 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
344 + | /// ```
|
345 + | ///
|
346 + | pub fn get_object<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
347 + | where
|
348 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::GetObject, HandlerExtractors>,
|
349 + |
|
350 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
351 + | AmazonS3<L>,
|
352 + | crate::operation_shape::GetObject,
|
353 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::GetObject, HandlerType>
|
354 + | >,
|
355 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
356 + | AmazonS3<L>,
|
357 + | crate::operation_shape::GetObject,
|
358 + | ModelPl::Output
|
359 + | >,
|
360 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
361 + | AmazonS3<L>,
|
362 + | crate::operation_shape::GetObject,
|
363 + | <
|
364 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
365 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
366 + | AmazonS3<L>,
|
367 + | crate::operation_shape::GetObject,
|
368 + | ModelPl::Output
|
369 + | >
|
370 + | >::Output
|
371 + | >,
|
372 + |
|
373 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
374 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
375 + |
|
376 + | {
|
377 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
378 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
379 + | let svc = crate::operation_shape::GetObject::from_handler(handler);
|
380 + | let svc = self.model_plugin.apply(svc);
|
381 + | let svc =
|
382 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
383 + | .apply(svc);
|
384 + | let svc = self.http_plugin.apply(svc);
|
385 + | self.get_object_custom(svc)
|
386 + | }
|
387 + |
|
388 + | /// Sets the [`GetObject`](crate::operation_shape::GetObject) operation.
|
389 + | ///
|
390 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
391 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
392 + | ///
|
393 + | /// # Example
|
394 + | ///
|
395 + | /// ```no_run
|
396 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
397 + | ///
|
398 + | /// use s3_http0x::{input, output, error};
|
399 + | ///
|
400 + | /// async fn handler(input: input::GetObjectInput) -> Result<output::GetObjectOutput, error::GetObjectError> {
|
401 + | /// todo!()
|
402 + | /// }
|
403 + | ///
|
404 + | /// let config = AmazonS3Config::builder().build();
|
405 + | /// let svc = ::tower::util::service_fn(handler);
|
406 + | /// let app = AmazonS3::builder(config)
|
407 + | /// .get_object_service(svc)
|
408 + | /// /* Set other handlers */
|
409 + | /// .build()
|
410 + | /// .unwrap();
|
411 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
412 + | /// ```
|
413 + | ///
|
414 + | pub fn get_object_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
415 + | where
|
416 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::GetObject, ServiceExtractors>,
|
417 + |
|
418 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
419 + | AmazonS3<L>,
|
420 + | crate::operation_shape::GetObject,
|
421 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::GetObject, S>
|
422 + | >,
|
423 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
424 + | AmazonS3<L>,
|
425 + | crate::operation_shape::GetObject,
|
426 + | ModelPl::Output
|
427 + | >,
|
428 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
429 + | AmazonS3<L>,
|
430 + | crate::operation_shape::GetObject,
|
431 + | <
|
432 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
433 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
434 + | AmazonS3<L>,
|
435 + | crate::operation_shape::GetObject,
|
436 + | ModelPl::Output
|
437 + | >
|
438 + | >::Output
|
439 + | >,
|
440 + |
|
441 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
442 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
443 + |
|
444 + | {
|
445 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
446 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
447 + | let svc = crate::operation_shape::GetObject::from_service(service);
|
448 + | let svc = self.model_plugin.apply(svc);
|
449 + | let svc =
|
450 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
451 + | .apply(svc);
|
452 + | let svc = self.http_plugin.apply(svc);
|
453 + | self.get_object_custom(svc)
|
454 + | }
|
455 + |
|
456 + | /// Sets the [`GetObject`](crate::operation_shape::GetObject) to a custom [`Service`](tower::Service).
|
457 + | /// not constrained by the Smithy contract.
|
458 + | fn get_object_custom<S>(mut self, svc: S) -> Self
|
459 + | where
|
460 + | S: ::tower::Service<
|
461 + | ::http::Request<Body>,
|
462 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
463 + | Error = ::std::convert::Infallible,
|
464 + | > + Clone
|
465 + | + Send
|
466 + | + 'static,
|
467 + | S::Future: Send + 'static,
|
468 + | {
|
469 + | self.get_object = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
470 + | self
|
471 + | }
|
472 + |
|
473 + | /// Sets the [`ListObjectsV2`](crate::operation_shape::ListObjectsV2) operation.
|
474 + | ///
|
475 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
476 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
477 + | ///
|
478 + | /// # Example
|
479 + | ///
|
480 + | /// ```no_run
|
481 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
482 + | ///
|
483 + | /// use s3_http0x::{input, output, error};
|
484 + | ///
|
485 + | /// async fn handler(input: input::ListObjectsV2Input) -> Result<output::ListObjectsV2Output, error::ListObjectsV2Error> {
|
486 + | /// todo!()
|
487 + | /// }
|
488 + | ///
|
489 + | /// let config = AmazonS3Config::builder().build();
|
490 + | /// let app = AmazonS3::builder(config)
|
491 + | /// .list_objects_v2(handler)
|
492 + | /// /* Set other handlers */
|
493 + | /// .build()
|
494 + | /// .unwrap();
|
495 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
496 + | /// ```
|
497 + | ///
|
498 + | pub fn list_objects_v2<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
499 + | where
|
500 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::ListObjectsV2, HandlerExtractors>,
|
501 + |
|
502 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
503 + | AmazonS3<L>,
|
504 + | crate::operation_shape::ListObjectsV2,
|
505 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::ListObjectsV2, HandlerType>
|
506 + | >,
|
507 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
508 + | AmazonS3<L>,
|
509 + | crate::operation_shape::ListObjectsV2,
|
510 + | ModelPl::Output
|
511 + | >,
|
512 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
513 + | AmazonS3<L>,
|
514 + | crate::operation_shape::ListObjectsV2,
|
515 + | <
|
516 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
517 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
518 + | AmazonS3<L>,
|
519 + | crate::operation_shape::ListObjectsV2,
|
520 + | ModelPl::Output
|
521 + | >
|
522 + | >::Output
|
523 + | >,
|
524 + |
|
525 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
526 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
527 + |
|
528 + | {
|
529 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
530 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
531 + | let svc = crate::operation_shape::ListObjectsV2::from_handler(handler);
|
532 + | let svc = self.model_plugin.apply(svc);
|
533 + | let svc =
|
534 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
535 + | .apply(svc);
|
536 + | let svc = self.http_plugin.apply(svc);
|
537 + | self.list_objects_v2_custom(svc)
|
538 + | }
|
539 + |
|
540 + | /// Sets the [`ListObjectsV2`](crate::operation_shape::ListObjectsV2) operation.
|
541 + | ///
|
542 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
543 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
544 + | ///
|
545 + | /// # Example
|
546 + | ///
|
547 + | /// ```no_run
|
548 + | /// use s3_http0x::{AmazonS3, AmazonS3Config};
|
549 + | ///
|
550 + | /// use s3_http0x::{input, output, error};
|
551 + | ///
|
552 + | /// async fn handler(input: input::ListObjectsV2Input) -> Result<output::ListObjectsV2Output, error::ListObjectsV2Error> {
|
553 + | /// todo!()
|
554 + | /// }
|
555 + | ///
|
556 + | /// let config = AmazonS3Config::builder().build();
|
557 + | /// let svc = ::tower::util::service_fn(handler);
|
558 + | /// let app = AmazonS3::builder(config)
|
559 + | /// .list_objects_v2_service(svc)
|
560 + | /// /* Set other handlers */
|
561 + | /// .build()
|
562 + | /// .unwrap();
|
563 + | /// # let app: AmazonS3<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml>> = app;
|
564 + | /// ```
|
565 + | ///
|
566 + | pub fn list_objects_v2_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
567 + | where
|
568 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::ListObjectsV2, ServiceExtractors>,
|
569 + |
|
570 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
571 + | AmazonS3<L>,
|
572 + | crate::operation_shape::ListObjectsV2,
|
573 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::ListObjectsV2, S>
|
574 + | >,
|
575 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
576 + | AmazonS3<L>,
|
577 + | crate::operation_shape::ListObjectsV2,
|
578 + | ModelPl::Output
|
579 + | >,
|
580 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
581 + | AmazonS3<L>,
|
582 + | crate::operation_shape::ListObjectsV2,
|
583 + | <
|
584 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
585 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
586 + | AmazonS3<L>,
|
587 + | crate::operation_shape::ListObjectsV2,
|
588 + | ModelPl::Output
|
589 + | >
|
590 + | >::Output
|
591 + | >,
|
592 + |
|
593 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
594 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
595 + |
|
596 + | {
|
597 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
598 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
599 + | let svc = crate::operation_shape::ListObjectsV2::from_service(service);
|
600 + | let svc = self.model_plugin.apply(svc);
|
601 + | let svc =
|
602 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
603 + | .apply(svc);
|
604 + | let svc = self.http_plugin.apply(svc);
|
605 + | self.list_objects_v2_custom(svc)
|
606 + | }
|
607 + |
|
608 + | /// Sets the [`ListObjectsV2`](crate::operation_shape::ListObjectsV2) to a custom [`Service`](tower::Service).
|
609 + | /// not constrained by the Smithy contract.
|
610 + | fn list_objects_v2_custom<S>(mut self, svc: S) -> Self
|
611 + | where
|
612 + | S: ::tower::Service<
|
613 + | ::http::Request<Body>,
|
614 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
615 + | Error = ::std::convert::Infallible,
|
616 + | > + Clone
|
617 + | + Send
|
618 + | + 'static,
|
619 + | S::Future: Send + 'static,
|
620 + | {
|
621 + | self.list_objects_v2 = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
622 + | self
|
623 + | }
|
624 + | }
|
625 + |
|
626 + | impl<Body, L, HttpPl, ModelPl> AmazonS3Builder<Body, L, HttpPl, ModelPl> {
|
627 + | /// Constructs a [`AmazonS3`] from the arguments provided to the builder.
|
628 + | ///
|
629 + | /// Forgetting to register a handler for one or more operations will result in an error.
|
630 + | ///
|
631 + | /// Check out [`AmazonS3Builder::build_unchecked`] if you'd prefer the service to return status code 500 when an
|
632 + | /// unspecified route is requested.
|
633 + | pub fn build(
|
634 + | self,
|
635 + | ) -> ::std::result::Result<
|
636 + | AmazonS3<
|
637 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
638 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
639 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
640 + | >,
|
641 + | >,
|
642 + | MissingOperationsError,
|
643 + | >
|
644 + | where
|
645 + | L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
646 + | {
|
647 + | let router = {
|
648 + | use ::aws_smithy_legacy_http_server::operation::OperationShape;
|
649 + | let mut missing_operation_names = std::collections::HashMap::new();
|
650 + | if self.delete_object_tagging.is_none() {
|
651 + | missing_operation_names.insert(
|
652 + | crate::operation_shape::DeleteObjectTagging::ID,
|
653 + | ".delete_object_tagging()",
|
654 + | );
|
655 + | }
|
656 + | if self.get_bucket_location.is_none() {
|
657 + | missing_operation_names.insert(
|
658 + | crate::operation_shape::GetBucketLocation::ID,
|
659 + | ".get_bucket_location()",
|
660 + | );
|
661 + | }
|
662 + | if self.get_object.is_none() {
|
663 + | missing_operation_names
|
664 + | .insert(crate::operation_shape::GetObject::ID, ".get_object()");
|
665 + | }
|
666 + | if self.list_objects_v2.is_none() {
|
667 + | missing_operation_names.insert(
|
668 + | crate::operation_shape::ListObjectsV2::ID,
|
669 + | ".list_objects_v2()",
|
670 + | );
|
671 + | }
|
672 + | if !missing_operation_names.is_empty() {
|
673 + | return Err(MissingOperationsError {
|
674 + | operation_names2setter_methods: missing_operation_names,
|
675 + | });
|
676 + | }
|
677 + | let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
|
678 + |
|
679 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([
|
680 + | (
|
681 + | request_specs::delete_object_tagging(),
|
682 + | self.delete_object_tagging.expect(unexpected_error_msg),
|
683 + | ),
|
684 + | (
|
685 + | request_specs::get_bucket_location(),
|
686 + | self.get_bucket_location.expect(unexpected_error_msg),
|
687 + | ),
|
688 + | (
|
689 + | request_specs::get_object(),
|
690 + | self.get_object.expect(unexpected_error_msg),
|
691 + | ),
|
692 + | (
|
693 + | request_specs::list_objects_v2(),
|
694 + | self.list_objects_v2.expect(unexpected_error_msg),
|
695 + | ),
|
696 + | ])
|
697 + | };
|
698 + | let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
|
699 + | let svc = svc.map(|s| s.layer(self.layer));
|
700 + | Ok(AmazonS3 { svc })
|
701 + | }
|
702 + |
|
703 + | /// Constructs a [`AmazonS3`] from the arguments provided to the builder.
|
704 + | /// Operations without a handler default to returning 500 Internal Server Error to the caller.
|
705 + | ///
|
706 + | /// Check out [`AmazonS3Builder::build`] if you'd prefer the builder to fail if one or more operations do
|
707 + | /// not have a registered handler.
|
708 + | pub fn build_unchecked(self) -> AmazonS3<L::Service>
|
709 + | where
|
710 + | Body: Send + 'static,
|
711 + | L: ::tower::Layer<
|
712 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
713 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
714 + | ::aws_smithy_legacy_http_server::routing::Route<Body>,
|
715 + | >,
|
716 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
717 + | >,
|
718 + | >,
|
719 + | {
|
720 + | let router =
|
721 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([
|
722 + | (
|
723 + | request_specs::delete_object_tagging(),
|
724 + | self.delete_object_tagging.unwrap_or_else(|| {
|
725 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
726 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
727 + | >::default();
|
728 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
729 + | }),
|
730 + | ),
|
731 + | (
|
732 + | request_specs::get_bucket_location(),
|
733 + | self.get_bucket_location.unwrap_or_else(|| {
|
734 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
735 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
736 + | >::default();
|
737 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
738 + | }),
|
739 + | ),
|
740 + | (
|
741 + | request_specs::get_object(),
|
742 + | self.get_object.unwrap_or_else(|| {
|
743 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
744 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
745 + | >::default();
|
746 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
747 + | }),
|
748 + | ),
|
749 + | (
|
750 + | request_specs::list_objects_v2(),
|
751 + | self.list_objects_v2.unwrap_or_else(|| {
|
752 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
753 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
754 + | >::default();
|
755 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
756 + | }),
|
757 + | ),
|
758 + | ]);
|
759 + | let svc = self
|
760 + | .layer
|
761 + | .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
|
762 + | AmazonS3 { svc }
|
763 + | }
|
764 + | }
|
765 + |
|
766 + | /// The error encountered when calling the [`AmazonS3Builder::build`] method if one or more operation handlers are not
|
767 + | /// specified.
|
768 + | #[derive(Debug)]
|
769 + | pub struct MissingOperationsError {
|
770 + | operation_names2setter_methods:
|
771 + | std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
|
772 + | }
|
773 + |
|
774 + | impl std::fmt::Display for MissingOperationsError {
|
775 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
776 + | write!(
|
777 + | f,
|
778 + | "You must specify a handler for all operations attached to `AmazonS3`.\n\
|
779 + | We are missing handlers for the following operations:\n",
|
780 + | )?;
|
781 + | for operation_name in self.operation_names2setter_methods.keys() {
|
782 + | writeln!(f, "- {}", operation_name.absolute())?;
|
783 + | }
|
784 + |
|
785 + | writeln!(
|
786 + | f,
|
787 + | "\nUse the dedicated methods on `AmazonS3Builder` to register the missing handlers:"
|
788 + | )?;
|
789 + | for setter_name in self.operation_names2setter_methods.values() {
|
790 + | writeln!(f, "- {}", setter_name)?;
|
791 + | }
|
792 + | Ok(())
|
793 + | }
|
794 + | }
|
795 + |
|
796 + | impl std::error::Error for MissingOperationsError {}
|
797 + |
|
798 + | mod request_specs {
|
799 + | pub(super) fn delete_object_tagging(
|
800 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
801 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
802 + | ::http::Method::DELETE,
|
803 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
804 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
805 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
806 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Label,
|
807 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Greedy,
|
808 + | ]),
|
809 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
810 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySegment::Key(String::from("tagging")),
|
811 + | ])
|
812 + | )
|
813 + | ),
|
814 + | )
|
815 + | }
|
816 + | pub(super) fn get_bucket_location(
|
817 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
818 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
819 + | ::http::Method::GET,
|
820 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
821 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
822 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
823 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Label,
|
824 + | ]),
|
825 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
826 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySegment::Key(String::from("location")),
|
827 + | ])
|
828 + | )
|
829 + | ),
|
830 + | )
|
831 + | }
|
832 + | pub(super) fn get_object() -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec
|
833 + | {
|
834 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
835 + | ::http::Method::GET,
|
836 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
837 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
838 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
839 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Label,
|
840 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Greedy,
|
841 + | ]),
|
842 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
843 + | ])
|
844 + | )
|
845 + | ),
|
846 + | )
|
847 + | }
|
848 + | pub(super) fn list_objects_v2(
|
849 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
850 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
851 + | ::http::Method::GET,
|
852 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
853 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
854 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
855 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Label,
|
856 + | ]),
|
857 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
858 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySegment::KeyValue(String::from("list-type"), String::from("2")),
|
859 + | ])
|
860 + | )
|
861 + | ),
|
862 + | )
|
863 + | }
|
864 + | }
|
865 + |
|
866 + | #[allow(missing_docs)] // documentation missing in model
|
867 + | ///
|
868 + | /// See the [root](crate) documentation for more information.
|
869 + | #[derive(Clone)]
|
870 + | pub struct AmazonS3<
|
871 + | S = ::aws_smithy_legacy_http_server::routing::RoutingService<
|
872 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
873 + | ::aws_smithy_legacy_http_server::routing::Route<
|
874 + | ::aws_smithy_legacy_http_server::body::BoxBody,
|
875 + | >,
|
876 + | >,
|
877 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
878 + | >,
|
879 + | > {
|
880 + | // This is the router wrapped by layers.
|
881 + | svc: S,
|
882 + | }
|
883 + |
|
884 + | impl AmazonS3<()> {
|
885 + | /// Constructs a builder for [`AmazonS3`].
|
886 + | /// You must specify a configuration object holding any plugins and layers that should be applied
|
887 + | /// to the operations in this service.
|
888 + | pub fn builder<
|
889 + | Body,
|
890 + | L,
|
891 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
892 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
893 + | >(
|
894 + | config: AmazonS3Config<L, HttpPl, ModelPl>,
|
895 + | ) -> AmazonS3Builder<Body, L, HttpPl, ModelPl> {
|
896 + | AmazonS3Builder {
|
897 + | delete_object_tagging: None,
|
898 + | get_bucket_location: None,
|
899 + | get_object: None,
|
900 + | list_objects_v2: None,
|
901 + | layer: config.layers,
|
902 + | http_plugin: config.http_plugins,
|
903 + | model_plugin: config.model_plugins,
|
904 + | }
|
905 + | }
|
906 + |
|
907 + | /// Constructs a builder for [`AmazonS3`].
|
908 + | /// You must specify what plugins should be applied to the operations in this service.
|
909 + | ///
|
910 + | /// Use [`AmazonS3::builder_without_plugins`] if you don't need to apply plugins.
|
911 + | ///
|
912 + | /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
|
913 + | /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
|
914 + | /// multiple plugins.
|
915 + | #[deprecated(
|
916 + | since = "0.57.0",
|
917 + | note = "please use the `builder` constructor and register plugins on the `AmazonS3Config` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
918 + | )]
|
919 + | pub fn builder_with_plugins<
|
920 + | Body,
|
921 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
922 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
923 + | >(
|
924 + | http_plugin: HttpPl,
|
925 + | model_plugin: ModelPl,
|
926 + | ) -> AmazonS3Builder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
|
927 + | AmazonS3Builder {
|
928 + | delete_object_tagging: None,
|
929 + | get_bucket_location: None,
|
930 + | get_object: None,
|
931 + | list_objects_v2: None,
|
932 + | layer: ::tower::layer::util::Identity::new(),
|
933 + | http_plugin,
|
934 + | model_plugin,
|
935 + | }
|
936 + | }
|
937 + |
|
938 + | /// Constructs a builder for [`AmazonS3`].
|
939 + | ///
|
940 + | /// Use [`AmazonS3::builder_with_plugins`] if you need to specify plugins.
|
941 + | #[deprecated(
|
942 + | since = "0.57.0",
|
943 + | note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
944 + | )]
|
945 + | pub fn builder_without_plugins<Body>() -> AmazonS3Builder<
|
946 + | Body,
|
947 + | ::tower::layer::util::Identity,
|
948 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
949 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
950 + | > {
|
951 + | Self::builder_with_plugins(
|
952 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
953 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
954 + | )
|
955 + | }
|
956 + | }
|
957 + |
|
958 + | impl<S> AmazonS3<S> {
|
959 + | /// Converts [`AmazonS3`] into a [`MakeService`](tower::make::MakeService).
|
960 + | pub fn into_make_service(
|
961 + | self,
|
962 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
|
963 + | ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
|
964 + | }
|
965 + |
|
966 + | /// Converts [`AmazonS3`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
|
967 + | pub fn into_make_service_with_connect_info<C>(
|
968 + | self,
|
969 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
970 + | ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
971 + | }
|
972 + | }
|
973 + |
|
974 + | impl<S>
|
975 + | AmazonS3<
|
976 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
977 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<S>,
|
978 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
979 + | >,
|
980 + | >
|
981 + | {
|
982 + | /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
|
983 + | #[deprecated(
|
984 + | since = "0.57.0",
|
985 + | note = "please add layers to the `AmazonS3Config` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
986 + | )]
|
987 + | pub fn layer<L>(
|
988 + | self,
|
989 + | layer: &L,
|
990 + | ) -> AmazonS3<
|
991 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
992 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
993 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
994 + | >,
|
995 + | >
|
996 + | where
|
997 + | L: ::tower::Layer<S>,
|
998 + | {
|
999 + | AmazonS3 {
|
1000 + | svc: self.svc.map(|s| s.layer(layer)),
|
1001 + | }
|
1002 + | }
|
1003 + |
|
1004 + | /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
|
1005 + | ///
|
1006 + | /// This has the effect of erasing all types accumulated via layers.
|
1007 + | pub fn boxed<B>(
|
1008 + | self,
|
1009 + | ) -> AmazonS3<
|
1010 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1011 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
1012 + | ::aws_smithy_legacy_http_server::routing::Route<B>,
|
1013 + | >,
|
1014 + | ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml,
|
1015 + | >,
|
1016 + | >
|
1017 + | where
|
1018 + | S: ::tower::Service<
|
1019 + | ::http::Request<B>,
|
1020 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1021 + | Error = std::convert::Infallible,
|
1022 + | >,
|
1023 + | S: Clone + Send + 'static,
|
1024 + | S::Future: Send + 'static,
|
1025 + | {
|
1026 + | self.layer(&::tower::layer::layer_fn(
|
1027 + | ::aws_smithy_legacy_http_server::routing::Route::new,
|
1028 + | ))
|
1029 + | }
|
1030 + | }
|
1031 + |
|
1032 + | impl<S, R> ::tower::Service<R> for AmazonS3<S>
|
1033 + | where
|
1034 + | S: ::tower::Service<R>,
|
1035 + | {
|
1036 + | type Response = S::Response;
|
1037 + | type Error = S::Error;
|
1038 + | type Future = S::Future;
|
1039 + |
|
1040 + | fn poll_ready(
|
1041 + | &mut self,
|
1042 + | cx: &mut std::task::Context,
|
1043 + | ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
|
1044 + | self.svc.poll_ready(cx)
|
1045 + | }
|
1046 + |
|
1047 + | fn call(&mut self, request: R) -> Self::Future {
|
1048 + | self.svc.call(request)
|
1049 + | }
|
1050 + | }
|
1051 + |
|
1052 + | /// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in AmazonS3.
|
1053 + | #[allow(clippy::enum_variant_names)]
|
1054 + | #[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
1055 + | pub enum Operation {
|
1056 + | DeleteObjectTagging,
|
1057 + | GetBucketLocation,
|
1058 + | GetObject,
|
1059 + | ListObjectsV2,
|
1060 + | }
|
1061 + |
|
1062 + | impl Operation {
|
1063 + | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
|
1064 + | pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
|
1065 + | match self {
|
1066 + | Operation::DeleteObjectTagging => {
|
1067 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1068 + | "com.amazonaws.s3#DeleteObjectTagging",
|
1069 + | "com.amazonaws.s3",
|
1070 + | "DeleteObjectTagging",
|
1071 + | )
|
1072 + | }
|
1073 + | Operation::GetBucketLocation => {
|
1074 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1075 + | "com.amazonaws.s3#GetBucketLocation",
|
1076 + | "com.amazonaws.s3",
|
1077 + | "GetBucketLocation",
|
1078 + | )
|
1079 + | }
|
1080 + | Operation::GetObject => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1081 + | "com.amazonaws.s3#GetObject",
|
1082 + | "com.amazonaws.s3",
|
1083 + | "GetObject",
|
1084 + | ),
|
1085 + | Operation::ListObjectsV2 => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1086 + | "com.amazonaws.s3#ListObjectsV2",
|
1087 + | "com.amazonaws.s3",
|
1088 + | "ListObjectsV2",
|
1089 + | ),
|
1090 + | }
|
1091 + | }
|
1092 + | }
|
1093 + | impl<L>
|
1094 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1095 + | crate::operation_shape::DeleteObjectTagging,
|
1096 + | > for AmazonS3<L>
|
1097 + | {
|
1098 + | const VALUE: Operation = Operation::DeleteObjectTagging;
|
1099 + | }
|
1100 + | impl<L>
|
1101 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1102 + | crate::operation_shape::GetBucketLocation,
|
1103 + | > for AmazonS3<L>
|
1104 + | {
|
1105 + | const VALUE: Operation = Operation::GetBucketLocation;
|
1106 + | }
|
1107 + | impl<L>
|
1108 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::GetObject>
|
1109 + | for AmazonS3<L>
|
1110 + | {
|
1111 + | const VALUE: Operation = Operation::GetObject;
|
1112 + | }
|
1113 + | impl<L>
|
1114 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1115 + | crate::operation_shape::ListObjectsV2,
|
1116 + | > for AmazonS3<L>
|
1117 + | {
|
1118 + | const VALUE: Operation = Operation::ListObjectsV2;
|
1119 + | }
|
1120 + |
|
1121 + | impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for AmazonS3<S> {
|
1122 + | const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
|
1123 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1124 + | "com.amazonaws.s3#AmazonS3",
|
1125 + | "com.amazonaws.s3",
|
1126 + | "AmazonS3",
|
1127 + | );
|
1128 + |
|
1129 + | const VERSION: Option<&'static str> = Some("2006-03-01");
|
1130 + |
|
1131 + | type Protocol = ::aws_smithy_legacy_http_server::protocol::rest_xml::RestXml;
|
1132 + |
|
1133 + | type Operations = Operation;
|
1134 + | }
|
1135 + | /// Configuration for the [`AmazonS3`]. This is the central place where to register and
|
1136 + | /// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
|
1137 + | ///
|
1138 + | /// ```rust,no_run
|
1139 + | /// # use s3_http0x::AmazonS3Config;
|
1140 + | /// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
|
1141 + | /// # use ::tower::layer::util::Identity;
|
1142 + | /// # let authentication_plugin = IdentityPlugin;
|
1143 + | /// # let authorization_plugin = IdentityPlugin;
|
1144 + | /// # let server_request_id_provider_layer = Identity::new();
|
1145 + | /// let config = AmazonS3Config::builder()
|
1146 + | /// // Layers get executed first...
|
1147 + | /// .layer(server_request_id_provider_layer)
|
1148 + | /// // ...then HTTP plugins...
|
1149 + | /// .http_plugin(authentication_plugin)
|
1150 + | /// // ...and right after deserialization, model plugins.
|
1151 + | /// .model_plugin(authorization_plugin)
|
1152 + | /// .build();
|
1153 + | /// ```
|
1154 + | ///
|
1155 + | /// See the [`plugin`] system for details.
|
1156 + | ///
|
1157 + | /// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
|
1158 + | #[derive(::std::fmt::Debug)]
|
1159 + | pub struct AmazonS3Config<L, H, M> {
|
1160 + | layers: L,
|
1161 + | http_plugins: H,
|
1162 + | model_plugins: M,
|
1163 + | }
|
1164 + |
|
1165 + | impl AmazonS3Config<(), (), ()> {
|
1166 + | /// Returns a builder to construct the configuration.
|
1167 + | pub fn builder() -> AmazonS3ConfigBuilder<
|
1168 + | ::tower::layer::util::Identity,
|
1169 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1170 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1171 + | > {
|
1172 + | AmazonS3ConfigBuilder {
|
1173 + | layers: ::tower::layer::util::Identity::new(),
|
1174 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1175 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1176 + | }
|
1177 + | }
|
1178 + | }
|
1179 + |
|
1180 + | /// Builder returned by [`AmazonS3Config::builder()`].
|
1181 + | #[derive(::std::fmt::Debug)]
|
1182 + | pub struct AmazonS3ConfigBuilder<L, H, M> {
|
1183 + | pub(crate) layers: L,
|
1184 + | pub(crate) http_plugins: H,
|
1185 + | pub(crate) model_plugins: M,
|
1186 + | }
|
1187 + |
|
1188 + | impl<L, H, M> AmazonS3ConfigBuilder<L, H, M> {
|
1189 + | /// Add a [`::tower::Layer`] to the service.
|
1190 + | pub fn layer<NewLayer>(
|
1191 + | self,
|
1192 + | layer: NewLayer,
|
1193 + | ) -> AmazonS3ConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
|
1194 + | AmazonS3ConfigBuilder {
|
1195 + | layers: ::tower::layer::util::Stack::new(layer, self.layers),
|
1196 + | http_plugins: self.http_plugins,
|
1197 + | model_plugins: self.model_plugins,
|
1198 + | }
|
1199 + | }
|
1200 + |
|
1201 + | /// Add a HTTP [plugin] to the service.
|
1202 + | ///
|
1203 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1204 + | // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
|
1205 + | // errors get _substantially_ better if the user makes a mistake.
|
1206 + | pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
|
1207 + | self,
|
1208 + | http_plugin: NewPlugin,
|
1209 + | ) -> AmazonS3ConfigBuilder<
|
1210 + | L,
|
1211 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
|
1212 + | M,
|
1213 + | > {
|
1214 + | AmazonS3ConfigBuilder {
|
1215 + | layers: self.layers,
|
1216 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1217 + | http_plugin,
|
1218 + | self.http_plugins,
|
1219 + | ),
|
1220 + | model_plugins: self.model_plugins,
|
1221 + | }
|
1222 + | }
|
1223 + |
|
1224 + | /// Add a model [plugin] to the service.
|
1225 + | ///
|
1226 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1227 + | // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
|
1228 + | // errors get _substantially_ better if the user makes a mistake.
|
1229 + | pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
|
1230 + | self,
|
1231 + | model_plugin: NewPlugin,
|
1232 + | ) -> AmazonS3ConfigBuilder<
|
1233 + | L,
|
1234 + | H,
|
1235 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
|
1236 + | > {
|
1237 + | AmazonS3ConfigBuilder {
|
1238 + | layers: self.layers,
|
1239 + | http_plugins: self.http_plugins,
|
1240 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1241 + | model_plugin,
|
1242 + | self.model_plugins,
|
1243 + | ),
|
1244 + | }
|
1245 + | }
|
1246 + |
|
1247 + | /// Build the configuration.
|
1248 + | pub fn build(self) -> super::AmazonS3Config<L, H, M> {
|
1249 + | super::AmazonS3Config {
|
1250 + | layers: self.layers,
|
1251 + | http_plugins: self.http_plugins,
|
1252 + | model_plugins: self.model_plugins,
|
1253 + | }
|
1254 + | }
|
1255 + | }
|
1256 + | /// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
|
1257 + | ///
|
1258 + | /// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
|
1259 + | /// of the service and any operations _not_ specified will be placed in the opposing group.
|
1260 + | ///
|
1261 + | /// # Example
|
1262 + | ///
|
1263 + | /// ```rust
|
1264 + | /// scope! {
|
1265 + | /// /// Includes [`DeleteObjectTagging`], excluding all other operations.
|
1266 + | /// struct ScopeA {
|
1267 + | /// includes: [DeleteObjectTagging]
|
1268 + | /// }
|
1269 + | /// }
|
1270 + | ///
|
1271 + | /// scope! {
|
1272 + | /// /// Excludes [`DeleteObjectTagging`], excluding all other operations.
|
1273 + | /// struct ScopeB {
|
1274 + | /// excludes: [DeleteObjectTagging]
|
1275 + | /// }
|
1276 + | /// }
|
1277 + | ///
|
1278 + | /// # use s3_http0x::server::plugin::{Plugin, Scoped};
|
1279 + | /// # use s3_http0x::scope;
|
1280 + | /// # struct MockPlugin;
|
1281 + | /// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
|
1282 + | /// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
|
1283 + | /// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
|
1284 + | /// # let a = Plugin::<(), s3_http0x::operation_shape::DeleteObjectTagging, u64>::apply(&scoped_a, 6);
|
1285 + | /// # let b = Plugin::<(), s3_http0x::operation_shape::DeleteObjectTagging, u64>::apply(&scoped_b, 6);
|
1286 + | /// # assert_eq!(a, 3_u32);
|
1287 + | /// # assert_eq!(b, 6_u64);
|
1288 + | /// ```
|
1289 + | #[macro_export]
|
1290 + | macro_rules! scope {
|
1291 + | // Completed, render impls
|
1292 + | (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
|
1293 + | $(
|
1294 + | impl $ crate::server::plugin::scoped::Membership<$ temp> for $ name {
|
1295 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1296 + | }
|
1297 + | )*
|
1298 + | $(
|
1299 + | impl $ crate::server::plugin::scoped::Membership<$ not_member> for $ name {
|
1300 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1301 + | }
|
1302 + | )*
|
1303 + | };
|
1304 + | // All `not_member`s exhausted, move `temp` into `not_member`
|
1305 + | (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
|
1306 + | scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
|
1307 + | };
|
1308 + |
|
1309 + | // DeleteObjectTagging match found, pop from both `member` and `not_member`
|
1310 + | (@ $ name: ident, $ contains: ident (DeleteObjectTagging $($ member: ident)*) ($($ temp: ident)*) (DeleteObjectTagging $($ not_member: ident)*)) => {
|
1311 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1312 + | };
|
1313 + | // DeleteObjectTagging match not found, pop from `not_member` into `temp` stack
|
1314 + | (@ $ name: ident, $ contains: ident (DeleteObjectTagging $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1315 + | scope! { @ $ name, $ contains (DeleteObjectTagging $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1316 + | };
|
1317 + |
|
1318 + | // GetBucketLocation match found, pop from both `member` and `not_member`
|
1319 + | (@ $ name: ident, $ contains: ident (GetBucketLocation $($ member: ident)*) ($($ temp: ident)*) (GetBucketLocation $($ not_member: ident)*)) => {
|
1320 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1321 + | };
|
1322 + | // GetBucketLocation match not found, pop from `not_member` into `temp` stack
|
1323 + | (@ $ name: ident, $ contains: ident (GetBucketLocation $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1324 + | scope! { @ $ name, $ contains (GetBucketLocation $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1325 + | };
|
1326 + |
|
1327 + | // GetObject match found, pop from both `member` and `not_member`
|
1328 + | (@ $ name: ident, $ contains: ident (GetObject $($ member: ident)*) ($($ temp: ident)*) (GetObject $($ not_member: ident)*)) => {
|
1329 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1330 + | };
|
1331 + | // GetObject match not found, pop from `not_member` into `temp` stack
|
1332 + | (@ $ name: ident, $ contains: ident (GetObject $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1333 + | scope! { @ $ name, $ contains (GetObject $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1334 + | };
|
1335 + |
|
1336 + | // ListObjectsV2 match found, pop from both `member` and `not_member`
|
1337 + | (@ $ name: ident, $ contains: ident (ListObjectsV2 $($ member: ident)*) ($($ temp: ident)*) (ListObjectsV2 $($ not_member: ident)*)) => {
|
1338 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1339 + | };
|
1340 + | // ListObjectsV2 match not found, pop from `not_member` into `temp` stack
|
1341 + | (@ $ name: ident, $ contains: ident (ListObjectsV2 $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1342 + | scope! { @ $ name, $ contains (ListObjectsV2 $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1343 + | };
|
1344 + |
|
1345 + | (
|
1346 + | $(#[$ attrs:meta])*
|
1347 + | $ vis:vis struct $ name:ident {
|
1348 + | includes: [$($ include:ident),*]
|
1349 + | }
|
1350 + | ) => {
|
1351 + | use $ crate::operation_shape::*;
|
1352 + | $ crate::server::scope! {
|
1353 + | $(#[$ attrs])*
|
1354 + | $ vis struct $ name {
|
1355 + | includes: [$($ include),*],
|
1356 + | excludes: []
|
1357 + | }
|
1358 + | }
|
1359 + | scope! { @ $ name, False ($($ include)*) () (DeleteObjectTagging GetBucketLocation GetObject ListObjectsV2) }
|
1360 + | };
|
1361 + | (
|
1362 + | $(#[$ attrs:meta])*
|
1363 + | $ vis:vis struct $ name:ident {
|
1364 + | excludes: [$($ exclude:ident),*]
|
1365 + | }
|
1366 + | ) => {
|
1367 + | use $ crate::operation_shape::*;
|
1368 + |
|
1369 + | $ crate::server::scope! {
|
1370 + | $(#[$ attrs])*
|
1371 + | $ vis struct $ name {
|
1372 + | includes: [],
|
1373 + | excludes: [$($ exclude),*]
|
1374 + | }
|
1375 + | }
|
1376 + | scope! { @ $ name, True ($($ exclude)*) () (DeleteObjectTagging GetBucketLocation GetObject ListObjectsV2) }
|
1377 + | };
|
1378 + | }
|