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 `GetStorage`.
|
3 4 | pub(crate) async fn get_storage(
|
4 5 | input: crate::input::GetStorageInput,
|
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<crate::output::GetStorageOutput, crate::error::GetStorageError> {
|
8 9 | // Async block used to run the handler and catch any Python error.
|
9 10 | let result = if handler.is_coroutine {
|
10 11 | ::tracing::trace!(name = "get_storage", "executing python handler coroutine");
|
11 12 | let result = ::pyo3::Python::with_gil(|py| {
|
12 13 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
13 14 | let coroutine = if handler.args == 1 {
|
14 15 | pyhandler.call1((input,))?
|
15 16 | } else {
|
16 17 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
17 18 | };
|
18 19 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
19 20 | })?;
|
20 21 | result.await.and_then(|r| {
|
21 22 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::GetStorageOutput>(py))
|
22 23 | })
|
23 24 | } else {
|
24 25 | ::tracing::trace!(name = "get_storage", "executing python handler function");
|
25 26 | ::pyo3::Python::with_gil(|py| {
|
26 27 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
27 28 | let output = if handler.args == 1 {
|
28 29 | pyhandler.call1((input,))?
|
29 30 | } else {
|
30 31 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
31 32 | };
|
32 33 | output.extract::<crate::output::GetStorageOutput>()
|
33 34 | })
|
34 35 | };
|
35 36 | // Catch and record a Python traceback.
|
36 37 | result.map_err(|e| {
|
37 38 | let rich_py_err =
|
38 39 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
39 40 | e.clone_ref(py)
|
40 41 | }));
|
41 42 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
42 43 | e.into()
|
43 44 | })
|
44 45 | }
|
45 46 |
|
47 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
46 48 | /// Python handler for operation `GetPokemonSpecies`.
|
47 49 | pub(crate) async fn get_pokemon_species(
|
48 50 | input: crate::input::GetPokemonSpeciesInput,
|
49 51 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
50 52 | handler: ::aws_smithy_http_server_python::PyHandler,
|
51 53 | ) -> std::result::Result<crate::output::GetPokemonSpeciesOutput, crate::error::GetPokemonSpeciesError>
|
52 54 | {
|
53 55 | // Async block used to run the handler and catch any Python error.
|
54 56 | let result = if handler.is_coroutine {
|
55 57 | ::tracing::trace!(
|
56 58 | name = "get_pokemon_species",
|
57 59 | "executing python handler coroutine"
|
58 60 | );
|
59 61 | let result = ::pyo3::Python::with_gil(|py| {
|
60 62 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
61 63 | let coroutine = if handler.args == 1 {
|
62 64 | pyhandler.call1((input,))?
|
63 65 | } else {
|
64 66 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
65 67 | };
|
66 68 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
67 69 | })?;
|
68 70 | result.await.and_then(|r| {
|
69 71 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::GetPokemonSpeciesOutput>(py))
|
70 72 | })
|
71 73 | } else {
|
72 74 | ::tracing::trace!(
|
73 75 | name = "get_pokemon_species",
|
74 76 | "executing python handler function"
|
75 77 | );
|
76 78 | ::pyo3::Python::with_gil(|py| {
|
77 79 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
78 80 | let output = if handler.args == 1 {
|
79 81 | pyhandler.call1((input,))?
|
80 82 | } else {
|
81 83 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
82 84 | };
|
83 85 | output.extract::<crate::output::GetPokemonSpeciesOutput>()
|
84 86 | })
|
85 87 | };
|
86 88 | // Catch and record a Python traceback.
|
87 89 | result.map_err(|e| {
|
88 90 | let rich_py_err =
|
89 91 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
90 92 | e.clone_ref(py)
|
91 93 | }));
|
92 94 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
93 95 | e.into()
|
94 96 | })
|
95 97 | }
|
96 98 |
|
99 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
97 100 | /// Python handler for operation `StreamPokemonRadio`.
|
98 101 | pub(crate) async fn stream_pokemon_radio(
|
99 102 | input: crate::input::StreamPokemonRadioInput,
|
100 103 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
101 104 | handler: ::aws_smithy_http_server_python::PyHandler,
|
102 105 | ) -> std::result::Result<
|
103 106 | crate::output::StreamPokemonRadioOutput,
|
104 107 | crate::error::StreamPokemonRadioError,
|
105 108 | > {
|
106 109 | // Async block used to run the handler and catch any Python error.
|
107 110 | let result = if handler.is_coroutine {
|
108 111 | ::tracing::trace!(
|
109 112 | name = "stream_pokemon_radio",
|
110 113 | "executing python handler coroutine"
|
111 114 | );
|
112 115 | let result = ::pyo3::Python::with_gil(|py| {
|
113 116 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
114 117 | let coroutine = if handler.args == 1 {
|
115 118 | pyhandler.call1((input,))?
|
116 119 | } else {
|
117 120 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
118 121 | };
|
119 122 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
120 123 | })?;
|
121 124 | result.await.and_then(|r| {
|
122 125 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::StreamPokemonRadioOutput>(py))
|
123 126 | })
|
124 127 | } else {
|
125 128 | ::tracing::trace!(
|
126 129 | name = "stream_pokemon_radio",
|
127 130 | "executing python handler function"
|
128 131 | );
|
129 132 | ::pyo3::Python::with_gil(|py| {
|
130 133 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
131 134 | let output = if handler.args == 1 {
|
132 135 | pyhandler.call1((input,))?
|
133 136 | } else {
|
134 137 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
135 138 | };
|
136 139 | output.extract::<crate::output::StreamPokemonRadioOutput>()
|
137 140 | })
|
138 141 | };
|
139 142 | // Catch and record a Python traceback.
|
140 143 | result.map_err(|e| {
|
141 144 | let rich_py_err =
|
142 145 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
143 146 | e.clone_ref(py)
|
144 147 | }));
|
145 148 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
146 149 | e.into()
|
147 150 | })
|
148 151 | }
|
149 152 |
|
153 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
150 154 | /// Python handler for operation `CheckHealth`.
|
151 155 | pub(crate) async fn check_health(
|
152 156 | input: crate::input::CheckHealthInput,
|
153 157 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
154 158 | handler: ::aws_smithy_http_server_python::PyHandler,
|
155 159 | ) -> std::result::Result<crate::output::CheckHealthOutput, crate::error::CheckHealthError> {
|
156 160 | // Async block used to run the handler and catch any Python error.
|
157 161 | let result = if handler.is_coroutine {
|
158 162 | ::tracing::trace!(name = "check_health", "executing python handler coroutine");
|
159 163 | let result = ::pyo3::Python::with_gil(|py| {
|
160 164 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
161 165 | let coroutine = if handler.args == 1 {
|
162 166 | pyhandler.call1((input,))?
|
163 167 | } else {
|
164 168 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
165 169 | };
|
166 170 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
167 171 | })?;
|
168 172 | result.await.and_then(|r| {
|
169 173 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::CheckHealthOutput>(py))
|
170 174 | })
|
171 175 | } else {
|
172 176 | ::tracing::trace!(name = "check_health", "executing python handler function");
|
173 177 | ::pyo3::Python::with_gil(|py| {
|
174 178 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
175 179 | let output = if handler.args == 1 {
|
176 180 | pyhandler.call1((input,))?
|
177 181 | } else {
|
178 182 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
179 183 | };
|
180 184 | output.extract::<crate::output::CheckHealthOutput>()
|
181 185 | })
|
182 186 | };
|
183 187 | // Catch and record a Python traceback.
|
184 188 | result.map_err(|e| {
|
185 189 | let rich_py_err =
|
186 190 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
187 191 | e.clone_ref(py)
|
188 192 | }));
|
189 193 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
190 194 | e.into()
|
191 195 | })
|
192 196 | }
|
193 197 |
|
198 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
194 199 | /// Python handler for operation `CapturePokemon`.
|
195 200 | pub(crate) async fn capture_pokemon(
|
196 201 | input: crate::input::CapturePokemonInput,
|
197 202 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
198 203 | handler: ::aws_smithy_http_server_python::PyHandler,
|
199 204 | ) -> std::result::Result<crate::output::CapturePokemonOutput, crate::error::CapturePokemonError> {
|
200 205 | // Async block used to run the handler and catch any Python error.
|
201 206 | let result = if handler.is_coroutine {
|
202 207 | ::tracing::trace!(
|
203 208 | name = "capture_pokemon",
|
204 209 | "executing python handler coroutine"
|
205 210 | );
|
206 211 | let result = ::pyo3::Python::with_gil(|py| {
|
207 212 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
208 213 | let coroutine = if handler.args == 1 {
|
209 214 | pyhandler.call1((input,))?
|
210 215 | } else {
|
211 216 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
212 217 | };
|
213 218 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
214 219 | })?;
|
215 220 | result.await.and_then(|r| {
|
216 221 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::CapturePokemonOutput>(py))
|
217 222 | })
|
218 223 | } else {
|
219 224 | ::tracing::trace!(
|
220 225 | name = "capture_pokemon",
|
221 226 | "executing python handler function"
|
222 227 | );
|
223 228 | ::pyo3::Python::with_gil(|py| {
|
224 229 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
225 230 | let output = if handler.args == 1 {
|
226 231 | pyhandler.call1((input,))?
|
227 232 | } else {
|
228 233 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
229 234 | };
|
230 235 | output.extract::<crate::output::CapturePokemonOutput>()
|
231 236 | })
|
232 237 | };
|
233 238 | // Catch and record a Python traceback.
|
234 239 | result.map_err(|e| {
|
235 240 | let rich_py_err =
|
236 241 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
237 242 | e.clone_ref(py)
|
238 243 | }));
|
239 244 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
240 245 | e.into()
|
241 246 | })
|
242 247 | }
|
243 248 |
|
249 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
244 250 | /// Python handler for operation `DoNothing`.
|
245 251 | pub(crate) async fn do_nothing(
|
246 252 | input: crate::input::DoNothingInput,
|
247 253 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
248 254 | handler: ::aws_smithy_http_server_python::PyHandler,
|
249 255 | ) -> std::result::Result<crate::output::DoNothingOutput, crate::error::DoNothingError> {
|
250 256 | // Async block used to run the handler and catch any Python error.
|
251 257 | let result = if handler.is_coroutine {
|
252 258 | ::tracing::trace!(name = "do_nothing", "executing python handler coroutine");
|
253 259 | let result = ::pyo3::Python::with_gil(|py| {
|
254 260 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
255 261 | let coroutine = if handler.args == 1 {
|
256 262 | pyhandler.call1((input,))?
|
257 263 | } else {
|
258 264 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
259 265 | };
|
260 266 | ::pyo3_asyncio::tokio::into_future(coroutine)
|
261 267 | })?;
|
262 268 | result.await.and_then(|r| {
|
263 269 | ::pyo3::Python::with_gil(|py| r.extract::<crate::output::DoNothingOutput>(py))
|
264 270 | })
|
265 271 | } else {
|
266 272 | ::tracing::trace!(name = "do_nothing", "executing python handler function");
|
267 273 | ::pyo3::Python::with_gil(|py| {
|
268 274 | let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
|
269 275 | let output = if handler.args == 1 {
|
270 276 | pyhandler.call1((input,))?
|
271 277 | } else {
|
272 278 | pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
|
273 279 | };
|
274 280 | output.extract::<crate::output::DoNothingOutput>()
|
275 281 | })
|
276 282 | };
|
277 283 | // Catch and record a Python traceback.
|
278 284 | result.map_err(|e| {
|
279 285 | let rich_py_err =
|
280 286 | ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
|
281 287 | e.clone_ref(py)
|
282 288 | }));
|
283 289 | ::tracing::error!(error = ?rich_py_err, "handler error");
|
284 290 | e.into()
|
285 291 | })
|
286 292 | }
|
287 293 |
|
294 + | /* PythonServerOperationHandlerGenerator.kt:61 */
|
288 295 | /// Python handler for operation `GetServerStatistics`.
|
289 296 | pub(crate) async fn get_server_statistics(
|
290 297 | input: crate::input::GetServerStatisticsInput,
|
291 298 | state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
|
292 299 | handler: ::aws_smithy_http_server_python::PyHandler,
|
293 300 | ) -> std::result::Result<
|
294 301 | crate::output::GetServerStatisticsOutput,
|
295 302 | crate::error::GetServerStatisticsError,
|
296 303 | > {
|
297 304 | // Async block used to run the handler and catch any Python error.
|