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