1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// The service builder for [`UniqueItemsService`].
|
3 3 | ///
|
4 4 | /// Constructed via [`UniqueItemsService::builder`].
|
5 5 | pub struct UniqueItemsServiceBuilder<Body, L, HttpPl, ModelPl> {
|
6 - | malformed_unique_items: Option<::aws_smithy_http_server::routing::Route<Body>>,
|
6 + | malformed_unique_items: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
7 7 | layer: L,
|
8 8 | http_plugin: HttpPl,
|
9 9 | model_plugin: ModelPl,
|
10 10 | }
|
11 11 |
|
12 12 | impl<Body, L, HttpPl, ModelPl> UniqueItemsServiceBuilder<Body, L, HttpPl, ModelPl> {
|
13 13 | /// Sets the [`MalformedUniqueItems`](crate::operation_shape::MalformedUniqueItems) operation.
|
14 14 | ///
|
15 - | /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
|
16 - | /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
|
15 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
16 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
17 17 | ///
|
18 18 | /// # Example
|
19 19 | ///
|
20 20 | /// ```no_run
|
21 21 | /// use unique_items::{UniqueItemsService, UniqueItemsServiceConfig};
|
22 22 | ///
|
23 23 | /// use unique_items::{input, output, error};
|
24 24 | ///
|
25 25 | /// async fn handler(input: input::MalformedUniqueItemsInput) -> Result<output::MalformedUniqueItemsOutput, error::MalformedUniqueItemsError> {
|
26 26 | /// todo!()
|
27 27 | /// }
|
28 28 | ///
|
29 29 | /// let config = UniqueItemsServiceConfig::builder().build();
|
30 30 | /// let app = UniqueItemsService::builder(config)
|
31 31 | /// .malformed_unique_items(handler)
|
32 32 | /// /* Set other handlers */
|
33 33 | /// .build()
|
34 34 | /// .unwrap();
|
35 - | /// # let app: UniqueItemsService<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::rest::router::RestRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::rest_json_1::RestJson1>> = app;
|
35 + | /// # let app: UniqueItemsService<::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;
|
36 36 | /// ```
|
37 37 | ///
|
38 38 | pub fn malformed_unique_items<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
|
39 39 | where
|
40 - | HandlerType: ::aws_smithy_http_server::operation::Handler<crate::operation_shape::MalformedUniqueItems, HandlerExtractors>,
|
40 + | HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::MalformedUniqueItems, HandlerExtractors>,
|
41 41 |
|
42 - | ModelPl: ::aws_smithy_http_server::plugin::Plugin<
|
42 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
43 43 | UniqueItemsService<L>,
|
44 44 | crate::operation_shape::MalformedUniqueItems,
|
45 - | ::aws_smithy_http_server::operation::IntoService<crate::operation_shape::MalformedUniqueItems, HandlerType>
|
45 + | ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::MalformedUniqueItems, HandlerType>
|
46 46 | >,
|
47 - | ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
|
47 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
48 48 | UniqueItemsService<L>,
|
49 49 | crate::operation_shape::MalformedUniqueItems,
|
50 50 | ModelPl::Output
|
51 51 | >,
|
52 - | HttpPl: ::aws_smithy_http_server::plugin::Plugin<
|
52 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
53 53 | UniqueItemsService<L>,
|
54 54 | crate::operation_shape::MalformedUniqueItems,
|
55 55 | <
|
56 - | ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
57 - | as ::aws_smithy_http_server::plugin::Plugin<
|
56 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
57 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
58 58 | UniqueItemsService<L>,
|
59 59 | crate::operation_shape::MalformedUniqueItems,
|
60 60 | ModelPl::Output
|
61 61 | >
|
62 62 | >::Output
|
63 63 | >,
|
64 64 |
|
65 - | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
65 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
66 66 | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
67 67 |
|
68 68 | {
|
69 - | use ::aws_smithy_http_server::operation::OperationShapeExt;
|
70 - | use ::aws_smithy_http_server::plugin::Plugin;
|
69 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
70 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
71 71 | let svc = crate::operation_shape::MalformedUniqueItems::from_handler(handler);
|
72 72 | let svc = self.model_plugin.apply(svc);
|
73 - | let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
74 - | .apply(svc);
|
73 + | let svc =
|
74 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
75 + | .apply(svc);
|
75 76 | let svc = self.http_plugin.apply(svc);
|
76 77 | self.malformed_unique_items_custom(svc)
|
77 78 | }
|
78 79 |
|
79 80 | /// Sets the [`MalformedUniqueItems`](crate::operation_shape::MalformedUniqueItems) operation.
|
80 81 | ///
|
81 - | /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
|
82 - | /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
|
82 + | /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
|
83 + | /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
|
83 84 | ///
|
84 85 | /// # Example
|
85 86 | ///
|
86 87 | /// ```no_run
|
87 88 | /// use unique_items::{UniqueItemsService, UniqueItemsServiceConfig};
|
88 89 | ///
|
89 90 | /// use unique_items::{input, output, error};
|
90 91 | ///
|
91 92 | /// async fn handler(input: input::MalformedUniqueItemsInput) -> Result<output::MalformedUniqueItemsOutput, error::MalformedUniqueItemsError> {
|
92 93 | /// todo!()
|
93 94 | /// }
|
94 95 | ///
|
95 96 | /// let config = UniqueItemsServiceConfig::builder().build();
|
96 97 | /// let svc = ::tower::util::service_fn(handler);
|
97 98 | /// let app = UniqueItemsService::builder(config)
|
98 99 | /// .malformed_unique_items_service(svc)
|
99 100 | /// /* Set other handlers */
|
100 101 | /// .build()
|
101 102 | /// .unwrap();
|
102 - | /// # let app: UniqueItemsService<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::rest::router::RestRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::rest_json_1::RestJson1>> = app;
|
103 + | /// # let app: UniqueItemsService<::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;
|
103 104 | /// ```
|
104 105 | ///
|
105 106 | pub fn malformed_unique_items_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
|
106 107 | where
|
107 - | S: ::aws_smithy_http_server::operation::OperationService<crate::operation_shape::MalformedUniqueItems, ServiceExtractors>,
|
108 + | S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::MalformedUniqueItems, ServiceExtractors>,
|
108 109 |
|
109 - | ModelPl: ::aws_smithy_http_server::plugin::Plugin<
|
110 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
110 111 | UniqueItemsService<L>,
|
111 112 | crate::operation_shape::MalformedUniqueItems,
|
112 - | ::aws_smithy_http_server::operation::Normalize<crate::operation_shape::MalformedUniqueItems, S>
|
113 + | ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::MalformedUniqueItems, S>
|
113 114 | >,
|
114 - | ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
|
115 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
115 116 | UniqueItemsService<L>,
|
116 117 | crate::operation_shape::MalformedUniqueItems,
|
117 118 | ModelPl::Output
|
118 119 | >,
|
119 - | HttpPl: ::aws_smithy_http_server::plugin::Plugin<
|
120 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
|
120 121 | UniqueItemsService<L>,
|
121 122 | crate::operation_shape::MalformedUniqueItems,
|
122 123 | <
|
123 - | ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
124 - | as ::aws_smithy_http_server::plugin::Plugin<
|
124 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
|
125 + | as ::aws_smithy_legacy_http_server::plugin::Plugin<
|
125 126 | UniqueItemsService<L>,
|
126 127 | crate::operation_shape::MalformedUniqueItems,
|
127 128 | ModelPl::Output
|
128 129 | >
|
129 130 | >::Output
|
130 131 | >,
|
131 132 |
|
132 - | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
133 + | HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
|
133 134 | <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
|
134 135 |
|
135 136 | {
|
136 - | use ::aws_smithy_http_server::operation::OperationShapeExt;
|
137 - | use ::aws_smithy_http_server::plugin::Plugin;
|
137 + | use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
|
138 + | use ::aws_smithy_legacy_http_server::plugin::Plugin;
|
138 139 | let svc = crate::operation_shape::MalformedUniqueItems::from_service(service);
|
139 140 | let svc = self.model_plugin.apply(svc);
|
140 - | let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
141 - | .apply(svc);
|
141 + | let svc =
|
142 + | ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
|
143 + | .apply(svc);
|
142 144 | let svc = self.http_plugin.apply(svc);
|
143 145 | self.malformed_unique_items_custom(svc)
|
144 146 | }
|
145 147 |
|
146 148 | /// Sets the [`MalformedUniqueItems`](crate::operation_shape::MalformedUniqueItems) to a custom [`Service`](tower::Service).
|
147 149 | /// not constrained by the Smithy contract.
|
148 150 | fn malformed_unique_items_custom<S>(mut self, svc: S) -> Self
|
149 151 | where
|
150 152 | S: ::tower::Service<
|
151 153 | ::http::Request<Body>,
|
152 - | Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
|
154 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
153 155 | Error = ::std::convert::Infallible,
|
154 156 | > + Clone
|
155 157 | + Send
|
156 158 | + 'static,
|
157 159 | S::Future: Send + 'static,
|
158 160 | {
|
159 - | self.malformed_unique_items = Some(::aws_smithy_http_server::routing::Route::new(svc));
|
161 + | self.malformed_unique_items =
|
162 + | Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
|
160 163 | self
|
161 164 | }
|
162 165 | }
|
163 166 |
|
164 167 | impl<Body, L, HttpPl, ModelPl> UniqueItemsServiceBuilder<Body, L, HttpPl, ModelPl> {
|
165 168 | /// Constructs a [`UniqueItemsService`] from the arguments provided to the builder.
|
166 169 | ///
|
167 170 | /// Forgetting to register a handler for one or more operations will result in an error.
|
168 171 | ///
|
169 172 | /// Check out [`UniqueItemsServiceBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
|
170 173 | /// unspecified route is requested.
|
171 174 | pub fn build(
|
172 175 | self,
|
173 176 | ) -> ::std::result::Result<
|
174 177 | UniqueItemsService<
|
175 - | ::aws_smithy_http_server::routing::RoutingService<
|
176 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
177 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
178 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
179 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
180 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
178 181 | >,
|
179 182 | >,
|
180 183 | MissingOperationsError,
|
181 184 | >
|
182 185 | where
|
183 - | L: ::tower::Layer<::aws_smithy_http_server::routing::Route<Body>>,
|
186 + | L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
|
184 187 | {
|
185 188 | let router = {
|
186 - | use ::aws_smithy_http_server::operation::OperationShape;
|
189 + | use ::aws_smithy_legacy_http_server::operation::OperationShape;
|
187 190 | let mut missing_operation_names = std::collections::HashMap::new();
|
188 191 | if self.malformed_unique_items.is_none() {
|
189 192 | missing_operation_names.insert(
|
190 193 | crate::operation_shape::MalformedUniqueItems::ID,
|
191 194 | ".malformed_unique_items()",
|
192 195 | );
|
193 196 | }
|
194 197 | if !missing_operation_names.is_empty() {
|
195 198 | return Err(MissingOperationsError {
|
196 199 | operation_names2setter_methods: missing_operation_names,
|
197 200 | });
|
198 201 | }
|
199 202 | 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";
|
200 203 |
|
201 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter::from_iter([(
|
204 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([(
|
202 205 | request_specs::malformed_unique_items(),
|
203 206 | self.malformed_unique_items.expect(unexpected_error_msg),
|
204 207 | )])
|
205 208 | };
|
206 - | let svc = ::aws_smithy_http_server::routing::RoutingService::new(router);
|
209 + | let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
|
207 210 | let svc = svc.map(|s| s.layer(self.layer));
|
208 211 | Ok(UniqueItemsService { svc })
|
209 212 | }
|
210 213 |
|
211 214 | /// Constructs a [`UniqueItemsService`] from the arguments provided to the builder.
|
212 215 | /// Operations without a handler default to returning 500 Internal Server Error to the caller.
|
213 216 | ///
|
214 217 | /// Check out [`UniqueItemsServiceBuilder::build`] if you'd prefer the builder to fail if one or more operations do
|
215 218 | /// not have a registered handler.
|
216 219 | pub fn build_unchecked(self) -> UniqueItemsService<L::Service>
|
217 220 | where
|
218 221 | Body: Send + 'static,
|
219 222 | L: ::tower::Layer<
|
220 - | ::aws_smithy_http_server::routing::RoutingService<
|
221 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<
|
222 - | ::aws_smithy_http_server::routing::Route<Body>,
|
223 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
224 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
225 + | ::aws_smithy_legacy_http_server::routing::Route<Body>,
|
223 226 | >,
|
224 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
227 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
225 228 | >,
|
226 229 | >,
|
227 230 | {
|
228 - | let router = ::aws_smithy_http_server::protocol::rest::router::RestRouter::from_iter([(
|
229 - | request_specs::malformed_unique_items(),
|
230 - | self.malformed_unique_items.unwrap_or_else(|| {
|
231 - | let svc = ::aws_smithy_http_server::operation::MissingFailure::<
|
232 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
233 - | >::default();
|
234 - | ::aws_smithy_http_server::routing::Route::new(svc)
|
235 - | }),
|
236 - | )]);
|
231 + | let router =
|
232 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([(
|
233 + | request_specs::malformed_unique_items(),
|
234 + | self.malformed_unique_items.unwrap_or_else(|| {
|
235 + | let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
|
236 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
237 + | >::default();
|
238 + | ::aws_smithy_legacy_http_server::routing::Route::new(svc)
|
239 + | }),
|
240 + | )]);
|
237 241 | let svc = self
|
238 242 | .layer
|
239 - | .layer(::aws_smithy_http_server::routing::RoutingService::new(
|
240 - | router,
|
241 - | ));
|
243 + | .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
|
242 244 | UniqueItemsService { svc }
|
243 245 | }
|
244 246 | }
|
245 247 |
|
246 248 | /// The error encountered when calling the [`UniqueItemsServiceBuilder::build`] method if one or more operation handlers are not
|
247 249 | /// specified.
|
248 250 | #[derive(Debug)]
|
249 251 | pub struct MissingOperationsError {
|
250 252 | operation_names2setter_methods:
|
251 - | std::collections::HashMap<::aws_smithy_http_server::shape_id::ShapeId, &'static str>,
|
253 + | std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
|
252 254 | }
|
253 255 |
|
254 256 | impl std::fmt::Display for MissingOperationsError {
|
255 257 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
256 258 | write!(
|
257 259 | f,
|
258 260 | "You must specify a handler for all operations attached to `UniqueItemsService`.\n\
|
259 261 | We are missing handlers for the following operations:\n",
|
260 262 | )?;
|
261 263 | for operation_name in self.operation_names2setter_methods.keys() {
|
262 264 | writeln!(f, "- {}", operation_name.absolute())?;
|
263 265 | }
|
264 266 |
|
265 267 | writeln!(f, "\nUse the dedicated methods on `UniqueItemsServiceBuilder` to register the missing handlers:")?;
|
266 268 | for setter_name in self.operation_names2setter_methods.values() {
|
267 269 | writeln!(f, "- {}", setter_name)?;
|
268 270 | }
|
269 271 | Ok(())
|
270 272 | }
|
271 273 | }
|
272 274 |
|
273 275 | impl std::error::Error for MissingOperationsError {}
|
274 276 |
|
275 277 | mod request_specs {
|
276 278 | pub(super) fn malformed_unique_items(
|
277 - | ) -> ::aws_smithy_http_server::routing::request_spec::RequestSpec {
|
278 - | ::aws_smithy_http_server::routing::request_spec::RequestSpec::new(
|
279 + | ) -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec {
|
280 + | ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
|
279 281 | ::http::Method::POST,
|
280 - | ::aws_smithy_http_server::routing::request_spec::UriSpec::new(
|
281 - | ::aws_smithy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
282 - | ::aws_smithy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
283 - | ::aws_smithy_http_server::routing::request_spec::PathSegment::Literal(String::from("MalformedUniqueItems")),
|
282 + | ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
|
283 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
|
284 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
|
285 + | ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("MalformedUniqueItems")),
|
284 286 | ]),
|
285 - | ::aws_smithy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
287 + | ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
|
286 288 | ])
|
287 289 | )
|
288 290 | ),
|
289 291 | )
|
290 292 | }
|
291 293 | }
|
292 294 |
|
293 295 | #[allow(missing_docs)] // documentation missing in model
|
294 296 | ///
|
295 297 | /// See the [root](crate) documentation for more information.
|
296 298 | #[derive(Clone)]
|
297 299 | pub struct UniqueItemsService<
|
298 - | S = ::aws_smithy_http_server::routing::RoutingService<
|
299 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<
|
300 - | ::aws_smithy_http_server::routing::Route<::aws_smithy_http_server::body::BoxBody>,
|
300 + | S = ::aws_smithy_legacy_http_server::routing::RoutingService<
|
301 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
302 + | ::aws_smithy_legacy_http_server::routing::Route<
|
303 + | ::aws_smithy_legacy_http_server::body::BoxBody,
|
304 + | >,
|
301 305 | >,
|
302 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
306 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
303 307 | >,
|
304 308 | > {
|
305 309 | // This is the router wrapped by layers.
|
306 310 | svc: S,
|
307 311 | }
|
308 312 |
|
309 313 | impl UniqueItemsService<()> {
|
310 314 | /// Constructs a builder for [`UniqueItemsService`].
|
311 315 | /// You must specify a configuration object holding any plugins and layers that should be applied
|
312 316 | /// to the operations in this service.
|
313 317 | pub fn builder<
|
314 318 | Body,
|
315 319 | L,
|
316 - | HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
|
317 - | ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
|
320 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
321 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
318 322 | >(
|
319 323 | config: UniqueItemsServiceConfig<L, HttpPl, ModelPl>,
|
320 324 | ) -> UniqueItemsServiceBuilder<Body, L, HttpPl, ModelPl> {
|
321 325 | UniqueItemsServiceBuilder {
|
322 326 | malformed_unique_items: None,
|
323 327 | layer: config.layers,
|
324 328 | http_plugin: config.http_plugins,
|
325 329 | model_plugin: config.model_plugins,
|
326 330 | }
|
327 331 | }
|
328 332 |
|
329 333 | /// Constructs a builder for [`UniqueItemsService`].
|
330 334 | /// You must specify what plugins should be applied to the operations in this service.
|
331 335 | ///
|
332 336 | /// Use [`UniqueItemsService::builder_without_plugins`] if you don't need to apply plugins.
|
333 337 | ///
|
334 - | /// Check out [`HttpPlugins`](::aws_smithy_http_server::plugin::HttpPlugins) and
|
335 - | /// [`ModelPlugins`](::aws_smithy_http_server::plugin::ModelPlugins) if you need to apply
|
338 + | /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
|
339 + | /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
|
336 340 | /// multiple plugins.
|
337 341 | #[deprecated(
|
338 342 | since = "0.57.0",
|
339 343 | note = "please use the `builder` constructor and register plugins on the `UniqueItemsServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
340 344 | )]
|
341 345 | pub fn builder_with_plugins<
|
342 346 | Body,
|
343 - | HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
|
344 - | ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
|
347 + | HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
|
348 + | ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
|
345 349 | >(
|
346 350 | http_plugin: HttpPl,
|
347 351 | model_plugin: ModelPl,
|
348 352 | ) -> UniqueItemsServiceBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
|
349 353 | UniqueItemsServiceBuilder {
|
350 354 | malformed_unique_items: None,
|
351 355 | layer: ::tower::layer::util::Identity::new(),
|
352 356 | http_plugin,
|
353 357 | model_plugin,
|
354 358 | }
|
355 359 | }
|
356 360 |
|
357 361 | /// Constructs a builder for [`UniqueItemsService`].
|
358 362 | ///
|
359 363 | /// Use [`UniqueItemsService::builder_with_plugins`] if you need to specify plugins.
|
360 364 | #[deprecated(
|
361 365 | since = "0.57.0",
|
362 366 | note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
363 367 | )]
|
364 368 | pub fn builder_without_plugins<Body>() -> UniqueItemsServiceBuilder<
|
365 369 | Body,
|
366 370 | ::tower::layer::util::Identity,
|
367 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
368 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
371 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
372 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
369 373 | > {
|
370 374 | Self::builder_with_plugins(
|
371 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
372 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
375 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
376 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
373 377 | )
|
374 378 | }
|
375 379 | }
|
376 380 |
|
377 381 | impl<S> UniqueItemsService<S> {
|
378 382 | /// Converts [`UniqueItemsService`] into a [`MakeService`](tower::make::MakeService).
|
379 - | pub fn into_make_service(self) -> ::aws_smithy_http_server::routing::IntoMakeService<Self> {
|
380 - | ::aws_smithy_http_server::routing::IntoMakeService::new(self)
|
383 + | pub fn into_make_service(
|
384 + | self,
|
385 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
|
386 + | ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
|
381 387 | }
|
382 388 |
|
383 - | /// Converts [`UniqueItemsService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_http_server::request::connect_info::ConnectInfo).
|
389 + | /// Converts [`UniqueItemsService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
|
384 390 | pub fn into_make_service_with_connect_info<C>(
|
385 391 | self,
|
386 - | ) -> ::aws_smithy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
387 - | ::aws_smithy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
392 + | ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
|
393 + | ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
|
388 394 | }
|
389 395 | }
|
390 396 |
|
391 397 | impl<S>
|
392 398 | UniqueItemsService<
|
393 - | ::aws_smithy_http_server::routing::RoutingService<
|
394 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<S>,
|
395 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
399 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
400 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<S>,
|
401 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
396 402 | >,
|
397 403 | >
|
398 404 | {
|
399 405 | /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
|
400 406 | #[deprecated(
|
401 407 | since = "0.57.0",
|
402 408 | note = "please add layers to the `UniqueItemsServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
|
403 409 | )]
|
404 410 | pub fn layer<L>(
|
405 411 | self,
|
406 412 | layer: &L,
|
407 413 | ) -> UniqueItemsService<
|
408 - | ::aws_smithy_http_server::routing::RoutingService<
|
409 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
410 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
414 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
415 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
|
416 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
411 417 | >,
|
412 418 | >
|
413 419 | where
|
414 420 | L: ::tower::Layer<S>,
|
415 421 | {
|
416 422 | UniqueItemsService {
|
417 423 | svc: self.svc.map(|s| s.layer(layer)),
|
418 424 | }
|
419 425 | }
|
420 426 |
|
421 - | /// Applies [`Route::new`](::aws_smithy_http_server::routing::Route::new) to all routes.
|
427 + | /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
|
422 428 | ///
|
423 429 | /// This has the effect of erasing all types accumulated via layers.
|
424 430 | pub fn boxed<B>(
|
425 431 | self,
|
426 432 | ) -> UniqueItemsService<
|
427 - | ::aws_smithy_http_server::routing::RoutingService<
|
428 - | ::aws_smithy_http_server::protocol::rest::router::RestRouter<
|
429 - | ::aws_smithy_http_server::routing::Route<B>,
|
433 + | ::aws_smithy_legacy_http_server::routing::RoutingService<
|
434 + | ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
|
435 + | ::aws_smithy_legacy_http_server::routing::Route<B>,
|
430 436 | >,
|
431 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
437 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
432 438 | >,
|
433 439 | >
|
434 440 | where
|
435 441 | S: ::tower::Service<
|
436 442 | ::http::Request<B>,
|
437 - | Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
|
443 + | Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
|
438 444 | Error = std::convert::Infallible,
|
439 445 | >,
|
440 446 | S: Clone + Send + 'static,
|
441 447 | S::Future: Send + 'static,
|
442 448 | {
|
443 449 | self.layer(&::tower::layer::layer_fn(
|
444 - | ::aws_smithy_http_server::routing::Route::new,
|
450 + | ::aws_smithy_legacy_http_server::routing::Route::new,
|
445 451 | ))
|
446 452 | }
|
447 453 | }
|
448 454 |
|
449 455 | impl<S, R> ::tower::Service<R> for UniqueItemsService<S>
|
450 456 | where
|
451 457 | S: ::tower::Service<R>,
|
452 458 | {
|
453 459 | type Response = S::Response;
|
454 460 | type Error = S::Error;
|
455 461 | type Future = S::Future;
|
456 462 |
|
457 463 | fn poll_ready(
|
458 464 | &mut self,
|
459 465 | cx: &mut std::task::Context,
|
460 466 | ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
|
461 467 | self.svc.poll_ready(cx)
|
462 468 | }
|
463 469 |
|
464 470 | fn call(&mut self, request: R) -> Self::Future {
|
465 471 | self.svc.call(request)
|
466 472 | }
|
467 473 | }
|
468 474 |
|
469 475 | /// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in UniqueItemsService.
|
470 476 | #[allow(clippy::enum_variant_names)]
|
471 477 | #[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
472 478 | pub enum Operation {
|
473 479 | MalformedUniqueItems,
|
474 480 | }
|
475 481 |
|
476 482 | impl Operation {
|
477 - | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_http_server::shape_id::ShapeId).
|
478 - | pub fn shape_id(&self) -> ::aws_smithy_http_server::shape_id::ShapeId {
|
483 + | /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
|
484 + | pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
|
479 485 | match self {
|
480 - | Operation::MalformedUniqueItems => ::aws_smithy_http_server::shape_id::ShapeId::new(
|
481 - | "com.amazonaws.constraints#MalformedUniqueItems",
|
482 - | "com.amazonaws.constraints",
|
483 - | "MalformedUniqueItems",
|
484 - | ),
|
486 + | Operation::MalformedUniqueItems => {
|
487 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
488 + | "com.amazonaws.constraints#MalformedUniqueItems",
|
489 + | "com.amazonaws.constraints",
|
490 + | "MalformedUniqueItems",
|
491 + | )
|
492 + | }
|
485 493 | }
|
486 494 | }
|
487 495 | }
|
488 496 | impl<L>
|
489 - | ::aws_smithy_http_server::service::ContainsOperation<
|
497 + | ::aws_smithy_legacy_http_server::service::ContainsOperation<
|
490 498 | crate::operation_shape::MalformedUniqueItems,
|
491 499 | > for UniqueItemsService<L>
|
492 500 | {
|
493 501 | const VALUE: Operation = Operation::MalformedUniqueItems;
|
494 502 | }
|
495 503 |
|
496 - | impl<S> ::aws_smithy_http_server::service::ServiceShape for UniqueItemsService<S> {
|
497 - | const ID: ::aws_smithy_http_server::shape_id::ShapeId =
|
498 - | ::aws_smithy_http_server::shape_id::ShapeId::new(
|
504 + | impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for UniqueItemsService<S> {
|
505 + | const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
|
506 + | ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
|
499 507 | "com.amazonaws.constraints#UniqueItemsService",
|
500 508 | "com.amazonaws.constraints",
|
501 509 | "UniqueItemsService",
|
502 510 | );
|
503 511 |
|
504 512 | const VERSION: Option<&'static str> = Some("");
|
505 513 |
|
506 - | type Protocol = ::aws_smithy_http_server::protocol::rest_json_1::RestJson1;
|
514 + | type Protocol = ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1;
|
507 515 |
|
508 516 | type Operations = Operation;
|
509 517 | }
|
510 518 | /// Configuration for the [`UniqueItemsService`]. This is the central place where to register and
|
511 519 | /// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
|
512 520 | ///
|
513 521 | /// ```rust,no_run
|
514 522 | /// # use unique_items::UniqueItemsServiceConfig;
|
515 - | /// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
|
523 + | /// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
|
516 524 | /// # use ::tower::layer::util::Identity;
|
517 525 | /// # let authentication_plugin = IdentityPlugin;
|
518 526 | /// # let authorization_plugin = IdentityPlugin;
|
519 527 | /// # let server_request_id_provider_layer = Identity::new();
|
520 528 | /// let config = UniqueItemsServiceConfig::builder()
|
521 529 | /// // Layers get executed first...
|
522 530 | /// .layer(server_request_id_provider_layer)
|
523 531 | /// // ...then HTTP plugins...
|
524 532 | /// .http_plugin(authentication_plugin)
|
525 533 | /// // ...and right after deserialization, model plugins.
|
526 534 | /// .model_plugin(authorization_plugin)
|
527 535 | /// .build();
|
528 536 | /// ```
|
529 537 | ///
|
530 538 | /// See the [`plugin`] system for details.
|
531 539 | ///
|
532 - | /// [`plugin`]: ::aws_smithy_http_server::plugin
|
540 + | /// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
|
533 541 | #[derive(::std::fmt::Debug)]
|
534 542 | pub struct UniqueItemsServiceConfig<L, H, M> {
|
535 543 | layers: L,
|
536 544 | http_plugins: H,
|
537 545 | model_plugins: M,
|
538 546 | }
|
539 547 |
|
540 548 | impl UniqueItemsServiceConfig<(), (), ()> {
|
541 549 | /// Returns a builder to construct the configuration.
|
542 550 | pub fn builder() -> UniqueItemsServiceConfigBuilder<
|
543 551 | ::tower::layer::util::Identity,
|
544 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
545 - | ::aws_smithy_http_server::plugin::IdentityPlugin,
|
552 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
553 + | ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
546 554 | > {
|
547 555 | UniqueItemsServiceConfigBuilder {
|
548 556 | layers: ::tower::layer::util::Identity::new(),
|
549 - | http_plugins: ::aws_smithy_http_server::plugin::IdentityPlugin,
|
550 - | model_plugins: ::aws_smithy_http_server::plugin::IdentityPlugin,
|
557 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
558 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
|
551 559 | }
|
552 560 | }
|
553 561 | }
|
554 562 |
|
555 563 | /// Builder returned by [`UniqueItemsServiceConfig::builder()`].
|
556 564 | #[derive(::std::fmt::Debug)]
|
557 565 | pub struct UniqueItemsServiceConfigBuilder<L, H, M> {
|
558 566 | pub(crate) layers: L,
|
559 567 | pub(crate) http_plugins: H,
|
560 568 | pub(crate) model_plugins: M,
|
561 569 | }
|
562 570 |
|
563 571 | impl<L, H, M> UniqueItemsServiceConfigBuilder<L, H, M> {
|
564 572 | /// Add a [`::tower::Layer`] to the service.
|
565 573 | pub fn layer<NewLayer>(
|
566 574 | self,
|
567 575 | layer: NewLayer,
|
568 576 | ) -> UniqueItemsServiceConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
|
569 577 | UniqueItemsServiceConfigBuilder {
|
570 578 | layers: ::tower::layer::util::Stack::new(layer, self.layers),
|
571 579 | http_plugins: self.http_plugins,
|
572 580 | model_plugins: self.model_plugins,
|
573 581 | }
|
574 582 | }
|
575 583 |
|
576 584 | /// Add a HTTP [plugin] to the service.
|
577 585 | ///
|
578 - | /// [plugin]: ::aws_smithy_http_server::plugin
|
586 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
579 587 | // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
|
580 588 | // errors get _substantially_ better if the user makes a mistake.
|
581 - | pub fn http_plugin<NewPlugin: ::aws_smithy_http_server::plugin::HttpMarker>(
|
589 + | pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
|
582 590 | self,
|
583 591 | http_plugin: NewPlugin,
|
584 592 | ) -> UniqueItemsServiceConfigBuilder<
|
585 593 | L,
|
586 - | ::aws_smithy_http_server::plugin::PluginStack<NewPlugin, H>,
|
594 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
|
587 595 | M,
|
588 596 | > {
|
589 597 | UniqueItemsServiceConfigBuilder {
|
590 598 | layers: self.layers,
|
591 - | http_plugins: ::aws_smithy_http_server::plugin::PluginStack::new(
|
599 + | http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
592 600 | http_plugin,
|
593 601 | self.http_plugins,
|
594 602 | ),
|
595 603 | model_plugins: self.model_plugins,
|
596 604 | }
|
597 605 | }
|
598 606 |
|
599 607 | /// Add a model [plugin] to the service.
|
600 608 | ///
|
601 - | /// [plugin]: ::aws_smithy_http_server::plugin
|
609 + | /// [plugin]: ::aws_smithy_legacy_http_server::plugin
|
602 610 | // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
|
603 611 | // errors get _substantially_ better if the user makes a mistake.
|
604 - | pub fn model_plugin<NewPlugin: ::aws_smithy_http_server::plugin::ModelMarker>(
|
612 + | pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
|
605 613 | self,
|
606 614 | model_plugin: NewPlugin,
|
607 615 | ) -> UniqueItemsServiceConfigBuilder<
|
608 616 | L,
|
609 617 | H,
|
610 - | ::aws_smithy_http_server::plugin::PluginStack<NewPlugin, M>,
|
618 + | ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
|
611 619 | > {
|
612 620 | UniqueItemsServiceConfigBuilder {
|
613 621 | layers: self.layers,
|
614 622 | http_plugins: self.http_plugins,
|
615 - | model_plugins: ::aws_smithy_http_server::plugin::PluginStack::new(
|
623 + | model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
|
616 624 | model_plugin,
|
617 625 | self.model_plugins,
|
618 626 | ),
|
619 627 | }
|
620 628 | }
|
621 629 |
|
622 630 | /// Build the configuration.
|
623 631 | pub fn build(self) -> super::UniqueItemsServiceConfig<L, H, M> {
|
624 632 | super::UniqueItemsServiceConfig {
|
625 633 | layers: self.layers,
|