1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
2 3 | /// Python handler for operation `OperationWithNestedStructure`.
|
3 4 | pub(crate) async fn operation_with_nested_structure(
|
4 5 | input: crate::input::OperationWithNestedStructureInput,
|
5 6 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
6 7 | handler: ::aws_smithy_http_server_python::PyHandler,
|
7 8 | ) -> std::result::Result<
|
8 9 | crate::output::OperationWithNestedStructureOutput,
|
9 10 | crate::error::OperationWithNestedStructureError,
|
10 11 | > {
|
11 12 | // Async block used to run the handler and catch any Python error.
|
12 13 | let result = if handler.is_coroutine {
|
13 14 | ::tracing::trace!(
|
14 15 | name = "operation_with_nested_structure",
|
15 16 | "executing python handler coroutine"
|
16 17 | );
|
17 18 | let result = ::pyo3::Python::with_gil(|py| {
|
18 19 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
19 20 | let coroutine = if handler.args == 1 {
|
20 21 | pyhandler.call1((input,))?
|
21 22 | } else {
|
22 23 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
23 24 | };
|
24 25 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
25 26 | })?;
|
26 27 | result.await.and_then(|r| {
|
27 28 | ::pyo3::Python::with_gil(|py| {
|
28 29 | r.extract::<crate::output::OperationWithNestedStructureOutput>(py)
|
29 30 | })
|
30 31 | })
|
31 32 | } else {
|
32 33 | ::tracing::trace!(
|
33 34 | name = "operation_with_nested_structure",
|
34 35 | "executing python handler function"
|
35 36 | );
|
36 37 | ::pyo3::Python::with_gil(|py| {
|
37 38 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
38 39 | let output = if handler.args == 1 {
|
39 40 | pyhandler.call1((input,))?
|
40 41 | } else {
|
41 42 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
42 43 | };
|
43 44 | output.extract::<crate::output::OperationWithNestedStructureOutput>()
|
44 45 | })
|
45 46 | };
|
46 47 | // Catch and record a Python traceback.
|
47 48 | result.map_err(|e| {
|
48 49 | let rich_py_err =
|
49 50 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
50 51 | e.clone_ref(py)
|
51 52 | }));
|
52 53 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
53 54 | e.into()
|
54 55 | })
|
55 56 | }
|
56 57 |
|
58 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
57 59 | /// Python handler for operation `OperationWithRequiredMembers`.
|
58 60 | pub(crate) async fn operation_with_required_members(
|
59 61 | input: crate::input::OperationWithRequiredMembersInput,
|
60 62 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
61 63 | handler: ::aws_smithy_http_server_python::PyHandler,
|
62 64 | ) -> std::result::Result<
|
63 65 | crate::output::OperationWithRequiredMembersOutput,
|
64 66 | crate::error::OperationWithRequiredMembersError,
|
65 67 | > {
|
66 68 | // Async block used to run the handler and catch any Python error.
|
67 69 | let result = if handler.is_coroutine {
|
68 70 | ::tracing::trace!(
|
69 71 | name = "operation_with_required_members",
|
70 72 | "executing python handler coroutine"
|
71 73 | );
|
72 74 | let result = ::pyo3::Python::with_gil(|py| {
|
73 75 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
74 76 | let coroutine = if handler.args == 1 {
|
75 77 | pyhandler.call1((input,))?
|
76 78 | } else {
|
77 79 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
78 80 | };
|
79 81 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
80 82 | })?;
|
81 83 | result.await.and_then(|r| {
|
82 84 | ::pyo3::Python::with_gil(|py| {
|
83 85 | r.extract::<crate::output::OperationWithRequiredMembersOutput>(py)
|
84 86 | })
|
85 87 | })
|
86 88 | } else {
|
87 89 | ::tracing::trace!(
|
88 90 | name = "operation_with_required_members",
|
89 91 | "executing python handler function"
|
90 92 | );
|
91 93 | ::pyo3::Python::with_gil(|py| {
|
92 94 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
93 95 | let output = if handler.args == 1 {
|
94 96 | pyhandler.call1((input,))?
|
95 97 | } else {
|
96 98 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
97 99 | };
|
98 100 | output.extract::<crate::output::OperationWithRequiredMembersOutput>()
|
99 101 | })
|
100 102 | };
|
101 103 | // Catch and record a Python traceback.
|
102 104 | result.map_err(|e| {
|
103 105 | let rich_py_err =
|
104 106 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
105 107 | e.clone_ref(py)
|
106 108 | }));
|
107 109 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
108 110 | e.into()
|
109 111 | })
|
110 112 | }
|
111 113 |
|
114 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
112 115 | /// Python handler for operation `OperationWithDefaults`.
|
113 116 | pub(crate) async fn operation_with_defaults(
|
114 117 | input: crate::input::OperationWithDefaultsInput,
|
115 118 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
116 119 | handler: ::aws_smithy_http_server_python::PyHandler,
|
117 120 | ) -> std::result::Result<
|
118 121 | crate::output::OperationWithDefaultsOutput,
|
119 122 | crate::error::OperationWithDefaultsError,
|
120 123 | > {
|
121 124 | // Async block used to run the handler and catch any Python error.
|
122 125 | let result = if handler.is_coroutine {
|
123 126 | ::tracing::trace!(
|
124 127 | name = "operation_with_defaults",
|
125 128 | "executing python handler coroutine"
|
126 129 | );
|
127 130 | let result = ::pyo3::Python::with_gil(|py| {
|
128 131 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
129 132 | let coroutine = if handler.args == 1 {
|
130 133 | pyhandler.call1((input,))?
|
131 134 | } else {
|
132 135 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
133 136 | };
|
134 137 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
135 138 | })?;
|
136 139 | result.await.and_then(|r| {
|
137 140 | ::pyo3::Python::with_gil(|py| {
|
138 141 | r.extract::<crate::output::OperationWithDefaultsOutput>(py)
|
139 142 | })
|
140 143 | })
|
141 144 | } else {
|
142 145 | ::tracing::trace!(
|
143 146 | name = "operation_with_defaults",
|
144 147 | "executing python handler function"
|
145 148 | );
|
146 149 | ::pyo3::Python::with_gil(|py| {
|
147 150 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
148 151 | let output = if handler.args == 1 {
|
149 152 | pyhandler.call1((input,))?
|
150 153 | } else {
|
151 154 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
152 155 | };
|
153 156 | output.extract::<crate::output::OperationWithDefaultsOutput>()
|
154 157 | })
|
155 158 | };
|
156 159 | // Catch and record a Python traceback.
|
157 160 | result.map_err(|e| {
|
158 161 | let rich_py_err =
|
159 162 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
160 163 | e.clone_ref(py)
|
161 164 | }));
|
162 165 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
163 166 | e.into()
|
164 167 | })
|
165 168 | }
|
166 169 |
|
170 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
167 171 | /// Python handler for operation `ContentTypeParameters`.
|
168 172 | pub(crate) async fn content_type_parameters(
|
169 173 | input: crate::input::ContentTypeParametersInput,
|
170 174 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
171 175 | handler: ::aws_smithy_http_server_python::PyHandler,
|
172 176 | ) -> std::result::Result<
|
173 177 | crate::output::ContentTypeParametersOutput,
|
174 178 | crate::error::ContentTypeParametersError,
|
175 179 | > {
|
176 180 | // Async block used to run the handler and catch any Python error.
|
177 181 | let result = if handler.is_coroutine {
|
178 182 | ::tracing::trace!(
|
179 183 | name = "content_type_parameters",
|
180 184 | "executing python handler coroutine"
|
181 185 | );
|
182 186 | let result = ::pyo3::Python::with_gil(|py| {
|
183 187 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
184 188 | let coroutine = if handler.args == 1 {
|
185 189 | pyhandler.call1((input,))?
|
186 190 | } else {
|
187 191 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
188 192 | };
|
189 193 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
190 194 | })?;
|
191 195 | result.await.and_then(|r| {
|
192 196 | ::pyo3::Python::with_gil(|py| {
|
193 197 | r.extract::<crate::output::ContentTypeParametersOutput>(py)
|
194 198 | })
|
195 199 | })
|
196 200 | } else {
|
197 201 | ::tracing::trace!(
|
198 202 | name = "content_type_parameters",
|
199 203 | "executing python handler function"
|
200 204 | );
|
201 205 | ::pyo3::Python::with_gil(|py| {
|
202 206 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
203 207 | let output = if handler.args == 1 {
|
204 208 | pyhandler.call1((input,))?
|
205 209 | } else {
|
206 210 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
207 211 | };
|
208 212 | output.extract::<crate::output::ContentTypeParametersOutput>()
|
209 213 | })
|
210 214 | };
|
211 215 | // Catch and record a Python traceback.
|
212 216 | result.map_err(|e| {
|
213 217 | let rich_py_err =
|
214 218 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
215 219 | e.clone_ref(py)
|
216 220 | }));
|
217 221 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
218 222 | e.into()
|
219 223 | })
|
220 224 | }
|
221 225 |
|
226 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
222 227 | /// Python handler for operation `PutWithContentEncoding`.
|
223 228 | pub(crate) async fn put_with_content_encoding(
|
224 229 | input: crate::input::PutWithContentEncodingInput,
|
225 230 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
226 231 | handler: ::aws_smithy_http_server_python::PyHandler,
|
227 232 | ) -> std::result::Result<
|
228 233 | crate::output::PutWithContentEncodingOutput,
|
229 234 | crate::error::PutWithContentEncodingError,
|
230 235 | > {
|
231 236 | // Async block used to run the handler and catch any Python error.
|
232 237 | let result = if handler.is_coroutine {
|
233 238 | ::tracing::trace!(
|
234 239 | name = "put_with_content_encoding",
|
235 240 | "executing python handler coroutine"
|
236 241 | );
|
237 242 | let result = ::pyo3::Python::with_gil(|py| {
|
238 243 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
239 244 | let coroutine = if handler.args == 1 {
|
240 245 | pyhandler.call1((input,))?
|
241 246 | } else {
|
242 247 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
243 248 | };
|
244 249 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
245 250 | })?;
|
246 251 | result.await.and_then(|r| {
|
247 252 | ::pyo3::Python::with_gil(|py| {
|
248 253 | r.extract::<crate::output::PutWithContentEncodingOutput>(py)
|
249 254 | })
|
250 255 | })
|
251 256 | } else {
|
252 257 | ::tracing::trace!(
|
253 258 | name = "put_with_content_encoding",
|
254 259 | "executing python handler function"
|
255 260 | );
|
256 261 | ::pyo3::Python::with_gil(|py| {
|
257 262 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
258 263 | let output = if handler.args == 1 {
|
259 264 | pyhandler.call1((input,))?
|
260 265 | } else {
|
261 266 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
262 267 | };
|
263 268 | output.extract::<crate::output::PutWithContentEncodingOutput>()
|
264 269 | })
|
265 270 | };
|
266 271 | // Catch and record a Python traceback.
|
267 272 | result.map_err(|e| {
|
268 273 | let rich_py_err =
|
269 274 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
270 275 | e.clone_ref(py)
|
271 276 | }));
|
272 277 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
273 278 | e.into()
|
274 279 | })
|
275 280 | }
|
276 281 |
|
282 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
277 283 | /// Python handler for operation `HostWithPathOperation`.
|
278 284 | pub(crate) async fn host_with_path_operation(
|
279 285 | input: crate::input::HostWithPathOperationInput,
|
280 286 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
281 287 | handler: ::aws_smithy_http_server_python::PyHandler,
|
282 288 | ) -> std::result::Result<
|
283 289 | crate::output::HostWithPathOperationOutput,
|
284 290 | crate::error::HostWithPathOperationError,
|
285 291 | > {
|
286 292 | // Async block used to run the handler and catch any Python error.
|
287 293 | let result = if handler.is_coroutine {
|
288 294 | ::tracing::trace!(
|
289 295 | name = "host_with_path_operation",
|
290 296 | "executing python handler coroutine"
|
291 297 | );
|
292 298 | let result = ::pyo3::Python::with_gil(|py| {
|
293 299 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
294 300 | let coroutine = if handler.args == 1 {
|
295 301 | pyhandler.call1((input,))?
|
296 302 | } else {
|
297 303 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
298 304 | };
|
299 305 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
300 306 | })?;
|
301 307 | result.await.and_then(|r| {
|
302 308 | ::pyo3::Python::with_gil(|py| {
|
303 309 | r.extract::<crate::output::HostWithPathOperationOutput>(py)
|
304 310 | })
|
305 311 | })
|
306 312 | } else {
|
307 313 | ::tracing::trace!(
|
308 314 | name = "host_with_path_operation",
|
309 315 | "executing python handler function"
|
310 316 | );
|
311 317 | ::pyo3::Python::with_gil(|py| {
|
312 318 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
313 319 | let output = if handler.args == 1 {
|
314 320 | pyhandler.call1((input,))?
|
315 321 | } else {
|
316 322 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
317 323 | };
|
318 324 | output.extract::<crate::output::HostWithPathOperationOutput>()
|
319 325 | })
|
320 326 | };
|
321 327 | // Catch and record a Python traceback.
|
322 328 | result.map_err(|e| {
|
323 329 | let rich_py_err =
|
324 330 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
325 331 | e.clone_ref(py)
|
326 332 | }));
|
327 333 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
328 334 | e.into()
|
329 335 | })
|
330 336 | }
|
331 337 |
|
338 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
332 339 | /// Python handler for operation `EndpointWithHostLabelOperation`.
|
333 340 | pub(crate) async fn endpoint_with_host_label_operation(
|
334 341 | input: crate::input::EndpointWithHostLabelOperationInput,
|
335 342 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
336 343 | handler: ::aws_smithy_http_server_python::PyHandler,
|
337 344 | ) -> std::result::Result<
|
338 345 | crate::output::EndpointWithHostLabelOperationOutput,
|
339 346 | crate::error::EndpointWithHostLabelOperationError,
|
340 347 | > {
|
341 348 | // Async block used to run the handler and catch any Python error.
|
342 349 | let result = if handler.is_coroutine {
|
343 350 | ::tracing::trace!(
|
344 351 | name = "endpoint_with_host_label_operation",
|
345 352 | "executing python handler coroutine"
|
346 353 | );
|
347 354 | let result = ::pyo3::Python::with_gil(|py| {
|
348 355 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
349 356 | let coroutine = if handler.args == 1 {
|
350 357 | pyhandler.call1((input,))?
|
351 358 | } else {
|
352 359 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
353 360 | };
|
354 361 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
355 362 | })?;
|
356 363 | result.await.and_then(|r| {
|
357 364 | ::pyo3::Python::with_gil(|py| {
|
358 365 | r.extract::<crate::output::EndpointWithHostLabelOperationOutput>(py)
|
359 366 | })
|
360 367 | })
|
361 368 | } else {
|
362 369 | ::tracing::trace!(
|
363 370 | name = "endpoint_with_host_label_operation",
|
364 371 | "executing python handler function"
|
365 372 | );
|
366 373 | ::pyo3::Python::with_gil(|py| {
|
367 374 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
368 375 | let output = if handler.args == 1 {
|
369 376 | pyhandler.call1((input,))?
|
370 377 | } else {
|
371 378 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
372 379 | };
|
373 380 | output.extract::<crate::output::EndpointWithHostLabelOperationOutput>()
|
374 381 | })
|
375 382 | };
|
376 383 | // Catch and record a Python traceback.
|
377 384 | result.map_err(|e| {
|
378 385 | let rich_py_err =
|
379 386 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
380 387 | e.clone_ref(py)
|
381 388 | }));
|
382 389 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
383 390 | e.into()
|
384 391 | })
|
385 392 | }
|
386 393 |
|
394 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
387 395 | /// Python handler for operation `EndpointOperation`.
|
388 396 | pub(crate) async fn endpoint_operation(
|
389 397 | input: crate::input::EndpointOperationInput,
|
390 398 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
391 399 | handler: ::aws_smithy_http_server_python::PyHandler,
|
392 400 | ) -> std::result::Result<crate::output::EndpointOperationOutput, crate::error::EndpointOperationError>
|
393 401 | {
|
394 402 | // Async block used to run the handler and catch any Python error.
|
395 403 | let result = if handler.is_coroutine {
|
396 404 | ::tracing::trace!(
|
397 405 | name = "endpoint_operation",
|
398 406 | "executing python handler coroutine"
|
399 407 | );
|
400 408 | let result = ::pyo3::Python::with_gil(|py| {
|
401 409 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
402 410 | let coroutine = if handler.args == 1 {
|
403 411 | pyhandler.call1((input,))?
|
404 412 | } else {
|
405 413 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
406 414 | };
|
407 415 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
408 416 | })?;
|
409 417 | result.await.and_then(|r| {
|
410 418 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::EndpointOperationOutput>(py))
|
411 419 | })
|
412 420 | } else {
|
413 421 | ::tracing::trace!(
|
414 422 | name = "endpoint_operation",
|
415 423 | "executing python handler function"
|
416 424 | );
|
417 425 | ::pyo3::Python::with_gil(|py| {
|
418 426 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
419 427 | let output = if handler.args == 1 {
|
420 428 | pyhandler.call1((input,))?
|
421 429 | } else {
|
422 430 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
423 431 | };
|
424 432 | output.extract::<crate::output::EndpointOperationOutput>()
|
425 433 | })
|
426 434 | };
|
427 435 | // Catch and record a Python traceback.
|
428 436 | result.map_err(|e| {
|
429 437 | let rich_py_err =
|
430 438 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
431 439 | e.clone_ref(py)
|
432 440 | }));
|
433 441 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
434 442 | e.into()
|
435 443 | })
|
436 444 | }
|
437 445 |
|
446 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
438 447 | /// Python handler for operation `JsonUnions`.
|
439 448 | pub(crate) async fn json_unions(
|
440 449 | input: crate::input::JsonUnionsInput,
|
441 450 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
442 451 | handler: ::aws_smithy_http_server_python::PyHandler,
|
443 452 | ) -> std::result::Result<crate::output::JsonUnionsOutput, crate::error::JsonUnionsError> {
|
444 453 | // Async block used to run the handler and catch any Python error.
|
445 454 | let result = if handler.is_coroutine {
|
446 455 | ::tracing::trace!(name = "json_unions", "executing python handler coroutine");
|
447 456 | let result = ::pyo3::Python::with_gil(|py| {
|
448 457 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
449 458 | let coroutine = if handler.args == 1 {
|
450 459 | pyhandler.call1((input,))?
|
451 460 | } else {
|
452 461 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
453 462 | };
|
454 463 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
455 464 | })?;
|
456 465 | result.await.and_then(|r| {
|
457 466 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::JsonUnionsOutput>(py))
|
458 467 | })
|
459 468 | } else {
|
460 469 | ::tracing::trace!(name = "json_unions", "executing python handler function");
|
461 470 | ::pyo3::Python::with_gil(|py| {
|
462 471 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
463 472 | let output = if handler.args == 1 {
|
464 473 | pyhandler.call1((input,))?
|
465 474 | } else {
|
466 475 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
467 476 | };
|
468 477 | output.extract::<crate::output::JsonUnionsOutput>()
|
469 478 | })
|
470 479 | };
|
471 480 | // Catch and record a Python traceback.
|
472 481 | result.map_err(|e| {
|
473 482 | let rich_py_err =
|
474 483 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
475 484 | e.clone_ref(py)
|
476 485 | }));
|
477 486 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
478 487 | e.into()
|
479 488 | })
|
480 489 | }
|
481 490 |
|
491 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
482 492 | /// Python handler for operation `GreetingWithErrors`.
|
483 493 | pub(crate) async fn greeting_with_errors(
|
484 494 | input: crate::input::GreetingWithErrorsInput,
|
485 495 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
486 496 | handler: ::aws_smithy_http_server_python::PyHandler,
|
487 497 | ) -> std::result::Result<
|
488 498 | crate::output::GreetingWithErrorsOutput,
|
489 499 | crate::error::GreetingWithErrorsError,
|
490 500 | > {
|
491 501 | // Async block used to run the handler and catch any Python error.
|
492 502 | let result = if handler.is_coroutine {
|
493 503 | ::tracing::trace!(
|
494 504 | name = "greeting_with_errors",
|
495 505 | "executing python handler coroutine"
|
496 506 | );
|
497 507 | let result = ::pyo3::Python::with_gil(|py| {
|
498 508 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
499 509 | let coroutine = if handler.args == 1 {
|
500 510 | pyhandler.call1((input,))?
|
501 511 | } else {
|
502 512 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
503 513 | };
|
504 514 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
505 515 | })?;
|
506 516 | result.await.and_then(|r| {
|
507 517 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::GreetingWithErrorsOutput>(py))
|
508 518 | })
|
509 519 | } else {
|
510 520 | ::tracing::trace!(
|
511 521 | name = "greeting_with_errors",
|
512 522 | "executing python handler function"
|
513 523 | );
|
514 524 | ::pyo3::Python::with_gil(|py| {
|
515 525 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
516 526 | let output = if handler.args == 1 {
|
517 527 | pyhandler.call1((input,))?
|
518 528 | } else {
|
519 529 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
520 530 | };
|
521 531 | output.extract::<crate::output::GreetingWithErrorsOutput>()
|
522 532 | })
|
523 533 | };
|
524 534 | // Catch and record a Python traceback.
|
525 535 | result.map_err(|e| {
|
526 536 | let rich_py_err =
|
527 537 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
528 538 | e.clone_ref(py)
|
529 539 | }));
|
530 540 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
531 541 | e.into()
|
532 542 | })
|
533 543 | }
|
534 544 |
|
545 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
535 546 | /// Python handler for operation `SimpleScalarProperties`.
|
536 547 | pub(crate) async fn simple_scalar_properties(
|
537 548 | input: crate::input::SimpleScalarPropertiesInput,
|
538 549 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
539 550 | handler: ::aws_smithy_http_server_python::PyHandler,
|
540 551 | ) -> std::result::Result<
|
541 552 | crate::output::SimpleScalarPropertiesOutput,
|
542 553 | crate::error::SimpleScalarPropertiesError,
|
543 554 | > {
|
544 555 | // Async block used to run the handler and catch any Python error.
|
545 556 | let result = if handler.is_coroutine {
|
546 557 | ::tracing::trace!(
|
547 558 | name = "simple_scalar_properties",
|
548 559 | "executing python handler coroutine"
|
549 560 | );
|
550 561 | let result = ::pyo3::Python::with_gil(|py| {
|
551 562 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
552 563 | let coroutine = if handler.args == 1 {
|
553 564 | pyhandler.call1((input,))?
|
554 565 | } else {
|
555 566 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
556 567 | };
|
557 568 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
558 569 | })?;
|
559 570 | result.await.and_then(|r| {
|
560 571 | ::pyo3::Python::with_gil(|py| {
|
561 572 | r.extract::<crate::output::SimpleScalarPropertiesOutput>(py)
|
562 573 | })
|
563 574 | })
|
564 575 | } else {
|
565 576 | ::tracing::trace!(
|
566 577 | name = "simple_scalar_properties",
|
567 578 | "executing python handler function"
|
568 579 | );
|
569 580 | ::pyo3::Python::with_gil(|py| {
|
570 581 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
571 582 | let output = if handler.args == 1 {
|
572 583 | pyhandler.call1((input,))?
|
573 584 | } else {
|
574 585 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
575 586 | };
|
576 587 | output.extract::<crate::output::SimpleScalarPropertiesOutput>()
|
577 588 | })
|
578 589 | };
|
579 590 | // Catch and record a Python traceback.
|
580 591 | result.map_err(|e| {
|
581 592 | let rich_py_err =
|
582 593 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
583 594 | e.clone_ref(py)
|
584 595 | }));
|
585 596 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
586 597 | e.into()
|
587 598 | })
|
588 599 | }
|
589 600 |
|
601 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
590 602 | /// Python handler for operation `EmptyInputAndEmptyOutput`.
|
591 603 | pub(crate) async fn empty_input_and_empty_output(
|
592 604 | input: crate::input::EmptyInputAndEmptyOutputInput,
|
593 605 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
594 606 | handler: ::aws_smithy_http_server_python::PyHandler,
|
595 607 | ) -> std::result::Result<
|
596 608 | crate::output::EmptyInputAndEmptyOutputOutput,
|
597 609 | crate::error::EmptyInputAndEmptyOutputError,
|
598 610 | > {
|
599 611 | // Async block used to run the handler and catch any Python error.
|
600 612 | let result = if handler.is_coroutine {
|
601 613 | ::tracing::trace!(
|
602 614 | name = "empty_input_and_empty_output",
|
603 615 | "executing python handler coroutine"
|
604 616 | );
|
605 617 | let result = ::pyo3::Python::with_gil(|py| {
|
606 618 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
607 619 | let coroutine = if handler.args == 1 {
|
608 620 | pyhandler.call1((input,))?
|
609 621 | } else {
|
610 622 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
611 623 | };
|
612 624 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
613 625 | })?;
|
614 626 | result.await.and_then(|r| {
|
615 627 | ::pyo3::Python::with_gil(|py| {
|
616 628 | r.extract::<crate::output::EmptyInputAndEmptyOutputOutput>(py)
|
617 629 | })
|
618 630 | })
|
619 631 | } else {
|
620 632 | ::tracing::trace!(
|
621 633 | name = "empty_input_and_empty_output",
|
622 634 | "executing python handler function"
|
623 635 | );
|
624 636 | ::pyo3::Python::with_gil(|py| {
|
625 637 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
626 638 | let output = if handler.args == 1 {
|
627 639 | pyhandler.call1((input,))?
|
628 640 | } else {
|
629 641 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
630 642 | };
|
631 643 | output.extract::<crate::output::EmptyInputAndEmptyOutputOutput>()
|
632 644 | })
|
633 645 | };
|
634 646 | // Catch and record a Python traceback.
|
635 647 | result.map_err(|e| {
|
636 648 | let rich_py_err =
|
637 649 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
638 650 | e.clone_ref(py)
|
639 651 | }));
|
640 652 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
641 653 | e.into()
|
642 654 | })
|
643 655 | }
|
644 656 |
|
657 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
645 658 | /// Python handler for operation `NoInputAndOutput`.
|
646 659 | pub(crate) async fn no_input_and_output(
|
647 660 | input: crate::input::NoInputAndOutputInput,
|
648 661 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
649 662 | handler: ::aws_smithy_http_server_python::PyHandler,
|
650 663 | ) -> std::result::Result<crate::output::NoInputAndOutputOutput, crate::error::NoInputAndOutputError>
|
651 664 | {
|
652 665 | // Async block used to run the handler and catch any Python error.
|
653 666 | let result = if handler.is_coroutine {
|
654 667 | ::tracing::trace!(
|
655 668 | name = "no_input_and_output",
|
656 669 | "executing python handler coroutine"
|
657 670 | );
|
658 671 | let result = ::pyo3::Python::with_gil(|py| {
|
659 672 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
660 673 | let coroutine = if handler.args == 1 {
|
661 674 | pyhandler.call1((input,))?
|
662 675 | } else {
|
663 676 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
664 677 | };
|
665 678 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
666 679 | })?;
|
667 680 | result.await.and_then(|r| {
|
668 681 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::NoInputAndOutputOutput>(py))
|
669 682 | })
|
670 683 | } else {
|
671 684 | ::tracing::trace!(
|
672 685 | name = "no_input_and_output",
|
673 686 | "executing python handler function"
|
674 687 | );
|
675 688 | ::pyo3::Python::with_gil(|py| {
|
676 689 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
677 690 | let output = if handler.args == 1 {
|
678 691 | pyhandler.call1((input,))?
|
679 692 | } else {
|
680 693 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
681 694 | };
|
682 695 | output.extract::<crate::output::NoInputAndOutputOutput>()
|
683 696 | })
|
684 697 | };
|
685 698 | // Catch and record a Python traceback.
|
686 699 | result.map_err(|e| {
|
687 700 | let rich_py_err =
|
688 701 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
689 702 | e.clone_ref(py)
|
690 703 | }));
|
691 704 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
692 705 | e.into()
|
693 706 | })
|
694 707 | }
|
695 708 |
|
709 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
696 710 | /// Python handler for operation `NoInputAndNoOutput`.
|
697 711 | pub(crate) async fn no_input_and_no_output(
|
698 712 | input: crate::input::NoInputAndNoOutputInput,
|
699 713 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
700 714 | handler: ::aws_smithy_http_server_python::PyHandler,
|
701 715 | ) -> std::result::Result<
|
702 716 | crate::output::NoInputAndNoOutputOutput,
|
703 717 | crate::error::NoInputAndNoOutputError,
|
704 718 | > {
|
705 719 | // Async block used to run the handler and catch any Python error.
|