1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /// The service builder for [`RestJsonExtras`].
|
3 + | ///
|
4 + | /// Constructed via [`RestJsonExtras::builder`].
|
5 + | pub struct RestJsonExtrasBuilder<Body, L, HttpPl, ModelPl> {
|
6 + | case_insensitive_error_operation: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
7 + | empty_struct_with_content_on_wire_op:
|
8 + | Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
9 + | enum_query: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
10 + | escaped_string_values: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
11 + | http_query_params_only_operation: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
12 + | map_with_enum_key_op: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
13 + | null_in_non_sparse: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
14 + | primitive_int_header: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
15 + | primitive_int_op: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
16 + | query_precedence: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
17 + | status_response: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
18 + | string_payload: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
19 + | layer: L,
|
20 + | http_plugin: HttpPl,
|
21 + | model_plugin: ModelPl,
|
22 + | }
|
23 + |
|
24 + | impl<Body, L, HttpPl, ModelPl> RestJsonExtrasBuilder<Body, L, HttpPl, ModelPl> {
|
25 + | /// Sets the [`CaseInsensitiveErrorOperation`](crate::operation_shape::CaseInsensitiveErrorOperation) operation.
|
26 + | ///
|
27 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
28 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
29 + | ///
|
30 + | /// # Example
|
31 + | ///
|
32 + | /// ```no_run
|
33 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
34 + | ///
|
35 + | /// use rest_json_extras_http0x::{input, output, error};
|
36 + | ///
|
37 + | /// async fn handler(input: input::CaseInsensitiveErrorOperationInput) -> Result<output::CaseInsensitiveErrorOperationOutput, error::CaseInsensitiveErrorOperationError> {
|
38 + | /// todo!()
|
39 + | /// }
|
40 + | ///
|
41 + | /// let config = RestJsonExtrasConfig::builder().build();
|
42 + | /// let app = RestJsonExtras::builder(config)
|
43 + | /// .case_insensitive_error_operation(handler)
|
44 + | /// /* Set other handlers */
|
45 + | /// .build()
|
46 + | /// .unwrap();
|
47 + | /// # let app: RestJsonExtras<::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;
|
48 + | /// ```
|
49 + | ///
|
50 + | pub fn case_insensitive_error_operation<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
51 + | where
|
52 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::CaseInsensitiveErrorOperation, HandlerExtractors>,
|
53 + |
|
54 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
55 + | RestJsonExtras<L>,
|
56 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
57 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::CaseInsensitiveErrorOperation, HandlerType>
|
58 + | >,
|
59 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
60 + | RestJsonExtras<L>,
|
61 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
62 + | ModelPl::Output
|
63 + | >,
|
64 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
65 + | RestJsonExtras<L>,
|
66 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
67 + | <
|
68 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
69 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
70 + | RestJsonExtras<L>,
|
71 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
72 + | ModelPl::Output
|
73 + | >
|
74 + | >::Output
|
75 + | >,
|
76 + |
|
77 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
78 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
79 + |
|
80 + | {
|
81 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
82 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
83 + | let svc = crate::operation_shape::CaseInsensitiveErrorOperation::from_handler(handler);
|
84 + | let svc = self.model_plugin.apply(svc);
|
85 + | let svc =
|
86 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
87 + | .apply(svc);
|
88 + | let svc = self.http_plugin.apply(svc);
|
89 + | self.case_insensitive_error_operation_custom(svc)
|
90 + | }
|
91 + |
|
92 + | /// Sets the [`CaseInsensitiveErrorOperation`](crate::operation_shape::CaseInsensitiveErrorOperation) operation.
|
93 + | ///
|
94 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
95 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
96 + | ///
|
97 + | /// # Example
|
98 + | ///
|
99 + | /// ```no_run
|
100 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
101 + | ///
|
102 + | /// use rest_json_extras_http0x::{input, output, error};
|
103 + | ///
|
104 + | /// async fn handler(input: input::CaseInsensitiveErrorOperationInput) -> Result<output::CaseInsensitiveErrorOperationOutput, error::CaseInsensitiveErrorOperationError> {
|
105 + | /// todo!()
|
106 + | /// }
|
107 + | ///
|
108 + | /// let config = RestJsonExtrasConfig::builder().build();
|
109 + | /// let svc = ::tower::util::service_fn(handler);
|
110 + | /// let app = RestJsonExtras::builder(config)
|
111 + | /// .case_insensitive_error_operation_service(svc)
|
112 + | /// /* Set other handlers */
|
113 + | /// .build()
|
114 + | /// .unwrap();
|
115 + | /// # let app: RestJsonExtras<::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;
|
116 + | /// ```
|
117 + | ///
|
118 + | pub fn case_insensitive_error_operation_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
119 + | where
|
120 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::CaseInsensitiveErrorOperation, ServiceExtractors>,
|
121 + |
|
122 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
123 + | RestJsonExtras<L>,
|
124 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
125 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::CaseInsensitiveErrorOperation, S>
|
126 + | >,
|
127 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
128 + | RestJsonExtras<L>,
|
129 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
130 + | ModelPl::Output
|
131 + | >,
|
132 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
133 + | RestJsonExtras<L>,
|
134 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
135 + | <
|
136 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
137 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
138 + | RestJsonExtras<L>,
|
139 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
140 + | ModelPl::Output
|
141 + | >
|
142 + | >::Output
|
143 + | >,
|
144 + |
|
145 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
146 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
147 + |
|
148 + | {
|
149 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
150 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
151 + | let svc = crate::operation_shape::CaseInsensitiveErrorOperation::from_service(service);
|
152 + | let svc = self.model_plugin.apply(svc);
|
153 + | let svc =
|
154 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
155 + | .apply(svc);
|
156 + | let svc = self.http_plugin.apply(svc);
|
157 + | self.case_insensitive_error_operation_custom(svc)
|
158 + | }
|
159 + |
|
160 + | /// Sets the [`CaseInsensitiveErrorOperation`](crate::operation_shape::CaseInsensitiveErrorOperation) to a custom [`Service`](tower::Service).
|
161 + | /// not constrained by the Smithy contract.
|
162 + | fn case_insensitive_error_operation_custom<S>(mut self, svc: S) -> Self
|
163 + | where
|
164 + | S: ::tower::Service<
|
165 + | ::http::Request<Body>,
|
166 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
167 + | Error = ::std::convert::Infallible,
|
168 + | > + Clone
|
169 + | + Send
|
170 + | + 'static,
|
171 + | S::Future: Send + 'static,
|
172 + | {
|
173 + | self.case_insensitive_error_operation =
|
174 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
175 + | self
|
176 + | }
|
177 + |
|
178 + | /// Sets the [`EmptyStructWithContentOnWireOp`](crate::operation_shape::EmptyStructWithContentOnWireOp) operation.
|
179 + | ///
|
180 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
181 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
182 + | ///
|
183 + | /// # Example
|
184 + | ///
|
185 + | /// ```no_run
|
186 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
187 + | ///
|
188 + | /// use rest_json_extras_http0x::{input, output, error};
|
189 + | ///
|
190 + | /// async fn handler(input: input::EmptyStructWithContentOnWireOpInput) -> Result<output::EmptyStructWithContentOnWireOpOutput, error::EmptyStructWithContentOnWireOpError> {
|
191 + | /// todo!()
|
192 + | /// }
|
193 + | ///
|
194 + | /// let config = RestJsonExtrasConfig::builder().build();
|
195 + | /// let app = RestJsonExtras::builder(config)
|
196 + | /// .empty_struct_with_content_on_wire_op(handler)
|
197 + | /// /* Set other handlers */
|
198 + | /// .build()
|
199 + | /// .unwrap();
|
200 + | /// # let app: RestJsonExtras<::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;
|
201 + | /// ```
|
202 + | ///
|
203 + | pub fn empty_struct_with_content_on_wire_op<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
204 + | where
|
205 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::EmptyStructWithContentOnWireOp, HandlerExtractors>,
|
206 + |
|
207 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
208 + | RestJsonExtras<L>,
|
209 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
210 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::EmptyStructWithContentOnWireOp, HandlerType>
|
211 + | >,
|
212 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
213 + | RestJsonExtras<L>,
|
214 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
215 + | ModelPl::Output
|
216 + | >,
|
217 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
218 + | RestJsonExtras<L>,
|
219 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
220 + | <
|
221 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
222 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
223 + | RestJsonExtras<L>,
|
224 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
225 + | ModelPl::Output
|
226 + | >
|
227 + | >::Output
|
228 + | >,
|
229 + |
|
230 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
231 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
232 + |
|
233 + | {
|
234 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
235 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
236 + | let svc = crate::operation_shape::EmptyStructWithContentOnWireOp::from_handler(handler);
|
237 + | let svc = self.model_plugin.apply(svc);
|
238 + | let svc =
|
239 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
240 + | .apply(svc);
|
241 + | let svc = self.http_plugin.apply(svc);
|
242 + | self.empty_struct_with_content_on_wire_op_custom(svc)
|
243 + | }
|
244 + |
|
245 + | /// Sets the [`EmptyStructWithContentOnWireOp`](crate::operation_shape::EmptyStructWithContentOnWireOp) operation.
|
246 + | ///
|
247 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
248 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
249 + | ///
|
250 + | /// # Example
|
251 + | ///
|
252 + | /// ```no_run
|
253 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
254 + | ///
|
255 + | /// use rest_json_extras_http0x::{input, output, error};
|
256 + | ///
|
257 + | /// async fn handler(input: input::EmptyStructWithContentOnWireOpInput) -> Result<output::EmptyStructWithContentOnWireOpOutput, error::EmptyStructWithContentOnWireOpError> {
|
258 + | /// todo!()
|
259 + | /// }
|
260 + | ///
|
261 + | /// let config = RestJsonExtrasConfig::builder().build();
|
262 + | /// let svc = ::tower::util::service_fn(handler);
|
263 + | /// let app = RestJsonExtras::builder(config)
|
264 + | /// .empty_struct_with_content_on_wire_op_service(svc)
|
265 + | /// /* Set other handlers */
|
266 + | /// .build()
|
267 + | /// .unwrap();
|
268 + | /// # let app: RestJsonExtras<::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;
|
269 + | /// ```
|
270 + | ///
|
271 + | pub fn empty_struct_with_content_on_wire_op_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
272 + | where
|
273 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::EmptyStructWithContentOnWireOp, ServiceExtractors>,
|
274 + |
|
275 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
276 + | RestJsonExtras<L>,
|
277 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
278 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::EmptyStructWithContentOnWireOp, S>
|
279 + | >,
|
280 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
281 + | RestJsonExtras<L>,
|
282 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
283 + | ModelPl::Output
|
284 + | >,
|
285 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
286 + | RestJsonExtras<L>,
|
287 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
288 + | <
|
289 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
290 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
291 + | RestJsonExtras<L>,
|
292 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
293 + | ModelPl::Output
|
294 + | >
|
295 + | >::Output
|
296 + | >,
|
297 + |
|
298 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
299 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
300 + |
|
301 + | {
|
302 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
303 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
304 + | let svc = crate::operation_shape::EmptyStructWithContentOnWireOp::from_service(service);
|
305 + | let svc = self.model_plugin.apply(svc);
|
306 + | let svc =
|
307 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
308 + | .apply(svc);
|
309 + | let svc = self.http_plugin.apply(svc);
|
310 + | self.empty_struct_with_content_on_wire_op_custom(svc)
|
311 + | }
|
312 + |
|
313 + | /// Sets the [`EmptyStructWithContentOnWireOp`](crate::operation_shape::EmptyStructWithContentOnWireOp) to a custom [`Service`](tower::Service).
|
314 + | /// not constrained by the Smithy contract.
|
315 + | fn empty_struct_with_content_on_wire_op_custom<S>(mut self, svc: S) -> Self
|
316 + | where
|
317 + | S: ::tower::Service<
|
318 + | ::http::Request<Body>,
|
319 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
320 + | Error = ::std::convert::Infallible,
|
321 + | > + Clone
|
322 + | + Send
|
323 + | + 'static,
|
324 + | S::Future: Send + 'static,
|
325 + | {
|
326 + | self.empty_struct_with_content_on_wire_op =
|
327 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
328 + | self
|
329 + | }
|
330 + |
|
331 + | /// Sets the [`EnumQuery`](crate::operation_shape::EnumQuery) operation.
|
332 + | ///
|
333 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
334 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
335 + | ///
|
336 + | /// # Example
|
337 + | ///
|
338 + | /// ```no_run
|
339 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
340 + | ///
|
341 + | /// use rest_json_extras_http0x::{input, output, error};
|
342 + | ///
|
343 + | /// async fn handler(input: input::EnumQueryInput) -> Result<output::EnumQueryOutput, error::EnumQueryError> {
|
344 + | /// todo!()
|
345 + | /// }
|
346 + | ///
|
347 + | /// let config = RestJsonExtrasConfig::builder().build();
|
348 + | /// let app = RestJsonExtras::builder(config)
|
349 + | /// .enum_query(handler)
|
350 + | /// /* Set other handlers */
|
351 + | /// .build()
|
352 + | /// .unwrap();
|
353 + | /// # let app: RestJsonExtras<::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;
|
354 + | /// ```
|
355 + | ///
|
356 + | pub fn enum_query<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
357 + | where
|
358 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::EnumQuery, HandlerExtractors>,
|
359 + |
|
360 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
361 + | RestJsonExtras<L>,
|
362 + | crate::operation_shape::EnumQuery,
|
363 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::EnumQuery, HandlerType>
|
364 + | >,
|
365 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
366 + | RestJsonExtras<L>,
|
367 + | crate::operation_shape::EnumQuery,
|
368 + | ModelPl::Output
|
369 + | >,
|
370 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
371 + | RestJsonExtras<L>,
|
372 + | crate::operation_shape::EnumQuery,
|
373 + | <
|
374 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
375 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
376 + | RestJsonExtras<L>,
|
377 + | crate::operation_shape::EnumQuery,
|
378 + | ModelPl::Output
|
379 + | >
|
380 + | >::Output
|
381 + | >,
|
382 + |
|
383 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
384 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
385 + |
|
386 + | {
|
387 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
388 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
389 + | let svc = crate::operation_shape::EnumQuery::from_handler(handler);
|
390 + | let svc = self.model_plugin.apply(svc);
|
391 + | let svc =
|
392 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
393 + | .apply(svc);
|
394 + | let svc = self.http_plugin.apply(svc);
|
395 + | self.enum_query_custom(svc)
|
396 + | }
|
397 + |
|
398 + | /// Sets the [`EnumQuery`](crate::operation_shape::EnumQuery) operation.
|
399 + | ///
|
400 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
401 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
402 + | ///
|
403 + | /// # Example
|
404 + | ///
|
405 + | /// ```no_run
|
406 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
407 + | ///
|
408 + | /// use rest_json_extras_http0x::{input, output, error};
|
409 + | ///
|
410 + | /// async fn handler(input: input::EnumQueryInput) -> Result<output::EnumQueryOutput, error::EnumQueryError> {
|
411 + | /// todo!()
|
412 + | /// }
|
413 + | ///
|
414 + | /// let config = RestJsonExtrasConfig::builder().build();
|
415 + | /// let svc = ::tower::util::service_fn(handler);
|
416 + | /// let app = RestJsonExtras::builder(config)
|
417 + | /// .enum_query_service(svc)
|
418 + | /// /* Set other handlers */
|
419 + | /// .build()
|
420 + | /// .unwrap();
|
421 + | /// # let app: RestJsonExtras<::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;
|
422 + | /// ```
|
423 + | ///
|
424 + | pub fn enum_query_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
425 + | where
|
426 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::EnumQuery, ServiceExtractors>,
|
427 + |
|
428 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
429 + | RestJsonExtras<L>,
|
430 + | crate::operation_shape::EnumQuery,
|
431 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::EnumQuery, S>
|
432 + | >,
|
433 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
434 + | RestJsonExtras<L>,
|
435 + | crate::operation_shape::EnumQuery,
|
436 + | ModelPl::Output
|
437 + | >,
|
438 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
439 + | RestJsonExtras<L>,
|
440 + | crate::operation_shape::EnumQuery,
|
441 + | <
|
442 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
443 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
444 + | RestJsonExtras<L>,
|
445 + | crate::operation_shape::EnumQuery,
|
446 + | ModelPl::Output
|
447 + | >
|
448 + | >::Output
|
449 + | >,
|
450 + |
|
451 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
452 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
453 + |
|
454 + | {
|
455 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
456 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
457 + | let svc = crate::operation_shape::EnumQuery::from_service(service);
|
458 + | let svc = self.model_plugin.apply(svc);
|
459 + | let svc =
|
460 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
461 + | .apply(svc);
|
462 + | let svc = self.http_plugin.apply(svc);
|
463 + | self.enum_query_custom(svc)
|
464 + | }
|
465 + |
|
466 + | /// Sets the [`EnumQuery`](crate::operation_shape::EnumQuery) to a custom [`Service`](tower::Service).
|
467 + | /// not constrained by the Smithy contract.
|
468 + | fn enum_query_custom<S>(mut self, svc: S) -> Self
|
469 + | where
|
470 + | S: ::tower::Service<
|
471 + | ::http::Request<Body>,
|
472 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
473 + | Error = ::std::convert::Infallible,
|
474 + | > + Clone
|
475 + | + Send
|
476 + | + 'static,
|
477 + | S::Future: Send + 'static,
|
478 + | {
|
479 + | self.enum_query = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
480 + | self
|
481 + | }
|
482 + |
|
483 + | /// Sets the [`EscapedStringValues`](crate::operation_shape::EscapedStringValues) operation.
|
484 + | ///
|
485 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
486 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
487 + | ///
|
488 + | /// # Example
|
489 + | ///
|
490 + | /// ```no_run
|
491 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
492 + | ///
|
493 + | /// use rest_json_extras_http0x::{input, output, error};
|
494 + | ///
|
495 + | /// async fn handler(input: input::EscapedStringValuesInput) -> Result<output::EscapedStringValuesOutput, error::EscapedStringValuesError> {
|
496 + | /// todo!()
|
497 + | /// }
|
498 + | ///
|
499 + | /// let config = RestJsonExtrasConfig::builder().build();
|
500 + | /// let app = RestJsonExtras::builder(config)
|
501 + | /// .escaped_string_values(handler)
|
502 + | /// /* Set other handlers */
|
503 + | /// .build()
|
504 + | /// .unwrap();
|
505 + | /// # let app: RestJsonExtras<::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;
|
506 + | /// ```
|
507 + | ///
|
508 + | pub fn escaped_string_values<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
509 + | where
|
510 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::EscapedStringValues, HandlerExtractors>,
|
511 + |
|
512 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
513 + | RestJsonExtras<L>,
|
514 + | crate::operation_shape::EscapedStringValues,
|
515 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::EscapedStringValues, HandlerType>
|
516 + | >,
|
517 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
518 + | RestJsonExtras<L>,
|
519 + | crate::operation_shape::EscapedStringValues,
|
520 + | ModelPl::Output
|
521 + | >,
|
522 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
523 + | RestJsonExtras<L>,
|
524 + | crate::operation_shape::EscapedStringValues,
|
525 + | <
|
526 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
527 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
528 + | RestJsonExtras<L>,
|
529 + | crate::operation_shape::EscapedStringValues,
|
530 + | ModelPl::Output
|
531 + | >
|
532 + | >::Output
|
533 + | >,
|
534 + |
|
535 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
536 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
537 + |
|
538 + | {
|
539 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
540 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
541 + | let svc = crate::operation_shape::EscapedStringValues::from_handler(handler);
|
542 + | let svc = self.model_plugin.apply(svc);
|
543 + | let svc =
|
544 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
545 + | .apply(svc);
|
546 + | let svc = self.http_plugin.apply(svc);
|
547 + | self.escaped_string_values_custom(svc)
|
548 + | }
|
549 + |
|
550 + | /// Sets the [`EscapedStringValues`](crate::operation_shape::EscapedStringValues) operation.
|
551 + | ///
|
552 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
553 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
554 + | ///
|
555 + | /// # Example
|
556 + | ///
|
557 + | /// ```no_run
|
558 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
559 + | ///
|
560 + | /// use rest_json_extras_http0x::{input, output, error};
|
561 + | ///
|
562 + | /// async fn handler(input: input::EscapedStringValuesInput) -> Result<output::EscapedStringValuesOutput, error::EscapedStringValuesError> {
|
563 + | /// todo!()
|
564 + | /// }
|
565 + | ///
|
566 + | /// let config = RestJsonExtrasConfig::builder().build();
|
567 + | /// let svc = ::tower::util::service_fn(handler);
|
568 + | /// let app = RestJsonExtras::builder(config)
|
569 + | /// .escaped_string_values_service(svc)
|
570 + | /// /* Set other handlers */
|
571 + | /// .build()
|
572 + | /// .unwrap();
|
573 + | /// # let app: RestJsonExtras<::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;
|
574 + | /// ```
|
575 + | ///
|
576 + | pub fn escaped_string_values_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
577 + | where
|
578 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::EscapedStringValues, ServiceExtractors>,
|
579 + |
|
580 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
581 + | RestJsonExtras<L>,
|
582 + | crate::operation_shape::EscapedStringValues,
|
583 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::EscapedStringValues, S>
|
584 + | >,
|
585 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
586 + | RestJsonExtras<L>,
|
587 + | crate::operation_shape::EscapedStringValues,
|
588 + | ModelPl::Output
|
589 + | >,
|
590 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
591 + | RestJsonExtras<L>,
|
592 + | crate::operation_shape::EscapedStringValues,
|
593 + | <
|
594 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
595 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
596 + | RestJsonExtras<L>,
|
597 + | crate::operation_shape::EscapedStringValues,
|
598 + | ModelPl::Output
|
599 + | >
|
600 + | >::Output
|
601 + | >,
|
602 + |
|
603 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
604 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
605 + |
|
606 + | {
|
607 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
608 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
609 + | let svc = crate::operation_shape::EscapedStringValues::from_service(service);
|
610 + | let svc = self.model_plugin.apply(svc);
|
611 + | let svc =
|
612 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
613 + | .apply(svc);
|
614 + | let svc = self.http_plugin.apply(svc);
|
615 + | self.escaped_string_values_custom(svc)
|
616 + | }
|
617 + |
|
618 + | /// Sets the [`EscapedStringValues`](crate::operation_shape::EscapedStringValues) to a custom [`Service`](tower::Service).
|
619 + | /// not constrained by the Smithy contract.
|
620 + | fn escaped_string_values_custom<S>(mut self, svc: S) -> Self
|
621 + | where
|
622 + | S: ::tower::Service<
|
623 + | ::http::Request<Body>,
|
624 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
625 + | Error = ::std::convert::Infallible,
|
626 + | > + Clone
|
627 + | + Send
|
628 + | + 'static,
|
629 + | S::Future: Send + 'static,
|
630 + | {
|
631 + | self.escaped_string_values =
|
632 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
633 + | self
|
634 + | }
|
635 + |
|
636 + | /// Sets the [`HttpQueryParamsOnlyOperation`](crate::operation_shape::HttpQueryParamsOnlyOperation) operation.
|
637 + | ///
|
638 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
639 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
640 + | ///
|
641 + | /// # Example
|
642 + | ///
|
643 + | /// ```no_run
|
644 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
645 + | ///
|
646 + | /// use rest_json_extras_http0x::{input, output, error};
|
647 + | ///
|
648 + | /// async fn handler(input: input::HttpQueryParamsOnlyOperationInput) -> Result<output::HttpQueryParamsOnlyOperationOutput, error::HttpQueryParamsOnlyOperationError> {
|
649 + | /// todo!()
|
650 + | /// }
|
651 + | ///
|
652 + | /// let config = RestJsonExtrasConfig::builder().build();
|
653 + | /// let app = RestJsonExtras::builder(config)
|
654 + | /// .http_query_params_only_operation(handler)
|
655 + | /// /* Set other handlers */
|
656 + | /// .build()
|
657 + | /// .unwrap();
|
658 + | /// # let app: RestJsonExtras<::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;
|
659 + | /// ```
|
660 + | ///
|
661 + | pub fn http_query_params_only_operation<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
662 + | where
|
663 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::HttpQueryParamsOnlyOperation, HandlerExtractors>,
|
664 + |
|
665 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
666 + | RestJsonExtras<L>,
|
667 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
668 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::HttpQueryParamsOnlyOperation, HandlerType>
|
669 + | >,
|
670 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
671 + | RestJsonExtras<L>,
|
672 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
673 + | ModelPl::Output
|
674 + | >,
|
675 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
676 + | RestJsonExtras<L>,
|
677 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
678 + | <
|
679 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
680 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
681 + | RestJsonExtras<L>,
|
682 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
683 + | ModelPl::Output
|
684 + | >
|
685 + | >::Output
|
686 + | >,
|
687 + |
|
688 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
689 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
690 + |
|
691 + | {
|
692 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
693 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
694 + | let svc = crate::operation_shape::HttpQueryParamsOnlyOperation::from_handler(handler);
|
695 + | let svc = self.model_plugin.apply(svc);
|
696 + | let svc =
|
697 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
698 + | .apply(svc);
|
699 + | let svc = self.http_plugin.apply(svc);
|
700 + | self.http_query_params_only_operation_custom(svc)
|
701 + | }
|
702 + |
|
703 + | /// Sets the [`HttpQueryParamsOnlyOperation`](crate::operation_shape::HttpQueryParamsOnlyOperation) operation.
|
704 + | ///
|
705 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
706 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
707 + | ///
|
708 + | /// # Example
|
709 + | ///
|
710 + | /// ```no_run
|
711 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
712 + | ///
|
713 + | /// use rest_json_extras_http0x::{input, output, error};
|
714 + | ///
|
715 + | /// async fn handler(input: input::HttpQueryParamsOnlyOperationInput) -> Result<output::HttpQueryParamsOnlyOperationOutput, error::HttpQueryParamsOnlyOperationError> {
|
716 + | /// todo!()
|
717 + | /// }
|
718 + | ///
|
719 + | /// let config = RestJsonExtrasConfig::builder().build();
|
720 + | /// let svc = ::tower::util::service_fn(handler);
|
721 + | /// let app = RestJsonExtras::builder(config)
|
722 + | /// .http_query_params_only_operation_service(svc)
|
723 + | /// /* Set other handlers */
|
724 + | /// .build()
|
725 + | /// .unwrap();
|
726 + | /// # let app: RestJsonExtras<::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;
|
727 + | /// ```
|
728 + | ///
|
729 + | pub fn http_query_params_only_operation_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
730 + | where
|
731 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::HttpQueryParamsOnlyOperation, ServiceExtractors>,
|
732 + |
|
733 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
734 + | RestJsonExtras<L>,
|
735 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
736 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::HttpQueryParamsOnlyOperation, S>
|
737 + | >,
|
738 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
739 + | RestJsonExtras<L>,
|
740 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
741 + | ModelPl::Output
|
742 + | >,
|
743 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
744 + | RestJsonExtras<L>,
|
745 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
746 + | <
|
747 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
748 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
749 + | RestJsonExtras<L>,
|
750 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
751 + | ModelPl::Output
|
752 + | >
|
753 + | >::Output
|
754 + | >,
|
755 + |
|
756 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
757 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
758 + |
|
759 + | {
|
760 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
761 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
762 + | let svc = crate::operation_shape::HttpQueryParamsOnlyOperation::from_service(service);
|
763 + | let svc = self.model_plugin.apply(svc);
|
764 + | let svc =
|
765 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
766 + | .apply(svc);
|
767 + | let svc = self.http_plugin.apply(svc);
|
768 + | self.http_query_params_only_operation_custom(svc)
|
769 + | }
|
770 + |
|
771 + | /// Sets the [`HttpQueryParamsOnlyOperation`](crate::operation_shape::HttpQueryParamsOnlyOperation) to a custom [`Service`](tower::Service).
|
772 + | /// not constrained by the Smithy contract.
|
773 + | fn http_query_params_only_operation_custom<S>(mut self, svc: S) -> Self
|
774 + | where
|
775 + | S: ::tower::Service<
|
776 + | ::http::Request<Body>,
|
777 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
778 + | Error = ::std::convert::Infallible,
|
779 + | > + Clone
|
780 + | + Send
|
781 + | + 'static,
|
782 + | S::Future: Send + 'static,
|
783 + | {
|
784 + | self.http_query_params_only_operation =
|
785 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
786 + | self
|
787 + | }
|
788 + |
|
789 + | /// Sets the [`MapWithEnumKeyOp`](crate::operation_shape::MapWithEnumKeyOp) operation.
|
790 + | ///
|
791 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
792 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
793 + | ///
|
794 + | /// # Example
|
795 + | ///
|
796 + | /// ```no_run
|
797 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
798 + | ///
|
799 + | /// use rest_json_extras_http0x::{input, output, error};
|
800 + | ///
|
801 + | /// async fn handler(input: input::MapWithEnumKeyOpInput) -> Result<output::MapWithEnumKeyOpOutput, error::MapWithEnumKeyOpError> {
|
802 + | /// todo!()
|
803 + | /// }
|
804 + | ///
|
805 + | /// let config = RestJsonExtrasConfig::builder().build();
|
806 + | /// let app = RestJsonExtras::builder(config)
|
807 + | /// .map_with_enum_key_op(handler)
|
808 + | /// /* Set other handlers */
|
809 + | /// .build()
|
810 + | /// .unwrap();
|
811 + | /// # let app: RestJsonExtras<::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;
|
812 + | /// ```
|
813 + | ///
|
814 + | pub fn map_with_enum_key_op<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
815 + | where
|
816 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::MapWithEnumKeyOp, HandlerExtractors>,
|
817 + |
|
818 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
819 + | RestJsonExtras<L>,
|
820 + | crate::operation_shape::MapWithEnumKeyOp,
|
821 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::MapWithEnumKeyOp, HandlerType>
|
822 + | >,
|
823 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
824 + | RestJsonExtras<L>,
|
825 + | crate::operation_shape::MapWithEnumKeyOp,
|
826 + | ModelPl::Output
|
827 + | >,
|
828 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
829 + | RestJsonExtras<L>,
|
830 + | crate::operation_shape::MapWithEnumKeyOp,
|
831 + | <
|
832 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
833 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
834 + | RestJsonExtras<L>,
|
835 + | crate::operation_shape::MapWithEnumKeyOp,
|
836 + | ModelPl::Output
|
837 + | >
|
838 + | >::Output
|
839 + | >,
|
840 + |
|
841 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
842 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
843 + |
|
844 + | {
|
845 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
846 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
847 + | let svc = crate::operation_shape::MapWithEnumKeyOp::from_handler(handler);
|
848 + | let svc = self.model_plugin.apply(svc);
|
849 + | let svc =
|
850 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
851 + | .apply(svc);
|
852 + | let svc = self.http_plugin.apply(svc);
|
853 + | self.map_with_enum_key_op_custom(svc)
|
854 + | }
|
855 + |
|
856 + | /// Sets the [`MapWithEnumKeyOp`](crate::operation_shape::MapWithEnumKeyOp) operation.
|
857 + | ///
|
858 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
859 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
860 + | ///
|
861 + | /// # Example
|
862 + | ///
|
863 + | /// ```no_run
|
864 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
865 + | ///
|
866 + | /// use rest_json_extras_http0x::{input, output, error};
|
867 + | ///
|
868 + | /// async fn handler(input: input::MapWithEnumKeyOpInput) -> Result<output::MapWithEnumKeyOpOutput, error::MapWithEnumKeyOpError> {
|
869 + | /// todo!()
|
870 + | /// }
|
871 + | ///
|
872 + | /// let config = RestJsonExtrasConfig::builder().build();
|
873 + | /// let svc = ::tower::util::service_fn(handler);
|
874 + | /// let app = RestJsonExtras::builder(config)
|
875 + | /// .map_with_enum_key_op_service(svc)
|
876 + | /// /* Set other handlers */
|
877 + | /// .build()
|
878 + | /// .unwrap();
|
879 + | /// # let app: RestJsonExtras<::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;
|
880 + | /// ```
|
881 + | ///
|
882 + | pub fn map_with_enum_key_op_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
883 + | where
|
884 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::MapWithEnumKeyOp, ServiceExtractors>,
|
885 + |
|
886 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
887 + | RestJsonExtras<L>,
|
888 + | crate::operation_shape::MapWithEnumKeyOp,
|
889 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::MapWithEnumKeyOp, S>
|
890 + | >,
|
891 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
892 + | RestJsonExtras<L>,
|
893 + | crate::operation_shape::MapWithEnumKeyOp,
|
894 + | ModelPl::Output
|
895 + | >,
|
896 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
897 + | RestJsonExtras<L>,
|
898 + | crate::operation_shape::MapWithEnumKeyOp,
|
899 + | <
|
900 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
901 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
902 + | RestJsonExtras<L>,
|
903 + | crate::operation_shape::MapWithEnumKeyOp,
|
904 + | ModelPl::Output
|
905 + | >
|
906 + | >::Output
|
907 + | >,
|
908 + |
|
909 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
910 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
911 + |
|
912 + | {
|
913 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
914 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
915 + | let svc = crate::operation_shape::MapWithEnumKeyOp::from_service(service);
|
916 + | let svc = self.model_plugin.apply(svc);
|
917 + | let svc =
|
918 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
919 + | .apply(svc);
|
920 + | let svc = self.http_plugin.apply(svc);
|
921 + | self.map_with_enum_key_op_custom(svc)
|
922 + | }
|
923 + |
|
924 + | /// Sets the [`MapWithEnumKeyOp`](crate::operation_shape::MapWithEnumKeyOp) to a custom [`Service`](tower::Service).
|
925 + | /// not constrained by the Smithy contract.
|
926 + | fn map_with_enum_key_op_custom<S>(mut self, svc: S) -> Self
|
927 + | where
|
928 + | S: ::tower::Service<
|
929 + | ::http::Request<Body>,
|
930 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
931 + | Error = ::std::convert::Infallible,
|
932 + | > + Clone
|
933 + | + Send
|
934 + | + 'static,
|
935 + | S::Future: Send + 'static,
|
936 + | {
|
937 + | self.map_with_enum_key_op = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
938 + | self
|
939 + | }
|
940 + |
|
941 + | /// Sets the [`NullInNonSparse`](crate::operation_shape::NullInNonSparse) operation.
|
942 + | ///
|
943 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
944 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
945 + | ///
|
946 + | /// # Example
|
947 + | ///
|
948 + | /// ```no_run
|
949 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
950 + | ///
|
951 + | /// use rest_json_extras_http0x::{input, output, error};
|
952 + | ///
|
953 + | /// async fn handler(input: input::NullInNonSparseInput) -> Result<output::NullInNonSparseOutput, error::NullInNonSparseError> {
|
954 + | /// todo!()
|
955 + | /// }
|
956 + | ///
|
957 + | /// let config = RestJsonExtrasConfig::builder().build();
|
958 + | /// let app = RestJsonExtras::builder(config)
|
959 + | /// .null_in_non_sparse(handler)
|
960 + | /// /* Set other handlers */
|
961 + | /// .build()
|
962 + | /// .unwrap();
|
963 + | /// # let app: RestJsonExtras<::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;
|
964 + | /// ```
|
965 + | ///
|
966 + | pub fn null_in_non_sparse<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
967 + | where
|
968 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::NullInNonSparse, HandlerExtractors>,
|
969 + |
|
970 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
971 + | RestJsonExtras<L>,
|
972 + | crate::operation_shape::NullInNonSparse,
|
973 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::NullInNonSparse, HandlerType>
|
974 + | >,
|
975 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
976 + | RestJsonExtras<L>,
|
977 + | crate::operation_shape::NullInNonSparse,
|
978 + | ModelPl::Output
|
979 + | >,
|
980 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
981 + | RestJsonExtras<L>,
|
982 + | crate::operation_shape::NullInNonSparse,
|
983 + | <
|
984 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
985 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
986 + | RestJsonExtras<L>,
|
987 + | crate::operation_shape::NullInNonSparse,
|
988 + | ModelPl::Output
|
989 + | >
|
990 + | >::Output
|
991 + | >,
|
992 + |
|
993 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
994 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
995 + |
|
996 + | {
|
997 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
998 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
999 + | let svc = crate::operation_shape::NullInNonSparse::from_handler(handler);
|
1000 + | let svc = self.model_plugin.apply(svc);
|
1001 + | let svc =
|
1002 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1003 + | .apply(svc);
|
1004 + | let svc = self.http_plugin.apply(svc);
|
1005 + | self.null_in_non_sparse_custom(svc)
|
1006 + | }
|
1007 + |
|
1008 + | /// Sets the [`NullInNonSparse`](crate::operation_shape::NullInNonSparse) operation.
|
1009 + | ///
|
1010 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1011 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1012 + | ///
|
1013 + | /// # Example
|
1014 + | ///
|
1015 + | /// ```no_run
|
1016 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1017 + | ///
|
1018 + | /// use rest_json_extras_http0x::{input, output, error};
|
1019 + | ///
|
1020 + | /// async fn handler(input: input::NullInNonSparseInput) -> Result<output::NullInNonSparseOutput, error::NullInNonSparseError> {
|
1021 + | /// todo!()
|
1022 + | /// }
|
1023 + | ///
|
1024 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1025 + | /// let svc = ::tower::util::service_fn(handler);
|
1026 + | /// let app = RestJsonExtras::builder(config)
|
1027 + | /// .null_in_non_sparse_service(svc)
|
1028 + | /// /* Set other handlers */
|
1029 + | /// .build()
|
1030 + | /// .unwrap();
|
1031 + | /// # let app: RestJsonExtras<::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;
|
1032 + | /// ```
|
1033 + | ///
|
1034 + | pub fn null_in_non_sparse_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1035 + | where
|
1036 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::NullInNonSparse, ServiceExtractors>,
|
1037 + |
|
1038 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1039 + | RestJsonExtras<L>,
|
1040 + | crate::operation_shape::NullInNonSparse,
|
1041 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::NullInNonSparse, S>
|
1042 + | >,
|
1043 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1044 + | RestJsonExtras<L>,
|
1045 + | crate::operation_shape::NullInNonSparse,
|
1046 + | ModelPl::Output
|
1047 + | >,
|
1048 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1049 + | RestJsonExtras<L>,
|
1050 + | crate::operation_shape::NullInNonSparse,
|
1051 + | <
|
1052 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1053 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1054 + | RestJsonExtras<L>,
|
1055 + | crate::operation_shape::NullInNonSparse,
|
1056 + | ModelPl::Output
|
1057 + | >
|
1058 + | >::Output
|
1059 + | >,
|
1060 + |
|
1061 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1062 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1063 + |
|
1064 + | {
|
1065 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1066 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1067 + | let svc = crate::operation_shape::NullInNonSparse::from_service(service);
|
1068 + | let svc = self.model_plugin.apply(svc);
|
1069 + | let svc =
|
1070 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1071 + | .apply(svc);
|
1072 + | let svc = self.http_plugin.apply(svc);
|
1073 + | self.null_in_non_sparse_custom(svc)
|
1074 + | }
|
1075 + |
|
1076 + | /// Sets the [`NullInNonSparse`](crate::operation_shape::NullInNonSparse) to a custom [`Service`](tower::Service).
|
1077 + | /// not constrained by the Smithy contract.
|
1078 + | fn null_in_non_sparse_custom<S>(mut self, svc: S) -> Self
|
1079 + | where
|
1080 + | S: ::tower::Service<
|
1081 + | ::http::Request<Body>,
|
1082 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1083 + | Error = ::std::convert::Infallible,
|
1084 + | > + Clone
|
1085 + | + Send
|
1086 + | + 'static,
|
1087 + | S::Future: Send + 'static,
|
1088 + | {
|
1089 + | self.null_in_non_sparse = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1090 + | self
|
1091 + | }
|
1092 + |
|
1093 + | /// Sets the [`PrimitiveIntHeader`](crate::operation_shape::PrimitiveIntHeader) operation.
|
1094 + | ///
|
1095 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1096 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1097 + | ///
|
1098 + | /// # Example
|
1099 + | ///
|
1100 + | /// ```no_run
|
1101 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1102 + | ///
|
1103 + | /// use rest_json_extras_http0x::{input, output, error};
|
1104 + | ///
|
1105 + | /// async fn handler(input: input::PrimitiveIntHeaderInput) -> Result<output::PrimitiveIntHeaderOutput, error::PrimitiveIntHeaderError> {
|
1106 + | /// todo!()
|
1107 + | /// }
|
1108 + | ///
|
1109 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1110 + | /// let app = RestJsonExtras::builder(config)
|
1111 + | /// .primitive_int_header(handler)
|
1112 + | /// /* Set other handlers */
|
1113 + | /// .build()
|
1114 + | /// .unwrap();
|
1115 + | /// # let app: RestJsonExtras<::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;
|
1116 + | /// ```
|
1117 + | ///
|
1118 + | pub fn primitive_int_header<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
1119 + | where
|
1120 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::PrimitiveIntHeader, HandlerExtractors>,
|
1121 + |
|
1122 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1123 + | RestJsonExtras<L>,
|
1124 + | crate::operation_shape::PrimitiveIntHeader,
|
1125 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::PrimitiveIntHeader, HandlerType>
|
1126 + | >,
|
1127 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1128 + | RestJsonExtras<L>,
|
1129 + | crate::operation_shape::PrimitiveIntHeader,
|
1130 + | ModelPl::Output
|
1131 + | >,
|
1132 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1133 + | RestJsonExtras<L>,
|
1134 + | crate::operation_shape::PrimitiveIntHeader,
|
1135 + | <
|
1136 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1137 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1138 + | RestJsonExtras<L>,
|
1139 + | crate::operation_shape::PrimitiveIntHeader,
|
1140 + | ModelPl::Output
|
1141 + | >
|
1142 + | >::Output
|
1143 + | >,
|
1144 + |
|
1145 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1146 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1147 + |
|
1148 + | {
|
1149 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1150 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1151 + | let svc = crate::operation_shape::PrimitiveIntHeader::from_handler(handler);
|
1152 + | let svc = self.model_plugin.apply(svc);
|
1153 + | let svc =
|
1154 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1155 + | .apply(svc);
|
1156 + | let svc = self.http_plugin.apply(svc);
|
1157 + | self.primitive_int_header_custom(svc)
|
1158 + | }
|
1159 + |
|
1160 + | /// Sets the [`PrimitiveIntHeader`](crate::operation_shape::PrimitiveIntHeader) operation.
|
1161 + | ///
|
1162 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1163 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1164 + | ///
|
1165 + | /// # Example
|
1166 + | ///
|
1167 + | /// ```no_run
|
1168 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1169 + | ///
|
1170 + | /// use rest_json_extras_http0x::{input, output, error};
|
1171 + | ///
|
1172 + | /// async fn handler(input: input::PrimitiveIntHeaderInput) -> Result<output::PrimitiveIntHeaderOutput, error::PrimitiveIntHeaderError> {
|
1173 + | /// todo!()
|
1174 + | /// }
|
1175 + | ///
|
1176 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1177 + | /// let svc = ::tower::util::service_fn(handler);
|
1178 + | /// let app = RestJsonExtras::builder(config)
|
1179 + | /// .primitive_int_header_service(svc)
|
1180 + | /// /* Set other handlers */
|
1181 + | /// .build()
|
1182 + | /// .unwrap();
|
1183 + | /// # let app: RestJsonExtras<::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;
|
1184 + | /// ```
|
1185 + | ///
|
1186 + | pub fn primitive_int_header_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1187 + | where
|
1188 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::PrimitiveIntHeader, ServiceExtractors>,
|
1189 + |
|
1190 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1191 + | RestJsonExtras<L>,
|
1192 + | crate::operation_shape::PrimitiveIntHeader,
|
1193 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::PrimitiveIntHeader, S>
|
1194 + | >,
|
1195 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1196 + | RestJsonExtras<L>,
|
1197 + | crate::operation_shape::PrimitiveIntHeader,
|
1198 + | ModelPl::Output
|
1199 + | >,
|
1200 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1201 + | RestJsonExtras<L>,
|
1202 + | crate::operation_shape::PrimitiveIntHeader,
|
1203 + | <
|
1204 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1205 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1206 + | RestJsonExtras<L>,
|
1207 + | crate::operation_shape::PrimitiveIntHeader,
|
1208 + | ModelPl::Output
|
1209 + | >
|
1210 + | >::Output
|
1211 + | >,
|
1212 + |
|
1213 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1214 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1215 + |
|
1216 + | {
|
1217 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1218 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1219 + | let svc = crate::operation_shape::PrimitiveIntHeader::from_service(service);
|
1220 + | let svc = self.model_plugin.apply(svc);
|
1221 + | let svc =
|
1222 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1223 + | .apply(svc);
|
1224 + | let svc = self.http_plugin.apply(svc);
|
1225 + | self.primitive_int_header_custom(svc)
|
1226 + | }
|
1227 + |
|
1228 + | /// Sets the [`PrimitiveIntHeader`](crate::operation_shape::PrimitiveIntHeader) to a custom [`Service`](tower::Service).
|
1229 + | /// not constrained by the Smithy contract.
|
1230 + | fn primitive_int_header_custom<S>(mut self, svc: S) -> Self
|
1231 + | where
|
1232 + | S: ::tower::Service<
|
1233 + | ::http::Request<Body>,
|
1234 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1235 + | Error = ::std::convert::Infallible,
|
1236 + | > + Clone
|
1237 + | + Send
|
1238 + | + 'static,
|
1239 + | S::Future: Send + 'static,
|
1240 + | {
|
1241 + | self.primitive_int_header = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1242 + | self
|
1243 + | }
|
1244 + |
|
1245 + | /// Sets the [`PrimitiveIntOp`](crate::operation_shape::PrimitiveIntOp) operation.
|
1246 + | ///
|
1247 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1248 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1249 + | ///
|
1250 + | /// # Example
|
1251 + | ///
|
1252 + | /// ```no_run
|
1253 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1254 + | ///
|
1255 + | /// use rest_json_extras_http0x::{input, output, error};
|
1256 + | ///
|
1257 + | /// async fn handler(input: input::PrimitiveIntOpInput) -> Result<output::PrimitiveIntOpOutput, error::PrimitiveIntOpError> {
|
1258 + | /// todo!()
|
1259 + | /// }
|
1260 + | ///
|
1261 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1262 + | /// let app = RestJsonExtras::builder(config)
|
1263 + | /// .primitive_int_op(handler)
|
1264 + | /// /* Set other handlers */
|
1265 + | /// .build()
|
1266 + | /// .unwrap();
|
1267 + | /// # let app: RestJsonExtras<::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;
|
1268 + | /// ```
|
1269 + | ///
|
1270 + | pub fn primitive_int_op<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
1271 + | where
|
1272 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::PrimitiveIntOp, HandlerExtractors>,
|
1273 + |
|
1274 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1275 + | RestJsonExtras<L>,
|
1276 + | crate::operation_shape::PrimitiveIntOp,
|
1277 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::PrimitiveIntOp, HandlerType>
|
1278 + | >,
|
1279 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1280 + | RestJsonExtras<L>,
|
1281 + | crate::operation_shape::PrimitiveIntOp,
|
1282 + | ModelPl::Output
|
1283 + | >,
|
1284 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1285 + | RestJsonExtras<L>,
|
1286 + | crate::operation_shape::PrimitiveIntOp,
|
1287 + | <
|
1288 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1289 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1290 + | RestJsonExtras<L>,
|
1291 + | crate::operation_shape::PrimitiveIntOp,
|
1292 + | ModelPl::Output
|
1293 + | >
|
1294 + | >::Output
|
1295 + | >,
|
1296 + |
|
1297 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1298 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1299 + |
|
1300 + | {
|
1301 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1302 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1303 + | let svc = crate::operation_shape::PrimitiveIntOp::from_handler(handler);
|
1304 + | let svc = self.model_plugin.apply(svc);
|
1305 + | let svc =
|
1306 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1307 + | .apply(svc);
|
1308 + | let svc = self.http_plugin.apply(svc);
|
1309 + | self.primitive_int_op_custom(svc)
|
1310 + | }
|
1311 + |
|
1312 + | /// Sets the [`PrimitiveIntOp`](crate::operation_shape::PrimitiveIntOp) operation.
|
1313 + | ///
|
1314 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1315 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1316 + | ///
|
1317 + | /// # Example
|
1318 + | ///
|
1319 + | /// ```no_run
|
1320 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1321 + | ///
|
1322 + | /// use rest_json_extras_http0x::{input, output, error};
|
1323 + | ///
|
1324 + | /// async fn handler(input: input::PrimitiveIntOpInput) -> Result<output::PrimitiveIntOpOutput, error::PrimitiveIntOpError> {
|
1325 + | /// todo!()
|
1326 + | /// }
|
1327 + | ///
|
1328 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1329 + | /// let svc = ::tower::util::service_fn(handler);
|
1330 + | /// let app = RestJsonExtras::builder(config)
|
1331 + | /// .primitive_int_op_service(svc)
|
1332 + | /// /* Set other handlers */
|
1333 + | /// .build()
|
1334 + | /// .unwrap();
|
1335 + | /// # let app: RestJsonExtras<::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;
|
1336 + | /// ```
|
1337 + | ///
|
1338 + | pub fn primitive_int_op_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1339 + | where
|
1340 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::PrimitiveIntOp, ServiceExtractors>,
|
1341 + |
|
1342 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1343 + | RestJsonExtras<L>,
|
1344 + | crate::operation_shape::PrimitiveIntOp,
|
1345 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::PrimitiveIntOp, S>
|
1346 + | >,
|
1347 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1348 + | RestJsonExtras<L>,
|
1349 + | crate::operation_shape::PrimitiveIntOp,
|
1350 + | ModelPl::Output
|
1351 + | >,
|
1352 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1353 + | RestJsonExtras<L>,
|
1354 + | crate::operation_shape::PrimitiveIntOp,
|
1355 + | <
|
1356 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1357 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1358 + | RestJsonExtras<L>,
|
1359 + | crate::operation_shape::PrimitiveIntOp,
|
1360 + | ModelPl::Output
|
1361 + | >
|
1362 + | >::Output
|
1363 + | >,
|
1364 + |
|
1365 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1366 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1367 + |
|
1368 + | {
|
1369 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1370 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1371 + | let svc = crate::operation_shape::PrimitiveIntOp::from_service(service);
|
1372 + | let svc = self.model_plugin.apply(svc);
|
1373 + | let svc =
|
1374 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1375 + | .apply(svc);
|
1376 + | let svc = self.http_plugin.apply(svc);
|
1377 + | self.primitive_int_op_custom(svc)
|
1378 + | }
|
1379 + |
|
1380 + | /// Sets the [`PrimitiveIntOp`](crate::operation_shape::PrimitiveIntOp) to a custom [`Service`](tower::Service).
|
1381 + | /// not constrained by the Smithy contract.
|
1382 + | fn primitive_int_op_custom<S>(mut self, svc: S) -> Self
|
1383 + | where
|
1384 + | S: ::tower::Service<
|
1385 + | ::http::Request<Body>,
|
1386 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1387 + | Error = ::std::convert::Infallible,
|
1388 + | > + Clone
|
1389 + | + Send
|
1390 + | + 'static,
|
1391 + | S::Future: Send + 'static,
|
1392 + | {
|
1393 + | self.primitive_int_op = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1394 + | self
|
1395 + | }
|
1396 + |
|
1397 + | /// Sets the [`QueryPrecedence`](crate::operation_shape::QueryPrecedence) operation.
|
1398 + | ///
|
1399 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1400 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1401 + | ///
|
1402 + | /// # Example
|
1403 + | ///
|
1404 + | /// ```no_run
|
1405 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1406 + | ///
|
1407 + | /// use rest_json_extras_http0x::{input, output, error};
|
1408 + | ///
|
1409 + | /// async fn handler(input: input::QueryPrecedenceInput) -> Result<output::QueryPrecedenceOutput, error::QueryPrecedenceError> {
|
1410 + | /// todo!()
|
1411 + | /// }
|
1412 + | ///
|
1413 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1414 + | /// let app = RestJsonExtras::builder(config)
|
1415 + | /// .query_precedence(handler)
|
1416 + | /// /* Set other handlers */
|
1417 + | /// .build()
|
1418 + | /// .unwrap();
|
1419 + | /// # let app: RestJsonExtras<::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;
|
1420 + | /// ```
|
1421 + | ///
|
1422 + | pub fn query_precedence<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
1423 + | where
|
1424 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::QueryPrecedence, HandlerExtractors>,
|
1425 + |
|
1426 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1427 + | RestJsonExtras<L>,
|
1428 + | crate::operation_shape::QueryPrecedence,
|
1429 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::QueryPrecedence, HandlerType>
|
1430 + | >,
|
1431 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1432 + | RestJsonExtras<L>,
|
1433 + | crate::operation_shape::QueryPrecedence,
|
1434 + | ModelPl::Output
|
1435 + | >,
|
1436 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1437 + | RestJsonExtras<L>,
|
1438 + | crate::operation_shape::QueryPrecedence,
|
1439 + | <
|
1440 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1441 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1442 + | RestJsonExtras<L>,
|
1443 + | crate::operation_shape::QueryPrecedence,
|
1444 + | ModelPl::Output
|
1445 + | >
|
1446 + | >::Output
|
1447 + | >,
|
1448 + |
|
1449 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1450 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1451 + |
|
1452 + | {
|
1453 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1454 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1455 + | let svc = crate::operation_shape::QueryPrecedence::from_handler(handler);
|
1456 + | let svc = self.model_plugin.apply(svc);
|
1457 + | let svc =
|
1458 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1459 + | .apply(svc);
|
1460 + | let svc = self.http_plugin.apply(svc);
|
1461 + | self.query_precedence_custom(svc)
|
1462 + | }
|
1463 + |
|
1464 + | /// Sets the [`QueryPrecedence`](crate::operation_shape::QueryPrecedence) operation.
|
1465 + | ///
|
1466 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1467 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1468 + | ///
|
1469 + | /// # Example
|
1470 + | ///
|
1471 + | /// ```no_run
|
1472 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1473 + | ///
|
1474 + | /// use rest_json_extras_http0x::{input, output, error};
|
1475 + | ///
|
1476 + | /// async fn handler(input: input::QueryPrecedenceInput) -> Result<output::QueryPrecedenceOutput, error::QueryPrecedenceError> {
|
1477 + | /// todo!()
|
1478 + | /// }
|
1479 + | ///
|
1480 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1481 + | /// let svc = ::tower::util::service_fn(handler);
|
1482 + | /// let app = RestJsonExtras::builder(config)
|
1483 + | /// .query_precedence_service(svc)
|
1484 + | /// /* Set other handlers */
|
1485 + | /// .build()
|
1486 + | /// .unwrap();
|
1487 + | /// # let app: RestJsonExtras<::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;
|
1488 + | /// ```
|
1489 + | ///
|
1490 + | pub fn query_precedence_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1491 + | where
|
1492 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::QueryPrecedence, ServiceExtractors>,
|
1493 + |
|
1494 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1495 + | RestJsonExtras<L>,
|
1496 + | crate::operation_shape::QueryPrecedence,
|
1497 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::QueryPrecedence, S>
|
1498 + | >,
|
1499 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1500 + | RestJsonExtras<L>,
|
1501 + | crate::operation_shape::QueryPrecedence,
|
1502 + | ModelPl::Output
|
1503 + | >,
|
1504 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1505 + | RestJsonExtras<L>,
|
1506 + | crate::operation_shape::QueryPrecedence,
|
1507 + | <
|
1508 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1509 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1510 + | RestJsonExtras<L>,
|
1511 + | crate::operation_shape::QueryPrecedence,
|
1512 + | ModelPl::Output
|
1513 + | >
|
1514 + | >::Output
|
1515 + | >,
|
1516 + |
|
1517 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1518 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1519 + |
|
1520 + | {
|
1521 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1522 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1523 + | let svc = crate::operation_shape::QueryPrecedence::from_service(service);
|
1524 + | let svc = self.model_plugin.apply(svc);
|
1525 + | let svc =
|
1526 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1527 + | .apply(svc);
|
1528 + | let svc = self.http_plugin.apply(svc);
|
1529 + | self.query_precedence_custom(svc)
|
1530 + | }
|
1531 + |
|
1532 + | /// Sets the [`QueryPrecedence`](crate::operation_shape::QueryPrecedence) to a custom [`Service`](tower::Service).
|
1533 + | /// not constrained by the Smithy contract.
|
1534 + | fn query_precedence_custom<S>(mut self, svc: S) -> Self
|
1535 + | where
|
1536 + | S: ::tower::Service<
|
1537 + | ::http::Request<Body>,
|
1538 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1539 + | Error = ::std::convert::Infallible,
|
1540 + | > + Clone
|
1541 + | + Send
|
1542 + | + 'static,
|
1543 + | S::Future: Send + 'static,
|
1544 + | {
|
1545 + | self.query_precedence = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1546 + | self
|
1547 + | }
|
1548 + |
|
1549 + | /// Sets the [`StatusResponse`](crate::operation_shape::StatusResponse) operation.
|
1550 + | ///
|
1551 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1552 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1553 + | ///
|
1554 + | /// # Example
|
1555 + | ///
|
1556 + | /// ```no_run
|
1557 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1558 + | ///
|
1559 + | /// use rest_json_extras_http0x::{input, output, error};
|
1560 + | ///
|
1561 + | /// async fn handler(input: input::StatusResponseInput) -> Result<output::StatusResponseOutput, error::StatusResponseError> {
|
1562 + | /// todo!()
|
1563 + | /// }
|
1564 + | ///
|
1565 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1566 + | /// let app = RestJsonExtras::builder(config)
|
1567 + | /// .status_response(handler)
|
1568 + | /// /* Set other handlers */
|
1569 + | /// .build()
|
1570 + | /// .unwrap();
|
1571 + | /// # let app: RestJsonExtras<::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;
|
1572 + | /// ```
|
1573 + | ///
|
1574 + | pub fn status_response<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
1575 + | where
|
1576 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::StatusResponse, HandlerExtractors>,
|
1577 + |
|
1578 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1579 + | RestJsonExtras<L>,
|
1580 + | crate::operation_shape::StatusResponse,
|
1581 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::StatusResponse, HandlerType>
|
1582 + | >,
|
1583 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1584 + | RestJsonExtras<L>,
|
1585 + | crate::operation_shape::StatusResponse,
|
1586 + | ModelPl::Output
|
1587 + | >,
|
1588 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1589 + | RestJsonExtras<L>,
|
1590 + | crate::operation_shape::StatusResponse,
|
1591 + | <
|
1592 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1593 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1594 + | RestJsonExtras<L>,
|
1595 + | crate::operation_shape::StatusResponse,
|
1596 + | ModelPl::Output
|
1597 + | >
|
1598 + | >::Output
|
1599 + | >,
|
1600 + |
|
1601 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1602 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1603 + |
|
1604 + | {
|
1605 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1606 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1607 + | let svc = crate::operation_shape::StatusResponse::from_handler(handler);
|
1608 + | let svc = self.model_plugin.apply(svc);
|
1609 + | let svc =
|
1610 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1611 + | .apply(svc);
|
1612 + | let svc = self.http_plugin.apply(svc);
|
1613 + | self.status_response_custom(svc)
|
1614 + | }
|
1615 + |
|
1616 + | /// Sets the [`StatusResponse`](crate::operation_shape::StatusResponse) operation.
|
1617 + | ///
|
1618 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1619 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1620 + | ///
|
1621 + | /// # Example
|
1622 + | ///
|
1623 + | /// ```no_run
|
1624 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1625 + | ///
|
1626 + | /// use rest_json_extras_http0x::{input, output, error};
|
1627 + | ///
|
1628 + | /// async fn handler(input: input::StatusResponseInput) -> Result<output::StatusResponseOutput, error::StatusResponseError> {
|
1629 + | /// todo!()
|
1630 + | /// }
|
1631 + | ///
|
1632 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1633 + | /// let svc = ::tower::util::service_fn(handler);
|
1634 + | /// let app = RestJsonExtras::builder(config)
|
1635 + | /// .status_response_service(svc)
|
1636 + | /// /* Set other handlers */
|
1637 + | /// .build()
|
1638 + | /// .unwrap();
|
1639 + | /// # let app: RestJsonExtras<::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;
|
1640 + | /// ```
|
1641 + | ///
|
1642 + | pub fn status_response_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1643 + | where
|
1644 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::StatusResponse, ServiceExtractors>,
|
1645 + |
|
1646 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1647 + | RestJsonExtras<L>,
|
1648 + | crate::operation_shape::StatusResponse,
|
1649 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::StatusResponse, S>
|
1650 + | >,
|
1651 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1652 + | RestJsonExtras<L>,
|
1653 + | crate::operation_shape::StatusResponse,
|
1654 + | ModelPl::Output
|
1655 + | >,
|
1656 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1657 + | RestJsonExtras<L>,
|
1658 + | crate::operation_shape::StatusResponse,
|
1659 + | <
|
1660 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1661 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1662 + | RestJsonExtras<L>,
|
1663 + | crate::operation_shape::StatusResponse,
|
1664 + | ModelPl::Output
|
1665 + | >
|
1666 + | >::Output
|
1667 + | >,
|
1668 + |
|
1669 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1670 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1671 + |
|
1672 + | {
|
1673 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1674 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1675 + | let svc = crate::operation_shape::StatusResponse::from_service(service);
|
1676 + | let svc = self.model_plugin.apply(svc);
|
1677 + | let svc =
|
1678 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1679 + | .apply(svc);
|
1680 + | let svc = self.http_plugin.apply(svc);
|
1681 + | self.status_response_custom(svc)
|
1682 + | }
|
1683 + |
|
1684 + | /// Sets the [`StatusResponse`](crate::operation_shape::StatusResponse) to a custom [`Service`](tower::Service).
|
1685 + | /// not constrained by the Smithy contract.
|
1686 + | fn status_response_custom<S>(mut self, svc: S) -> Self
|
1687 + | where
|
1688 + | S: ::tower::Service<
|
1689 + | ::http::Request<Body>,
|
1690 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1691 + | Error = ::std::convert::Infallible,
|
1692 + | > + Clone
|
1693 + | + Send
|
1694 + | + 'static,
|
1695 + | S::Future: Send + 'static,
|
1696 + | {
|
1697 + | self.status_response = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1698 + | self
|
1699 + | }
|
1700 + |
|
1701 + | /// Sets the [`StringPayload`](crate::operation_shape::StringPayload) operation.
|
1702 + | ///
|
1703 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1704 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1705 + | ///
|
1706 + | /// # Example
|
1707 + | ///
|
1708 + | /// ```no_run
|
1709 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1710 + | ///
|
1711 + | /// use rest_json_extras_http0x::{input, output, error};
|
1712 + | ///
|
1713 + | /// async fn handler(input: input::StringPayloadInput) -> Result<output::StringPayloadOutput, error::StringPayloadError> {
|
1714 + | /// todo!()
|
1715 + | /// }
|
1716 + | ///
|
1717 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1718 + | /// let app = RestJsonExtras::builder(config)
|
1719 + | /// .string_payload(handler)
|
1720 + | /// /* Set other handlers */
|
1721 + | /// .build()
|
1722 + | /// .unwrap();
|
1723 + | /// # let app: RestJsonExtras<::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;
|
1724 + | /// ```
|
1725 + | ///
|
1726 + | pub fn string_payload<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
1727 + | where
|
1728 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::StringPayload, HandlerExtractors>,
|
1729 + |
|
1730 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1731 + | RestJsonExtras<L>,
|
1732 + | crate::operation_shape::StringPayload,
|
1733 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::StringPayload, HandlerType>
|
1734 + | >,
|
1735 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1736 + | RestJsonExtras<L>,
|
1737 + | crate::operation_shape::StringPayload,
|
1738 + | ModelPl::Output
|
1739 + | >,
|
1740 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1741 + | RestJsonExtras<L>,
|
1742 + | crate::operation_shape::StringPayload,
|
1743 + | <
|
1744 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1745 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1746 + | RestJsonExtras<L>,
|
1747 + | crate::operation_shape::StringPayload,
|
1748 + | ModelPl::Output
|
1749 + | >
|
1750 + | >::Output
|
1751 + | >,
|
1752 + |
|
1753 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1754 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1755 + |
|
1756 + | {
|
1757 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1758 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1759 + | let svc = crate::operation_shape::StringPayload::from_handler(handler);
|
1760 + | let svc = self.model_plugin.apply(svc);
|
1761 + | let svc =
|
1762 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1763 + | .apply(svc);
|
1764 + | let svc = self.http_plugin.apply(svc);
|
1765 + | self.string_payload_custom(svc)
|
1766 + | }
|
1767 + |
|
1768 + | /// Sets the [`StringPayload`](crate::operation_shape::StringPayload) operation.
|
1769 + | ///
|
1770 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
1771 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
1772 + | ///
|
1773 + | /// # Example
|
1774 + | ///
|
1775 + | /// ```no_run
|
1776 + | /// use rest_json_extras_http0x::{RestJsonExtras, RestJsonExtrasConfig};
|
1777 + | ///
|
1778 + | /// use rest_json_extras_http0x::{input, output, error};
|
1779 + | ///
|
1780 + | /// async fn handler(input: input::StringPayloadInput) -> Result<output::StringPayloadOutput, error::StringPayloadError> {
|
1781 + | /// todo!()
|
1782 + | /// }
|
1783 + | ///
|
1784 + | /// let config = RestJsonExtrasConfig::builder().build();
|
1785 + | /// let svc = ::tower::util::service_fn(handler);
|
1786 + | /// let app = RestJsonExtras::builder(config)
|
1787 + | /// .string_payload_service(svc)
|
1788 + | /// /* Set other handlers */
|
1789 + | /// .build()
|
1790 + | /// .unwrap();
|
1791 + | /// # let app: RestJsonExtras<::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;
|
1792 + | /// ```
|
1793 + | ///
|
1794 + | pub fn string_payload_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
1795 + | where
|
1796 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::StringPayload, ServiceExtractors>,
|
1797 + |
|
1798 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1799 + | RestJsonExtras<L>,
|
1800 + | crate::operation_shape::StringPayload,
|
1801 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::StringPayload, S>
|
1802 + | >,
|
1803 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1804 + | RestJsonExtras<L>,
|
1805 + | crate::operation_shape::StringPayload,
|
1806 + | ModelPl::Output
|
1807 + | >,
|
1808 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1809 + | RestJsonExtras<L>,
|
1810 + | crate::operation_shape::StringPayload,
|
1811 + | <
|
1812 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
1813 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
1814 + | RestJsonExtras<L>,
|
1815 + | crate::operation_shape::StringPayload,
|
1816 + | ModelPl::Output
|
1817 + | >
|
1818 + | >::Output
|
1819 + | >,
|
1820 + |
|
1821 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
1822 + | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
1823 + |
|
1824 + | {
|
1825 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
1826 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
1827 + | let svc = crate::operation_shape::StringPayload::from_service(service);
|
1828 + | let svc = self.model_plugin.apply(svc);
|
1829 + | let svc =
|
1830 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
1831 + | .apply(svc);
|
1832 + | let svc = self.http_plugin.apply(svc);
|
1833 + | self.string_payload_custom(svc)
|
1834 + | }
|
1835 + |
|
1836 + | /// Sets the [`StringPayload`](crate::operation_shape::StringPayload) to a custom [`Service`](tower::Service).
|
1837 + | /// not constrained by the Smithy contract.
|
1838 + | fn string_payload_custom<S>(mut self, svc: S) -> Self
|
1839 + | where
|
1840 + | S: ::tower::Service<
|
1841 + | ::http::Request<Body>,
|
1842 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
1843 + | Error = ::std::convert::Infallible,
|
1844 + | > + Clone
|
1845 + | + Send
|
1846 + | + 'static,
|
1847 + | S::Future: Send + 'static,
|
1848 + | {
|
1849 + | self.string_payload = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
1850 + | self
|
1851 + | }
|
1852 + | }
|
1853 + |
|
1854 + | impl<Body, L, HttpPl, ModelPl> RestJsonExtrasBuilder<Body, L, HttpPl, ModelPl> {
|
1855 + | /// Constructs a [`RestJsonExtras`] from the arguments provided to the builder.
|
1856 + | ///
|
1857 + | /// Forgetting to register a handler for one or more operations will result in an error.
|
1858 + | ///
|
1859 + | /// Check out [`RestJsonExtrasBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
|
1860 + | /// unspecified route is requested.
|
1861 + | pub fn build(
|
1862 + | self,
|
1863 + | ) -> ::std::result::Result<
|
1864 + | RestJsonExtras<
|
1865 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
1866 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
1867 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1868 + | >,
|
1869 + | >,
|
1870 + | MissingOperationsError,
|
1871 + | >
|
1872 + | where
|
1873 + | L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
1874 + | {
|
1875 + | let router = {
|
1876 + | use ::aws_smithy_legacy_http_server::operation::OperationShape;
|
1877 + | let mut missing_operation_names = std::collections::HashMap::new();
|
1878 + | if self.case_insensitive_error_operation.is_none() {
|
1879 + | missing_operation_names.insert(
|
1880 + | crate::operation_shape::CaseInsensitiveErrorOperation::ID,
|
1881 + | ".case_insensitive_error_operation()",
|
1882 + | );
|
1883 + | }
|
1884 + | if self.empty_struct_with_content_on_wire_op.is_none() {
|
1885 + | missing_operation_names.insert(
|
1886 + | crate::operation_shape::EmptyStructWithContentOnWireOp::ID,
|
1887 + | ".empty_struct_with_content_on_wire_op()",
|
1888 + | );
|
1889 + | }
|
1890 + | if self.enum_query.is_none() {
|
1891 + | missing_operation_names
|
1892 + | .insert(crate::operation_shape::EnumQuery::ID, ".enum_query()");
|
1893 + | }
|
1894 + | if self.escaped_string_values.is_none() {
|
1895 + | missing_operation_names.insert(
|
1896 + | crate::operation_shape::EscapedStringValues::ID,
|
1897 + | ".escaped_string_values()",
|
1898 + | );
|
1899 + | }
|
1900 + | if self.http_query_params_only_operation.is_none() {
|
1901 + | missing_operation_names.insert(
|
1902 + | crate::operation_shape::HttpQueryParamsOnlyOperation::ID,
|
1903 + | ".http_query_params_only_operation()",
|
1904 + | );
|
1905 + | }
|
1906 + | if self.map_with_enum_key_op.is_none() {
|
1907 + | missing_operation_names.insert(
|
1908 + | crate::operation_shape::MapWithEnumKeyOp::ID,
|
1909 + | ".map_with_enum_key_op()",
|
1910 + | );
|
1911 + | }
|
1912 + | if self.null_in_non_sparse.is_none() {
|
1913 + | missing_operation_names.insert(
|
1914 + | crate::operation_shape::NullInNonSparse::ID,
|
1915 + | ".null_in_non_sparse()",
|
1916 + | );
|
1917 + | }
|
1918 + | if self.primitive_int_header.is_none() {
|
1919 + | missing_operation_names.insert(
|
1920 + | crate::operation_shape::PrimitiveIntHeader::ID,
|
1921 + | ".primitive_int_header()",
|
1922 + | );
|
1923 + | }
|
1924 + | if self.primitive_int_op.is_none() {
|
1925 + | missing_operation_names.insert(
|
1926 + | crate::operation_shape::PrimitiveIntOp::ID,
|
1927 + | ".primitive_int_op()",
|
1928 + | );
|
1929 + | }
|
1930 + | if self.query_precedence.is_none() {
|
1931 + | missing_operation_names.insert(
|
1932 + | crate::operation_shape::QueryPrecedence::ID,
|
1933 + | ".query_precedence()",
|
1934 + | );
|
1935 + | }
|
1936 + | if self.status_response.is_none() {
|
1937 + | missing_operation_names.insert(
|
1938 + | crate::operation_shape::StatusResponse::ID,
|
1939 + | ".status_response()",
|
1940 + | );
|
1941 + | }
|
1942 + | if self.string_payload.is_none() {
|
1943 + | missing_operation_names.insert(
|
1944 + | crate::operation_shape::StringPayload::ID,
|
1945 + | ".string_payload()",
|
1946 + | );
|
1947 + | }
|
1948 + | if !missing_operation_names.is_empty() {
|
1949 + | return Err(MissingOperationsError {
|
1950 + | operation_names2setter_methods: missing_operation_names,
|
1951 + | });
|
1952 + | }
|
1953 + | 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";
|
1954 + |
|
1955 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([
|
1956 + | (
|
1957 + | request_specs::case_insensitive_error_operation(),
|
1958 + | self.case_insensitive_error_operation
|
1959 + | .expect(unexpected_error_msg),
|
1960 + | ),
|
1961 + | (
|
1962 + | request_specs::empty_struct_with_content_on_wire_op(),
|
1963 + | self.empty_struct_with_content_on_wire_op
|
1964 + | .expect(unexpected_error_msg),
|
1965 + | ),
|
1966 + | (
|
1967 + | request_specs::enum_query(),
|
1968 + | self.enum_query.expect(unexpected_error_msg),
|
1969 + | ),
|
1970 + | (
|
1971 + | request_specs::escaped_string_values(),
|
1972 + | self.escaped_string_values.expect(unexpected_error_msg),
|
1973 + | ),
|
1974 + | (
|
1975 + | request_specs::http_query_params_only_operation(),
|
1976 + | self.http_query_params_only_operation
|
1977 + | .expect(unexpected_error_msg),
|
1978 + | ),
|
1979 + | (
|
1980 + | request_specs::map_with_enum_key_op(),
|
1981 + | self.map_with_enum_key_op.expect(unexpected_error_msg),
|
1982 + | ),
|
1983 + | (
|
1984 + | request_specs::null_in_non_sparse(),
|
1985 + | self.null_in_non_sparse.expect(unexpected_error_msg),
|
1986 + | ),
|
1987 + | (
|
1988 + | request_specs::primitive_int_header(),
|
1989 + | self.primitive_int_header.expect(unexpected_error_msg),
|
1990 + | ),
|
1991 + | (
|
1992 + | request_specs::primitive_int_op(),
|
1993 + | self.primitive_int_op.expect(unexpected_error_msg),
|
1994 + | ),
|
1995 + | (
|
1996 + | request_specs::query_precedence(),
|
1997 + | self.query_precedence.expect(unexpected_error_msg),
|
1998 + | ),
|
1999 + | (
|
2000 + | request_specs::status_response(),
|
2001 + | self.status_response.expect(unexpected_error_msg),
|
2002 + | ),
|
2003 + | (
|
2004 + | request_specs::string_payload(),
|
2005 + | self.string_payload.expect(unexpected_error_msg),
|
2006 + | ),
|
2007 + | ])
|
2008 + | };
|
2009 + | let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
|
2010 + | let svc = svc.map(|s| s.layer(self.layer));
|
2011 + | Ok(RestJsonExtras { svc })
|
2012 + | }
|
2013 + |
|
2014 + | /// Constructs a [`RestJsonExtras`] from the arguments provided to the builder.
|
2015 + | /// Operations without a handler default to returning 500 Internal Server Error to the caller.
|
2016 + | ///
|
2017 + | /// Check out [`RestJsonExtrasBuilder::build`] if you'd prefer the builder to fail if one or more operations do
|
2018 + | /// not have a registered handler.
|
2019 + | pub fn build_unchecked(self) -> RestJsonExtras<L::Service>
|
2020 + | where
|
2021 + | Body: Send + 'static,
|
2022 + | L: ::tower::Layer<
|
2023 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
2024 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
2025 + | ::aws_smithy_legacy_http_server::routing::Route<Body>,
|
2026 + | >,
|
2027 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2028 + | >,
|
2029 + | >,
|
2030 + | {
|
2031 + | let router =
|
2032 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([
|
2033 + | (
|
2034 + | request_specs::case_insensitive_error_operation(),
|
2035 + | self.case_insensitive_error_operation.unwrap_or_else(|| {
|
2036 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2037 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2038 + | >::default();
|
2039 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2040 + | }),
|
2041 + | ),
|
2042 + | (
|
2043 + | request_specs::empty_struct_with_content_on_wire_op(),
|
2044 + | self.empty_struct_with_content_on_wire_op
|
2045 + | .unwrap_or_else(|| {
|
2046 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2047 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2048 + | >::default();
|
2049 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2050 + | }),
|
2051 + | ),
|
2052 + | (
|
2053 + | request_specs::enum_query(),
|
2054 + | self.enum_query.unwrap_or_else(|| {
|
2055 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2056 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2057 + | >::default();
|
2058 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2059 + | }),
|
2060 + | ),
|
2061 + | (
|
2062 + | request_specs::escaped_string_values(),
|
2063 + | self.escaped_string_values.unwrap_or_else(|| {
|
2064 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2065 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2066 + | >::default();
|
2067 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2068 + | }),
|
2069 + | ),
|
2070 + | (
|
2071 + | request_specs::http_query_params_only_operation(),
|
2072 + | self.http_query_params_only_operation.unwrap_or_else(|| {
|
2073 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2074 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2075 + | >::default();
|
2076 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2077 + | }),
|
2078 + | ),
|
2079 + | (
|
2080 + | request_specs::map_with_enum_key_op(),
|
2081 + | self.map_with_enum_key_op.unwrap_or_else(|| {
|
2082 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2083 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2084 + | >::default();
|
2085 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2086 + | }),
|
2087 + | ),
|
2088 + | (
|
2089 + | request_specs::null_in_non_sparse(),
|
2090 + | self.null_in_non_sparse.unwrap_or_else(|| {
|
2091 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2092 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2093 + | >::default();
|
2094 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2095 + | }),
|
2096 + | ),
|
2097 + | (
|
2098 + | request_specs::primitive_int_header(),
|
2099 + | self.primitive_int_header.unwrap_or_else(|| {
|
2100 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2101 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2102 + | >::default();
|
2103 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2104 + | }),
|
2105 + | ),
|
2106 + | (
|
2107 + | request_specs::primitive_int_op(),
|
2108 + | self.primitive_int_op.unwrap_or_else(|| {
|
2109 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2110 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2111 + | >::default();
|
2112 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2113 + | }),
|
2114 + | ),
|
2115 + | (
|
2116 + | request_specs::query_precedence(),
|
2117 + | self.query_precedence.unwrap_or_else(|| {
|
2118 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2119 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2120 + | >::default();
|
2121 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2122 + | }),
|
2123 + | ),
|
2124 + | (
|
2125 + | request_specs::status_response(),
|
2126 + | self.status_response.unwrap_or_else(|| {
|
2127 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2128 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2129 + | >::default();
|
2130 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2131 + | }),
|
2132 + | ),
|
2133 + | (
|
2134 + | request_specs::string_payload(),
|
2135 + | self.string_payload.unwrap_or_else(|| {
|
2136 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
2137 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2138 + | >::default();
|
2139 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
2140 + | }),
|
2141 + | ),
|
2142 + | ]);
|
2143 + | let svc = self
|
2144 + | .layer
|
2145 + | .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
|
2146 + | RestJsonExtras { svc }
|
2147 + | }
|
2148 + | }
|
2149 + |
|
2150 + | /// The error encountered when calling the [`RestJsonExtrasBuilder::build`] method if one or more operation handlers are not
|
2151 + | /// specified.
|
2152 + | #[derive(Debug)]
|
2153 + | pub struct MissingOperationsError {
|
2154 + | operation_names2setter_methods:
|
2155 + | std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
|
2156 + | }
|
2157 + |
|
2158 + | impl std::fmt::Display for MissingOperationsError {
|
2159 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2160 + | write!(
|
2161 + | f,
|
2162 + | "You must specify a handler for all operations attached to `RestJsonExtras`.\n\
|
2163 + | We are missing handlers for the following operations:\n",
|
2164 + | )?;
|
2165 + | for operation_name in self.operation_names2setter_methods.keys() {
|
2166 + | writeln!(f, "- {}", operation_name.absolute())?;
|
2167 + | }
|
2168 + |
|
2169 + | writeln!(f, "\nUse the dedicated methods on `RestJsonExtrasBuilder` to register the missing handlers:")?;
|
2170 + | for setter_name in self.operation_names2setter_methods.values() {
|
2171 + | writeln!(f, "- {}", setter_name)?;
|
2172 + | }
|
2173 + | Ok(())
|
2174 + | }
|
2175 + | }
|
2176 + |
|
2177 + | impl std::error::Error for MissingOperationsError {}
|
2178 + |
|
2179 + | mod request_specs {
|
2180 + | pub(super) fn case_insensitive_error_operation(
|
2181 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2182 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2183 + | ::http::Method::POST,
|
2184 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2185 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2186 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2187 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("error-sensitive")),
|
2188 + | ]),
|
2189 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2190 + | ])
|
2191 + | )
|
2192 + | ),
|
2193 + | )
|
2194 + | }
|
2195 + | pub(super) fn empty_struct_with_content_on_wire_op(
|
2196 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2197 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2198 + | ::http::Method::GET,
|
2199 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2200 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2201 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2202 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("empty-struct-with-content-on-wire-op")),
|
2203 + | ]),
|
2204 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2205 + | ])
|
2206 + | )
|
2207 + | ),
|
2208 + | )
|
2209 + | }
|
2210 + | pub(super) fn enum_query() -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec
|
2211 + | {
|
2212 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2213 + | ::http::Method::GET,
|
2214 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2215 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2216 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2217 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("foo")),
|
2218 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Label,
|
2219 + | ]),
|
2220 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2221 + | ])
|
2222 + | )
|
2223 + | ),
|
2224 + | )
|
2225 + | }
|
2226 + | pub(super) fn escaped_string_values(
|
2227 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2228 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2229 + | ::http::Method::POST,
|
2230 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2231 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2232 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2233 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("escaped-string-values")),
|
2234 + | ]),
|
2235 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2236 + | ])
|
2237 + | )
|
2238 + | ),
|
2239 + | )
|
2240 + | }
|
2241 + | pub(super) fn http_query_params_only_operation(
|
2242 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2243 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2244 + | ::http::Method::GET,
|
2245 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2246 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2247 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2248 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("http-query-params-only")),
|
2249 + | ]),
|
2250 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2251 + | ])
|
2252 + | )
|
2253 + | ),
|
2254 + | )
|
2255 + | }
|
2256 + | pub(super) fn map_with_enum_key_op(
|
2257 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2258 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2259 + | ::http::Method::POST,
|
2260 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2261 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2262 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2263 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("map-with-enum-key")),
|
2264 + | ]),
|
2265 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2266 + | ])
|
2267 + | )
|
2268 + | ),
|
2269 + | )
|
2270 + | }
|
2271 + | pub(super) fn null_in_non_sparse(
|
2272 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2273 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2274 + | ::http::Method::POST,
|
2275 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2276 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2277 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2278 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("null-in-non-sparse")),
|
2279 + | ]),
|
2280 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2281 + | ])
|
2282 + | )
|
2283 + | ),
|
2284 + | )
|
2285 + | }
|
2286 + | pub(super) fn primitive_int_header(
|
2287 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2288 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2289 + | ::http::Method::POST,
|
2290 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2291 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2292 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2293 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("primitive")),
|
2294 + | ]),
|
2295 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2296 + | ])
|
2297 + | )
|
2298 + | ),
|
2299 + | )
|
2300 + | }
|
2301 + | pub(super) fn primitive_int_op(
|
2302 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2303 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2304 + | ::http::Method::POST,
|
2305 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2306 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2307 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2308 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("primitive-document")),
|
2309 + | ]),
|
2310 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2311 + | ])
|
2312 + | )
|
2313 + | ),
|
2314 + | )
|
2315 + | }
|
2316 + | pub(super) fn query_precedence(
|
2317 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2318 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2319 + | ::http::Method::POST,
|
2320 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2321 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2322 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2323 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("Precedence")),
|
2324 + | ]),
|
2325 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2326 + | ])
|
2327 + | )
|
2328 + | ),
|
2329 + | )
|
2330 + | }
|
2331 + | pub(super) fn status_response(
|
2332 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2333 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2334 + | ::http::Method::POST,
|
2335 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2336 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2337 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2338 + | ]),
|
2339 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2340 + | ])
|
2341 + | )
|
2342 + | ),
|
2343 + | )
|
2344 + | }
|
2345 + | pub(super) fn string_payload(
|
2346 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
2347 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
2348 + | ::http::Method::POST,
|
2349 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
2350 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
2351 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
2352 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("StringPayload")),
|
2353 + | ]),
|
2354 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
2355 + | ])
|
2356 + | )
|
2357 + | ),
|
2358 + | )
|
2359 + | }
|
2360 + | }
|
2361 + |
|
2362 + | /// A REST JSON service that sends JSON requests and responses.
|
2363 + | ///
|
2364 + | /// See the [root](crate) documentation for more information.
|
2365 + | #[derive(Clone)]
|
2366 + | pub struct RestJsonExtras<
|
2367 + | S = ::aws_smithy_legacy_http_server::routing::RoutingService<
|
2368 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
2369 + | ::aws_smithy_legacy_http_server::routing::Route<
|
2370 + | ::aws_smithy_legacy_http_server::body::BoxBody,
|
2371 + | >,
|
2372 + | >,
|
2373 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2374 + | >,
|
2375 + | > {
|
2376 + | // This is the router wrapped by layers.
|
2377 + | svc: S,
|
2378 + | }
|
2379 + |
|
2380 + | impl RestJsonExtras<()> {
|
2381 + | /// Constructs a builder for [`RestJsonExtras`].
|
2382 + | /// You must specify a configuration object holding any plugins and layers that should be applied
|
2383 + | /// to the operations in this service.
|
2384 + | pub fn builder<
|
2385 + | Body,
|
2386 + | L,
|
2387 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
2388 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
2389 + | >(
|
2390 + | config: RestJsonExtrasConfig<L, HttpPl, ModelPl>,
|
2391 + | ) -> RestJsonExtrasBuilder<Body, L, HttpPl, ModelPl> {
|
2392 + | RestJsonExtrasBuilder {
|
2393 + | case_insensitive_error_operation: None,
|
2394 + | empty_struct_with_content_on_wire_op: None,
|
2395 + | enum_query: None,
|
2396 + | escaped_string_values: None,
|
2397 + | http_query_params_only_operation: None,
|
2398 + | map_with_enum_key_op: None,
|
2399 + | null_in_non_sparse: None,
|
2400 + | primitive_int_header: None,
|
2401 + | primitive_int_op: None,
|
2402 + | query_precedence: None,
|
2403 + | status_response: None,
|
2404 + | string_payload: None,
|
2405 + | layer: config.layers,
|
2406 + | http_plugin: config.http_plugins,
|
2407 + | model_plugin: config.model_plugins,
|
2408 + | }
|
2409 + | }
|
2410 + |
|
2411 + | /// Constructs a builder for [`RestJsonExtras`].
|
2412 + | /// You must specify what plugins should be applied to the operations in this service.
|
2413 + | ///
|
2414 + | /// Use [`RestJsonExtras::builder_without_plugins`] if you don't need to apply plugins.
|
2415 + | ///
|
2416 + | /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
|
2417 + | /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
|
2418 + | /// multiple plugins.
|
2419 + | #[deprecated(
|
2420 + | since = "0.57.0",
|
2421 + | note = "please use the `builder` constructor and register plugins on the `RestJsonExtrasConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
2422 + | )]
|
2423 + | pub fn builder_with_plugins<
|
2424 + | Body,
|
2425 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
2426 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
2427 + | >(
|
2428 + | http_plugin: HttpPl,
|
2429 + | model_plugin: ModelPl,
|
2430 + | ) -> RestJsonExtrasBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
|
2431 + | RestJsonExtrasBuilder {
|
2432 + | case_insensitive_error_operation: None,
|
2433 + | empty_struct_with_content_on_wire_op: None,
|
2434 + | enum_query: None,
|
2435 + | escaped_string_values: None,
|
2436 + | http_query_params_only_operation: None,
|
2437 + | map_with_enum_key_op: None,
|
2438 + | null_in_non_sparse: None,
|
2439 + | primitive_int_header: None,
|
2440 + | primitive_int_op: None,
|
2441 + | query_precedence: None,
|
2442 + | status_response: None,
|
2443 + | string_payload: None,
|
2444 + | layer: ::tower::layer::util::Identity::new(),
|
2445 + | http_plugin,
|
2446 + | model_plugin,
|
2447 + | }
|
2448 + | }
|
2449 + |
|
2450 + | /// Constructs a builder for [`RestJsonExtras`].
|
2451 + | ///
|
2452 + | /// Use [`RestJsonExtras::builder_with_plugins`] if you need to specify plugins.
|
2453 + | #[deprecated(
|
2454 + | since = "0.57.0",
|
2455 + | note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
2456 + | )]
|
2457 + | pub fn builder_without_plugins<Body>() -> RestJsonExtrasBuilder<
|
2458 + | Body,
|
2459 + | ::tower::layer::util::Identity,
|
2460 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2461 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2462 + | > {
|
2463 + | Self::builder_with_plugins(
|
2464 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2465 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2466 + | )
|
2467 + | }
|
2468 + | }
|
2469 + |
|
2470 + | impl<S> RestJsonExtras<S> {
|
2471 + | /// Converts [`RestJsonExtras`] into a [`MakeService`](tower::make::MakeService).
|
2472 + | pub fn into_make_service(
|
2473 + | self,
|
2474 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
|
2475 + | ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
|
2476 + | }
|
2477 + |
|
2478 + | /// Converts [`RestJsonExtras`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
|
2479 + | pub fn into_make_service_with_connect_info<C>(
|
2480 + | self,
|
2481 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
2482 + | ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
2483 + | }
|
2484 + | }
|
2485 + |
|
2486 + | impl<S>
|
2487 + | RestJsonExtras<
|
2488 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
2489 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<S>,
|
2490 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2491 + | >,
|
2492 + | >
|
2493 + | {
|
2494 + | /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
|
2495 + | #[deprecated(
|
2496 + | since = "0.57.0",
|
2497 + | note = "please add layers to the `RestJsonExtrasConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
2498 + | )]
|
2499 + | pub fn layer<L>(
|
2500 + | self,
|
2501 + | layer: &L,
|
2502 + | ) -> RestJsonExtras<
|
2503 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
2504 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
2505 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2506 + | >,
|
2507 + | >
|
2508 + | where
|
2509 + | L: ::tower::Layer<S>,
|
2510 + | {
|
2511 + | RestJsonExtras {
|
2512 + | svc: self.svc.map(|s| s.layer(layer)),
|
2513 + | }
|
2514 + | }
|
2515 + |
|
2516 + | /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
|
2517 + | ///
|
2518 + | /// This has the effect of erasing all types accumulated via layers.
|
2519 + | pub fn boxed<B>(
|
2520 + | self,
|
2521 + | ) -> RestJsonExtras<
|
2522 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
2523 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
2524 + | ::aws_smithy_legacy_http_server::routing::Route<B>,
|
2525 + | >,
|
2526 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2527 + | >,
|
2528 + | >
|
2529 + | where
|
2530 + | S: ::tower::Service<
|
2531 + | ::http::Request<B>,
|
2532 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
2533 + | Error = std::convert::Infallible,
|
2534 + | >,
|
2535 + | S: Clone + Send + 'static,
|
2536 + | S::Future: Send + 'static,
|
2537 + | {
|
2538 + | self.layer(&::tower::layer::layer_fn(
|
2539 + | ::aws_smithy_legacy_http_server::routing::Route::new,
|
2540 + | ))
|
2541 + | }
|
2542 + | }
|
2543 + |
|
2544 + | impl<S, R> ::tower::Service<R> for RestJsonExtras<S>
|
2545 + | where
|
2546 + | S: ::tower::Service<R>,
|
2547 + | {
|
2548 + | type Response = S::Response;
|
2549 + | type Error = S::Error;
|
2550 + | type Future = S::Future;
|
2551 + |
|
2552 + | fn poll_ready(
|
2553 + | &mut self,
|
2554 + | cx: &mut std::task::Context,
|
2555 + | ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
|
2556 + | self.svc.poll_ready(cx)
|
2557 + | }
|
2558 + |
|
2559 + | fn call(&mut self, request: R) -> Self::Future {
|
2560 + | self.svc.call(request)
|
2561 + | }
|
2562 + | }
|
2563 + |
|
2564 + | /// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in RestJsonExtras.
|
2565 + | #[allow(clippy::enum_variant_names)]
|
2566 + | #[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
2567 + | pub enum Operation {
|
2568 + | CaseInsensitiveErrorOperation,
|
2569 + | EmptyStructWithContentOnWireOp,
|
2570 + | EnumQuery,
|
2571 + | EscapedStringValues,
|
2572 + | HttpQueryParamsOnlyOperation,
|
2573 + | MapWithEnumKeyOp,
|
2574 + | NullInNonSparse,
|
2575 + | PrimitiveIntHeader,
|
2576 + | PrimitiveIntOp,
|
2577 + | QueryPrecedence,
|
2578 + | StatusResponse,
|
2579 + | StringPayload,
|
2580 + | }
|
2581 + |
|
2582 + | impl Operation {
|
2583 + | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
|
2584 + | pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
|
2585 + | match self {
|
2586 + | Operation::CaseInsensitiveErrorOperation => {
|
2587 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2588 + | "aws.protocoltests.restjson#CaseInsensitiveErrorOperation",
|
2589 + | "aws.protocoltests.restjson",
|
2590 + | "CaseInsensitiveErrorOperation",
|
2591 + | )
|
2592 + | }
|
2593 + | Operation::EmptyStructWithContentOnWireOp => {
|
2594 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2595 + | "aws.protocoltests.restjson#EmptyStructWithContentOnWireOp",
|
2596 + | "aws.protocoltests.restjson",
|
2597 + | "EmptyStructWithContentOnWireOp",
|
2598 + | )
|
2599 + | }
|
2600 + | Operation::EnumQuery => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2601 + | "aws.protocoltests.restjson#EnumQuery",
|
2602 + | "aws.protocoltests.restjson",
|
2603 + | "EnumQuery",
|
2604 + | ),
|
2605 + | Operation::EscapedStringValues => {
|
2606 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2607 + | "aws.protocoltests.restjson#EscapedStringValues",
|
2608 + | "aws.protocoltests.restjson",
|
2609 + | "EscapedStringValues",
|
2610 + | )
|
2611 + | }
|
2612 + | Operation::HttpQueryParamsOnlyOperation => {
|
2613 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2614 + | "aws.protocoltests.restjson#HttpQueryParamsOnlyOperation",
|
2615 + | "aws.protocoltests.restjson",
|
2616 + | "HttpQueryParamsOnlyOperation",
|
2617 + | )
|
2618 + | }
|
2619 + | Operation::MapWithEnumKeyOp => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2620 + | "aws.protocoltests.restjson#MapWithEnumKeyOp",
|
2621 + | "aws.protocoltests.restjson",
|
2622 + | "MapWithEnumKeyOp",
|
2623 + | ),
|
2624 + | Operation::NullInNonSparse => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2625 + | "aws.protocoltests.restjson#NullInNonSparse",
|
2626 + | "aws.protocoltests.restjson",
|
2627 + | "NullInNonSparse",
|
2628 + | ),
|
2629 + | Operation::PrimitiveIntHeader => {
|
2630 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2631 + | "aws.protocoltests.restjson#PrimitiveIntHeader",
|
2632 + | "aws.protocoltests.restjson",
|
2633 + | "PrimitiveIntHeader",
|
2634 + | )
|
2635 + | }
|
2636 + | Operation::PrimitiveIntOp => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2637 + | "aws.protocoltests.restjson#PrimitiveIntOp",
|
2638 + | "aws.protocoltests.restjson",
|
2639 + | "PrimitiveIntOp",
|
2640 + | ),
|
2641 + | Operation::QueryPrecedence => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2642 + | "aws.protocoltests.restjson#QueryPrecedence",
|
2643 + | "aws.protocoltests.restjson",
|
2644 + | "QueryPrecedence",
|
2645 + | ),
|
2646 + | Operation::StatusResponse => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2647 + | "aws.protocoltests.restjson#StatusResponse",
|
2648 + | "aws.protocoltests.restjson",
|
2649 + | "StatusResponse",
|
2650 + | ),
|
2651 + | Operation::StringPayload => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2652 + | "aws.protocoltests.restjson#StringPayload",
|
2653 + | "aws.protocoltests.restjson",
|
2654 + | "StringPayload",
|
2655 + | ),
|
2656 + | }
|
2657 + | }
|
2658 + | }
|
2659 + | impl<L>
|
2660 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2661 + | crate::operation_shape::CaseInsensitiveErrorOperation,
|
2662 + | > for RestJsonExtras<L>
|
2663 + | {
|
2664 + | const VALUE: Operation = Operation::CaseInsensitiveErrorOperation;
|
2665 + | }
|
2666 + | impl<L>
|
2667 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2668 + | crate::operation_shape::EmptyStructWithContentOnWireOp,
|
2669 + | > for RestJsonExtras<L>
|
2670 + | {
|
2671 + | const VALUE: Operation = Operation::EmptyStructWithContentOnWireOp;
|
2672 + | }
|
2673 + | impl<L>
|
2674 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::EnumQuery>
|
2675 + | for RestJsonExtras<L>
|
2676 + | {
|
2677 + | const VALUE: Operation = Operation::EnumQuery;
|
2678 + | }
|
2679 + | impl<L>
|
2680 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2681 + | crate::operation_shape::EscapedStringValues,
|
2682 + | > for RestJsonExtras<L>
|
2683 + | {
|
2684 + | const VALUE: Operation = Operation::EscapedStringValues;
|
2685 + | }
|
2686 + | impl<L>
|
2687 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2688 + | crate::operation_shape::HttpQueryParamsOnlyOperation,
|
2689 + | > for RestJsonExtras<L>
|
2690 + | {
|
2691 + | const VALUE: Operation = Operation::HttpQueryParamsOnlyOperation;
|
2692 + | }
|
2693 + | impl<L>
|
2694 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2695 + | crate::operation_shape::MapWithEnumKeyOp,
|
2696 + | > for RestJsonExtras<L>
|
2697 + | {
|
2698 + | const VALUE: Operation = Operation::MapWithEnumKeyOp;
|
2699 + | }
|
2700 + | impl<L>
|
2701 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2702 + | crate::operation_shape::NullInNonSparse,
|
2703 + | > for RestJsonExtras<L>
|
2704 + | {
|
2705 + | const VALUE: Operation = Operation::NullInNonSparse;
|
2706 + | }
|
2707 + | impl<L>
|
2708 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2709 + | crate::operation_shape::PrimitiveIntHeader,
|
2710 + | > for RestJsonExtras<L>
|
2711 + | {
|
2712 + | const VALUE: Operation = Operation::PrimitiveIntHeader;
|
2713 + | }
|
2714 + | impl<L>
|
2715 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2716 + | crate::operation_shape::PrimitiveIntOp,
|
2717 + | > for RestJsonExtras<L>
|
2718 + | {
|
2719 + | const VALUE: Operation = Operation::PrimitiveIntOp;
|
2720 + | }
|
2721 + | impl<L>
|
2722 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2723 + | crate::operation_shape::QueryPrecedence,
|
2724 + | > for RestJsonExtras<L>
|
2725 + | {
|
2726 + | const VALUE: Operation = Operation::QueryPrecedence;
|
2727 + | }
|
2728 + | impl<L>
|
2729 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2730 + | crate::operation_shape::StatusResponse,
|
2731 + | > for RestJsonExtras<L>
|
2732 + | {
|
2733 + | const VALUE: Operation = Operation::StatusResponse;
|
2734 + | }
|
2735 + | impl<L>
|
2736 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
2737 + | crate::operation_shape::StringPayload,
|
2738 + | > for RestJsonExtras<L>
|
2739 + | {
|
2740 + | const VALUE: Operation = Operation::StringPayload;
|
2741 + | }
|
2742 + |
|
2743 + | impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for RestJsonExtras<S> {
|
2744 + | const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
|
2745 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
2746 + | "aws.protocoltests.restjson#RestJsonExtras",
|
2747 + | "aws.protocoltests.restjson",
|
2748 + | "RestJsonExtras",
|
2749 + | );
|
2750 + |
|
2751 + | const VERSION: Option<&'static str> = Some("2019-12-16");
|
2752 + |
|
2753 + | type Protocol = ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1;
|
2754 + |
|
2755 + | type Operations = Operation;
|
2756 + | }
|
2757 + | /// Configuration for the [`RestJsonExtras`]. This is the central place where to register and
|
2758 + | /// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
|
2759 + | ///
|
2760 + | /// ```rust,no_run
|
2761 + | /// # use rest_json_extras_http0x::RestJsonExtrasConfig;
|
2762 + | /// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
|
2763 + | /// # use ::tower::layer::util::Identity;
|
2764 + | /// # let authentication_plugin = IdentityPlugin;
|
2765 + | /// # let authorization_plugin = IdentityPlugin;
|
2766 + | /// # let server_request_id_provider_layer = Identity::new();
|
2767 + | /// let config = RestJsonExtrasConfig::builder()
|
2768 + | /// // Layers get executed first...
|
2769 + | /// .layer(server_request_id_provider_layer)
|
2770 + | /// // ...then HTTP plugins...
|
2771 + | /// .http_plugin(authentication_plugin)
|
2772 + | /// // ...and right after deserialization, model plugins.
|
2773 + | /// .model_plugin(authorization_plugin)
|
2774 + | /// .build();
|
2775 + | /// ```
|
2776 + | ///
|
2777 + | /// See the [`plugin`] system for details.
|
2778 + | ///
|
2779 + | /// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
|
2780 + | #[derive(::std::fmt::Debug)]
|
2781 + | pub struct RestJsonExtrasConfig<L, H, M> {
|
2782 + | layers: L,
|
2783 + | http_plugins: H,
|
2784 + | model_plugins: M,
|
2785 + | }
|
2786 + |
|
2787 + | impl RestJsonExtrasConfig<(), (), ()> {
|
2788 + | /// Returns a builder to construct the configuration.
|
2789 + | pub fn builder() -> RestJsonExtrasConfigBuilder<
|
2790 + | ::tower::layer::util::Identity,
|
2791 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2792 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2793 + | > {
|
2794 + | RestJsonExtrasConfigBuilder {
|
2795 + | layers: ::tower::layer::util::Identity::new(),
|
2796 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2797 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
2798 + | }
|
2799 + | }
|
2800 + | }
|
2801 + |
|
2802 + | /// Builder returned by [`RestJsonExtrasConfig::builder()`].
|
2803 + | #[derive(::std::fmt::Debug)]
|
2804 + | pub struct RestJsonExtrasConfigBuilder<L, H, M> {
|
2805 + | pub(crate) layers: L,
|
2806 + | pub(crate) http_plugins: H,
|
2807 + | pub(crate) model_plugins: M,
|
2808 + | }
|
2809 + |
|
2810 + | impl<L, H, M> RestJsonExtrasConfigBuilder<L, H, M> {
|
2811 + | /// Add a [`::tower::Layer`] to the service.
|
2812 + | pub fn layer<NewLayer>(
|
2813 + | self,
|
2814 + | layer: NewLayer,
|
2815 + | ) -> RestJsonExtrasConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
|
2816 + | RestJsonExtrasConfigBuilder {
|
2817 + | layers: ::tower::layer::util::Stack::new(layer, self.layers),
|
2818 + | http_plugins: self.http_plugins,
|
2819 + | model_plugins: self.model_plugins,
|
2820 + | }
|
2821 + | }
|
2822 + |
|
2823 + | /// Add a HTTP [plugin] to the service.
|
2824 + | ///
|
2825 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
2826 + | // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
|
2827 + | // errors get _substantially_ better if the user makes a mistake.
|
2828 + | pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
|
2829 + | self,
|
2830 + | http_plugin: NewPlugin,
|
2831 + | ) -> RestJsonExtrasConfigBuilder<
|
2832 + | L,
|
2833 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
|
2834 + | M,
|
2835 + | > {
|
2836 + | RestJsonExtrasConfigBuilder {
|
2837 + | layers: self.layers,
|
2838 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
2839 + | http_plugin,
|
2840 + | self.http_plugins,
|
2841 + | ),
|
2842 + | model_plugins: self.model_plugins,
|
2843 + | }
|
2844 + | }
|
2845 + |
|
2846 + | /// Add a model [plugin] to the service.
|
2847 + | ///
|
2848 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
2849 + | // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
|
2850 + | // errors get _substantially_ better if the user makes a mistake.
|
2851 + | pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
|
2852 + | self,
|
2853 + | model_plugin: NewPlugin,
|
2854 + | ) -> RestJsonExtrasConfigBuilder<
|
2855 + | L,
|
2856 + | H,
|
2857 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
|
2858 + | > {
|
2859 + | RestJsonExtrasConfigBuilder {
|
2860 + | layers: self.layers,
|
2861 + | http_plugins: self.http_plugins,
|
2862 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
2863 + | model_plugin,
|
2864 + | self.model_plugins,
|
2865 + | ),
|
2866 + | }
|
2867 + | }
|
2868 + |
|
2869 + | /// Build the configuration.
|
2870 + | pub fn build(self) -> super::RestJsonExtrasConfig<L, H, M> {
|
2871 + | super::RestJsonExtrasConfig {
|
2872 + | layers: self.layers,
|
2873 + | http_plugins: self.http_plugins,
|
2874 + | model_plugins: self.model_plugins,
|
2875 + | }
|
2876 + | }
|
2877 + | }
|
2878 + | /// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
|
2879 + | ///
|
2880 + | /// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
|
2881 + | /// of the service and any operations _not_ specified will be placed in the opposing group.
|
2882 + | ///
|
2883 + | /// # Example
|
2884 + | ///
|
2885 + | /// ```rust
|
2886 + | /// scope! {
|
2887 + | /// /// Includes [`CaseInsensitiveErrorOperation`], excluding all other operations.
|
2888 + | /// struct ScopeA {
|
2889 + | /// includes: [CaseInsensitiveErrorOperation]
|
2890 + | /// }
|
2891 + | /// }
|
2892 + | ///
|
2893 + | /// scope! {
|
2894 + | /// /// Excludes [`CaseInsensitiveErrorOperation`], excluding all other operations.
|
2895 + | /// struct ScopeB {
|
2896 + | /// excludes: [CaseInsensitiveErrorOperation]
|
2897 + | /// }
|
2898 + | /// }
|
2899 + | ///
|
2900 + | /// # use rest_json_extras_http0x::server::plugin::{Plugin, Scoped};
|
2901 + | /// # use rest_json_extras_http0x::scope;
|
2902 + | /// # struct MockPlugin;
|
2903 + | /// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
|
2904 + | /// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
|
2905 + | /// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
|
2906 + | /// # let a = Plugin::<(), rest_json_extras_http0x::operation_shape::CaseInsensitiveErrorOperation, u64>::apply(&scoped_a, 6);
|
2907 + | /// # let b = Plugin::<(), rest_json_extras_http0x::operation_shape::CaseInsensitiveErrorOperation, u64>::apply(&scoped_b, 6);
|
2908 + | /// # assert_eq!(a, 3_u32);
|
2909 + | /// # assert_eq!(b, 6_u64);
|
2910 + | /// ```
|
2911 + | #[macro_export]
|
2912 + | macro_rules! scope {
|
2913 + | // Completed, render impls
|
2914 + | (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
|
2915 + | $(
|
2916 + | impl $ crate::server::plugin::scoped::Membership<$ temp> for $ name {
|
2917 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
2918 + | }
|
2919 + | )*
|
2920 + | $(
|
2921 + | impl $ crate::server::plugin::scoped::Membership<$ not_member> for $ name {
|
2922 + | type Contains = $ crate::server::plugin::scoped::$ contains;
|
2923 + | }
|
2924 + | )*
|
2925 + | };
|
2926 + | // All `not_member`s exhausted, move `temp` into `not_member`
|
2927 + | (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
|
2928 + | scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
|
2929 + | };
|
2930 + |
|
2931 + | // CaseInsensitiveErrorOperation match found, pop from both `member` and `not_member`
|
2932 + | (@ $ name: ident, $ contains: ident (CaseInsensitiveErrorOperation $($ member: ident)*) ($($ temp: ident)*) (CaseInsensitiveErrorOperation $($ not_member: ident)*)) => {
|
2933 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2934 + | };
|
2935 + | // CaseInsensitiveErrorOperation match not found, pop from `not_member` into `temp` stack
|
2936 + | (@ $ name: ident, $ contains: ident (CaseInsensitiveErrorOperation $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2937 + | scope! { @ $ name, $ contains (CaseInsensitiveErrorOperation $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2938 + | };
|
2939 + |
|
2940 + | // EmptyStructWithContentOnWireOp match found, pop from both `member` and `not_member`
|
2941 + | (@ $ name: ident, $ contains: ident (EmptyStructWithContentOnWireOp $($ member: ident)*) ($($ temp: ident)*) (EmptyStructWithContentOnWireOp $($ not_member: ident)*)) => {
|
2942 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2943 + | };
|
2944 + | // EmptyStructWithContentOnWireOp match not found, pop from `not_member` into `temp` stack
|
2945 + | (@ $ name: ident, $ contains: ident (EmptyStructWithContentOnWireOp $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2946 + | scope! { @ $ name, $ contains (EmptyStructWithContentOnWireOp $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2947 + | };
|
2948 + |
|
2949 + | // EnumQuery match found, pop from both `member` and `not_member`
|
2950 + | (@ $ name: ident, $ contains: ident (EnumQuery $($ member: ident)*) ($($ temp: ident)*) (EnumQuery $($ not_member: ident)*)) => {
|
2951 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2952 + | };
|
2953 + | // EnumQuery match not found, pop from `not_member` into `temp` stack
|
2954 + | (@ $ name: ident, $ contains: ident (EnumQuery $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2955 + | scope! { @ $ name, $ contains (EnumQuery $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2956 + | };
|
2957 + |
|
2958 + | // EscapedStringValues match found, pop from both `member` and `not_member`
|
2959 + | (@ $ name: ident, $ contains: ident (EscapedStringValues $($ member: ident)*) ($($ temp: ident)*) (EscapedStringValues $($ not_member: ident)*)) => {
|
2960 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2961 + | };
|
2962 + | // EscapedStringValues match not found, pop from `not_member` into `temp` stack
|
2963 + | (@ $ name: ident, $ contains: ident (EscapedStringValues $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2964 + | scope! { @ $ name, $ contains (EscapedStringValues $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2965 + | };
|
2966 + |
|
2967 + | // HttpQueryParamsOnlyOperation match found, pop from both `member` and `not_member`
|
2968 + | (@ $ name: ident, $ contains: ident (HttpQueryParamsOnlyOperation $($ member: ident)*) ($($ temp: ident)*) (HttpQueryParamsOnlyOperation $($ not_member: ident)*)) => {
|
2969 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2970 + | };
|
2971 + | // HttpQueryParamsOnlyOperation match not found, pop from `not_member` into `temp` stack
|
2972 + | (@ $ name: ident, $ contains: ident (HttpQueryParamsOnlyOperation $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2973 + | scope! { @ $ name, $ contains (HttpQueryParamsOnlyOperation $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2974 + | };
|
2975 + |
|
2976 + | // MapWithEnumKeyOp match found, pop from both `member` and `not_member`
|
2977 + | (@ $ name: ident, $ contains: ident (MapWithEnumKeyOp $($ member: ident)*) ($($ temp: ident)*) (MapWithEnumKeyOp $($ not_member: ident)*)) => {
|
2978 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2979 + | };
|
2980 + | // MapWithEnumKeyOp match not found, pop from `not_member` into `temp` stack
|
2981 + | (@ $ name: ident, $ contains: ident (MapWithEnumKeyOp $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2982 + | scope! { @ $ name, $ contains (MapWithEnumKeyOp $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2983 + | };
|
2984 + |
|
2985 + | // NullInNonSparse match found, pop from both `member` and `not_member`
|
2986 + | (@ $ name: ident, $ contains: ident (NullInNonSparse $($ member: ident)*) ($($ temp: ident)*) (NullInNonSparse $($ not_member: ident)*)) => {
|
2987 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2988 + | };
|
2989 + | // NullInNonSparse match not found, pop from `not_member` into `temp` stack
|
2990 + | (@ $ name: ident, $ contains: ident (NullInNonSparse $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
2991 + | scope! { @ $ name, $ contains (NullInNonSparse $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
2992 + | };
|
2993 + |
|
2994 + | // PrimitiveIntHeader match found, pop from both `member` and `not_member`
|
2995 + | (@ $ name: ident, $ contains: ident (PrimitiveIntHeader $($ member: ident)*) ($($ temp: ident)*) (PrimitiveIntHeader $($ not_member: ident)*)) => {
|
2996 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
2997 + | };
|
2998 + | // PrimitiveIntHeader match not found, pop from `not_member` into `temp` stack
|
2999 + | (@ $ name: ident, $ contains: ident (PrimitiveIntHeader $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
3000 + | scope! { @ $ name, $ contains (PrimitiveIntHeader $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
3001 + | };
|
3002 + |
|
3003 + | // PrimitiveIntOp match found, pop from both `member` and `not_member`
|
3004 + | (@ $ name: ident, $ contains: ident (PrimitiveIntOp $($ member: ident)*) ($($ temp: ident)*) (PrimitiveIntOp $($ not_member: ident)*)) => {
|
3005 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
3006 + | };
|
3007 + | // PrimitiveIntOp match not found, pop from `not_member` into `temp` stack
|
3008 + | (@ $ name: ident, $ contains: ident (PrimitiveIntOp $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
3009 + | scope! { @ $ name, $ contains (PrimitiveIntOp $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
3010 + | };
|
3011 + |
|
3012 + | // QueryPrecedence match found, pop from both `member` and `not_member`
|
3013 + | (@ $ name: ident, $ contains: ident (QueryPrecedence $($ member: ident)*) ($($ temp: ident)*) (QueryPrecedence $($ not_member: ident)*)) => {
|
3014 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
3015 + | };
|
3016 + | // QueryPrecedence match not found, pop from `not_member` into `temp` stack
|
3017 + | (@ $ name: ident, $ contains: ident (QueryPrecedence $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
3018 + | scope! { @ $ name, $ contains (QueryPrecedence $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
3019 + | };
|
3020 + |
|
3021 + | // StatusResponse match found, pop from both `member` and `not_member`
|
3022 + | (@ $ name: ident, $ contains: ident (StatusResponse $($ member: ident)*) ($($ temp: ident)*) (StatusResponse $($ not_member: ident)*)) => {
|
3023 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
3024 + | };
|
3025 + | // StatusResponse match not found, pop from `not_member` into `temp` stack
|
3026 + | (@ $ name: ident, $ contains: ident (StatusResponse $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
3027 + | scope! { @ $ name, $ contains (StatusResponse $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
3028 + | };
|
3029 + |
|
3030 + | // StringPayload match found, pop from both `member` and `not_member`
|
3031 + | (@ $ name: ident, $ contains: ident (StringPayload $($ member: ident)*) ($($ temp: ident)*) (StringPayload $($ not_member: ident)*)) => {
|
3032 + | scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
|
3033 + | };
|
3034 + | // StringPayload match not found, pop from `not_member` into `temp` stack
|
3035 + | (@ $ name: ident, $ contains: ident (StringPayload $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
|
3036 + | scope! { @ $ name, $ contains (StringPayload $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
|
3037 + | };
|
3038 + |
|
3039 + | (
|
3040 + | $(#[$ attrs:meta])*
|
3041 + | $ vis:vis struct $ name:ident {
|
3042 + | includes: [$($ include:ident),*]
|
3043 + | }
|
3044 + | ) => {
|
3045 + | use $ crate::operation_shape::*;
|
3046 + | $ crate::server::scope! {
|
3047 + | $(#[$ attrs])*
|
3048 + | $ vis struct $ name {
|
3049 + | includes: [$($ include),*],
|
3050 + | excludes: []
|
3051 + | }
|
3052 + | }
|
3053 + | scope! { @ $ name, False ($($ include)*) () (CaseInsensitiveErrorOperation EmptyStructWithContentOnWireOp EnumQuery EscapedStringValues HttpQueryParamsOnlyOperation MapWithEnumKeyOp NullInNonSparse PrimitiveIntHeader PrimitiveIntOp QueryPrecedence StatusResponse StringPayload) }
|
3054 + | };
|
3055 + | (
|
3056 + | $(#[$ attrs:meta])*
|
3057 + | $ vis:vis struct $ name:ident {
|
3058 + | excludes: [$($ exclude:ident),*]
|
3059 + | }
|
3060 + | ) => {
|
3061 + | use $ crate::operation_shape::*;
|
3062 + |
|
3063 + | $ crate::server::scope! {
|
3064 + | $(#[$ attrs])*
|
3065 + | $ vis struct $ name {
|
3066 + | includes: [],
|
3067 + | excludes: [$($ exclude),*]
|
3068 + | }
|
3069 + | }
|
3070 + | scope! { @ $ name, True ($($ exclude)*) () (CaseInsensitiveErrorOperation EmptyStructWithContentOnWireOp EnumQuery EscapedStringValues HttpQueryParamsOnlyOperation MapWithEnumKeyOp NullInNonSparse PrimitiveIntHeader PrimitiveIntOp QueryPrecedence StatusResponse StringPayload) }
|
3071 + | };
|
3072 + | }
|