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