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