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