1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// Python handler for operation `HttpQueryParamsOnlyOperation`.
|
3 3 | pub(crate) async fn http_query_params_only_operation(
|
4 4 | input: crate::input::HttpQueryParamsOnlyOperationInput,
|
5 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
5 + | state: ::aws_smithy_legacy_http_server::Extension<
|
6 + | ::aws_smithy_http_server_python::context::PyContext,
|
7 + | >,
|
6 8 | handler: ::aws_smithy_http_server_python::PyHandler,
|
7 9 | ) -> std::result::Result<
|
8 10 | crate::output::HttpQueryParamsOnlyOperationOutput,
|
9 11 | crate::error::HttpQueryParamsOnlyOperationError,
|
10 12 | > {
|
11 13 | // Async block used to run the handler and catch any Python error.
|
12 14 | let result = if handler.is_coroutine {
|
13 15 | ::tracing::trace!(
|
14 16 | name = "http_query_params_only_operation",
|
15 17 | "executing python handler coroutine"
|
16 18 | );
|
17 19 | let result = ::pyo3::Python::with_gil(|py| {
|
18 20 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
19 21 | let coroutine = if handler.args == 1 {
|
20 22 | pyhandler.call1((input,))?
|
21 23 | } else {
|
22 24 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
23 25 | };
|
24 26 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
25 27 | })?;
|
26 28 | result.await.and_then(|r| {
|
27 29 | ::pyo3::Python::with_gil(|py| {
|
28 30 | r.extract::<crate::output::HttpQueryParamsOnlyOperationOutput>(py)
|
29 31 | })
|
30 32 | })
|
31 33 | } else {
|
32 34 | ::tracing::trace!(
|
33 35 | name = "http_query_params_only_operation",
|
34 36 | "executing python handler function"
|
35 37 | );
|
36 38 | ::pyo3::Python::with_gil(|py| {
|
37 39 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
38 40 | let output = if handler.args == 1 {
|
39 41 | pyhandler.call1((input,))?
|
40 42 | } else {
|
41 43 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
42 44 | };
|
43 45 | output.extract::<crate::output::HttpQueryParamsOnlyOperationOutput>()
|
44 46 | })
|
45 47 | };
|
46 48 | // Catch and record a Python traceback.
|
47 49 | result.map_err(|e| {
|
48 50 | let rich_py_err =
|
49 51 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
50 52 | e.clone_ref(py)
|
51 53 | }));
|
52 54 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
53 55 | e.into()
|
54 56 | })
|
55 57 | }
|
56 58 |
|
57 59 | /// Python handler for operation `QueryPrecedence`.
|
58 60 | pub(crate) async fn query_precedence(
|
59 61 | input: crate::input::QueryPrecedenceInput,
|
60 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
62 + | state: ::aws_smithy_legacy_http_server::Extension<
|
63 + | ::aws_smithy_http_server_python::context::PyContext,
|
64 + | >,
|
61 65 | handler: ::aws_smithy_http_server_python::PyHandler,
|
62 66 | ) -> std::result::Result<crate::output::QueryPrecedenceOutput, crate::error::QueryPrecedenceError> {
|
63 67 | // Async block used to run the handler and catch any Python error.
|
64 68 | let result = if handler.is_coroutine {
|
65 69 | ::tracing::trace!(
|
66 70 | name = "query_precedence",
|
67 71 | "executing python handler coroutine"
|
68 72 | );
|
69 73 | let result = ::pyo3::Python::with_gil(|py| {
|
70 74 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
71 75 | let coroutine = if handler.args == 1 {
|
72 76 | pyhandler.call1((input,))?
|
73 77 | } else {
|
74 78 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
75 79 | };
|
76 80 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
77 81 | })?;
|
78 82 | result.await.and_then(|r| {
|
79 83 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::QueryPrecedenceOutput>(py))
|
80 84 | })
|
81 85 | } else {
|
82 86 | ::tracing::trace!(
|
83 87 | name = "query_precedence",
|
84 88 | "executing python handler function"
|
85 89 | );
|
86 90 | ::pyo3::Python::with_gil(|py| {
|
87 91 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
88 92 | let output = if handler.args == 1 {
|
89 93 | pyhandler.call1((input,))?
|
90 94 | } else {
|
91 95 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
92 96 | };
|
93 97 | output.extract::<crate::output::QueryPrecedenceOutput>()
|
94 98 | })
|
95 99 | };
|
96 100 | // Catch and record a Python traceback.
|
97 101 | result.map_err(|e| {
|
98 102 | let rich_py_err =
|
99 103 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
100 104 | e.clone_ref(py)
|
101 105 | }));
|
102 106 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
103 107 | e.into()
|
104 108 | })
|
105 109 | }
|
106 110 |
|
107 111 | /// Python handler for operation `EmptyStructWithContentOnWireOp`.
|
108 112 | pub(crate) async fn empty_struct_with_content_on_wire_op(
|
109 113 | input: crate::input::EmptyStructWithContentOnWireOpInput,
|
110 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
114 + | state: ::aws_smithy_legacy_http_server::Extension<
|
115 + | ::aws_smithy_http_server_python::context::PyContext,
|
116 + | >,
|
111 117 | handler: ::aws_smithy_http_server_python::PyHandler,
|
112 118 | ) -> std::result::Result<
|
113 119 | crate::output::EmptyStructWithContentOnWireOpOutput,
|
114 120 | crate::error::EmptyStructWithContentOnWireOpError,
|
115 121 | > {
|
116 122 | // Async block used to run the handler and catch any Python error.
|
117 123 | let result = if handler.is_coroutine {
|
118 124 | ::tracing::trace!(
|
119 125 | name = "empty_struct_with_content_on_wire_op",
|
120 126 | "executing python handler coroutine"
|
121 127 | );
|
122 128 | let result = ::pyo3::Python::with_gil(|py| {
|
123 129 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
124 130 | let coroutine = if handler.args == 1 {
|
125 131 | pyhandler.call1((input,))?
|
126 132 | } else {
|
127 133 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
128 134 | };
|
129 135 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
130 136 | })?;
|
131 137 | result.await.and_then(|r| {
|
132 138 | ::pyo3::Python::with_gil(|py| {
|
133 139 | r.extract::<crate::output::EmptyStructWithContentOnWireOpOutput>(py)
|
134 140 | })
|
135 141 | })
|
136 142 | } else {
|
137 143 | ::tracing::trace!(
|
138 144 | name = "empty_struct_with_content_on_wire_op",
|
139 145 | "executing python handler function"
|
140 146 | );
|
141 147 | ::pyo3::Python::with_gil(|py| {
|
142 148 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
143 149 | let output = if handler.args == 1 {
|
144 150 | pyhandler.call1((input,))?
|
145 151 | } else {
|
146 152 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
147 153 | };
|
148 154 | output.extract::<crate::output::EmptyStructWithContentOnWireOpOutput>()
|
149 155 | })
|
150 156 | };
|
151 157 | // Catch and record a Python traceback.
|
152 158 | result.map_err(|e| {
|
153 159 | let rich_py_err =
|
154 160 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
155 161 | e.clone_ref(py)
|
156 162 | }));
|
157 163 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
158 164 | e.into()
|
159 165 | })
|
160 166 | }
|
161 167 |
|
162 168 | /// Python handler for operation `CaseInsensitiveErrorOperation`.
|
163 169 | pub(crate) async fn case_insensitive_error_operation(
|
164 170 | input: crate::input::CaseInsensitiveErrorOperationInput,
|
165 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
171 + | state: ::aws_smithy_legacy_http_server::Extension<
|
172 + | ::aws_smithy_http_server_python::context::PyContext,
|
173 + | >,
|
166 174 | handler: ::aws_smithy_http_server_python::PyHandler,
|
167 175 | ) -> std::result::Result<
|
168 176 | crate::output::CaseInsensitiveErrorOperationOutput,
|
169 177 | crate::error::CaseInsensitiveErrorOperationError,
|
170 178 | > {
|
171 179 | // Async block used to run the handler and catch any Python error.
|
172 180 | let result = if handler.is_coroutine {
|
173 181 | ::tracing::trace!(
|
174 182 | name = "case_insensitive_error_operation",
|
175 183 | "executing python handler coroutine"
|
176 184 | );
|
177 185 | let result = ::pyo3::Python::with_gil(|py| {
|
178 186 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
179 187 | let coroutine = if handler.args == 1 {
|
180 188 | pyhandler.call1((input,))?
|
181 189 | } else {
|
182 190 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
183 191 | };
|
184 192 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
185 193 | })?;
|
186 194 | result.await.and_then(|r| {
|
187 195 | ::pyo3::Python::with_gil(|py| {
|
188 196 | r.extract::<crate::output::CaseInsensitiveErrorOperationOutput>(py)
|
189 197 | })
|
190 198 | })
|
191 199 | } else {
|
192 200 | ::tracing::trace!(
|
193 201 | name = "case_insensitive_error_operation",
|
194 202 | "executing python handler function"
|
195 203 | );
|
196 204 | ::pyo3::Python::with_gil(|py| {
|
197 205 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
198 206 | let output = if handler.args == 1 {
|
199 207 | pyhandler.call1((input,))?
|
200 208 | } else {
|
201 209 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
202 210 | };
|
203 211 | output.extract::<crate::output::CaseInsensitiveErrorOperationOutput>()
|
204 212 | })
|
205 213 | };
|
206 214 | // Catch and record a Python traceback.
|
207 215 | result.map_err(|e| {
|
208 216 | let rich_py_err =
|
209 217 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
210 218 | e.clone_ref(py)
|
211 219 | }));
|
212 220 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
213 221 | e.into()
|
214 222 | })
|
215 223 | }
|
216 224 |
|
217 225 | /// Python handler for operation `NullInNonSparse`.
|
218 226 | pub(crate) async fn null_in_non_sparse(
|
219 227 | input: crate::input::NullInNonSparseInput,
|
220 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
228 + | state: ::aws_smithy_legacy_http_server::Extension<
|
229 + | ::aws_smithy_http_server_python::context::PyContext,
|
230 + | >,
|
221 231 | handler: ::aws_smithy_http_server_python::PyHandler,
|
222 232 | ) -> std::result::Result<crate::output::NullInNonSparseOutput, crate::error::NullInNonSparseError> {
|
223 233 | // Async block used to run the handler and catch any Python error.
|
224 234 | let result = if handler.is_coroutine {
|
225 235 | ::tracing::trace!(
|
226 236 | name = "null_in_non_sparse",
|
227 237 | "executing python handler coroutine"
|
228 238 | );
|
229 239 | let result = ::pyo3::Python::with_gil(|py| {
|
230 240 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
231 241 | let coroutine = if handler.args == 1 {
|
232 242 | pyhandler.call1((input,))?
|
233 243 | } else {
|
234 244 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
235 245 | };
|
236 246 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
237 247 | })?;
|
238 248 | result.await.and_then(|r| {
|
239 249 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::NullInNonSparseOutput>(py))
|
240 250 | })
|
241 251 | } else {
|
242 252 | ::tracing::trace!(
|
243 253 | name = "null_in_non_sparse",
|
244 254 | "executing python handler function"
|
245 255 | );
|
246 256 | ::pyo3::Python::with_gil(|py| {
|
247 257 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
248 258 | let output = if handler.args == 1 {
|
249 259 | pyhandler.call1((input,))?
|
250 260 | } else {
|
251 261 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
252 262 | };
|
253 263 | output.extract::<crate::output::NullInNonSparseOutput>()
|
254 264 | })
|
255 265 | };
|
256 266 | // Catch and record a Python traceback.
|
257 267 | result.map_err(|e| {
|
258 268 | let rich_py_err =
|
259 269 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
260 270 | e.clone_ref(py)
|
261 271 | }));
|
262 272 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
263 273 | e.into()
|
264 274 | })
|
265 275 | }
|
266 276 |
|
267 277 | /// Python handler for operation `EscapedStringValues`.
|
268 278 | pub(crate) async fn escaped_string_values(
|
269 279 | input: crate::input::EscapedStringValuesInput,
|
270 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
280 + | state: ::aws_smithy_legacy_http_server::Extension<
|
281 + | ::aws_smithy_http_server_python::context::PyContext,
|
282 + | >,
|
271 283 | handler: ::aws_smithy_http_server_python::PyHandler,
|
272 284 | ) -> std::result::Result<
|
273 285 | crate::output::EscapedStringValuesOutput,
|
274 286 | crate::error::EscapedStringValuesError,
|
275 287 | > {
|
276 288 | // Async block used to run the handler and catch any Python error.
|
277 289 | let result = if handler.is_coroutine {
|
278 290 | ::tracing::trace!(
|
279 291 | name = "escaped_string_values",
|
280 292 | "executing python handler coroutine"
|
281 293 | );
|
282 294 | let result = ::pyo3::Python::with_gil(|py| {
|
283 295 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
284 296 | let coroutine = if handler.args == 1 {
|
285 297 | pyhandler.call1((input,))?
|
286 298 | } else {
|
287 299 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
288 300 | };
|
289 301 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
290 302 | })?;
|
291 303 | result.await.and_then(|r| {
|
292 304 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::EscapedStringValuesOutput>(py))
|
293 305 | })
|
294 306 | } else {
|
295 307 | ::tracing::trace!(
|
296 308 | name = "escaped_string_values",
|
297 309 | "executing python handler function"
|
298 310 | );
|
299 311 | ::pyo3::Python::with_gil(|py| {
|
300 312 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
301 313 | let output = if handler.args == 1 {
|
302 314 | pyhandler.call1((input,))?
|
303 315 | } else {
|
304 316 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
305 317 | };
|
306 318 | output.extract::<crate::output::EscapedStringValuesOutput>()
|
307 319 | })
|
308 320 | };
|
309 321 | // Catch and record a Python traceback.
|
310 322 | result.map_err(|e| {
|
311 323 | let rich_py_err =
|
312 324 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
313 325 | e.clone_ref(py)
|
314 326 | }));
|
315 327 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
316 328 | e.into()
|
317 329 | })
|
318 330 | }
|
319 331 |
|
320 332 | /// Python handler for operation `PrimitiveIntOp`.
|
321 333 | pub(crate) async fn primitive_int_op(
|
322 334 | input: crate::input::PrimitiveIntOpInput,
|
323 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
335 + | state: ::aws_smithy_legacy_http_server::Extension<
|
336 + | ::aws_smithy_http_server_python::context::PyContext,
|
337 + | >,
|
324 338 | handler: ::aws_smithy_http_server_python::PyHandler,
|
325 339 | ) -> std::result::Result<crate::output::PrimitiveIntOpOutput, crate::error::PrimitiveIntOpError> {
|
326 340 | // Async block used to run the handler and catch any Python error.
|
327 341 | let result = if handler.is_coroutine {
|
328 342 | ::tracing::trace!(
|
329 343 | name = "primitive_int_op",
|
330 344 | "executing python handler coroutine"
|
331 345 | );
|
332 346 | let result = ::pyo3::Python::with_gil(|py| {
|
333 347 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
334 348 | let coroutine = if handler.args == 1 {
|
335 349 | pyhandler.call1((input,))?
|
336 350 | } else {
|
337 351 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
338 352 | };
|
339 353 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
340 354 | })?;
|
341 355 | result.await.and_then(|r| {
|
342 356 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::PrimitiveIntOpOutput>(py))
|
343 357 | })
|
344 358 | } else {
|
345 359 | ::tracing::trace!(
|
346 360 | name = "primitive_int_op",
|
347 361 | "executing python handler function"
|
348 362 | );
|
349 363 | ::pyo3::Python::with_gil(|py| {
|
350 364 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
351 365 | let output = if handler.args == 1 {
|
352 366 | pyhandler.call1((input,))?
|
353 367 | } else {
|
354 368 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
355 369 | };
|
356 370 | output.extract::<crate::output::PrimitiveIntOpOutput>()
|
357 371 | })
|
358 372 | };
|
359 373 | // Catch and record a Python traceback.
|
360 374 | result.map_err(|e| {
|
361 375 | let rich_py_err =
|
362 376 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
363 377 | e.clone_ref(py)
|
364 378 | }));
|
365 379 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
366 380 | e.into()
|
367 381 | })
|
368 382 | }
|
369 383 |
|
370 384 | /// Python handler for operation `MapWithEnumKeyOp`.
|
371 385 | pub(crate) async fn map_with_enum_key_op(
|
372 386 | input: crate::input::MapWithEnumKeyOpInput,
|
373 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
387 + | state: ::aws_smithy_legacy_http_server::Extension<
|
388 + | ::aws_smithy_http_server_python::context::PyContext,
|
389 + | >,
|
374 390 | handler: ::aws_smithy_http_server_python::PyHandler,
|
375 391 | ) -> std::result::Result<crate::output::MapWithEnumKeyOpOutput, crate::error::MapWithEnumKeyOpError>
|
376 392 | {
|
377 393 | // Async block used to run the handler and catch any Python error.
|
378 394 | let result = if handler.is_coroutine {
|
379 395 | ::tracing::trace!(
|
380 396 | name = "map_with_enum_key_op",
|
381 397 | "executing python handler coroutine"
|
382 398 | );
|
383 399 | let result = ::pyo3::Python::with_gil(|py| {
|
384 400 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
385 401 | let coroutine = if handler.args == 1 {
|
386 402 | pyhandler.call1((input,))?
|
387 403 | } else {
|
388 404 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
389 405 | };
|
390 406 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
391 407 | })?;
|
392 408 | result.await.and_then(|r| {
|
393 409 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::MapWithEnumKeyOpOutput>(py))
|
394 410 | })
|
395 411 | } else {
|
396 412 | ::tracing::trace!(
|
397 413 | name = "map_with_enum_key_op",
|
398 414 | "executing python handler function"
|
399 415 | );
|
400 416 | ::pyo3::Python::with_gil(|py| {
|
401 417 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
402 418 | let output = if handler.args == 1 {
|
403 419 | pyhandler.call1((input,))?
|
404 420 | } else {
|
405 421 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
406 422 | };
|
407 423 | output.extract::<crate::output::MapWithEnumKeyOpOutput>()
|
408 424 | })
|
409 425 | };
|
410 426 | // Catch and record a Python traceback.
|
411 427 | result.map_err(|e| {
|
412 428 | let rich_py_err =
|
413 429 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
414 430 | e.clone_ref(py)
|
415 431 | }));
|
416 432 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
417 433 | e.into()
|
418 434 | })
|
419 435 | }
|
420 436 |
|
421 437 | /// Python handler for operation `StatusResponse`.
|
422 438 | pub(crate) async fn status_response(
|
423 439 | input: crate::input::StatusResponseInput,
|
424 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
440 + | state: ::aws_smithy_legacy_http_server::Extension<
|
441 + | ::aws_smithy_http_server_python::context::PyContext,
|
442 + | >,
|
425 443 | handler: ::aws_smithy_http_server_python::PyHandler,
|
426 444 | ) -> std::result::Result<crate::output::StatusResponseOutput, crate::error::StatusResponseError> {
|
427 445 | // Async block used to run the handler and catch any Python error.
|
428 446 | let result = if handler.is_coroutine {
|
429 447 | ::tracing::trace!(
|
430 448 | name = "status_response",
|
431 449 | "executing python handler coroutine"
|
432 450 | );
|
433 451 | let result = ::pyo3::Python::with_gil(|py| {
|
434 452 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
435 453 | let coroutine = if handler.args == 1 {
|
436 454 | pyhandler.call1((input,))?
|
437 455 | } else {
|
438 456 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
439 457 | };
|
440 458 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
441 459 | })?;
|
442 460 | result.await.and_then(|r| {
|
443 461 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::StatusResponseOutput>(py))
|
444 462 | })
|
445 463 | } else {
|
446 464 | ::tracing::trace!(
|
447 465 | name = "status_response",
|
448 466 | "executing python handler function"
|
449 467 | );
|
450 468 | ::pyo3::Python::with_gil(|py| {
|
451 469 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
452 470 | let output = if handler.args == 1 {
|
453 471 | pyhandler.call1((input,))?
|
454 472 | } else {
|
455 473 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
456 474 | };
|
457 475 | output.extract::<crate::output::StatusResponseOutput>()
|
458 476 | })
|
459 477 | };
|
460 478 | // Catch and record a Python traceback.
|
461 479 | result.map_err(|e| {
|
462 480 | let rich_py_err =
|
463 481 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
464 482 | e.clone_ref(py)
|
465 483 | }));
|
466 484 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
467 485 | e.into()
|
468 486 | })
|
469 487 | }
|
470 488 |
|
471 489 | /// Python handler for operation `EnumQuery`.
|
472 490 | pub(crate) async fn enum_query(
|
473 491 | input: crate::input::EnumQueryInput,
|
474 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
492 + | state: ::aws_smithy_legacy_http_server::Extension<
|
493 + | ::aws_smithy_http_server_python::context::PyContext,
|
494 + | >,
|
475 495 | handler: ::aws_smithy_http_server_python::PyHandler,
|
476 496 | ) -> std::result::Result<crate::output::EnumQueryOutput, crate::error::EnumQueryError> {
|
477 497 | // Async block used to run the handler and catch any Python error.
|
478 498 | let result = if handler.is_coroutine {
|
479 499 | ::tracing::trace!(name = "enum_query", "executing python handler coroutine");
|
480 500 | let result = ::pyo3::Python::with_gil(|py| {
|
481 501 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
482 502 | let coroutine = if handler.args == 1 {
|
483 503 | pyhandler.call1((input,))?
|
484 504 | } else {
|
485 505 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
486 506 | };
|
487 507 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
488 508 | })?;
|
489 509 | result.await.and_then(|r| {
|
490 510 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::EnumQueryOutput>(py))
|
491 511 | })
|
492 512 | } else {
|
493 513 | ::tracing::trace!(name = "enum_query", "executing python handler function");
|
494 514 | ::pyo3::Python::with_gil(|py| {
|
495 515 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
496 516 | let output = if handler.args == 1 {
|
497 517 | pyhandler.call1((input,))?
|
498 518 | } else {
|
499 519 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
500 520 | };
|
501 521 | output.extract::<crate::output::EnumQueryOutput>()
|
502 522 | })
|
503 523 | };
|
504 524 | // Catch and record a Python traceback.
|
505 525 | result.map_err(|e| {
|
506 526 | let rich_py_err =
|
507 527 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
508 528 | e.clone_ref(py)
|
509 529 | }));
|
510 530 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
511 531 | e.into()
|
512 532 | })
|
513 533 | }
|
514 534 |
|
515 535 | /// Python handler for operation `PrimitiveIntHeader`.
|
516 536 | pub(crate) async fn primitive_int_header(
|
517 537 | input: crate::input::PrimitiveIntHeaderInput,
|
518 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
538 + | state: ::aws_smithy_legacy_http_server::Extension<
|
539 + | ::aws_smithy_http_server_python::context::PyContext,
|
540 + | >,
|
519 541 | handler: ::aws_smithy_http_server_python::PyHandler,
|
520 542 | ) -> std::result::Result<
|
521 543 | crate::output::PrimitiveIntHeaderOutput,
|
522 544 | crate::error::PrimitiveIntHeaderError,
|
523 545 | > {
|
524 546 | // Async block used to run the handler and catch any Python error.
|
525 547 | let result = if handler.is_coroutine {
|
526 548 | ::tracing::trace!(
|
527 549 | name = "primitive_int_header",
|
528 550 | "executing python handler coroutine"
|
529 551 | );
|
530 552 | let result = ::pyo3::Python::with_gil(|py| {
|
531 553 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
532 554 | let coroutine = if handler.args == 1 {
|
533 555 | pyhandler.call1((input,))?
|
534 556 | } else {
|
535 557 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
536 558 | };
|
537 559 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
538 560 | })?;
|
539 561 | result.await.and_then(|r| {
|
540 562 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::PrimitiveIntHeaderOutput>(py))
|
541 563 | })
|
542 564 | } else {
|
543 565 | ::tracing::trace!(
|
544 566 | name = "primitive_int_header",
|
545 567 | "executing python handler function"
|
546 568 | );
|
547 569 | ::pyo3::Python::with_gil(|py| {
|
548 570 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
549 571 | let output = if handler.args == 1 {
|
550 572 | pyhandler.call1((input,))?
|
551 573 | } else {
|
552 574 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
553 575 | };
|
554 576 | output.extract::<crate::output::PrimitiveIntHeaderOutput>()
|
555 577 | })
|
556 578 | };
|
557 579 | // Catch and record a Python traceback.
|
558 580 | result.map_err(|e| {
|
559 581 | let rich_py_err =
|
560 582 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
561 583 | e.clone_ref(py)
|
562 584 | }));
|
563 585 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
564 586 | e.into()
|
565 587 | })
|
566 588 | }
|
567 589 |
|
568 590 | /// Python handler for operation `StringPayload`.
|
569 591 | pub(crate) async fn string_payload(
|
570 592 | input: crate::input::StringPayloadInput,
|
571 - | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
593 + | state: ::aws_smithy_legacy_http_server::Extension<
|
594 + | ::aws_smithy_http_server_python::context::PyContext,
|
595 + | >,
|
572 596 | handler: ::aws_smithy_http_server_python::PyHandler,
|
573 597 | ) -> std::result::Result<crate::output::StringPayloadOutput, crate::error::StringPayloadError> {
|
574 598 | // Async block used to run the handler and catch any Python error.
|
575 599 | let result = if handler.is_coroutine {
|
576 600 | ::tracing::trace!(
|
577 601 | name = "string_payload",
|
578 602 | "executing python handler coroutine"
|
579 603 | );
|
580 604 | let result = ::pyo3::Python::with_gil(|py| {
|
581 605 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|