1 - | import constraints.input
|
2 - | import constraints.middleware
|
3 - | import constraints.output
|
4 - | import constraints.tls
|
5 - | import typing
|
6 - |
|
7 - | Ctx = typing.TypeVar('Ctx')
|
8 - |
|
9 - | class App(typing.Generic[Ctx]):
|
10 - | """
|
11 - | Main Python application, used to register operations and context and start multiple
|
12 - | workers on the same shared socket.
|
13 - |
|
14 - | Operations can be registered using the application object as a decorator (`@app.operation_name`).
|
15 - |
|
16 - | Here's a full example to get you started:
|
17 - |
|
18 - | ```python
|
19 - | from constraints import input
|
20 - | from constraints import output
|
21 - | from constraints import error
|
22 - | from constraints import middleware
|
23 - | from constraints import App
|
24 - |
|
25 - | @dataclass
|
26 - | class Context:
|
27 - | counter: int = 0
|
28 - |
|
29 - | app = App()
|
30 - | app.context(Context())
|
31 - |
|
32 - | @app.request_middleware
|
33 - | def request_middleware(request: middleware::Request):
|
34 - | if request.get_header("x-amzn-id") != "secret":
|
35 - | raise middleware.MiddlewareException("Unsupported `x-amz-id` header", 401)
|
36 - |
|
37 - | @app.constrained_http_bound_shapes_operation
|
38 - | def constrained_http_bound_shapes_operation(input: input::ConstrainedHttpBoundShapesOperationInput, ctx: Context) -> output::ConstrainedHttpBoundShapesOperationOutput:
|
39 - | raise NotImplementedError
|
40 - |
|
41 - | @app.constrained_http_payload_bound_shape_operation
|
42 - | def constrained_http_payload_bound_shape_operation(input: input::ConstrainedHttpPayloadBoundShapeOperationInput, ctx: Context) -> output::ConstrainedHttpPayloadBoundShapeOperationOutput:
|
43 - | raise NotImplementedError
|
44 - |
|
45 - | @app.constrained_recursive_shapes_operation
|
46 - | def constrained_recursive_shapes_operation(input: input::ConstrainedRecursiveShapesOperationInput, ctx: Context) -> output::ConstrainedRecursiveShapesOperationOutput:
|
47 - | raise NotImplementedError
|
48 - |
|
49 - | @app.constrained_shapes_only_in_output_operation
|
50 - | def constrained_shapes_only_in_output_operation(input: input::ConstrainedShapesOnlyInOutputOperationInput, ctx: Context) -> output::ConstrainedShapesOnlyInOutputOperationOutput:
|
51 - | raise NotImplementedError
|
52 - |
|
53 - | @app.constrained_shapes_operation
|
54 - | def constrained_shapes_operation(input: input::ConstrainedShapesOperationInput, ctx: Context) -> output::ConstrainedShapesOperationOutput:
|
55 - | raise NotImplementedError
|
56 - |
|
57 - | @app.event_streams_operation
|
58 - | def event_streams_operation(input: input::EventStreamsOperationInput, ctx: Context) -> output::EventStreamsOperationOutput:
|
59 - | raise NotImplementedError
|
60 - |
|
61 - | @app.http_prefix_headers_targeting_length_map_operation
|
62 - | def http_prefix_headers_targeting_length_map_operation(input: input::HttpPrefixHeadersTargetingLengthMapOperationInput, ctx: Context) -> output::HttpPrefixHeadersTargetingLengthMapOperationOutput:
|
63 - | raise NotImplementedError
|
64 - |
|
65 - | @app.non_streaming_blob_operation
|
66 - | def non_streaming_blob_operation(input: input::NonStreamingBlobOperationInput, ctx: Context) -> output::NonStreamingBlobOperationOutput:
|
67 - | raise NotImplementedError
|
68 - |
|
69 - | @app.query_params_targeting_length_map_operation
|
70 - | def query_params_targeting_length_map_operation(input: input::QueryParamsTargetingLengthMapOperationInput, ctx: Context) -> output::QueryParamsTargetingLengthMapOperationOutput:
|
71 - | raise NotImplementedError
|
72 - |
|
73 - | @app.query_params_targeting_map_of_enum_string_operation
|
74 - | def query_params_targeting_map_of_enum_string_operation(input: input::QueryParamsTargetingMapOfEnumStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfEnumStringOperationOutput:
|
75 - | raise NotImplementedError
|
76 - |
|
77 - | @app.query_params_targeting_map_of_length_list_of_pattern_string_operation
|
78 - | def query_params_targeting_map_of_length_list_of_pattern_string_operation(input: input::QueryParamsTargetingMapOfLengthListOfPatternStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput:
|
79 - | raise NotImplementedError
|
80 - |
|
81 - | @app.query_params_targeting_map_of_length_pattern_string_operation
|
82 - | def query_params_targeting_map_of_length_pattern_string_operation(input: input::QueryParamsTargetingMapOfLengthPatternStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfLengthPatternStringOperationOutput:
|
83 - | raise NotImplementedError
|
84 - |
|
85 - | @app.query_params_targeting_map_of_length_string_operation
|
86 - | def query_params_targeting_map_of_length_string_operation(input: input::QueryParamsTargetingMapOfLengthStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfLengthStringOperationOutput:
|
87 - | raise NotImplementedError
|
88 - |
|
89 - | @app.query_params_targeting_map_of_list_of_enum_string_operation
|
90 - | def query_params_targeting_map_of_list_of_enum_string_operation(input: input::QueryParamsTargetingMapOfListOfEnumStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfListOfEnumStringOperationOutput:
|
91 - | raise NotImplementedError
|
92 - |
|
93 - | @app.query_params_targeting_map_of_list_of_length_pattern_string_operation
|
94 - | def query_params_targeting_map_of_list_of_length_pattern_string_operation(input: input::QueryParamsTargetingMapOfListOfLengthPatternStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput:
|
95 - | raise NotImplementedError
|
96 - |
|
97 - | @app.query_params_targeting_map_of_list_of_length_string_operation
|
98 - | def query_params_targeting_map_of_list_of_length_string_operation(input: input::QueryParamsTargetingMapOfListOfLengthStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfListOfLengthStringOperationOutput:
|
99 - | raise NotImplementedError
|
100 - |
|
101 - | @app.query_params_targeting_map_of_list_of_pattern_string_operation
|
102 - | def query_params_targeting_map_of_list_of_pattern_string_operation(input: input::QueryParamsTargetingMapOfListOfPatternStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfListOfPatternStringOperationOutput:
|
103 - | raise NotImplementedError
|
104 - |
|
105 - | @app.query_params_targeting_map_of_pattern_string_operation
|
106 - | def query_params_targeting_map_of_pattern_string_operation(input: input::QueryParamsTargetingMapOfPatternStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfPatternStringOperationOutput:
|
107 - | raise NotImplementedError
|
108 - |
|
109 - | @app.query_params_targeting_map_of_set_of_length_string_operation
|
110 - | def query_params_targeting_map_of_set_of_length_string_operation(input: input::QueryParamsTargetingMapOfSetOfLengthStringOperationInput, ctx: Context) -> output::QueryParamsTargetingMapOfSetOfLengthStringOperationOutput:
|
111 - | raise NotImplementedError
|
112 - |
|
113 - | @app.streaming_blob_operation
|
114 - | def streaming_blob_operation(input: input::StreamingBlobOperationInput, ctx: Context) -> output::StreamingBlobOperationOutput:
|
115 - | raise NotImplementedError
|
116 - |
|
117 - | app.run()
|
118 - | ```
|
119 - |
|
120 - | Any of operations above can be written as well prepending the `async` keyword and
|
121 - | the Python application will automatically handle it and schedule it on the event loop for you.
|
122 - | """
|
123 - |
|
124 - | def constrained_http_bound_shapes_operation(self, func: typing.Union[typing.Callable[[constraints.input.ConstrainedHttpBoundShapesOperationInput, Ctx], typing.Union[constraints.output.ConstrainedHttpBoundShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedHttpBoundShapesOperationOutput]]], typing.Callable[[constraints.input.ConstrainedHttpBoundShapesOperationInput], typing.Union[constraints.output.ConstrainedHttpBoundShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedHttpBoundShapesOperationOutput]]]]) -> None:
|
125 - | """
|
126 - | Method to register `constrained_http_bound_shapes_operation` Python implementation inside the handlers map.
|
127 - | It can be used as a function decorator in Python.
|
128 - | """
|
129 - | ...
|
130 - |
|
131 - |
|
132 - | def constrained_http_payload_bound_shape_operation(self, func: typing.Union[typing.Callable[[constraints.input.ConstrainedHttpPayloadBoundShapeOperationInput, Ctx], typing.Union[constraints.output.ConstrainedHttpPayloadBoundShapeOperationOutput, typing.Awaitable[constraints.output.ConstrainedHttpPayloadBoundShapeOperationOutput]]], typing.Callable[[constraints.input.ConstrainedHttpPayloadBoundShapeOperationInput], typing.Union[constraints.output.ConstrainedHttpPayloadBoundShapeOperationOutput, typing.Awaitable[constraints.output.ConstrainedHttpPayloadBoundShapeOperationOutput]]]]) -> None:
|
133 - | """
|
134 - | Method to register `constrained_http_payload_bound_shape_operation` Python implementation inside the handlers map.
|
135 - | It can be used as a function decorator in Python.
|
136 - | """
|
137 - | ...
|
138 - |
|
139 - |
|
140 - | def constrained_recursive_shapes_operation(self, func: typing.Union[typing.Callable[[constraints.input.ConstrainedRecursiveShapesOperationInput, Ctx], typing.Union[constraints.output.ConstrainedRecursiveShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedRecursiveShapesOperationOutput]]], typing.Callable[[constraints.input.ConstrainedRecursiveShapesOperationInput], typing.Union[constraints.output.ConstrainedRecursiveShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedRecursiveShapesOperationOutput]]]]) -> None:
|
141 - | """
|
142 - | Method to register `constrained_recursive_shapes_operation` Python implementation inside the handlers map.
|
143 - | It can be used as a function decorator in Python.
|
144 - | """
|
145 - | ...
|
146 - |
|
147 - |
|
148 - | def constrained_shapes_only_in_output_operation(self, func: typing.Union[typing.Callable[[constraints.input.ConstrainedShapesOnlyInOutputOperationInput, Ctx], typing.Union[constraints.output.ConstrainedShapesOnlyInOutputOperationOutput, typing.Awaitable[constraints.output.ConstrainedShapesOnlyInOutputOperationOutput]]], typing.Callable[[constraints.input.ConstrainedShapesOnlyInOutputOperationInput], typing.Union[constraints.output.ConstrainedShapesOnlyInOutputOperationOutput, typing.Awaitable[constraints.output.ConstrainedShapesOnlyInOutputOperationOutput]]]]) -> None:
|
149 - | """
|
150 - | Method to register `constrained_shapes_only_in_output_operation` Python implementation inside the handlers map.
|
151 - | It can be used as a function decorator in Python.
|
152 - | """
|
153 - | ...
|
154 - |
|
155 - |
|
156 - | def constrained_shapes_operation(self, func: typing.Union[typing.Callable[[constraints.input.ConstrainedShapesOperationInput, Ctx], typing.Union[constraints.output.ConstrainedShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedShapesOperationOutput]]], typing.Callable[[constraints.input.ConstrainedShapesOperationInput], typing.Union[constraints.output.ConstrainedShapesOperationOutput, typing.Awaitable[constraints.output.ConstrainedShapesOperationOutput]]]]) -> None:
|
157 - | """
|
158 - | Method to register `constrained_shapes_operation` Python implementation inside the handlers map.
|
159 - | It can be used as a function decorator in Python.
|
160 - | """
|
161 - | ...
|
162 - |
|
163 - |
|
164 - | def context(self, context: Ctx) -> None:
|
165 - | """
|
166 - | Register a context object that will be shared between handlers.
|
167 - | """
|
168 - | ...
|
169 - |
|
170 - |
|
171 - | def event_streams_operation(self, func: typing.Union[typing.Callable[[constraints.input.EventStreamsOperationInput, Ctx], typing.Union[constraints.output.EventStreamsOperationOutput, typing.Awaitable[constraints.output.EventStreamsOperationOutput]]], typing.Callable[[constraints.input.EventStreamsOperationInput], typing.Union[constraints.output.EventStreamsOperationOutput, typing.Awaitable[constraints.output.EventStreamsOperationOutput]]]]) -> None:
|
172 - | """
|
173 - | Method to register `event_streams_operation` Python implementation inside the handlers map.
|
174 - | It can be used as a function decorator in Python.
|
175 - | """
|
176 - | ...
|
177 - |
|
178 - |
|
179 - | def http_prefix_headers_targeting_length_map_operation(self, func: typing.Union[typing.Callable[[constraints.input.HttpPrefixHeadersTargetingLengthMapOperationInput, Ctx], typing.Union[constraints.output.HttpPrefixHeadersTargetingLengthMapOperationOutput, typing.Awaitable[constraints.output.HttpPrefixHeadersTargetingLengthMapOperationOutput]]], typing.Callable[[constraints.input.HttpPrefixHeadersTargetingLengthMapOperationInput], typing.Union[constraints.output.HttpPrefixHeadersTargetingLengthMapOperationOutput, typing.Awaitable[constraints.output.HttpPrefixHeadersTargetingLengthMapOperationOutput]]]]) -> None:
|
180 - | """
|
181 - | Method to register `http_prefix_headers_targeting_length_map_operation` Python implementation inside the handlers map.
|
182 - | It can be used as a function decorator in Python.
|
183 - | """
|
184 - | ...
|
185 - |
|
186 - |
|
187 - | def middleware(self, func: typing.Callable[[constraints.middleware.Request, typing.Callable[[constraints.middleware.Request], typing.Awaitable[constraints.middleware.Response]]], typing.Awaitable[constraints.middleware.Response]]) -> None:
|
188 - | """
|
189 - | Register a Python function to be executed inside a Tower middleware layer.
|
190 - | """
|
191 - | ...
|
192 - |
|
193 - |
|
194 - | def non_streaming_blob_operation(self, func: typing.Union[typing.Callable[[constraints.input.NonStreamingBlobOperationInput, Ctx], typing.Union[constraints.output.NonStreamingBlobOperationOutput, typing.Awaitable[constraints.output.NonStreamingBlobOperationOutput]]], typing.Callable[[constraints.input.NonStreamingBlobOperationInput], typing.Union[constraints.output.NonStreamingBlobOperationOutput, typing.Awaitable[constraints.output.NonStreamingBlobOperationOutput]]]]) -> None:
|
195 - | """
|
196 - | Method to register `non_streaming_blob_operation` Python implementation inside the handlers map.
|
197 - | It can be used as a function decorator in Python.
|
198 - | """
|
199 - | ...
|
200 - |
|
201 - |
|
202 - | def query_params_targeting_length_map_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingLengthMapOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingLengthMapOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingLengthMapOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingLengthMapOperationInput], typing.Union[constraints.output.QueryParamsTargetingLengthMapOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingLengthMapOperationOutput]]]]) -> None:
|
203 - | """
|
204 - | Method to register `query_params_targeting_length_map_operation` Python implementation inside the handlers map.
|
205 - | It can be used as a function decorator in Python.
|
206 - | """
|
207 - | ...
|
208 - |
|
209 - |
|
210 - | def query_params_targeting_map_of_enum_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfEnumStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfEnumStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfEnumStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfEnumStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfEnumStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfEnumStringOperationOutput]]]]) -> None:
|
211 - | """
|
212 - | Method to register `query_params_targeting_map_of_enum_string_operation` Python implementation inside the handlers map.
|
213 - | It can be used as a function decorator in Python.
|
214 - | """
|
215 - | ...
|
216 - |
|
217 - |
|
218 - | def query_params_targeting_map_of_length_list_of_pattern_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthListOfPatternStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthListOfPatternStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput]]]]) -> None:
|
219 - | """
|
220 - | Method to register `query_params_targeting_map_of_length_list_of_pattern_string_operation` Python implementation inside the handlers map.
|
221 - | It can be used as a function decorator in Python.
|
222 - | """
|
223 - | ...
|
224 - |
|
225 - |
|
226 - | def query_params_targeting_map_of_length_pattern_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthPatternStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthPatternStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthPatternStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthPatternStringOperationOutput]]]]) -> None:
|
227 - | """
|
228 - | Method to register `query_params_targeting_map_of_length_pattern_string_operation` Python implementation inside the handlers map.
|
229 - | It can be used as a function decorator in Python.
|
230 - | """
|
231 - | ...
|
232 - |
|
233 - |
|
234 - | def query_params_targeting_map_of_length_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfLengthStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfLengthStringOperationOutput]]]]) -> None:
|
235 - | """
|
236 - | Method to register `query_params_targeting_map_of_length_string_operation` Python implementation inside the handlers map.
|
237 - | It can be used as a function decorator in Python.
|
238 - | """
|
239 - | ...
|
240 - |
|
241 - |
|
242 - | def query_params_targeting_map_of_list_of_enum_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfEnumStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfEnumStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfEnumStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfEnumStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfEnumStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfEnumStringOperationOutput]]]]) -> None:
|
243 - | """
|
244 - | Method to register `query_params_targeting_map_of_list_of_enum_string_operation` Python implementation inside the handlers map.
|
245 - | It can be used as a function decorator in Python.
|
246 - | """
|
247 - | ...
|
248 - |
|
249 - |
|
250 - | def query_params_targeting_map_of_list_of_length_pattern_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfLengthPatternStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfLengthPatternStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput]]]]) -> None:
|
251 - | """
|
252 - | Method to register `query_params_targeting_map_of_list_of_length_pattern_string_operation` Python implementation inside the handlers map.
|
253 - | It can be used as a function decorator in Python.
|
254 - | """
|
255 - | ...
|
256 - |
|
257 - |
|
258 - | def query_params_targeting_map_of_list_of_length_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfLengthStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfLengthStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfLengthStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfLengthStringOperationOutput]]]]) -> None:
|
259 - | """
|
260 - | Method to register `query_params_targeting_map_of_list_of_length_string_operation` Python implementation inside the handlers map.
|
261 - | It can be used as a function decorator in Python.
|
262 - | """
|
263 - | ...
|
264 - |
|
265 - |
|
266 - | def query_params_targeting_map_of_list_of_pattern_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfPatternStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfPatternStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfListOfPatternStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfListOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfListOfPatternStringOperationOutput]]]]) -> None:
|
267 - | """
|
268 - | Method to register `query_params_targeting_map_of_list_of_pattern_string_operation` Python implementation inside the handlers map.
|
269 - | It can be used as a function decorator in Python.
|
270 - | """
|
271 - | ...
|
272 - |
|
273 - |
|
274 - | def query_params_targeting_map_of_pattern_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfPatternStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfPatternStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfPatternStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfPatternStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfPatternStringOperationOutput]]]]) -> None:
|
275 - | """
|
276 - | Method to register `query_params_targeting_map_of_pattern_string_operation` Python implementation inside the handlers map.
|
277 - | It can be used as a function decorator in Python.
|
278 - | """
|
279 - | ...
|
280 - |
|
281 - |
|
282 - | def query_params_targeting_map_of_set_of_length_string_operation(self, func: typing.Union[typing.Callable[[constraints.input.QueryParamsTargetingMapOfSetOfLengthStringOperationInput, Ctx], typing.Union[constraints.output.QueryParamsTargetingMapOfSetOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfSetOfLengthStringOperationOutput]]], typing.Callable[[constraints.input.QueryParamsTargetingMapOfSetOfLengthStringOperationInput], typing.Union[constraints.output.QueryParamsTargetingMapOfSetOfLengthStringOperationOutput, typing.Awaitable[constraints.output.QueryParamsTargetingMapOfSetOfLengthStringOperationOutput]]]]) -> None:
|
283 - | """
|
284 - | Method to register `query_params_targeting_map_of_set_of_length_string_operation` Python implementation inside the handlers map.
|
285 - | It can be used as a function decorator in Python.
|
286 - | """
|
287 - | ...
|
288 - |
|
289 - |
|
290 - | def run(self, address: typing.Optional[str] = ..., port: typing.Optional[int] = ..., backlog: typing.Optional[int] = ..., workers: typing.Optional[int] = ..., tls: typing.Optional[constraints.tls.TlsConfig] = ...) -> None:
|
291 - | """
|
292 - | Main entrypoint: start the server on multiple workers.
|
293 - | """
|
294 - | ...
|
295 - |
|
296 - |
|
297 - | def run_lambda(self) -> None:
|
298 - | """
|
299 - | Lambda entrypoint: start the server on Lambda.
|
300 - | """
|
301 - | ...
|
302 - |
|
303 - |
|
304 - | def start_worker(self) -> None:
|
305 - | """
|
306 - | Build the service and start a single worker.
|
307 - | """
|
308 - | ...
|
309 - |
|
310 - |
|
311 - | def streaming_blob_operation(self, func: typing.Union[typing.Callable[[constraints.input.StreamingBlobOperationInput, Ctx], typing.Union[constraints.output.StreamingBlobOperationOutput, typing.Awaitable[constraints.output.StreamingBlobOperationOutput]]], typing.Callable[[constraints.input.StreamingBlobOperationInput], typing.Union[constraints.output.StreamingBlobOperationOutput, typing.Awaitable[constraints.output.StreamingBlobOperationOutput]]]]) -> None:
|
312 - | """
|
313 - | Method to register `streaming_blob_operation` Python implementation inside the handlers map.
|
314 - | It can be used as a function decorator in Python.
|
315 - | """
|
316 - | ...
|
317 - |
|
318 - |
|
319 - | def __init__(self) -> None:
|
320 - | ...
|
321 - |
|
322 - |
|
323 - | CODEGEN_VERSION: str = ...
|