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