1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /// The service builder for [`Config`].
|
3 + | ///
|
4 + | /// Constructed via [`Config::builder`].
|
5 + | pub struct ConfigBuilder<Body, L, HttpPl, ModelPl> {
|
6 + | err_collisions: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
7 + | r#match: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
8 + | option: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
9 + | reserved_words_as_members: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
10 + | result: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
11 + | rpc_echo: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
12 + | structure_name_punning: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
13 + | layer: L,
|
14 + | http_plugin: HttpPl,
|
15 + | model_plugin: ModelPl,
|
16 + | }
|
17 + |
|
18 + | impl<Body, L, HttpPl, ModelPl> ConfigBuilder<Body, L, HttpPl, ModelPl> {
|
19 + | /// Sets the [`ErrCollisions`](crate::operation_shape::ErrCollisions) operation.
|
20 + | ///
|
21 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
22 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
23 + | ///
|
24 + | /// # Example
|
25 + | ///
|
26 + | /// ```no_run
|
27 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
28 + | ///
|
29 + | /// use naming_test_ops_http0x::{input, output, error};
|
30 + | ///
|
31 + | /// async fn handler(input: input::ErrCollisionsInput) -> Result<output::ErrCollisionsOutput, error::ErrCollisionsError> {
|
32 + | /// todo!()
|
33 + | /// }
|
34 + | ///
|
35 + | /// let config = ConfigConfig::builder().build();
|
36 + | /// let app = Config::builder(config)
|
37 + | /// .err_collisions(handler)
|
38 + | /// /* Set other handlers */
|
39 + | /// .build()
|
40 + | /// .unwrap();
|
41 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
42 + | /// ```
|
43 + | ///
|
44 + | pub fn err_collisions<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
45 + | where
|
46 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::ErrCollisions, HandlerExtractors>,
|
47 + |
|
48 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
49 + | Config<L>,
|
50 + | crate::operation_shape::ErrCollisions,
|
51 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::ErrCollisions, HandlerType>
|
52 + | >,
|
53 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
54 + | Config<L>,
|
55 + | crate::operation_shape::ErrCollisions,
|
56 + | ModelPl::Output
|
57 + | >,
|
58 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
59 + | Config<L>,
|
60 + | crate::operation_shape::ErrCollisions,
|
61 + | <
|
62 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
63 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
64 + | Config<L>,
|
65 + | crate::operation_shape::ErrCollisions,
|
66 + | ModelPl::Output
|
67 + | >
|
68 + | >::Output
|
69 + | >,
|
70 + |
|
71 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
72 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
73 + |
|
74 + | {
|
75 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
76 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
77 + | let svc = crate::operation_shape::ErrCollisions::from_handler(handler);
|
78 + | let svc = self.model_plugin.apply(svc);
|
79 + | let svc =
|
80 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
81 + | .apply(svc);
|
82 + | let svc = self.http_plugin.apply(svc);
|
83 + | self.err_collisions_custom(svc)
|
84 + | }
|
85 + |
|
86 + | /// Sets the [`ErrCollisions`](crate::operation_shape::ErrCollisions) operation.
|
87 + | ///
|
88 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
89 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
90 + | ///
|
91 + | /// # Example
|
92 + | ///
|
93 + | /// ```no_run
|
94 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
95 + | ///
|
96 + | /// use naming_test_ops_http0x::{input, output, error};
|
97 + | ///
|
98 + | /// async fn handler(input: input::ErrCollisionsInput) -> Result<output::ErrCollisionsOutput, error::ErrCollisionsError> {
|
99 + | /// todo!()
|
100 + | /// }
|
101 + | ///
|
102 + | /// let config = ConfigConfig::builder().build();
|
103 + | /// let svc = ::tower::util::service_fn(handler);
|
104 + | /// let app = Config::builder(config)
|
105 + | /// .err_collisions_service(svc)
|
106 + | /// /* Set other handlers */
|
107 + | /// .build()
|
108 + | /// .unwrap();
|
109 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
110 + | /// ```
|
111 + | ///
|
112 + | pub fn err_collisions_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
113 + | where
|
114 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::ErrCollisions, ServiceExtractors>,
|
115 + |
|
116 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
117 + | Config<L>,
|
118 + | crate::operation_shape::ErrCollisions,
|
119 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::ErrCollisions, S>
|
120 + | >,
|
121 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
122 + | Config<L>,
|
123 + | crate::operation_shape::ErrCollisions,
|
124 + | ModelPl::Output
|
125 + | >,
|
126 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
127 + | Config<L>,
|
128 + | crate::operation_shape::ErrCollisions,
|
129 + | <
|
130 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
131 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
132 + | Config<L>,
|
133 + | crate::operation_shape::ErrCollisions,
|
134 + | ModelPl::Output
|
135 + | >
|
136 + | >::Output
|
137 + | >,
|
138 + |
|
139 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
140 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
141 + |
|
142 + | {
|
143 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
144 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
145 + | let svc = crate::operation_shape::ErrCollisions::from_service(service);
|
146 + | let svc = self.model_plugin.apply(svc);
|
147 + | let svc =
|
148 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
149 + | .apply(svc);
|
150 + | let svc = self.http_plugin.apply(svc);
|
151 + | self.err_collisions_custom(svc)
|
152 + | }
|
153 + |
|
154 + | /// Sets the [`ErrCollisions`](crate::operation_shape::ErrCollisions) to a custom [`Service`](tower::Service).
|
155 + | /// not constrained by the Smithy contract.
|
156 + | fn err_collisions_custom<S>(mut self, svc: S) -> Self
|
157 + | where
|
158 + | S: ::tower::Service<
|
159 + | ::http::Request<Body>,
|
160 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
161 + | Error = ::std::convert::Infallible,
|
162 + | > + Clone
|
163 + | + Send
|
164 + | + 'static,
|
165 + | S::Future: Send + 'static,
|
166 + | {
|
167 + | self.err_collisions = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
168 + | self
|
169 + | }
|
170 + |
|
171 + | /// Sets the [`Match`](crate::operation_shape::Match) operation.
|
172 + | ///
|
173 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
174 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
175 + | ///
|
176 + | /// # Example
|
177 + | ///
|
178 + | /// ```no_run
|
179 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
180 + | ///
|
181 + | /// use naming_test_ops_http0x::{input, output, error};
|
182 + | ///
|
183 + | /// async fn handler(input: input::MatchInput) -> Result<output::MatchOutput, error::MatchError> {
|
184 + | /// todo!()
|
185 + | /// }
|
186 + | ///
|
187 + | /// let config = ConfigConfig::builder().build();
|
188 + | /// let app = Config::builder(config)
|
189 + | /// .r#match(handler)
|
190 + | /// /* Set other handlers */
|
191 + | /// .build()
|
192 + | /// .unwrap();
|
193 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
194 + | /// ```
|
195 + | ///
|
196 + | pub fn r#match<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
197 + | where
|
198 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::Match, HandlerExtractors>,
|
199 + |
|
200 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
201 + | Config<L>,
|
202 + | crate::operation_shape::Match,
|
203 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::Match, HandlerType>
|
204 + | >,
|
205 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
206 + | Config<L>,
|
207 + | crate::operation_shape::Match,
|
208 + | ModelPl::Output
|
209 + | >,
|
210 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
211 + | Config<L>,
|
212 + | crate::operation_shape::Match,
|
213 + | <
|
214 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
215 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
216 + | Config<L>,
|
217 + | crate::operation_shape::Match,
|
218 + | ModelPl::Output
|
219 + | >
|
220 + | >::Output
|
221 + | >,
|
222 + |
|
223 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
224 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
225 + |
|
226 + | {
|
227 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
228 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
229 + | let svc = crate::operation_shape::Match::from_handler(handler);
|
230 + | let svc = self.model_plugin.apply(svc);
|
231 + | let svc =
|
232 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
233 + | .apply(svc);
|
234 + | let svc = self.http_plugin.apply(svc);
|
235 + | self.r#match_custom(svc)
|
236 + | }
|
237 + |
|
238 + | /// Sets the [`Match`](crate::operation_shape::Match) operation.
|
239 + | ///
|
240 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
241 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
242 + | ///
|
243 + | /// # Example
|
244 + | ///
|
245 + | /// ```no_run
|
246 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
247 + | ///
|
248 + | /// use naming_test_ops_http0x::{input, output, error};
|
249 + | ///
|
250 + | /// async fn handler(input: input::MatchInput) -> Result<output::MatchOutput, error::MatchError> {
|
251 + | /// todo!()
|
252 + | /// }
|
253 + | ///
|
254 + | /// let config = ConfigConfig::builder().build();
|
255 + | /// let svc = ::tower::util::service_fn(handler);
|
256 + | /// let app = Config::builder(config)
|
257 + | /// .r#match_service(svc)
|
258 + | /// /* Set other handlers */
|
259 + | /// .build()
|
260 + | /// .unwrap();
|
261 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
262 + | /// ```
|
263 + | ///
|
264 + | pub fn r#match_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
265 + | where
|
266 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::Match, ServiceExtractors>,
|
267 + |
|
268 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
269 + | Config<L>,
|
270 + | crate::operation_shape::Match,
|
271 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::Match, S>
|
272 + | >,
|
273 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
274 + | Config<L>,
|
275 + | crate::operation_shape::Match,
|
276 + | ModelPl::Output
|
277 + | >,
|
278 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
279 + | Config<L>,
|
280 + | crate::operation_shape::Match,
|
281 + | <
|
282 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
283 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
284 + | Config<L>,
|
285 + | crate::operation_shape::Match,
|
286 + | ModelPl::Output
|
287 + | >
|
288 + | >::Output
|
289 + | >,
|
290 + |
|
291 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
292 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
293 + |
|
294 + | {
|
295 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
296 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
297 + | let svc = crate::operation_shape::Match::from_service(service);
|
298 + | let svc = self.model_plugin.apply(svc);
|
299 + | let svc =
|
300 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
301 + | .apply(svc);
|
302 + | let svc = self.http_plugin.apply(svc);
|
303 + | self.r#match_custom(svc)
|
304 + | }
|
305 + |
|
306 + | /// Sets the [`Match`](crate::operation_shape::Match) to a custom [`Service`](tower::Service).
|
307 + | /// not constrained by the Smithy contract.
|
308 + | fn r#match_custom<S>(mut self, svc: S) -> Self
|
309 + | where
|
310 + | S: ::tower::Service<
|
311 + | ::http::Request<Body>,
|
312 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
313 + | Error = ::std::convert::Infallible,
|
314 + | > + Clone
|
315 + | + Send
|
316 + | + 'static,
|
317 + | S::Future: Send + 'static,
|
318 + | {
|
319 + | self.r#match = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
320 + | self
|
321 + | }
|
322 + |
|
323 + | /// Sets the [`Option`](crate::operation_shape::Option) operation.
|
324 + | ///
|
325 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
326 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
327 + | ///
|
328 + | /// # Example
|
329 + | ///
|
330 + | /// ```no_run
|
331 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
332 + | ///
|
333 + | /// use naming_test_ops_http0x::{input, output, error};
|
334 + | ///
|
335 + | /// async fn handler(input: input::OptionInput) -> output::OptionOutput {
|
336 + | /// todo!()
|
337 + | /// }
|
338 + | ///
|
339 + | /// let config = ConfigConfig::builder().build();
|
340 + | /// let app = Config::builder(config)
|
341 + | /// .option(handler)
|
342 + | /// /* Set other handlers */
|
343 + | /// .build()
|
344 + | /// .unwrap();
|
345 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
346 + | /// ```
|
347 + | ///
|
348 + | pub fn option<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
349 + | where
|
350 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::Option, HandlerExtractors>,
|
351 + |
|
352 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
353 + | Config<L>,
|
354 + | crate::operation_shape::Option,
|
355 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::Option, HandlerType>
|
356 + | >,
|
357 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
358 + | Config<L>,
|
359 + | crate::operation_shape::Option,
|
360 + | ModelPl::Output
|
361 + | >,
|
362 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
363 + | Config<L>,
|
364 + | crate::operation_shape::Option,
|
365 + | <
|
366 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
367 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
368 + | Config<L>,
|
369 + | crate::operation_shape::Option,
|
370 + | ModelPl::Output
|
371 + | >
|
372 + | >::Output
|
373 + | >,
|
374 + |
|
375 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
376 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
377 + |
|
378 + | {
|
379 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
380 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
381 + | let svc = crate::operation_shape::Option::from_handler(handler);
|
382 + | let svc = self.model_plugin.apply(svc);
|
383 + | let svc =
|
384 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
385 + | .apply(svc);
|
386 + | let svc = self.http_plugin.apply(svc);
|
387 + | self.option_custom(svc)
|
388 + | }
|
389 + |
|
390 + | /// Sets the [`Option`](crate::operation_shape::Option) operation.
|
391 + | ///
|
392 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
393 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
394 + | ///
|
395 + | /// # Example
|
396 + | ///
|
397 + | /// ```no_run
|
398 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
399 + | ///
|
400 + | /// use naming_test_ops_http0x::{input, output, error};
|
401 + | ///
|
402 + | /// async fn handler(input: input::OptionInput) -> Result<output::OptionOutput, std::convert::Infallible> {
|
403 + | /// todo!()
|
404 + | /// }
|
405 + | ///
|
406 + | /// let config = ConfigConfig::builder().build();
|
407 + | /// let svc = ::tower::util::service_fn(handler);
|
408 + | /// let app = Config::builder(config)
|
409 + | /// .option_service(svc)
|
410 + | /// /* Set other handlers */
|
411 + | /// .build()
|
412 + | /// .unwrap();
|
413 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
414 + | /// ```
|
415 + | ///
|
416 + | pub fn option_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
417 + | where
|
418 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::Option, ServiceExtractors>,
|
419 + |
|
420 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
421 + | Config<L>,
|
422 + | crate::operation_shape::Option,
|
423 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::Option, S>
|
424 + | >,
|
425 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
426 + | Config<L>,
|
427 + | crate::operation_shape::Option,
|
428 + | ModelPl::Output
|
429 + | >,
|
430 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
431 + | Config<L>,
|
432 + | crate::operation_shape::Option,
|
433 + | <
|
434 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
435 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
436 + | Config<L>,
|
437 + | crate::operation_shape::Option,
|
438 + | ModelPl::Output
|
439 + | >
|
440 + | >::Output
|
441 + | >,
|
442 + |
|
443 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
444 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
445 + |
|
446 + | {
|
447 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
448 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
449 + | let svc = crate::operation_shape::Option::from_service(service);
|
450 + | let svc = self.model_plugin.apply(svc);
|
451 + | let svc =
|
452 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
453 + | .apply(svc);
|
454 + | let svc = self.http_plugin.apply(svc);
|
455 + | self.option_custom(svc)
|
456 + | }
|
457 + |
|
458 + | /// Sets the [`Option`](crate::operation_shape::Option) to a custom [`Service`](tower::Service).
|
459 + | /// not constrained by the Smithy contract.
|
460 + | fn option_custom<S>(mut self, svc: S) -> Self
|
461 + | where
|
462 + | S: ::tower::Service<
|
463 + | ::http::Request<Body>,
|
464 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
465 + | Error = ::std::convert::Infallible,
|
466 + | > + Clone
|
467 + | + Send
|
468 + | + 'static,
|
469 + | S::Future: Send + 'static,
|
470 + | {
|
471 + | self.option = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
472 + | self
|
473 + | }
|
474 + |
|
475 + | /// Sets the [`ReservedWordsAsMembers`](crate::operation_shape::ReservedWordsAsMembers) operation.
|
476 + | ///
|
477 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
478 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
479 + | ///
|
480 + | /// # Example
|
481 + | ///
|
482 + | /// ```no_run
|
483 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
484 + | ///
|
485 + | /// use naming_test_ops_http0x::{input, output, error};
|
486 + | ///
|
487 + | /// async fn handler(input: input::ReservedWordsAsMembersInput) -> Result<output::ReservedWordsAsMembersOutput, error::ReservedWordsAsMembersError> {
|
488 + | /// todo!()
|
489 + | /// }
|
490 + | ///
|
491 + | /// let config = ConfigConfig::builder().build();
|
492 + | /// let app = Config::builder(config)
|
493 + | /// .reserved_words_as_members(handler)
|
494 + | /// /* Set other handlers */
|
495 + | /// .build()
|
496 + | /// .unwrap();
|
497 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
498 + | /// ```
|
499 + | ///
|
500 + | pub fn reserved_words_as_members<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
501 + | where
|
502 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::ReservedWordsAsMembers, HandlerExtractors>,
|
503 + |
|
504 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
505 + | Config<L>,
|
506 + | crate::operation_shape::ReservedWordsAsMembers,
|
507 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::ReservedWordsAsMembers, HandlerType>
|
508 + | >,
|
509 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
510 + | Config<L>,
|
511 + | crate::operation_shape::ReservedWordsAsMembers,
|
512 + | ModelPl::Output
|
513 + | >,
|
514 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
515 + | Config<L>,
|
516 + | crate::operation_shape::ReservedWordsAsMembers,
|
517 + | <
|
518 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
519 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
520 + | Config<L>,
|
521 + | crate::operation_shape::ReservedWordsAsMembers,
|
522 + | ModelPl::Output
|
523 + | >
|
524 + | >::Output
|
525 + | >,
|
526 + |
|
527 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
528 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
529 + |
|
530 + | {
|
531 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
532 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
533 + | let svc = crate::operation_shape::ReservedWordsAsMembers::from_handler(handler);
|
534 + | let svc = self.model_plugin.apply(svc);
|
535 + | let svc =
|
536 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
537 + | .apply(svc);
|
538 + | let svc = self.http_plugin.apply(svc);
|
539 + | self.reserved_words_as_members_custom(svc)
|
540 + | }
|
541 + |
|
542 + | /// Sets the [`ReservedWordsAsMembers`](crate::operation_shape::ReservedWordsAsMembers) operation.
|
543 + | ///
|
544 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
545 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
546 + | ///
|
547 + | /// # Example
|
548 + | ///
|
549 + | /// ```no_run
|
550 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
551 + | ///
|
552 + | /// use naming_test_ops_http0x::{input, output, error};
|
553 + | ///
|
554 + | /// async fn handler(input: input::ReservedWordsAsMembersInput) -> Result<output::ReservedWordsAsMembersOutput, error::ReservedWordsAsMembersError> {
|
555 + | /// todo!()
|
556 + | /// }
|
557 + | ///
|
558 + | /// let config = ConfigConfig::builder().build();
|
559 + | /// let svc = ::tower::util::service_fn(handler);
|
560 + | /// let app = Config::builder(config)
|
561 + | /// .reserved_words_as_members_service(svc)
|
562 + | /// /* Set other handlers */
|
563 + | /// .build()
|
564 + | /// .unwrap();
|
565 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
566 + | /// ```
|
567 + | ///
|
568 + | pub fn reserved_words_as_members_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
569 + | where
|
570 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::ReservedWordsAsMembers, ServiceExtractors>,
|
571 + |
|
572 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
573 + | Config<L>,
|
574 + | crate::operation_shape::ReservedWordsAsMembers,
|
575 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::ReservedWordsAsMembers, S>
|
576 + | >,
|
577 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
578 + | Config<L>,
|
579 + | crate::operation_shape::ReservedWordsAsMembers,
|
580 + | ModelPl::Output
|
581 + | >,
|
582 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
583 + | Config<L>,
|
584 + | crate::operation_shape::ReservedWordsAsMembers,
|
585 + | <
|
586 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
587 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
588 + | Config<L>,
|
589 + | crate::operation_shape::ReservedWordsAsMembers,
|
590 + | ModelPl::Output
|
591 + | >
|
592 + | >::Output
|
593 + | >,
|
594 + |
|
595 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
596 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
597 + |
|
598 + | {
|
599 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
600 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
601 + | let svc = crate::operation_shape::ReservedWordsAsMembers::from_service(service);
|
602 + | let svc = self.model_plugin.apply(svc);
|
603 + | let svc =
|
604 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
605 + | .apply(svc);
|
606 + | let svc = self.http_plugin.apply(svc);
|
607 + | self.reserved_words_as_members_custom(svc)
|
608 + | }
|
609 + |
|
610 + | /// Sets the [`ReservedWordsAsMembers`](crate::operation_shape::ReservedWordsAsMembers) to a custom [`Service`](tower::Service).
|
611 + | /// not constrained by the Smithy contract.
|
612 + | fn reserved_words_as_members_custom<S>(mut self, svc: S) -> Self
|
613 + | where
|
614 + | S: ::tower::Service<
|
615 + | ::http::Request<Body>,
|
616 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
617 + | Error = ::std::convert::Infallible,
|
618 + | > + Clone
|
619 + | + Send
|
620 + | + 'static,
|
621 + | S::Future: Send + 'static,
|
622 + | {
|
623 + | self.reserved_words_as_members =
|
624 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
625 + | self
|
626 + | }
|
627 + |
|
628 + | /// Sets the [`Result`](crate::operation_shape::Result) operation.
|
629 + | ///
|
630 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
631 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
632 + | ///
|
633 + | /// # Example
|
634 + | ///
|
635 + | /// ```no_run
|
636 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
637 + | ///
|
638 + | /// use naming_test_ops_http0x::{input, output, error};
|
639 + | ///
|
640 + | /// async fn handler(input: input::ResultInput) -> output::ResultOutput {
|
641 + | /// todo!()
|
642 + | /// }
|
643 + | ///
|
644 + | /// let config = ConfigConfig::builder().build();
|
645 + | /// let app = Config::builder(config)
|
646 + | /// .result(handler)
|
647 + | /// /* Set other handlers */
|
648 + | /// .build()
|
649 + | /// .unwrap();
|
650 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
651 + | /// ```
|
652 + | ///
|
653 + | pub fn result<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
654 + | where
|
655 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::Result, HandlerExtractors>,
|
656 + |
|
657 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
658 + | Config<L>,
|
659 + | crate::operation_shape::Result,
|
660 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::Result, HandlerType>
|
661 + | >,
|
662 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
663 + | Config<L>,
|
664 + | crate::operation_shape::Result,
|
665 + | ModelPl::Output
|
666 + | >,
|
667 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
668 + | Config<L>,
|
669 + | crate::operation_shape::Result,
|
670 + | <
|
671 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
672 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
673 + | Config<L>,
|
674 + | crate::operation_shape::Result,
|
675 + | ModelPl::Output
|
676 + | >
|
677 + | >::Output
|
678 + | >,
|
679 + |
|
680 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
681 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
682 + |
|
683 + | {
|
684 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
685 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
686 + | let svc = crate::operation_shape::Result::from_handler(handler);
|
687 + | let svc = self.model_plugin.apply(svc);
|
688 + | let svc =
|
689 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
690 + | .apply(svc);
|
691 + | let svc = self.http_plugin.apply(svc);
|
692 + | self.result_custom(svc)
|
693 + | }
|
694 + |
|
695 + | /// Sets the [`Result`](crate::operation_shape::Result) operation.
|
696 + | ///
|
697 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
698 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
699 + | ///
|
700 + | /// # Example
|
701 + | ///
|
702 + | /// ```no_run
|
703 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
704 + | ///
|
705 + | /// use naming_test_ops_http0x::{input, output, error};
|
706 + | ///
|
707 + | /// async fn handler(input: input::ResultInput) -> Result<output::ResultOutput, std::convert::Infallible> {
|
708 + | /// todo!()
|
709 + | /// }
|
710 + | ///
|
711 + | /// let config = ConfigConfig::builder().build();
|
712 + | /// let svc = ::tower::util::service_fn(handler);
|
713 + | /// let app = Config::builder(config)
|
714 + | /// .result_service(svc)
|
715 + | /// /* Set other handlers */
|
716 + | /// .build()
|
717 + | /// .unwrap();
|
718 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
719 + | /// ```
|
720 + | ///
|
721 + | pub fn result_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
722 + | where
|
723 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::Result, ServiceExtractors>,
|
724 + |
|
725 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
726 + | Config<L>,
|
727 + | crate::operation_shape::Result,
|
728 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::Result, S>
|
729 + | >,
|
730 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
731 + | Config<L>,
|
732 + | crate::operation_shape::Result,
|
733 + | ModelPl::Output
|
734 + | >,
|
735 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
736 + | Config<L>,
|
737 + | crate::operation_shape::Result,
|
738 + | <
|
739 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
740 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
741 + | Config<L>,
|
742 + | crate::operation_shape::Result,
|
743 + | ModelPl::Output
|
744 + | >
|
745 + | >::Output
|
746 + | >,
|
747 + |
|
748 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
749 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
750 + |
|
751 + | {
|
752 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
753 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
754 + | let svc = crate::operation_shape::Result::from_service(service);
|
755 + | let svc = self.model_plugin.apply(svc);
|
756 + | let svc =
|
757 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
758 + | .apply(svc);
|
759 + | let svc = self.http_plugin.apply(svc);
|
760 + | self.result_custom(svc)
|
761 + | }
|
762 + |
|
763 + | /// Sets the [`Result`](crate::operation_shape::Result) to a custom [`Service`](tower::Service).
|
764 + | /// not constrained by the Smithy contract.
|
765 + | fn result_custom<S>(mut self, svc: S) -> Self
|
766 + | where
|
767 + | S: ::tower::Service<
|
768 + | ::http::Request<Body>,
|
769 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
770 + | Error = ::std::convert::Infallible,
|
771 + | > + Clone
|
772 + | + Send
|
773 + | + 'static,
|
774 + | S::Future: Send + 'static,
|
775 + | {
|
776 + | self.result = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
777 + | self
|
778 + | }
|
779 + |
|
780 + | /// Sets the [`RpcEcho`](crate::operation_shape::RpcEcho) operation.
|
781 + | ///
|
782 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
783 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
784 + | ///
|
785 + | /// # Example
|
786 + | ///
|
787 + | /// ```no_run
|
788 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
789 + | ///
|
790 + | /// use naming_test_ops_http0x::{input, output, error};
|
791 + | ///
|
792 + | /// async fn handler(input: input::RpcEchoInput) -> Result<output::RpcEchoOutput, error::RPCEchoError> {
|
793 + | /// todo!()
|
794 + | /// }
|
795 + | ///
|
796 + | /// let config = ConfigConfig::builder().build();
|
797 + | /// let app = Config::builder(config)
|
798 + | /// .rpc_echo(handler)
|
799 + | /// /* Set other handlers */
|
800 + | /// .build()
|
801 + | /// .unwrap();
|
802 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
803 + | /// ```
|
804 + | ///
|
805 + | pub fn rpc_echo<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
806 + | where
|
807 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::RpcEcho, HandlerExtractors>,
|
808 + |
|
809 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
810 + | Config<L>,
|
811 + | crate::operation_shape::RpcEcho,
|
812 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::RpcEcho, HandlerType>
|
813 + | >,
|
814 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
815 + | Config<L>,
|
816 + | crate::operation_shape::RpcEcho,
|
817 + | ModelPl::Output
|
818 + | >,
|
819 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
820 + | Config<L>,
|
821 + | crate::operation_shape::RpcEcho,
|
822 + | <
|
823 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
824 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
825 + | Config<L>,
|
826 + | crate::operation_shape::RpcEcho,
|
827 + | ModelPl::Output
|
828 + | >
|
829 + | >::Output
|
830 + | >,
|
831 + |
|
832 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
833 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
834 + |
|
835 + | {
|
836 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
837 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
838 + | let svc = crate::operation_shape::RpcEcho::from_handler(handler);
|
839 + | let svc = self.model_plugin.apply(svc);
|
840 + | let svc =
|
841 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
842 + | .apply(svc);
|
843 + | let svc = self.http_plugin.apply(svc);
|
844 + | self.rpc_echo_custom(svc)
|
845 + | }
|
846 + |
|
847 + | /// Sets the [`RpcEcho`](crate::operation_shape::RpcEcho) operation.
|
848 + | ///
|
849 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
850 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
851 + | ///
|
852 + | /// # Example
|
853 + | ///
|
854 + | /// ```no_run
|
855 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
856 + | ///
|
857 + | /// use naming_test_ops_http0x::{input, output, error};
|
858 + | ///
|
859 + | /// async fn handler(input: input::RpcEchoInput) -> Result<output::RpcEchoOutput, error::RPCEchoError> {
|
860 + | /// todo!()
|
861 + | /// }
|
862 + | ///
|
863 + | /// let config = ConfigConfig::builder().build();
|
864 + | /// let svc = ::tower::util::service_fn(handler);
|
865 + | /// let app = Config::builder(config)
|
866 + | /// .rpc_echo_service(svc)
|
867 + | /// /* Set other handlers */
|
868 + | /// .build()
|
869 + | /// .unwrap();
|
870 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
871 + | /// ```
|
872 + | ///
|
873 + | pub fn rpc_echo_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
874 + | where
|
875 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::RpcEcho, ServiceExtractors>,
|
876 + |
|
877 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
878 + | Config<L>,
|
879 + | crate::operation_shape::RpcEcho,
|
880 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::RpcEcho, S>
|
881 + | >,
|
882 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
883 + | Config<L>,
|
884 + | crate::operation_shape::RpcEcho,
|
885 + | ModelPl::Output
|
886 + | >,
|
887 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
888 + | Config<L>,
|
889 + | crate::operation_shape::RpcEcho,
|
890 + | <
|
891 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
892 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
893 + | Config<L>,
|
894 + | crate::operation_shape::RpcEcho,
|
895 + | ModelPl::Output
|
896 + | >
|
897 + | >::Output
|
898 + | >,
|
899 + |
|
900 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
901 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
902 + |
|
903 + | {
|
904 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
905 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
906 + | let svc = crate::operation_shape::RpcEcho::from_service(service);
|
907 + | let svc = self.model_plugin.apply(svc);
|
908 + | let svc =
|
909 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
910 + | .apply(svc);
|
911 + | let svc = self.http_plugin.apply(svc);
|
912 + | self.rpc_echo_custom(svc)
|
913 + | }
|
914 + |
|
915 + | /// Sets the [`RpcEcho`](crate::operation_shape::RpcEcho) to a custom [`Service`](tower::Service).
|
916 + | /// not constrained by the Smithy contract.
|
917 + | fn rpc_echo_custom<S>(mut self, svc: S) -> Self
|
918 + | where
|
919 + | S: ::tower::Service<
|
920 + | ::http::Request<Body>,
|
921 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
922 + | Error = ::std::convert::Infallible,
|
923 + | > + Clone
|
924 + | + Send
|
925 + | + 'static,
|
926 + | S::Future: Send + 'static,
|
927 + | {
|
928 + | self.rpc_echo = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
929 + | self
|
930 + | }
|
931 + |
|
932 + | /// Sets the [`StructureNamePunning`](crate::operation_shape::StructureNamePunning) operation.
|
933 + | ///
|
934 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
935 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
936 + | ///
|
937 + | /// # Example
|
938 + | ///
|
939 + | /// ```no_run
|
940 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
941 + | ///
|
942 + | /// use naming_test_ops_http0x::{input, output, error};
|
943 + | ///
|
944 + | /// async fn handler(input: input::StructureNamePunningInput) -> output::StructureNamePunningOutput {
|
945 + | /// todo!()
|
946 + | /// }
|
947 + | ///
|
948 + | /// let config = ConfigConfig::builder().build();
|
949 + | /// let app = Config::builder(config)
|
950 + | /// .structure_name_punning(handler)
|
951 + | /// /* Set other handlers */
|
952 + | /// .build()
|
953 + | /// .unwrap();
|
954 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
955 + | /// ```
|
956 + | ///
|
957 + | pub fn structure_name_punning<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
958 + | where
|
959 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::StructureNamePunning, HandlerExtractors>,
|
960 + |
|
961 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
962 + | Config<L>,
|
963 + | crate::operation_shape::StructureNamePunning,
|
964 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::StructureNamePunning, HandlerType>
|
965 + | >,
|
966 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
967 + | Config<L>,
|
968 + | crate::operation_shape::StructureNamePunning,
|
969 + | ModelPl::Output
|
970 + | >,
|
971 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
972 + | Config<L>,
|
973 + | crate::operation_shape::StructureNamePunning,
|
974 + | <
|
975 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
976 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
977 + | Config<L>,
|
978 + | crate::operation_shape::StructureNamePunning,
|
979 + | ModelPl::Output
|
980 + | >
|
981 + | >::Output
|
982 + | >,
|
983 + |
|
984 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
985 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
986 + |
|
987 + | {
|
988 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
989 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
990 + | let svc = crate::operation_shape::StructureNamePunning::from_handler(handler);
|
991 + | let svc = self.model_plugin.apply(svc);
|
992 + | let svc =
|
993 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
994 + | .apply(svc);
|
995 + | let svc = self.http_plugin.apply(svc);
|
996 + | self.structure_name_punning_custom(svc)
|
997 + | }
|
998 + |
|
999 + | /// Sets the [`StructureNamePunning`](crate::operation_shape::StructureNamePunning) operation.
|
1000 + | ///
|
1001 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1002 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1003 + | ///
|
1004 + | /// # Example
|
1005 + | ///
|
1006 + | /// ```no_run
|
1007 + | /// use naming_test_ops_http0x::{Config, ConfigConfig};
|
1008 + | ///
|
1009 + | /// use naming_test_ops_http0x::{input, output, error};
|
1010 + | ///
|
1011 + | /// async fn handler(input: input::StructureNamePunningInput) -> Result<output::StructureNamePunningOutput, std::convert::Infallible> {
|
1012 + | /// todo!()
|
1013 + | /// }
|
1014 + | ///
|
1015 + | /// let config = ConfigConfig::builder().build();
|
1016 + | /// let svc = ::tower::util::service_fn(handler);
|
1017 + | /// let app = Config::builder(config)
|
1018 + | /// .structure_name_punning_service(svc)
|
1019 + | /// /* Set other handlers */
|
1020 + | /// .build()
|
1021 + | /// .unwrap();
|
1022 + | /// # let app: Config<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
|
1023 + | /// ```
|
1024 + | ///
|
1025 + | pub fn structure_name_punning_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1026 + | where
|
1027 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::StructureNamePunning, ServiceExtractors>,
|
1028 + |
|
1029 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1030 + | Config<L>,
|
1031 + | crate::operation_shape::StructureNamePunning,
|
1032 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::StructureNamePunning, S>
|
1033 + | >,
|
1034 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1035 + | Config<L>,
|
1036 + | crate::operation_shape::StructureNamePunning,
|
1037 + | ModelPl::Output
|
1038 + | >,
|
1039 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1040 + | Config<L>,
|
1041 + | crate::operation_shape::StructureNamePunning,
|
1042 + | <
|
1043 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1044 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1045 + | Config<L>,
|
1046 + | crate::operation_shape::StructureNamePunning,
|
1047 + | ModelPl::Output
|
1048 + | >
|
1049 + | >::Output
|
1050 + | >,
|
1051 + |
|
1052 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1053 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1054 + |
|
1055 + | {
|
1056 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1057 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1058 + | let svc = crate::operation_shape::StructureNamePunning::from_service(service);
|
1059 + | let svc = self.model_plugin.apply(svc);
|
1060 + | let svc =
|
1061 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1062 + | .apply(svc);
|
1063 + | let svc = self.http_plugin.apply(svc);
|
1064 + | self.structure_name_punning_custom(svc)
|
1065 + | }
|
1066 + |
|
1067 + | /// Sets the [`StructureNamePunning`](crate::operation_shape::StructureNamePunning) to a custom [`Service`](tower::Service).
|
1068 + | /// not constrained by the Smithy contract.
|
1069 + | fn structure_name_punning_custom<S>(mut self, svc: S) -> Self
|
1070 + | where
|
1071 + | S: ::tower::Service<
|
1072 + | ::http::Request<Body>,
|
1073 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1074 + | Error = ::std::convert::Infallible,
|
1075 + | > + Clone
|
1076 + | + Send
|
1077 + | + 'static,
|
1078 + | S::Future: Send + 'static,
|
1079 + | {
|
1080 + | self.structure_name_punning =
|
1081 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1082 + | self
|
1083 + | }
|
1084 + | }
|
1085 + |
|
1086 + | impl<Body, L, HttpPl, ModelPl> ConfigBuilder<Body, L, HttpPl, ModelPl> {
|
1087 + | /// Constructs a [`Config`] from the arguments provided to the builder.
|
1088 + | ///
|
1089 + | /// Forgetting to register a handler for one or more operations will result in an error.
|
1090 + | ///
|
1091 + | /// Check out [`ConfigBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
|
1092 + | /// unspecified route is requested.
|
1093 + | pub fn build(
|
1094 + | self,
|
1095 + | ) -> ::std::result::Result<
|
1096 + | Config<
|
1097 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1098 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
1099 + | L::Service,
|
1100 + | >,
|
1101 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1102 + | >,
|
1103 + | >,
|
1104 + | MissingOperationsError,
|
1105 + | >
|
1106 + | where
|
1107 + | L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
1108 + | {
|
1109 + | let router = {
|
1110 + | use ::aws_smithy_legacy_http_server::operation::OperationShape;
|
1111 + | let mut missing_operation_names = std::collections::HashMap::new();
|
1112 + | if self.err_collisions.is_none() {
|
1113 + | missing_operation_names.insert(
|
1114 + | crate::operation_shape::ErrCollisions::ID,
|
1115 + | ".err_collisions()",
|
1116 + | );
|
1117 + | }
|
1118 + | if self.r#match.is_none() {
|
1119 + | missing_operation_names.insert(crate::operation_shape::Match::ID, ".r#match()");
|
1120 + | }
|
1121 + | if self.option.is_none() {
|
1122 + | missing_operation_names.insert(crate::operation_shape::Option::ID, ".option()");
|
1123 + | }
|
1124 + | if self.reserved_words_as_members.is_none() {
|
1125 + | missing_operation_names.insert(
|
1126 + | crate::operation_shape::ReservedWordsAsMembers::ID,
|
1127 + | ".reserved_words_as_members()",
|
1128 + | );
|
1129 + | }
|
1130 + | if self.result.is_none() {
|
1131 + | missing_operation_names.insert(crate::operation_shape::Result::ID, ".result()");
|
1132 + | }
|
1133 + | if self.rpc_echo.is_none() {
|
1134 + | missing_operation_names.insert(crate::operation_shape::RpcEcho::ID, ".rpc_echo()");
|
1135 + | }
|
1136 + | if self.structure_name_punning.is_none() {
|
1137 + | missing_operation_names.insert(
|
1138 + | crate::operation_shape::StructureNamePunning::ID,
|
1139 + | ".structure_name_punning()",
|
1140 + | );
|
1141 + | }
|
1142 + | if !missing_operation_names.is_empty() {
|
1143 + | return Err(MissingOperationsError {
|
1144 + | operation_names2setter_methods: missing_operation_names,
|
1145 + | });
|
1146 + | }
|
1147 + | 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";
|
1148 + |
|
1149 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
|
1150 + | (
|
1151 + | request_specs::err_collisions(),
|
1152 + | self.err_collisions.expect(unexpected_error_msg),
|
1153 + | ),
|
1154 + | (
|
1155 + | request_specs::r#match(),
|
1156 + | self.r#match.expect(unexpected_error_msg),
|
1157 + | ),
|
1158 + | (
|
1159 + | request_specs::option(),
|
1160 + | self.option.expect(unexpected_error_msg),
|
1161 + | ),
|
1162 + | (
|
1163 + | request_specs::reserved_words_as_members(),
|
1164 + | self.reserved_words_as_members.expect(unexpected_error_msg),
|
1165 + | ),
|
1166 + | (
|
1167 + | request_specs::result(),
|
1168 + | self.result.expect(unexpected_error_msg),
|
1169 + | ),
|
1170 + | (
|
1171 + | request_specs::rpc_echo(),
|
1172 + | self.rpc_echo.expect(unexpected_error_msg),
|
1173 + | ),
|
1174 + | (
|
1175 + | request_specs::structure_name_punning(),
|
1176 + | self.structure_name_punning.expect(unexpected_error_msg),
|
1177 + | ),
|
1178 + | ])
|
1179 + | };
|
1180 + | let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
|
1181 + | let svc = svc.map(|s| s.layer(self.layer));
|
1182 + | Ok(Config { svc })
|
1183 + | }
|
1184 + |
|
1185 + | /// Constructs a [`Config`] from the arguments provided to the builder.
|
1186 + | /// Operations without a handler default to returning 500 Internal Server Error to the caller.
|
1187 + | ///
|
1188 + | /// Check out [`ConfigBuilder::build`] if you'd prefer the builder to fail if one or more operations do
|
1189 + | /// not have a registered handler.
|
1190 + | pub fn build_unchecked(self) -> Config<L::Service>
|
1191 + | where
|
1192 + | Body: Send + 'static,
|
1193 + | L: ::tower::Layer<
|
1194 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1195 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
1196 + | ::aws_smithy_legacy_http_server::routing::Route<Body>,
|
1197 + | >,
|
1198 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1199 + | >,
|
1200 + | >,
|
1201 + | {
|
1202 + | let router =
|
1203 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter(
|
1204 + | [
|
1205 + | (
|
1206 + | request_specs::err_collisions(),
|
1207 + | self.err_collisions.unwrap_or_else(|| {
|
1208 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1209 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1210 + | >::default();
|
1211 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1212 + | }),
|
1213 + | ),
|
1214 + | (
|
1215 + | request_specs::r#match(),
|
1216 + | self.r#match.unwrap_or_else(|| {
|
1217 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1218 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1219 + | >::default();
|
1220 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1221 + | }),
|
1222 + | ),
|
1223 + | (
|
1224 + | request_specs::option(),
|
1225 + | self.option.unwrap_or_else(|| {
|
1226 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1227 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1228 + | >::default();
|
1229 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1230 + | }),
|
1231 + | ),
|
1232 + | (
|
1233 + | request_specs::reserved_words_as_members(),
|
1234 + | self.reserved_words_as_members.unwrap_or_else(|| {
|
1235 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1236 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1237 + | >::default();
|
1238 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1239 + | }),
|
1240 + | ),
|
1241 + | (
|
1242 + | request_specs::result(),
|
1243 + | self.result.unwrap_or_else(|| {
|
1244 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1245 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1246 + | >::default();
|
1247 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1248 + | }),
|
1249 + | ),
|
1250 + | (
|
1251 + | request_specs::rpc_echo(),
|
1252 + | self.rpc_echo.unwrap_or_else(|| {
|
1253 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1254 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1255 + | >::default();
|
1256 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1257 + | }),
|
1258 + | ),
|
1259 + | (
|
1260 + | request_specs::structure_name_punning(),
|
1261 + | self.structure_name_punning.unwrap_or_else(|| {
|
1262 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
1263 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1264 + | >::default();
|
1265 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
1266 + | }),
|
1267 + | ),
|
1268 + | ],
|
1269 + | );
|
1270 + | let svc = self
|
1271 + | .layer
|
1272 + | .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
|
1273 + | Config { svc }
|
1274 + | }
|
1275 + | }
|
1276 + |
|
1277 + | /// The error encountered when calling the [`ConfigBuilder::build`] method if one or more operation handlers are not
|
1278 + | /// specified.
|
1279 + | #[derive(Debug)]
|
1280 + | pub struct MissingOperationsError {
|
1281 + | operation_names2setter_methods:
|
1282 + | std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
|
1283 + | }
|
1284 + |
|
1285 + | impl std::fmt::Display for MissingOperationsError {
|
1286 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1287 + | write!(
|
1288 + | f,
|
1289 + | "You must specify a handler for all operations attached to `Config`.\n\
|
1290 + | We are missing handlers for the following operations:\n",
|
1291 + | )?;
|
1292 + | for operation_name in self.operation_names2setter_methods.keys() {
|
1293 + | writeln!(f, "- {}", operation_name.absolute())?;
|
1294 + | }
|
1295 + |
|
1296 + | writeln!(
|
1297 + | f,
|
1298 + | "\nUse the dedicated methods on `ConfigBuilder` to register the missing handlers:"
|
1299 + | )?;
|
1300 + | for setter_name in self.operation_names2setter_methods.values() {
|
1301 + | writeln!(f, "- {}", setter_name)?;
|
1302 + | }
|
1303 + | Ok(())
|
1304 + | }
|
1305 + | }
|
1306 + |
|
1307 + | impl std::error::Error for MissingOperationsError {}
|
1308 + |
|
1309 + | mod request_specs {
|
1310 + | pub(super) fn err_collisions() -> &'static str {
|
1311 + | "Config.ErrCollisions"
|
1312 + | }
|
1313 + | pub(super) fn r#match() -> &'static str {
|
1314 + | "Config.Match"
|
1315 + | }
|
1316 + | pub(super) fn option() -> &'static str {
|
1317 + | "Config.Option"
|
1318 + | }
|
1319 + | pub(super) fn reserved_words_as_members() -> &'static str {
|
1320 + | "Config.ReservedWordsAsMembers"
|
1321 + | }
|
1322 + | pub(super) fn result() -> &'static str {
|
1323 + | "Config.Result"
|
1324 + | }
|
1325 + | pub(super) fn rpc_echo() -> &'static str {
|
1326 + | "Config.RPCEcho"
|
1327 + | }
|
1328 + | pub(super) fn structure_name_punning() -> &'static str {
|
1329 + | "Config.StructureNamePunning"
|
1330 + | }
|
1331 + | }
|
1332 + |
|
1333 + | /// Confounds model generation machinery with lots of problematic names
|
1334 + | ///
|
1335 + | /// See the [root](crate) documentation for more information.
|
1336 + | #[derive(Clone)]
|
1337 + | pub struct Config<
|
1338 + | S = ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1339 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
1340 + | ::aws_smithy_legacy_http_server::routing::Route<
|
1341 + | ::aws_smithy_legacy_http_server::body::BoxBody,
|
1342 + | >,
|
1343 + | >,
|
1344 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1345 + | >,
|
1346 + | > {
|
1347 + | // This is the router wrapped by layers.
|
1348 + | svc: S,
|
1349 + | }
|
1350 + |
|
1351 + | impl Config<()> {
|
1352 + | /// Constructs a builder for [`Config`].
|
1353 + | /// You must specify a configuration object holding any plugins and layers that should be applied
|
1354 + | /// to the operations in this service.
|
1355 + | pub fn builder<
|
1356 + | Body,
|
1357 + | L,
|
1358 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
1359 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
1360 + | >(
|
1361 + | config: ConfigConfig<L, HttpPl, ModelPl>,
|
1362 + | ) -> ConfigBuilder<Body, L, HttpPl, ModelPl> {
|
1363 + | ConfigBuilder {
|
1364 + | err_collisions: None,
|
1365 + | r#match: None,
|
1366 + | option: None,
|
1367 + | reserved_words_as_members: None,
|
1368 + | result: None,
|
1369 + | rpc_echo: None,
|
1370 + | structure_name_punning: None,
|
1371 + | layer: config.layers,
|
1372 + | http_plugin: config.http_plugins,
|
1373 + | model_plugin: config.model_plugins,
|
1374 + | }
|
1375 + | }
|
1376 + |
|
1377 + | /// Constructs a builder for [`Config`].
|
1378 + | /// You must specify what plugins should be applied to the operations in this service.
|
1379 + | ///
|
1380 + | /// Use [`Config::builder_without_plugins`] if you don't need to apply plugins.
|
1381 + | ///
|
1382 + | /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
|
1383 + | /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
|
1384 + | /// multiple plugins.
|
1385 + | #[deprecated(
|
1386 + | since = "0.57.0",
|
1387 + | note = "please use the `builder` constructor and register plugins on the `ConfigConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
1388 + | )]
|
1389 + | pub fn builder_with_plugins<
|
1390 + | Body,
|
1391 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
1392 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
1393 + | >(
|
1394 + | http_plugin: HttpPl,
|
1395 + | model_plugin: ModelPl,
|
1396 + | ) -> ConfigBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
|
1397 + | ConfigBuilder {
|
1398 + | err_collisions: None,
|
1399 + | r#match: None,
|
1400 + | option: None,
|
1401 + | reserved_words_as_members: None,
|
1402 + | result: None,
|
1403 + | rpc_echo: None,
|
1404 + | structure_name_punning: None,
|
1405 + | layer: ::tower::layer::util::Identity::new(),
|
1406 + | http_plugin,
|
1407 + | model_plugin,
|
1408 + | }
|
1409 + | }
|
1410 + |
|
1411 + | /// Constructs a builder for [`Config`].
|
1412 + | ///
|
1413 + | /// Use [`Config::builder_with_plugins`] if you need to specify plugins.
|
1414 + | #[deprecated(
|
1415 + | since = "0.57.0",
|
1416 + | note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
1417 + | )]
|
1418 + | pub fn builder_without_plugins<Body>() -> ConfigBuilder<
|
1419 + | Body,
|
1420 + | ::tower::layer::util::Identity,
|
1421 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1422 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1423 + | > {
|
1424 + | Self::builder_with_plugins(
|
1425 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1426 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1427 + | )
|
1428 + | }
|
1429 + | }
|
1430 + |
|
1431 + | impl<S> Config<S> {
|
1432 + | /// Converts [`Config`] into a [`MakeService`](tower::make::MakeService).
|
1433 + | pub fn into_make_service(
|
1434 + | self,
|
1435 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
|
1436 + | ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
|
1437 + | }
|
1438 + |
|
1439 + | /// Converts [`Config`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
|
1440 + | pub fn into_make_service_with_connect_info<C>(
|
1441 + | self,
|
1442 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
1443 + | ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
1444 + | }
|
1445 + | }
|
1446 + |
|
1447 + | impl<S>
|
1448 + | Config<
|
1449 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1450 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<S>,
|
1451 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1452 + | >,
|
1453 + | >
|
1454 + | {
|
1455 + | /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
|
1456 + | #[deprecated(
|
1457 + | since = "0.57.0",
|
1458 + | note = "please add layers to the `ConfigConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
1459 + | )]
|
1460 + | pub fn layer<L>(
|
1461 + | self,
|
1462 + | layer: &L,
|
1463 + | ) -> Config<
|
1464 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1465 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<L::Service>,
|
1466 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1467 + | >,
|
1468 + | >
|
1469 + | where
|
1470 + | L: ::tower::Layer<S>,
|
1471 + | {
|
1472 + | Config {
|
1473 + | svc: self.svc.map(|s| s.layer(layer)),
|
1474 + | }
|
1475 + | }
|
1476 + |
|
1477 + | /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
|
1478 + | ///
|
1479 + | /// This has the effect of erasing all types accumulated via layers.
|
1480 + | pub fn boxed<B>(
|
1481 + | self,
|
1482 + | ) -> Config<
|
1483 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1484 + | ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
|
1485 + | ::aws_smithy_legacy_http_server::routing::Route<B>,
|
1486 + | >,
|
1487 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1488 + | >,
|
1489 + | >
|
1490 + | where
|
1491 + | S: ::tower::Service<
|
1492 + | ::http::Request<B>,
|
1493 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1494 + | Error = std::convert::Infallible,
|
1495 + | >,
|
1496 + | S: Clone + Send + 'static,
|
1497 + | S::Future: Send + 'static,
|
1498 + | {
|
1499 + | self.layer(&::tower::layer::layer_fn(
|
1500 + | ::aws_smithy_legacy_http_server::routing::Route::new,
|
1501 + | ))
|
1502 + | }
|
1503 + | }
|
1504 + |
|
1505 + | impl<S, R> ::tower::Service<R> for Config<S>
|
1506 + | where
|
1507 + | S: ::tower::Service<R>,
|
1508 + | {
|
1509 + | type Response = S::Response;
|
1510 + | type Error = S::Error;
|
1511 + | type Future = S::Future;
|
1512 + |
|
1513 + | fn poll_ready(
|
1514 + | &mut self,
|
1515 + | cx: &mut std::task::Context,
|
1516 + | ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
|
1517 + | self.svc.poll_ready(cx)
|
1518 + | }
|
1519 + |
|
1520 + | fn call(&mut self, request: R) -> Self::Future {
|
1521 + | self.svc.call(request)
|
1522 + | }
|
1523 + | }
|
1524 + |
|
1525 + | /// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in Config.
|
1526 + | #[allow(clippy::enum_variant_names)]
|
1527 + | #[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
1528 + | pub enum Operation {
|
1529 + | ErrCollisions,
|
1530 + | Match,
|
1531 + | Option,
|
1532 + | ReservedWordsAsMembers,
|
1533 + | Result,
|
1534 + | RpcEcho,
|
1535 + | StructureNamePunning,
|
1536 + | }
|
1537 + |
|
1538 + | impl Operation {
|
1539 + | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
|
1540 + | pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
|
1541 + | match self {
|
1542 + | Operation::ErrCollisions => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1543 + | "crate#ErrCollisions",
|
1544 + | "crate",
|
1545 + | "ErrCollisions",
|
1546 + | ),
|
1547 + | Operation::Match => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1548 + | "crate#Match",
|
1549 + | "crate",
|
1550 + | "Match",
|
1551 + | ),
|
1552 + | Operation::Option => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1553 + | "crate#Option",
|
1554 + | "crate",
|
1555 + | "Option",
|
1556 + | ),
|
1557 + | Operation::ReservedWordsAsMembers => {
|
1558 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1559 + | "crate#ReservedWordsAsMembers",
|
1560 + | "crate",
|
1561 + | "ReservedWordsAsMembers",
|
1562 + | )
|
1563 + | }
|
1564 + | Operation::Result => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1565 + | "crate#Result",
|
1566 + | "crate",
|
1567 + | "Result",
|
1568 + | ),
|
1569 + | Operation::RpcEcho => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1570 + | "crate#RPCEcho",
|
1571 + | "crate",
|
1572 + | "RPCEcho",
|
1573 + | ),
|
1574 + | Operation::StructureNamePunning => {
|
1575 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
1576 + | "crate#StructureNamePunning",
|
1577 + | "crate",
|
1578 + | "StructureNamePunning",
|
1579 + | )
|
1580 + | }
|
1581 + | }
|
1582 + | }
|
1583 + | }
|
1584 + | impl<L>
|
1585 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1586 + | crate::operation_shape::ErrCollisions,
|
1587 + | > for Config<L>
|
1588 + | {
|
1589 + | const VALUE: Operation = Operation::ErrCollisions;
|
1590 + | }
|
1591 + | impl<L> ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::Match>
|
1592 + | for Config<L>
|
1593 + | {
|
1594 + | const VALUE: Operation = Operation::Match;
|
1595 + | }
|
1596 + | impl<L> ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::Option>
|
1597 + | for Config<L>
|
1598 + | {
|
1599 + | const VALUE: Operation = Operation::Option;
|
1600 + | }
|
1601 + | impl<L>
|
1602 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1603 + | crate::operation_shape::ReservedWordsAsMembers,
|
1604 + | > for Config<L>
|
1605 + | {
|
1606 + | const VALUE: Operation = Operation::ReservedWordsAsMembers;
|
1607 + | }
|
1608 + | impl<L> ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::Result>
|
1609 + | for Config<L>
|
1610 + | {
|
1611 + | const VALUE: Operation = Operation::Result;
|
1612 + | }
|
1613 + | impl<L> ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::RpcEcho>
|
1614 + | for Config<L>
|
1615 + | {
|
1616 + | const VALUE: Operation = Operation::RpcEcho;
|
1617 + | }
|
1618 + | impl<L>
|
1619 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
1620 + | crate::operation_shape::StructureNamePunning,
|
1621 + | > for Config<L>
|
1622 + | {
|
1623 + | const VALUE: Operation = Operation::StructureNamePunning;
|
1624 + | }
|
1625 + |
|
1626 + | impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for Config<S> {
|
1627 + | const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
|
1628 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new("crate#Config", "crate", "Config");
|
1629 + |
|
1630 + | const VERSION: Option<&'static str> = Some("2006-03-01");
|
1631 + |
|
1632 + | type Protocol = ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1;
|
1633 + |
|
1634 + | type Operations = Operation;
|
1635 + | }
|
1636 + | /// Configuration for the [`Config`]. This is the central place where to register and
|
1637 + | /// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
|
1638 + | ///
|
1639 + | /// ```rust,no_run
|
1640 + | /// # use naming_test_ops_http0x::ConfigConfig;
|
1641 + | /// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
|
1642 + | /// # use ::tower::layer::util::Identity;
|
1643 + | /// # let authentication_plugin = IdentityPlugin;
|
1644 + | /// # let authorization_plugin = IdentityPlugin;
|
1645 + | /// # let server_request_id_provider_layer = Identity::new();
|
1646 + | /// let config = ConfigConfig::builder()
|
1647 + | /// // Layers get executed first...
|
1648 + | /// .layer(server_request_id_provider_layer)
|
1649 + | /// // ...then HTTP plugins...
|
1650 + | /// .http_plugin(authentication_plugin)
|
1651 + | /// // ...and right after deserialization, model plugins.
|
1652 + | /// .model_plugin(authorization_plugin)
|
1653 + | /// .build();
|
1654 + | /// ```
|
1655 + | ///
|
1656 + | /// See the [`plugin`] system for details.
|
1657 + | ///
|
1658 + | /// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
|
1659 + | #[derive(::std::fmt::Debug)]
|
1660 + | pub struct ConfigConfig<L, H, M> {
|
1661 + | layers: L,
|
1662 + | http_plugins: H,
|
1663 + | model_plugins: M,
|
1664 + | }
|
1665 + |
|
1666 + | impl ConfigConfig<(), (), ()> {
|
1667 + | /// Returns a builder to construct the configuration.
|
1668 + | pub fn builder() -> ConfigConfigBuilder<
|
1669 + | ::tower::layer::util::Identity,
|
1670 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1671 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1672 + | > {
|
1673 + | ConfigConfigBuilder {
|
1674 + | layers: ::tower::layer::util::Identity::new(),
|
1675 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1676 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
1677 + | }
|
1678 + | }
|
1679 + | }
|
1680 + |
|
1681 + | /// Builder returned by [`ConfigConfig::builder()`].
|
1682 + | #[derive(::std::fmt::Debug)]
|
1683 + | pub struct ConfigConfigBuilder<L, H, M> {
|
1684 + | pub(crate) layers: L,
|
1685 + | pub(crate) http_plugins: H,
|
1686 + | pub(crate) model_plugins: M,
|
1687 + | }
|
1688 + |
|
1689 + | impl<L, H, M> ConfigConfigBuilder<L, H, M> {
|
1690 + | /// Add a [`::tower::Layer`] to the service.
|
1691 + | pub fn layer<NewLayer>(
|
1692 + | self,
|
1693 + | layer: NewLayer,
|
1694 + | ) -> ConfigConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
|
1695 + | ConfigConfigBuilder {
|
1696 + | layers: ::tower::layer::util::Stack::new(layer, self.layers),
|
1697 + | http_plugins: self.http_plugins,
|
1698 + | model_plugins: self.model_plugins,
|
1699 + | }
|
1700 + | }
|
1701 + |
|
1702 + | /// Add a HTTP [plugin] to the service.
|
1703 + | ///
|
1704 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1705 + | // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
|
1706 + | // errors get _substantially_ better if the user makes a mistake.
|
1707 + | pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
|
1708 + | self,
|
1709 + | http_plugin: NewPlugin,
|
1710 + | ) -> ConfigConfigBuilder<L, ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>, M>
|
1711 + | {
|
1712 + | ConfigConfigBuilder {
|
1713 + | layers: self.layers,
|
1714 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1715 + | http_plugin,
|
1716 + | self.http_plugins,
|
1717 + | ),
|
1718 + | model_plugins: self.model_plugins,
|
1719 + | }
|
1720 + | }
|
1721 + |
|
1722 + | /// Add a model [plugin] to the service.
|
1723 + | ///
|
1724 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
1725 + | // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
|
1726 + | // errors get _substantially_ better if the user makes a mistake.
|
1727 + | pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
|
1728 + | self,
|
1729 + | model_plugin: NewPlugin,
|
1730 + | ) -> ConfigConfigBuilder<L, H, ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>>
|
1731 + | {
|
1732 + | ConfigConfigBuilder {
|
1733 + | layers: self.layers,
|
1734 + | http_plugins: self.http_plugins,
|
1735 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
1736 + | model_plugin,
|
1737 + | self.model_plugins,
|
1738 + | ),
|
1739 + | }
|
1740 + | }
|
1741 + |
|
1742 + | /// Build the configuration.
|
1743 + | pub fn build(self) -> super::ConfigConfig<L, H, M> {
|
1744 + | super::ConfigConfig {
|
1745 + | layers: self.layers,
|
1746 + | http_plugins: self.http_plugins,
|
1747 + | model_plugins: self.model_plugins,
|
1748 + | }
|
1749 + | }
|
1750 + | }
|
1751 + | /// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
|
1752 + | ///
|
1753 + | /// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
|
1754 + | /// of the service and any operations _not_ specified will be placed in the opposing group.
|
1755 + | ///
|
1756 + | /// # Example
|
1757 + | ///
|
1758 + | /// ```rust
|
1759 + | /// scope! {
|
1760 + | /// /// Includes [`ErrCollisions`], excluding all other operations.
|
1761 + | /// struct ScopeA {
|
1762 + | /// includes: [ErrCollisions]
|
1763 + | /// }
|
1764 + | /// }
|
1765 + | ///
|
1766 + | /// scope! {
|
1767 + | /// /// Excludes [`ErrCollisions`], excluding all other operations.
|
1768 + | /// struct ScopeB {
|
1769 + | /// excludes: [ErrCollisions]
|
1770 + | /// }
|
1771 + | /// }
|
1772 + | ///
|
1773 + | /// # use naming_test_ops_http0x::server::plugin::{Plugin, Scoped};
|
1774 + | /// # use naming_test_ops_http0x::scope;
|
1775 + | /// # struct MockPlugin;
|
1776 + | /// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
|
1777 + | /// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
|
1778 + | /// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
|
1779 + | /// # let a = Plugin::<(), naming_test_ops_http0x::operation_shape::ErrCollisions, u64>::apply(&scoped_a, 6);
|
1780 + | /// # let b = Plugin::<(), naming_test_ops_http0x::operation_shape::ErrCollisions, u64>::apply(&scoped_b, 6);
|
1781 + | /// # assert_eq!(a, 3_u32);
|
1782 + | /// # assert_eq!(b, 6_u64);
|
1783 + | /// ```
|
1784 + | #[macro_export]
|
1785 + | macro_rules! scope {
|
1786 + | // Completed, render impls
|
1787 + | (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
|
1788 + | $(
|
1789 + | impl $ crate::server::plugin::scoped::Membership<$ temp> for $ name {
|
1790 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1791 + | }
|
1792 + | )*
|
1793 + | $(
|
1794 + | impl $ crate::server::plugin::scoped::Membership<$ not_member> for $ name {
|
1795 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
1796 + | }
|
1797 + | )*
|
1798 + | };
|
1799 + | // All `not_member`s exhausted, move `temp` into `not_member`
|
1800 + | (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
|
1801 + | scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
|
1802 + | };
|
1803 + |
|
1804 + | // ErrCollisions match found, pop from both `member` and `not_member`
|
1805 + | (@ $ name: ident, $ contains: ident (ErrCollisions $($ member: ident)*) ($($ temp: ident)*) (ErrCollisions $($ not_member: ident)*)) => {
|
1806 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1807 + | };
|
1808 + | // ErrCollisions match not found, pop from `not_member` into `temp` stack
|
1809 + | (@ $ name: ident, $ contains: ident (ErrCollisions $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1810 + | scope! { @ $ name, $ contains (ErrCollisions $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1811 + | };
|
1812 + |
|
1813 + | // Match match found, pop from both `member` and `not_member`
|
1814 + | (@ $ name: ident, $ contains: ident (Match $($ member: ident)*) ($($ temp: ident)*) (Match $($ not_member: ident)*)) => {
|
1815 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1816 + | };
|
1817 + | // Match match not found, pop from `not_member` into `temp` stack
|
1818 + | (@ $ name: ident, $ contains: ident (Match $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1819 + | scope! { @ $ name, $ contains (Match $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1820 + | };
|
1821 + |
|
1822 + | // Option match found, pop from both `member` and `not_member`
|
1823 + | (@ $ name: ident, $ contains: ident (Option $($ member: ident)*) ($($ temp: ident)*) (Option $($ not_member: ident)*)) => {
|
1824 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1825 + | };
|
1826 + | // Option match not found, pop from `not_member` into `temp` stack
|
1827 + | (@ $ name: ident, $ contains: ident (Option $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1828 + | scope! { @ $ name, $ contains (Option $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1829 + | };
|
1830 + |
|
1831 + | // ReservedWordsAsMembers match found, pop from both `member` and `not_member`
|
1832 + | (@ $ name: ident, $ contains: ident (ReservedWordsAsMembers $($ member: ident)*) ($($ temp: ident)*) (ReservedWordsAsMembers $($ not_member: ident)*)) => {
|
1833 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1834 + | };
|
1835 + | // ReservedWordsAsMembers match not found, pop from `not_member` into `temp` stack
|
1836 + | (@ $ name: ident, $ contains: ident (ReservedWordsAsMembers $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1837 + | scope! { @ $ name, $ contains (ReservedWordsAsMembers $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1838 + | };
|
1839 + |
|
1840 + | // Result match found, pop from both `member` and `not_member`
|
1841 + | (@ $ name: ident, $ contains: ident (Result $($ member: ident)*) ($($ temp: ident)*) (Result $($ not_member: ident)*)) => {
|
1842 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1843 + | };
|
1844 + | // Result match not found, pop from `not_member` into `temp` stack
|
1845 + | (@ $ name: ident, $ contains: ident (Result $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1846 + | scope! { @ $ name, $ contains (Result $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1847 + | };
|
1848 + |
|
1849 + | // RpcEcho match found, pop from both `member` and `not_member`
|
1850 + | (@ $ name: ident, $ contains: ident (RpcEcho $($ member: ident)*) ($($ temp: ident)*) (RpcEcho $($ not_member: ident)*)) => {
|
1851 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1852 + | };
|
1853 + | // RpcEcho match not found, pop from `not_member` into `temp` stack
|
1854 + | (@ $ name: ident, $ contains: ident (RpcEcho $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1855 + | scope! { @ $ name, $ contains (RpcEcho $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1856 + | };
|
1857 + |
|
1858 + | // StructureNamePunning match found, pop from both `member` and `not_member`
|
1859 + | (@ $ name: ident, $ contains: ident (StructureNamePunning $($ member: ident)*) ($($ temp: ident)*) (StructureNamePunning $($ not_member: ident)*)) => {
|
1860 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
1861 + | };
|
1862 + | // StructureNamePunning match not found, pop from `not_member` into `temp` stack
|
1863 + | (@ $ name: ident, $ contains: ident (StructureNamePunning $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
1864 + | scope! { @ $ name, $ contains (StructureNamePunning $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
1865 + | };
|
1866 + |
|
1867 + | (
|
1868 + | $(#[$ attrs:meta])*
|
1869 + | $ vis:vis struct $ name:ident {
|
1870 + | includes: [$($ include:ident),*]
|
1871 + | }
|
1872 + | ) => {
|
1873 + | use $ crate::operation_shape::*;
|
1874 + | $ crate::server::scope! {
|
1875 + | $(#[$ attrs])*
|
1876 + | $ vis struct $ name {
|
1877 + | includes: [$($ include),*],
|
1878 + | excludes: []
|
1879 + | }
|
1880 + | }
|
1881 + | scope! { @ $ name, False ($($ include)*) () (ErrCollisions Match Option ReservedWordsAsMembers Result RpcEcho StructureNamePunning) }
|
1882 + | };
|
1883 + | (
|
1884 + | $(#[$ attrs:meta])*
|
1885 + | $ vis:vis struct $ name:ident {
|
1886 + | excludes: [$($ exclude:ident),*]
|
1887 + | }
|
1888 + | ) => {
|
1889 + | use $ crate::operation_shape::*;
|
1890 + |
|
1891 + | $ crate::server::scope! {
|
1892 + | $(#[$ attrs])*
|
1893 + | $ vis struct $ name {
|
1894 + | includes: [],
|
1895 + | excludes: [$($ exclude),*]
|
1896 + | }
|
1897 + | }
|
1898 + | scope! { @ $ name, True ($($ exclude)*) () (ErrCollisions Match Option ReservedWordsAsMembers Result RpcEcho StructureNamePunning) }
|
1899 + | };
|
1900 + | }
|