nexo-schemas 0.0.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. nexo/schemas/__init__.py +0 -0
  2. nexo/schemas/application.py +292 -0
  3. nexo/schemas/connection.py +134 -0
  4. nexo/schemas/data.py +27 -0
  5. nexo/schemas/document.py +237 -0
  6. nexo/schemas/error/__init__.py +476 -0
  7. nexo/schemas/error/constants.py +50 -0
  8. nexo/schemas/error/descriptor.py +354 -0
  9. nexo/schemas/error/enums.py +40 -0
  10. nexo/schemas/error/metadata.py +15 -0
  11. nexo/schemas/error/spec.py +312 -0
  12. nexo/schemas/exception/__init__.py +0 -0
  13. nexo/schemas/exception/exc.py +911 -0
  14. nexo/schemas/exception/factory.py +1928 -0
  15. nexo/schemas/exception/handlers.py +110 -0
  16. nexo/schemas/google.py +14 -0
  17. nexo/schemas/key/__init__.py +0 -0
  18. nexo/schemas/key/rsa.py +131 -0
  19. nexo/schemas/metadata.py +21 -0
  20. nexo/schemas/mixins/__init__.py +0 -0
  21. nexo/schemas/mixins/filter.py +140 -0
  22. nexo/schemas/mixins/general.py +65 -0
  23. nexo/schemas/mixins/hierarchy.py +19 -0
  24. nexo/schemas/mixins/identity.py +387 -0
  25. nexo/schemas/mixins/parameter.py +50 -0
  26. nexo/schemas/mixins/service.py +40 -0
  27. nexo/schemas/mixins/sort.py +111 -0
  28. nexo/schemas/mixins/timestamp.py +192 -0
  29. nexo/schemas/model.py +240 -0
  30. nexo/schemas/operation/__init__.py +0 -0
  31. nexo/schemas/operation/action/__init__.py +9 -0
  32. nexo/schemas/operation/action/base.py +14 -0
  33. nexo/schemas/operation/action/resource.py +371 -0
  34. nexo/schemas/operation/action/status.py +8 -0
  35. nexo/schemas/operation/action/system.py +6 -0
  36. nexo/schemas/operation/action/websocket.py +6 -0
  37. nexo/schemas/operation/base.py +289 -0
  38. nexo/schemas/operation/constants.py +18 -0
  39. nexo/schemas/operation/context.py +68 -0
  40. nexo/schemas/operation/dependency.py +26 -0
  41. nexo/schemas/operation/enums.py +168 -0
  42. nexo/schemas/operation/extractor.py +36 -0
  43. nexo/schemas/operation/mixins.py +53 -0
  44. nexo/schemas/operation/request.py +1066 -0
  45. nexo/schemas/operation/resource.py +839 -0
  46. nexo/schemas/operation/system.py +55 -0
  47. nexo/schemas/operation/websocket.py +55 -0
  48. nexo/schemas/pagination.py +67 -0
  49. nexo/schemas/parameter.py +60 -0
  50. nexo/schemas/payload.py +116 -0
  51. nexo/schemas/resource.py +64 -0
  52. nexo/schemas/response.py +1041 -0
  53. nexo/schemas/security/__init__.py +0 -0
  54. nexo/schemas/security/api_key.py +63 -0
  55. nexo/schemas/security/authentication.py +848 -0
  56. nexo/schemas/security/authorization.py +922 -0
  57. nexo/schemas/security/enums.py +32 -0
  58. nexo/schemas/security/impersonation.py +179 -0
  59. nexo/schemas/security/token.py +402 -0
  60. nexo/schemas/security/types.py +17 -0
  61. nexo/schemas/success/__init__.py +0 -0
  62. nexo/schemas/success/descriptor.py +100 -0
  63. nexo/schemas/success/enums.py +23 -0
  64. nexo/schemas/user_agent.py +46 -0
  65. nexo_schemas-0.0.16.dist-info/METADATA +87 -0
  66. nexo_schemas-0.0.16.dist-info/RECORD +69 -0
  67. nexo_schemas-0.0.16.dist-info/WHEEL +5 -0
  68. nexo_schemas-0.0.16.dist-info/licenses/LICENSE +21 -0
  69. nexo_schemas-0.0.16.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1928 @@
1
+ import httpx
2
+ from typing import Any, Literal, Type, overload
3
+ from nexo.logging.enums import LogLevel
4
+ from nexo.logging.logger import Base
5
+ from nexo.types.string import OptStr
6
+ from nexo.types.uuid import OptUUID
7
+ from ..application import OptApplicationContext
8
+ from ..connection import ConnectionContext, OptConnectionContext
9
+ from ..error.enums import ErrorCode
10
+ from ..operation.context import Context
11
+ from ..operation.enums import OperationType
12
+ from ..operation.mixins import OptTimestamp
13
+ from ..operation.action.resource import AnyResourceOperationAction
14
+ from ..operation.action.system import SystemOperationAction
15
+ from ..operation.action.websocket import WebSocketOperationAction
16
+ from ..resource import Resource, OptResource
17
+ from ..response import (
18
+ OptBadRequestResponse,
19
+ OptUnauthorizedResponse,
20
+ OptForbiddenResponse,
21
+ OptNotFoundResponse,
22
+ OptMethodNotAllowedResponse,
23
+ OptConflictResponse,
24
+ OptUnprocessableEntityResponse,
25
+ OptTooManyRequestsResponse,
26
+ OptInternalServerErrorResponse,
27
+ OptNotImplementedResponse,
28
+ OptBadGatewayResponse,
29
+ OptServiceUnavailableResponse,
30
+ OptAnyErrorResponse,
31
+ ErrorResponseFactory,
32
+ )
33
+ from ..security.authentication import OptAnyAuthentication
34
+ from ..security.authorization import OptAnyAuthorization
35
+ from ..security.impersonation import OptImpersonation
36
+ from .exc import (
37
+ BadRequest,
38
+ Unauthorized,
39
+ Forbidden,
40
+ NotFound,
41
+ MethodNotAllowed,
42
+ Conflict,
43
+ UnprocessableEntity,
44
+ TooManyRequests,
45
+ InternalServerError,
46
+ NotImplemented,
47
+ BadGateway,
48
+ ServiceUnavailable,
49
+ AnyExceptionType,
50
+ AnyException,
51
+ )
52
+
53
+
54
+ class MaleoExceptionFactory:
55
+ @overload
56
+ @classmethod
57
+ def cls_from_code(
58
+ cls,
59
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
60
+ /,
61
+ ) -> Type[BadRequest]: ...
62
+ @overload
63
+ @classmethod
64
+ def cls_from_code(
65
+ cls,
66
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
67
+ /,
68
+ ) -> Type[Unauthorized]: ...
69
+ @overload
70
+ @classmethod
71
+ def cls_from_code(
72
+ cls,
73
+ code: Literal[ErrorCode.FORBIDDEN, 403],
74
+ /,
75
+ ) -> Type[Forbidden]: ...
76
+ @overload
77
+ @classmethod
78
+ def cls_from_code(
79
+ cls,
80
+ code: Literal[ErrorCode.NOT_FOUND, 404],
81
+ /,
82
+ ) -> Type[NotFound]: ...
83
+ @overload
84
+ @classmethod
85
+ def cls_from_code(
86
+ cls,
87
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
88
+ /,
89
+ ) -> Type[MethodNotAllowed]: ...
90
+ @overload
91
+ @classmethod
92
+ def cls_from_code(
93
+ cls,
94
+ code: Literal[ErrorCode.CONFLICT, 409],
95
+ /,
96
+ ) -> Type[Conflict]: ...
97
+ @overload
98
+ @classmethod
99
+ def cls_from_code(
100
+ cls,
101
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
102
+ /,
103
+ ) -> Type[UnprocessableEntity]: ...
104
+ @overload
105
+ @classmethod
106
+ def cls_from_code(
107
+ cls,
108
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
109
+ /,
110
+ ) -> Type[TooManyRequests]: ...
111
+ @overload
112
+ @classmethod
113
+ def cls_from_code(
114
+ cls,
115
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
116
+ /,
117
+ ) -> Type[InternalServerError]: ...
118
+ @overload
119
+ @classmethod
120
+ def cls_from_code(
121
+ cls,
122
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
123
+ /,
124
+ ) -> Type[NotImplemented]: ...
125
+ @overload
126
+ @classmethod
127
+ def cls_from_code(
128
+ cls,
129
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
130
+ /,
131
+ ) -> Type[BadGateway]: ...
132
+ @overload
133
+ @classmethod
134
+ def cls_from_code(
135
+ cls,
136
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
137
+ /,
138
+ ) -> Type[ServiceUnavailable]: ...
139
+ @overload
140
+ @classmethod
141
+ def cls_from_code(
142
+ cls,
143
+ code: ErrorCode | int,
144
+ /,
145
+ ) -> AnyExceptionType: ...
146
+ @classmethod
147
+ def cls_from_code(
148
+ cls,
149
+ code: ErrorCode | int,
150
+ /,
151
+ ) -> AnyExceptionType:
152
+ if code is ErrorCode.BAD_REQUEST or code == 400:
153
+ return BadRequest
154
+ elif code is ErrorCode.UNAUTHORIZED or code == 401:
155
+ return Unauthorized
156
+ elif code is ErrorCode.FORBIDDEN or code == 403:
157
+ return Forbidden
158
+ elif code is ErrorCode.NOT_FOUND or code == 404:
159
+ return NotFound
160
+ elif code is ErrorCode.METHOD_NOT_ALLOWED or code == 405:
161
+ return MethodNotAllowed
162
+ elif code is ErrorCode.CONFLICT or code == 409:
163
+ return Conflict
164
+ elif code is ErrorCode.UNPROCESSABLE_ENTITY or code == 422:
165
+ return UnprocessableEntity
166
+ elif code is ErrorCode.TOO_MANY_REQUESTS or code == 429:
167
+ return TooManyRequests
168
+ elif code is ErrorCode.INTERNAL_SERVER_ERROR or code == 500:
169
+ return InternalServerError
170
+ elif code is ErrorCode.NOT_IMPLEMENTED or code == 501:
171
+ return NotImplemented
172
+ elif code is ErrorCode.BAD_GATEWAY or code == 502:
173
+ return BadGateway
174
+ elif code is ErrorCode.SERVICE_UNAVAILABLE or code == 503:
175
+ return ServiceUnavailable
176
+ raise ValueError(
177
+ f"Unable to determine response and exception class for code: {code}"
178
+ )
179
+
180
+ # Specific code, request operation
181
+ @overload
182
+ @classmethod
183
+ def from_code(
184
+ cls,
185
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
186
+ *args: object,
187
+ details: Any = None,
188
+ operation_type: Literal[OperationType.REQUEST],
189
+ application_context: OptApplicationContext = None,
190
+ operation_id: OptUUID = None,
191
+ operation_context: Context,
192
+ operation_action: AnyResourceOperationAction,
193
+ operation_timestamp: OptTimestamp = None,
194
+ operation_summary: OptStr = None,
195
+ connection_context: ConnectionContext,
196
+ authentication: OptAnyAuthentication = None,
197
+ authorization: OptAnyAuthorization = None,
198
+ impersonation: OptImpersonation = None,
199
+ response: OptBadRequestResponse = None,
200
+ ) -> BadRequest: ...
201
+ @overload
202
+ @classmethod
203
+ def from_code(
204
+ cls,
205
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
206
+ *args: object,
207
+ details: Any = None,
208
+ operation_type: Literal[OperationType.REQUEST],
209
+ application_context: OptApplicationContext = None,
210
+ operation_id: OptUUID = None,
211
+ operation_context: Context,
212
+ operation_action: AnyResourceOperationAction,
213
+ operation_timestamp: OptTimestamp = None,
214
+ operation_summary: OptStr = None,
215
+ connection_context: ConnectionContext,
216
+ authentication: OptAnyAuthentication = None,
217
+ authorization: OptAnyAuthorization = None,
218
+ impersonation: OptImpersonation = None,
219
+ response: OptUnauthorizedResponse = None,
220
+ ) -> Unauthorized: ...
221
+ @overload
222
+ @classmethod
223
+ def from_code(
224
+ cls,
225
+ code: Literal[ErrorCode.FORBIDDEN, 403],
226
+ *args: object,
227
+ details: Any = None,
228
+ operation_type: Literal[OperationType.REQUEST],
229
+ application_context: OptApplicationContext = None,
230
+ operation_id: OptUUID = None,
231
+ operation_context: Context,
232
+ operation_action: AnyResourceOperationAction,
233
+ operation_timestamp: OptTimestamp = None,
234
+ operation_summary: OptStr = None,
235
+ connection_context: ConnectionContext,
236
+ authentication: OptAnyAuthentication = None,
237
+ authorization: OptAnyAuthorization = None,
238
+ impersonation: OptImpersonation = None,
239
+ response: OptForbiddenResponse = None,
240
+ ) -> Forbidden: ...
241
+ @overload
242
+ @classmethod
243
+ def from_code(
244
+ cls,
245
+ code: Literal[ErrorCode.NOT_FOUND, 404],
246
+ *args: object,
247
+ details: Any = None,
248
+ operation_type: Literal[OperationType.REQUEST],
249
+ application_context: OptApplicationContext = None,
250
+ operation_id: OptUUID = None,
251
+ operation_context: Context,
252
+ operation_action: AnyResourceOperationAction,
253
+ operation_timestamp: OptTimestamp = None,
254
+ operation_summary: OptStr = None,
255
+ connection_context: ConnectionContext,
256
+ authentication: OptAnyAuthentication = None,
257
+ authorization: OptAnyAuthorization = None,
258
+ impersonation: OptImpersonation = None,
259
+ response: OptNotFoundResponse = None,
260
+ ) -> NotFound: ...
261
+ @overload
262
+ @classmethod
263
+ def from_code(
264
+ cls,
265
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
266
+ *args: object,
267
+ details: Any = None,
268
+ operation_type: Literal[OperationType.REQUEST],
269
+ application_context: OptApplicationContext = None,
270
+ operation_id: OptUUID = None,
271
+ operation_context: Context,
272
+ operation_action: AnyResourceOperationAction,
273
+ operation_timestamp: OptTimestamp = None,
274
+ operation_summary: OptStr = None,
275
+ connection_context: ConnectionContext,
276
+ authentication: OptAnyAuthentication = None,
277
+ authorization: OptAnyAuthorization = None,
278
+ impersonation: OptImpersonation = None,
279
+ response: OptMethodNotAllowedResponse = None,
280
+ ) -> MethodNotAllowed: ...
281
+ @overload
282
+ @classmethod
283
+ def from_code(
284
+ cls,
285
+ code: Literal[ErrorCode.CONFLICT, 409],
286
+ *args: object,
287
+ details: Any = None,
288
+ operation_type: Literal[OperationType.REQUEST],
289
+ application_context: OptApplicationContext = None,
290
+ operation_id: OptUUID = None,
291
+ operation_context: Context,
292
+ operation_action: AnyResourceOperationAction,
293
+ operation_timestamp: OptTimestamp = None,
294
+ operation_summary: OptStr = None,
295
+ connection_context: ConnectionContext,
296
+ authentication: OptAnyAuthentication = None,
297
+ authorization: OptAnyAuthorization = None,
298
+ impersonation: OptImpersonation = None,
299
+ response: OptConflictResponse = None,
300
+ ) -> Conflict: ...
301
+ @overload
302
+ @classmethod
303
+ def from_code(
304
+ cls,
305
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
306
+ *args: object,
307
+ details: Any = None,
308
+ operation_type: Literal[OperationType.REQUEST],
309
+ application_context: OptApplicationContext = None,
310
+ operation_id: OptUUID = None,
311
+ operation_context: Context,
312
+ operation_action: AnyResourceOperationAction,
313
+ operation_timestamp: OptTimestamp = None,
314
+ operation_summary: OptStr = None,
315
+ connection_context: ConnectionContext,
316
+ authentication: OptAnyAuthentication = None,
317
+ authorization: OptAnyAuthorization = None,
318
+ impersonation: OptImpersonation = None,
319
+ response: OptUnprocessableEntityResponse = None,
320
+ ) -> UnprocessableEntity: ...
321
+ @overload
322
+ @classmethod
323
+ def from_code(
324
+ cls,
325
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
326
+ *args: object,
327
+ details: Any = None,
328
+ operation_type: Literal[OperationType.REQUEST],
329
+ application_context: OptApplicationContext = None,
330
+ operation_id: OptUUID = None,
331
+ operation_context: Context,
332
+ operation_action: AnyResourceOperationAction,
333
+ operation_timestamp: OptTimestamp = None,
334
+ operation_summary: OptStr = None,
335
+ connection_context: ConnectionContext,
336
+ authentication: OptAnyAuthentication = None,
337
+ authorization: OptAnyAuthorization = None,
338
+ impersonation: OptImpersonation = None,
339
+ response: OptTooManyRequestsResponse = None,
340
+ ) -> TooManyRequests: ...
341
+ @overload
342
+ @classmethod
343
+ def from_code(
344
+ cls,
345
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
346
+ *args: object,
347
+ details: Any = None,
348
+ operation_type: Literal[OperationType.REQUEST],
349
+ application_context: OptApplicationContext = None,
350
+ operation_id: OptUUID = None,
351
+ operation_context: Context,
352
+ operation_action: AnyResourceOperationAction,
353
+ operation_timestamp: OptTimestamp = None,
354
+ operation_summary: OptStr = None,
355
+ connection_context: ConnectionContext,
356
+ authentication: OptAnyAuthentication = None,
357
+ authorization: OptAnyAuthorization = None,
358
+ impersonation: OptImpersonation = None,
359
+ response: OptInternalServerErrorResponse = None,
360
+ ) -> InternalServerError: ...
361
+ @overload
362
+ @classmethod
363
+ def from_code(
364
+ cls,
365
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
366
+ *args: object,
367
+ details: Any = None,
368
+ operation_type: Literal[OperationType.REQUEST],
369
+ application_context: OptApplicationContext = None,
370
+ operation_id: OptUUID = None,
371
+ operation_context: Context,
372
+ operation_action: AnyResourceOperationAction,
373
+ operation_timestamp: OptTimestamp = None,
374
+ operation_summary: OptStr = None,
375
+ connection_context: ConnectionContext,
376
+ authentication: OptAnyAuthentication = None,
377
+ authorization: OptAnyAuthorization = None,
378
+ impersonation: OptImpersonation = None,
379
+ response: OptNotImplementedResponse = None,
380
+ ) -> NotImplemented: ...
381
+ @overload
382
+ @classmethod
383
+ def from_code(
384
+ cls,
385
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
386
+ *args: object,
387
+ details: Any = None,
388
+ operation_type: Literal[OperationType.REQUEST],
389
+ application_context: OptApplicationContext = None,
390
+ operation_id: OptUUID = None,
391
+ operation_context: Context,
392
+ operation_action: AnyResourceOperationAction,
393
+ operation_timestamp: OptTimestamp = None,
394
+ operation_summary: OptStr = None,
395
+ connection_context: ConnectionContext,
396
+ authentication: OptAnyAuthentication = None,
397
+ authorization: OptAnyAuthorization = None,
398
+ impersonation: OptImpersonation = None,
399
+ response: OptBadGatewayResponse = None,
400
+ ) -> BadGateway: ...
401
+ @overload
402
+ @classmethod
403
+ def from_code(
404
+ cls,
405
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
406
+ *args: object,
407
+ details: Any = None,
408
+ operation_type: Literal[OperationType.REQUEST],
409
+ application_context: OptApplicationContext = None,
410
+ operation_id: OptUUID = None,
411
+ operation_context: Context,
412
+ operation_action: AnyResourceOperationAction,
413
+ operation_timestamp: OptTimestamp = None,
414
+ operation_summary: OptStr = None,
415
+ connection_context: ConnectionContext,
416
+ authentication: OptAnyAuthentication = None,
417
+ authorization: OptAnyAuthorization = None,
418
+ impersonation: OptImpersonation = None,
419
+ response: OptServiceUnavailableResponse = None,
420
+ ) -> ServiceUnavailable: ...
421
+
422
+ # Specific code, resource operation
423
+ @overload
424
+ @classmethod
425
+ def from_code(
426
+ cls,
427
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
428
+ *args: object,
429
+ details: Any = None,
430
+ operation_type: Literal[OperationType.RESOURCE],
431
+ application_context: OptApplicationContext = None,
432
+ operation_id: OptUUID = None,
433
+ operation_context: Context,
434
+ operation_action: AnyResourceOperationAction,
435
+ resource: Resource,
436
+ operation_timestamp: OptTimestamp = None,
437
+ operation_summary: OptStr = None,
438
+ connection_context: OptConnectionContext = None,
439
+ authentication: OptAnyAuthentication = None,
440
+ authorization: OptAnyAuthorization = None,
441
+ impersonation: OptImpersonation = None,
442
+ response: OptBadRequestResponse = None,
443
+ ) -> BadRequest: ...
444
+ @overload
445
+ @classmethod
446
+ def from_code(
447
+ cls,
448
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
449
+ *args: object,
450
+ details: Any = None,
451
+ operation_type: Literal[OperationType.RESOURCE],
452
+ application_context: OptApplicationContext = None,
453
+ operation_id: OptUUID = None,
454
+ operation_context: Context,
455
+ operation_action: AnyResourceOperationAction,
456
+ resource: Resource,
457
+ operation_timestamp: OptTimestamp = None,
458
+ operation_summary: OptStr = None,
459
+ connection_context: OptConnectionContext = None,
460
+ authentication: OptAnyAuthentication = None,
461
+ authorization: OptAnyAuthorization = None,
462
+ impersonation: OptImpersonation = None,
463
+ response: OptUnauthorizedResponse = None,
464
+ ) -> Unauthorized: ...
465
+ @overload
466
+ @classmethod
467
+ def from_code(
468
+ cls,
469
+ code: Literal[ErrorCode.FORBIDDEN, 403],
470
+ *args: object,
471
+ details: Any = None,
472
+ operation_type: Literal[OperationType.RESOURCE],
473
+ application_context: OptApplicationContext = None,
474
+ operation_id: OptUUID = None,
475
+ operation_context: Context,
476
+ operation_action: AnyResourceOperationAction,
477
+ resource: Resource,
478
+ operation_timestamp: OptTimestamp = None,
479
+ operation_summary: OptStr = None,
480
+ connection_context: OptConnectionContext = None,
481
+ authentication: OptAnyAuthentication = None,
482
+ authorization: OptAnyAuthorization = None,
483
+ impersonation: OptImpersonation = None,
484
+ response: OptForbiddenResponse = None,
485
+ ) -> Forbidden: ...
486
+ @overload
487
+ @classmethod
488
+ def from_code(
489
+ cls,
490
+ code: Literal[ErrorCode.NOT_FOUND, 404],
491
+ *args: object,
492
+ details: Any = None,
493
+ operation_type: Literal[OperationType.RESOURCE],
494
+ application_context: OptApplicationContext = None,
495
+ operation_id: OptUUID = None,
496
+ operation_context: Context,
497
+ operation_action: AnyResourceOperationAction,
498
+ resource: Resource,
499
+ operation_timestamp: OptTimestamp = None,
500
+ operation_summary: OptStr = None,
501
+ connection_context: OptConnectionContext = None,
502
+ authentication: OptAnyAuthentication = None,
503
+ authorization: OptAnyAuthorization = None,
504
+ impersonation: OptImpersonation = None,
505
+ response: OptNotFoundResponse = None,
506
+ ) -> NotFound: ...
507
+ @overload
508
+ @classmethod
509
+ def from_code(
510
+ cls,
511
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
512
+ *args: object,
513
+ details: Any = None,
514
+ operation_type: Literal[OperationType.RESOURCE],
515
+ application_context: OptApplicationContext = None,
516
+ operation_id: OptUUID = None,
517
+ operation_context: Context,
518
+ operation_action: AnyResourceOperationAction,
519
+ resource: Resource,
520
+ operation_timestamp: OptTimestamp = None,
521
+ operation_summary: OptStr = None,
522
+ connection_context: OptConnectionContext = None,
523
+ authentication: OptAnyAuthentication = None,
524
+ authorization: OptAnyAuthorization = None,
525
+ impersonation: OptImpersonation = None,
526
+ response: OptMethodNotAllowedResponse = None,
527
+ ) -> MethodNotAllowed: ...
528
+ @overload
529
+ @classmethod
530
+ def from_code(
531
+ cls,
532
+ code: Literal[ErrorCode.CONFLICT, 409],
533
+ *args: object,
534
+ details: Any = None,
535
+ operation_type: Literal[OperationType.RESOURCE],
536
+ application_context: OptApplicationContext = None,
537
+ operation_id: OptUUID = None,
538
+ operation_context: Context,
539
+ operation_action: AnyResourceOperationAction,
540
+ resource: Resource,
541
+ operation_timestamp: OptTimestamp = None,
542
+ operation_summary: OptStr = None,
543
+ connection_context: OptConnectionContext = None,
544
+ authentication: OptAnyAuthentication = None,
545
+ authorization: OptAnyAuthorization = None,
546
+ impersonation: OptImpersonation = None,
547
+ response: OptConflictResponse = None,
548
+ ) -> Conflict: ...
549
+ @overload
550
+ @classmethod
551
+ def from_code(
552
+ cls,
553
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
554
+ *args: object,
555
+ details: Any = None,
556
+ operation_type: Literal[OperationType.RESOURCE],
557
+ application_context: OptApplicationContext = None,
558
+ operation_id: OptUUID = None,
559
+ operation_context: Context,
560
+ operation_action: AnyResourceOperationAction,
561
+ resource: Resource,
562
+ operation_timestamp: OptTimestamp = None,
563
+ operation_summary: OptStr = None,
564
+ connection_context: OptConnectionContext = None,
565
+ authentication: OptAnyAuthentication = None,
566
+ authorization: OptAnyAuthorization = None,
567
+ impersonation: OptImpersonation = None,
568
+ response: OptUnprocessableEntityResponse = None,
569
+ ) -> UnprocessableEntity: ...
570
+ @overload
571
+ @classmethod
572
+ def from_code(
573
+ cls,
574
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
575
+ *args: object,
576
+ details: Any = None,
577
+ operation_type: Literal[OperationType.RESOURCE],
578
+ application_context: OptApplicationContext = None,
579
+ operation_id: OptUUID = None,
580
+ operation_context: Context,
581
+ operation_action: AnyResourceOperationAction,
582
+ resource: Resource,
583
+ operation_timestamp: OptTimestamp = None,
584
+ operation_summary: OptStr = None,
585
+ connection_context: OptConnectionContext = None,
586
+ authentication: OptAnyAuthentication = None,
587
+ authorization: OptAnyAuthorization = None,
588
+ impersonation: OptImpersonation = None,
589
+ response: OptTooManyRequestsResponse = None,
590
+ ) -> TooManyRequests: ...
591
+ @overload
592
+ @classmethod
593
+ def from_code(
594
+ cls,
595
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
596
+ *args: object,
597
+ details: Any = None,
598
+ operation_type: Literal[OperationType.RESOURCE],
599
+ application_context: OptApplicationContext = None,
600
+ operation_id: OptUUID = None,
601
+ operation_context: Context,
602
+ operation_action: AnyResourceOperationAction,
603
+ resource: Resource,
604
+ operation_timestamp: OptTimestamp = None,
605
+ operation_summary: OptStr = None,
606
+ connection_context: OptConnectionContext = None,
607
+ authentication: OptAnyAuthentication = None,
608
+ authorization: OptAnyAuthorization = None,
609
+ impersonation: OptImpersonation = None,
610
+ response: OptInternalServerErrorResponse = None,
611
+ ) -> InternalServerError: ...
612
+ @overload
613
+ @classmethod
614
+ def from_code(
615
+ cls,
616
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
617
+ *args: object,
618
+ details: Any = None,
619
+ operation_type: Literal[OperationType.RESOURCE],
620
+ application_context: OptApplicationContext = None,
621
+ operation_id: OptUUID = None,
622
+ operation_context: Context,
623
+ operation_action: AnyResourceOperationAction,
624
+ resource: Resource,
625
+ operation_timestamp: OptTimestamp = None,
626
+ operation_summary: OptStr = None,
627
+ connection_context: OptConnectionContext = None,
628
+ authentication: OptAnyAuthentication = None,
629
+ authorization: OptAnyAuthorization = None,
630
+ impersonation: OptImpersonation = None,
631
+ response: OptNotImplementedResponse = None,
632
+ ) -> NotImplemented: ...
633
+ @overload
634
+ @classmethod
635
+ def from_code(
636
+ cls,
637
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
638
+ *args: object,
639
+ details: Any = None,
640
+ operation_type: Literal[OperationType.RESOURCE],
641
+ application_context: OptApplicationContext = None,
642
+ operation_id: OptUUID = None,
643
+ operation_context: Context,
644
+ operation_action: AnyResourceOperationAction,
645
+ resource: Resource,
646
+ operation_timestamp: OptTimestamp = None,
647
+ operation_summary: OptStr = None,
648
+ connection_context: OptConnectionContext = None,
649
+ authentication: OptAnyAuthentication = None,
650
+ authorization: OptAnyAuthorization = None,
651
+ impersonation: OptImpersonation = None,
652
+ response: OptBadGatewayResponse = None,
653
+ ) -> BadGateway: ...
654
+ @overload
655
+ @classmethod
656
+ def from_code(
657
+ cls,
658
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
659
+ *args: object,
660
+ details: Any = None,
661
+ operation_type: Literal[OperationType.RESOURCE],
662
+ application_context: OptApplicationContext = None,
663
+ operation_id: OptUUID = None,
664
+ operation_context: Context,
665
+ operation_action: AnyResourceOperationAction,
666
+ resource: Resource,
667
+ operation_timestamp: OptTimestamp = None,
668
+ operation_summary: OptStr = None,
669
+ connection_context: OptConnectionContext = None,
670
+ authentication: OptAnyAuthentication = None,
671
+ authorization: OptAnyAuthorization = None,
672
+ impersonation: OptImpersonation = None,
673
+ response: OptServiceUnavailableResponse = None,
674
+ ) -> ServiceUnavailable: ...
675
+
676
+ # Specific code, request or resource operation
677
+ @overload
678
+ @classmethod
679
+ def from_code(
680
+ cls,
681
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
682
+ *args: object,
683
+ details: Any = None,
684
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
685
+ application_context: OptApplicationContext = None,
686
+ operation_id: OptUUID = None,
687
+ operation_context: Context,
688
+ operation_action: AnyResourceOperationAction,
689
+ resource: OptResource = None,
690
+ operation_timestamp: OptTimestamp = None,
691
+ operation_summary: OptStr = None,
692
+ connection_context: OptConnectionContext = None,
693
+ authentication: OptAnyAuthentication = None,
694
+ authorization: OptAnyAuthorization = None,
695
+ impersonation: OptImpersonation = None,
696
+ response: OptBadRequestResponse = None,
697
+ ) -> BadRequest: ...
698
+ @overload
699
+ @classmethod
700
+ def from_code(
701
+ cls,
702
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
703
+ *args: object,
704
+ details: Any = None,
705
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
706
+ application_context: OptApplicationContext = None,
707
+ operation_id: OptUUID = None,
708
+ operation_context: Context,
709
+ operation_action: AnyResourceOperationAction,
710
+ resource: OptResource = None,
711
+ operation_timestamp: OptTimestamp = None,
712
+ operation_summary: OptStr = None,
713
+ connection_context: OptConnectionContext = None,
714
+ authentication: OptAnyAuthentication = None,
715
+ authorization: OptAnyAuthorization = None,
716
+ impersonation: OptImpersonation = None,
717
+ response: OptUnauthorizedResponse = None,
718
+ ) -> Unauthorized: ...
719
+ @overload
720
+ @classmethod
721
+ def from_code(
722
+ cls,
723
+ code: Literal[ErrorCode.FORBIDDEN, 403],
724
+ *args: object,
725
+ details: Any = None,
726
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
727
+ application_context: OptApplicationContext = None,
728
+ operation_id: OptUUID = None,
729
+ operation_context: Context,
730
+ operation_action: AnyResourceOperationAction,
731
+ resource: OptResource = None,
732
+ operation_timestamp: OptTimestamp = None,
733
+ operation_summary: OptStr = None,
734
+ connection_context: OptConnectionContext = None,
735
+ authentication: OptAnyAuthentication = None,
736
+ authorization: OptAnyAuthorization = None,
737
+ impersonation: OptImpersonation = None,
738
+ response: OptForbiddenResponse = None,
739
+ ) -> Forbidden: ...
740
+ @overload
741
+ @classmethod
742
+ def from_code(
743
+ cls,
744
+ code: Literal[ErrorCode.NOT_FOUND, 404],
745
+ *args: object,
746
+ details: Any = None,
747
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
748
+ application_context: OptApplicationContext = None,
749
+ operation_id: OptUUID = None,
750
+ operation_context: Context,
751
+ operation_action: AnyResourceOperationAction,
752
+ resource: OptResource = None,
753
+ operation_timestamp: OptTimestamp = None,
754
+ operation_summary: OptStr = None,
755
+ connection_context: OptConnectionContext = None,
756
+ authentication: OptAnyAuthentication = None,
757
+ authorization: OptAnyAuthorization = None,
758
+ impersonation: OptImpersonation = None,
759
+ response: OptNotFoundResponse = None,
760
+ ) -> NotFound: ...
761
+ @overload
762
+ @classmethod
763
+ def from_code(
764
+ cls,
765
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
766
+ *args: object,
767
+ details: Any = None,
768
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
769
+ application_context: OptApplicationContext = None,
770
+ operation_id: OptUUID = None,
771
+ operation_context: Context,
772
+ operation_action: AnyResourceOperationAction,
773
+ resource: OptResource = None,
774
+ operation_timestamp: OptTimestamp = None,
775
+ operation_summary: OptStr = None,
776
+ connection_context: OptConnectionContext = None,
777
+ authentication: OptAnyAuthentication = None,
778
+ authorization: OptAnyAuthorization = None,
779
+ impersonation: OptImpersonation = None,
780
+ response: OptMethodNotAllowedResponse = None,
781
+ ) -> MethodNotAllowed: ...
782
+ @overload
783
+ @classmethod
784
+ def from_code(
785
+ cls,
786
+ code: Literal[ErrorCode.CONFLICT, 409],
787
+ *args: object,
788
+ details: Any = None,
789
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
790
+ application_context: OptApplicationContext = None,
791
+ operation_id: OptUUID = None,
792
+ operation_context: Context,
793
+ operation_action: AnyResourceOperationAction,
794
+ resource: OptResource = None,
795
+ operation_timestamp: OptTimestamp = None,
796
+ operation_summary: OptStr = None,
797
+ connection_context: OptConnectionContext = None,
798
+ authentication: OptAnyAuthentication = None,
799
+ authorization: OptAnyAuthorization = None,
800
+ impersonation: OptImpersonation = None,
801
+ response: OptConflictResponse = None,
802
+ ) -> Conflict: ...
803
+ @overload
804
+ @classmethod
805
+ def from_code(
806
+ cls,
807
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
808
+ *args: object,
809
+ details: Any = None,
810
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
811
+ application_context: OptApplicationContext = None,
812
+ operation_id: OptUUID = None,
813
+ operation_context: Context,
814
+ operation_action: AnyResourceOperationAction,
815
+ resource: OptResource = None,
816
+ operation_timestamp: OptTimestamp = None,
817
+ operation_summary: OptStr = None,
818
+ connection_context: OptConnectionContext = None,
819
+ authentication: OptAnyAuthentication = None,
820
+ authorization: OptAnyAuthorization = None,
821
+ impersonation: OptImpersonation = None,
822
+ response: OptUnprocessableEntityResponse = None,
823
+ ) -> UnprocessableEntity: ...
824
+ @overload
825
+ @classmethod
826
+ def from_code(
827
+ cls,
828
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
829
+ *args: object,
830
+ details: Any = None,
831
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
832
+ application_context: OptApplicationContext = None,
833
+ operation_id: OptUUID = None,
834
+ operation_context: Context,
835
+ operation_action: AnyResourceOperationAction,
836
+ resource: OptResource = None,
837
+ operation_timestamp: OptTimestamp = None,
838
+ operation_summary: OptStr = None,
839
+ connection_context: OptConnectionContext = None,
840
+ authentication: OptAnyAuthentication = None,
841
+ authorization: OptAnyAuthorization = None,
842
+ impersonation: OptImpersonation = None,
843
+ response: OptTooManyRequestsResponse = None,
844
+ ) -> TooManyRequests: ...
845
+ @overload
846
+ @classmethod
847
+ def from_code(
848
+ cls,
849
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
850
+ *args: object,
851
+ details: Any = None,
852
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
853
+ application_context: OptApplicationContext = None,
854
+ operation_id: OptUUID = None,
855
+ operation_context: Context,
856
+ operation_action: AnyResourceOperationAction,
857
+ resource: OptResource = None,
858
+ operation_timestamp: OptTimestamp = None,
859
+ operation_summary: OptStr = None,
860
+ connection_context: OptConnectionContext = None,
861
+ authentication: OptAnyAuthentication = None,
862
+ authorization: OptAnyAuthorization = None,
863
+ impersonation: OptImpersonation = None,
864
+ response: OptInternalServerErrorResponse = None,
865
+ ) -> InternalServerError: ...
866
+ @overload
867
+ @classmethod
868
+ def from_code(
869
+ cls,
870
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
871
+ *args: object,
872
+ details: Any = None,
873
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
874
+ application_context: OptApplicationContext = None,
875
+ operation_id: OptUUID = None,
876
+ operation_context: Context,
877
+ operation_action: AnyResourceOperationAction,
878
+ resource: OptResource = None,
879
+ operation_timestamp: OptTimestamp = None,
880
+ operation_summary: OptStr = None,
881
+ connection_context: OptConnectionContext = None,
882
+ authentication: OptAnyAuthentication = None,
883
+ authorization: OptAnyAuthorization = None,
884
+ impersonation: OptImpersonation = None,
885
+ response: OptNotImplementedResponse = None,
886
+ ) -> NotImplemented: ...
887
+ @overload
888
+ @classmethod
889
+ def from_code(
890
+ cls,
891
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
892
+ *args: object,
893
+ details: Any = None,
894
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
895
+ application_context: OptApplicationContext = None,
896
+ operation_id: OptUUID = None,
897
+ operation_context: Context,
898
+ operation_action: AnyResourceOperationAction,
899
+ resource: OptResource = None,
900
+ operation_timestamp: OptTimestamp = None,
901
+ operation_summary: OptStr = None,
902
+ connection_context: OptConnectionContext = None,
903
+ authentication: OptAnyAuthentication = None,
904
+ authorization: OptAnyAuthorization = None,
905
+ impersonation: OptImpersonation = None,
906
+ response: OptBadGatewayResponse = None,
907
+ ) -> BadGateway: ...
908
+ @overload
909
+ @classmethod
910
+ def from_code(
911
+ cls,
912
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
913
+ *args: object,
914
+ details: Any = None,
915
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
916
+ application_context: OptApplicationContext = None,
917
+ operation_id: OptUUID = None,
918
+ operation_context: Context,
919
+ operation_action: AnyResourceOperationAction,
920
+ resource: OptResource = None,
921
+ operation_timestamp: OptTimestamp = None,
922
+ operation_summary: OptStr = None,
923
+ connection_context: OptConnectionContext = None,
924
+ authentication: OptAnyAuthentication = None,
925
+ authorization: OptAnyAuthorization = None,
926
+ impersonation: OptImpersonation = None,
927
+ response: OptServiceUnavailableResponse = None,
928
+ ) -> ServiceUnavailable: ...
929
+
930
+ # Specific code, system operation
931
+ @overload
932
+ @classmethod
933
+ def from_code(
934
+ cls,
935
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
936
+ *args: object,
937
+ details: Any = None,
938
+ operation_type: Literal[OperationType.SYSTEM],
939
+ application_context: OptApplicationContext = None,
940
+ operation_id: OptUUID = None,
941
+ operation_context: Context,
942
+ operation_action: SystemOperationAction,
943
+ operation_timestamp: OptTimestamp = None,
944
+ operation_summary: OptStr = None,
945
+ connection_context: OptConnectionContext = None,
946
+ authentication: OptAnyAuthentication = None,
947
+ authorization: OptAnyAuthorization = None,
948
+ impersonation: OptImpersonation = None,
949
+ response: OptBadRequestResponse = None,
950
+ ) -> BadRequest: ...
951
+ @overload
952
+ @classmethod
953
+ def from_code(
954
+ cls,
955
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
956
+ *args: object,
957
+ details: Any = None,
958
+ operation_type: Literal[OperationType.SYSTEM],
959
+ application_context: OptApplicationContext = None,
960
+ operation_id: OptUUID = None,
961
+ operation_context: Context,
962
+ operation_action: SystemOperationAction,
963
+ operation_timestamp: OptTimestamp = None,
964
+ operation_summary: OptStr = None,
965
+ connection_context: OptConnectionContext = None,
966
+ authentication: OptAnyAuthentication = None,
967
+ authorization: OptAnyAuthorization = None,
968
+ impersonation: OptImpersonation = None,
969
+ response: OptUnauthorizedResponse = None,
970
+ ) -> Unauthorized: ...
971
+ @overload
972
+ @classmethod
973
+ def from_code(
974
+ cls,
975
+ code: Literal[ErrorCode.FORBIDDEN, 403],
976
+ *args: object,
977
+ details: Any = None,
978
+ operation_type: Literal[OperationType.SYSTEM],
979
+ application_context: OptApplicationContext = None,
980
+ operation_id: OptUUID = None,
981
+ operation_context: Context,
982
+ operation_action: SystemOperationAction,
983
+ operation_timestamp: OptTimestamp = None,
984
+ operation_summary: OptStr = None,
985
+ connection_context: OptConnectionContext = None,
986
+ authentication: OptAnyAuthentication = None,
987
+ authorization: OptAnyAuthorization = None,
988
+ impersonation: OptImpersonation = None,
989
+ response: OptForbiddenResponse = None,
990
+ ) -> Forbidden: ...
991
+ @overload
992
+ @classmethod
993
+ def from_code(
994
+ cls,
995
+ code: Literal[ErrorCode.NOT_FOUND, 404],
996
+ *args: object,
997
+ details: Any = None,
998
+ operation_type: Literal[OperationType.SYSTEM],
999
+ application_context: OptApplicationContext = None,
1000
+ operation_id: OptUUID = None,
1001
+ operation_context: Context,
1002
+ operation_action: SystemOperationAction,
1003
+ operation_timestamp: OptTimestamp = None,
1004
+ operation_summary: OptStr = None,
1005
+ connection_context: OptConnectionContext = None,
1006
+ authentication: OptAnyAuthentication = None,
1007
+ authorization: OptAnyAuthorization = None,
1008
+ impersonation: OptImpersonation = None,
1009
+ response: OptNotFoundResponse = None,
1010
+ ) -> NotFound: ...
1011
+ @overload
1012
+ @classmethod
1013
+ def from_code(
1014
+ cls,
1015
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
1016
+ *args: object,
1017
+ details: Any = None,
1018
+ operation_type: Literal[OperationType.SYSTEM],
1019
+ application_context: OptApplicationContext = None,
1020
+ operation_id: OptUUID = None,
1021
+ operation_context: Context,
1022
+ operation_action: SystemOperationAction,
1023
+ operation_timestamp: OptTimestamp = None,
1024
+ operation_summary: OptStr = None,
1025
+ connection_context: OptConnectionContext = None,
1026
+ authentication: OptAnyAuthentication = None,
1027
+ authorization: OptAnyAuthorization = None,
1028
+ impersonation: OptImpersonation = None,
1029
+ response: OptMethodNotAllowedResponse = None,
1030
+ ) -> MethodNotAllowed: ...
1031
+ @overload
1032
+ @classmethod
1033
+ def from_code(
1034
+ cls,
1035
+ code: Literal[ErrorCode.CONFLICT, 409],
1036
+ *args: object,
1037
+ details: Any = None,
1038
+ operation_type: Literal[OperationType.SYSTEM],
1039
+ application_context: OptApplicationContext = None,
1040
+ operation_id: OptUUID = None,
1041
+ operation_context: Context,
1042
+ operation_action: SystemOperationAction,
1043
+ operation_timestamp: OptTimestamp = None,
1044
+ operation_summary: OptStr = None,
1045
+ connection_context: OptConnectionContext = None,
1046
+ authentication: OptAnyAuthentication = None,
1047
+ authorization: OptAnyAuthorization = None,
1048
+ impersonation: OptImpersonation = None,
1049
+ response: OptConflictResponse = None,
1050
+ ) -> Conflict: ...
1051
+ @overload
1052
+ @classmethod
1053
+ def from_code(
1054
+ cls,
1055
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
1056
+ *args: object,
1057
+ details: Any = None,
1058
+ operation_type: Literal[OperationType.SYSTEM],
1059
+ application_context: OptApplicationContext = None,
1060
+ operation_id: OptUUID = None,
1061
+ operation_context: Context,
1062
+ operation_action: SystemOperationAction,
1063
+ operation_timestamp: OptTimestamp = None,
1064
+ operation_summary: OptStr = None,
1065
+ connection_context: OptConnectionContext = None,
1066
+ authentication: OptAnyAuthentication = None,
1067
+ authorization: OptAnyAuthorization = None,
1068
+ impersonation: OptImpersonation = None,
1069
+ response: OptUnprocessableEntityResponse = None,
1070
+ ) -> UnprocessableEntity: ...
1071
+ @overload
1072
+ @classmethod
1073
+ def from_code(
1074
+ cls,
1075
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
1076
+ *args: object,
1077
+ details: Any = None,
1078
+ operation_type: Literal[OperationType.SYSTEM],
1079
+ application_context: OptApplicationContext = None,
1080
+ operation_id: OptUUID = None,
1081
+ operation_context: Context,
1082
+ operation_action: SystemOperationAction,
1083
+ operation_timestamp: OptTimestamp = None,
1084
+ operation_summary: OptStr = None,
1085
+ connection_context: OptConnectionContext = None,
1086
+ authentication: OptAnyAuthentication = None,
1087
+ authorization: OptAnyAuthorization = None,
1088
+ impersonation: OptImpersonation = None,
1089
+ response: OptTooManyRequestsResponse = None,
1090
+ ) -> TooManyRequests: ...
1091
+ @overload
1092
+ @classmethod
1093
+ def from_code(
1094
+ cls,
1095
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
1096
+ *args: object,
1097
+ details: Any = None,
1098
+ operation_type: Literal[OperationType.SYSTEM],
1099
+ application_context: OptApplicationContext = None,
1100
+ operation_id: OptUUID = None,
1101
+ operation_context: Context,
1102
+ operation_action: SystemOperationAction,
1103
+ operation_timestamp: OptTimestamp = None,
1104
+ operation_summary: OptStr = None,
1105
+ connection_context: OptConnectionContext = None,
1106
+ authentication: OptAnyAuthentication = None,
1107
+ authorization: OptAnyAuthorization = None,
1108
+ impersonation: OptImpersonation = None,
1109
+ response: OptInternalServerErrorResponse = None,
1110
+ ) -> InternalServerError: ...
1111
+ @overload
1112
+ @classmethod
1113
+ def from_code(
1114
+ cls,
1115
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
1116
+ *args: object,
1117
+ details: Any = None,
1118
+ operation_type: Literal[OperationType.SYSTEM],
1119
+ application_context: OptApplicationContext = None,
1120
+ operation_id: OptUUID = None,
1121
+ operation_context: Context,
1122
+ operation_action: SystemOperationAction,
1123
+ operation_timestamp: OptTimestamp = None,
1124
+ operation_summary: OptStr = None,
1125
+ connection_context: OptConnectionContext = None,
1126
+ authentication: OptAnyAuthentication = None,
1127
+ authorization: OptAnyAuthorization = None,
1128
+ impersonation: OptImpersonation = None,
1129
+ response: OptNotImplementedResponse = None,
1130
+ ) -> NotImplemented: ...
1131
+ @overload
1132
+ @classmethod
1133
+ def from_code(
1134
+ cls,
1135
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
1136
+ *args: object,
1137
+ details: Any = None,
1138
+ operation_type: Literal[OperationType.SYSTEM],
1139
+ application_context: OptApplicationContext = None,
1140
+ operation_id: OptUUID = None,
1141
+ operation_context: Context,
1142
+ operation_action: SystemOperationAction,
1143
+ operation_timestamp: OptTimestamp = None,
1144
+ operation_summary: OptStr = None,
1145
+ connection_context: OptConnectionContext = None,
1146
+ authentication: OptAnyAuthentication = None,
1147
+ authorization: OptAnyAuthorization = None,
1148
+ impersonation: OptImpersonation = None,
1149
+ response: OptBadGatewayResponse = None,
1150
+ ) -> BadGateway: ...
1151
+ @overload
1152
+ @classmethod
1153
+ def from_code(
1154
+ cls,
1155
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
1156
+ *args: object,
1157
+ details: Any = None,
1158
+ operation_type: Literal[OperationType.SYSTEM],
1159
+ application_context: OptApplicationContext = None,
1160
+ operation_id: OptUUID = None,
1161
+ operation_context: Context,
1162
+ operation_action: SystemOperationAction,
1163
+ operation_timestamp: OptTimestamp = None,
1164
+ operation_summary: OptStr = None,
1165
+ connection_context: OptConnectionContext = None,
1166
+ authentication: OptAnyAuthentication = None,
1167
+ authorization: OptAnyAuthorization = None,
1168
+ impersonation: OptImpersonation = None,
1169
+ response: OptServiceUnavailableResponse = None,
1170
+ ) -> ServiceUnavailable: ...
1171
+
1172
+ # Specific code, websocket operation
1173
+ @overload
1174
+ @classmethod
1175
+ def from_code(
1176
+ cls,
1177
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
1178
+ *args: object,
1179
+ details: Any = None,
1180
+ operation_type: Literal[OperationType.WEBSOCKET],
1181
+ application_context: OptApplicationContext = None,
1182
+ operation_id: OptUUID = None,
1183
+ operation_context: Context,
1184
+ operation_action: WebSocketOperationAction,
1185
+ operation_timestamp: OptTimestamp = None,
1186
+ operation_summary: OptStr = None,
1187
+ connection_context: OptConnectionContext = None,
1188
+ authentication: OptAnyAuthentication = None,
1189
+ authorization: OptAnyAuthorization = None,
1190
+ impersonation: OptImpersonation = None,
1191
+ response: OptBadRequestResponse = None,
1192
+ ) -> BadRequest: ...
1193
+ @overload
1194
+ @classmethod
1195
+ def from_code(
1196
+ cls,
1197
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
1198
+ *args: object,
1199
+ details: Any = None,
1200
+ operation_type: Literal[OperationType.WEBSOCKET],
1201
+ application_context: OptApplicationContext = None,
1202
+ operation_id: OptUUID = None,
1203
+ operation_context: Context,
1204
+ operation_action: WebSocketOperationAction,
1205
+ operation_timestamp: OptTimestamp = None,
1206
+ operation_summary: OptStr = None,
1207
+ connection_context: OptConnectionContext = None,
1208
+ authentication: OptAnyAuthentication = None,
1209
+ authorization: OptAnyAuthorization = None,
1210
+ impersonation: OptImpersonation = None,
1211
+ response: OptUnauthorizedResponse = None,
1212
+ ) -> Unauthorized: ...
1213
+ @overload
1214
+ @classmethod
1215
+ def from_code(
1216
+ cls,
1217
+ code: Literal[ErrorCode.FORBIDDEN, 403],
1218
+ *args: object,
1219
+ details: Any = None,
1220
+ operation_type: Literal[OperationType.WEBSOCKET],
1221
+ application_context: OptApplicationContext = None,
1222
+ operation_id: OptUUID = None,
1223
+ operation_context: Context,
1224
+ operation_action: WebSocketOperationAction,
1225
+ operation_timestamp: OptTimestamp = None,
1226
+ operation_summary: OptStr = None,
1227
+ connection_context: OptConnectionContext = None,
1228
+ authentication: OptAnyAuthentication = None,
1229
+ authorization: OptAnyAuthorization = None,
1230
+ impersonation: OptImpersonation = None,
1231
+ response: OptForbiddenResponse = None,
1232
+ ) -> Forbidden: ...
1233
+ @overload
1234
+ @classmethod
1235
+ def from_code(
1236
+ cls,
1237
+ code: Literal[ErrorCode.NOT_FOUND, 404],
1238
+ *args: object,
1239
+ details: Any = None,
1240
+ operation_type: Literal[OperationType.WEBSOCKET],
1241
+ application_context: OptApplicationContext = None,
1242
+ operation_id: OptUUID = None,
1243
+ operation_context: Context,
1244
+ operation_action: WebSocketOperationAction,
1245
+ operation_timestamp: OptTimestamp = None,
1246
+ operation_summary: OptStr = None,
1247
+ connection_context: OptConnectionContext = None,
1248
+ authentication: OptAnyAuthentication = None,
1249
+ authorization: OptAnyAuthorization = None,
1250
+ impersonation: OptImpersonation = None,
1251
+ response: OptNotFoundResponse = None,
1252
+ ) -> NotFound: ...
1253
+ @overload
1254
+ @classmethod
1255
+ def from_code(
1256
+ cls,
1257
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
1258
+ *args: object,
1259
+ details: Any = None,
1260
+ operation_type: Literal[OperationType.WEBSOCKET],
1261
+ application_context: OptApplicationContext = None,
1262
+ operation_id: OptUUID = None,
1263
+ operation_context: Context,
1264
+ operation_action: WebSocketOperationAction,
1265
+ operation_timestamp: OptTimestamp = None,
1266
+ operation_summary: OptStr = None,
1267
+ connection_context: OptConnectionContext = None,
1268
+ authentication: OptAnyAuthentication = None,
1269
+ authorization: OptAnyAuthorization = None,
1270
+ impersonation: OptImpersonation = None,
1271
+ response: OptMethodNotAllowedResponse = None,
1272
+ ) -> MethodNotAllowed: ...
1273
+ @overload
1274
+ @classmethod
1275
+ def from_code(
1276
+ cls,
1277
+ code: Literal[ErrorCode.CONFLICT, 409],
1278
+ *args: object,
1279
+ details: Any = None,
1280
+ operation_type: Literal[OperationType.WEBSOCKET],
1281
+ application_context: OptApplicationContext = None,
1282
+ operation_id: OptUUID = None,
1283
+ operation_context: Context,
1284
+ operation_action: WebSocketOperationAction,
1285
+ operation_timestamp: OptTimestamp = None,
1286
+ operation_summary: OptStr = None,
1287
+ connection_context: OptConnectionContext = None,
1288
+ authentication: OptAnyAuthentication = None,
1289
+ authorization: OptAnyAuthorization = None,
1290
+ impersonation: OptImpersonation = None,
1291
+ response: OptConflictResponse = None,
1292
+ ) -> Conflict: ...
1293
+ @overload
1294
+ @classmethod
1295
+ def from_code(
1296
+ cls,
1297
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
1298
+ *args: object,
1299
+ details: Any = None,
1300
+ operation_type: Literal[OperationType.WEBSOCKET],
1301
+ application_context: OptApplicationContext = None,
1302
+ operation_id: OptUUID = None,
1303
+ operation_context: Context,
1304
+ operation_action: WebSocketOperationAction,
1305
+ operation_timestamp: OptTimestamp = None,
1306
+ operation_summary: OptStr = None,
1307
+ connection_context: OptConnectionContext = None,
1308
+ authentication: OptAnyAuthentication = None,
1309
+ authorization: OptAnyAuthorization = None,
1310
+ impersonation: OptImpersonation = None,
1311
+ response: OptUnprocessableEntityResponse = None,
1312
+ ) -> UnprocessableEntity: ...
1313
+ @overload
1314
+ @classmethod
1315
+ def from_code(
1316
+ cls,
1317
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
1318
+ *args: object,
1319
+ details: Any = None,
1320
+ operation_type: Literal[OperationType.WEBSOCKET],
1321
+ application_context: OptApplicationContext = None,
1322
+ operation_id: OptUUID = None,
1323
+ operation_context: Context,
1324
+ operation_action: WebSocketOperationAction,
1325
+ operation_timestamp: OptTimestamp = None,
1326
+ operation_summary: OptStr = None,
1327
+ connection_context: OptConnectionContext = None,
1328
+ authentication: OptAnyAuthentication = None,
1329
+ authorization: OptAnyAuthorization = None,
1330
+ impersonation: OptImpersonation = None,
1331
+ response: OptTooManyRequestsResponse = None,
1332
+ ) -> TooManyRequests: ...
1333
+ @overload
1334
+ @classmethod
1335
+ def from_code(
1336
+ cls,
1337
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
1338
+ *args: object,
1339
+ details: Any = None,
1340
+ operation_type: Literal[OperationType.WEBSOCKET],
1341
+ application_context: OptApplicationContext = None,
1342
+ operation_id: OptUUID = None,
1343
+ operation_context: Context,
1344
+ operation_action: WebSocketOperationAction,
1345
+ operation_timestamp: OptTimestamp = None,
1346
+ operation_summary: OptStr = None,
1347
+ connection_context: OptConnectionContext = None,
1348
+ authentication: OptAnyAuthentication = None,
1349
+ authorization: OptAnyAuthorization = None,
1350
+ impersonation: OptImpersonation = None,
1351
+ response: OptInternalServerErrorResponse = None,
1352
+ ) -> InternalServerError: ...
1353
+ @overload
1354
+ @classmethod
1355
+ def from_code(
1356
+ cls,
1357
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
1358
+ *args: object,
1359
+ details: Any = None,
1360
+ operation_type: Literal[OperationType.WEBSOCKET],
1361
+ application_context: OptApplicationContext = None,
1362
+ operation_id: OptUUID = None,
1363
+ operation_context: Context,
1364
+ operation_action: WebSocketOperationAction,
1365
+ operation_timestamp: OptTimestamp = None,
1366
+ operation_summary: OptStr = None,
1367
+ connection_context: OptConnectionContext = None,
1368
+ authentication: OptAnyAuthentication = None,
1369
+ authorization: OptAnyAuthorization = None,
1370
+ impersonation: OptImpersonation = None,
1371
+ response: OptNotImplementedResponse = None,
1372
+ ) -> NotImplemented: ...
1373
+ @overload
1374
+ @classmethod
1375
+ def from_code(
1376
+ cls,
1377
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
1378
+ *args: object,
1379
+ details: Any = None,
1380
+ operation_type: Literal[OperationType.WEBSOCKET],
1381
+ application_context: OptApplicationContext = None,
1382
+ operation_id: OptUUID = None,
1383
+ operation_context: Context,
1384
+ operation_action: WebSocketOperationAction,
1385
+ operation_timestamp: OptTimestamp = None,
1386
+ operation_summary: OptStr = None,
1387
+ connection_context: OptConnectionContext = None,
1388
+ authentication: OptAnyAuthentication = None,
1389
+ authorization: OptAnyAuthorization = None,
1390
+ impersonation: OptImpersonation = None,
1391
+ response: OptBadGatewayResponse = None,
1392
+ ) -> BadGateway: ...
1393
+ @overload
1394
+ @classmethod
1395
+ def from_code(
1396
+ cls,
1397
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
1398
+ *args: object,
1399
+ details: Any = None,
1400
+ operation_type: Literal[OperationType.WEBSOCKET],
1401
+ application_context: OptApplicationContext = None,
1402
+ operation_id: OptUUID = None,
1403
+ operation_context: Context,
1404
+ operation_action: WebSocketOperationAction,
1405
+ operation_timestamp: OptTimestamp = None,
1406
+ operation_summary: OptStr = None,
1407
+ connection_context: OptConnectionContext = None,
1408
+ authentication: OptAnyAuthentication = None,
1409
+ authorization: OptAnyAuthorization = None,
1410
+ impersonation: OptImpersonation = None,
1411
+ response: OptServiceUnavailableResponse = None,
1412
+ ) -> ServiceUnavailable: ...
1413
+
1414
+ # Specific code, any operation_type
1415
+ @overload
1416
+ @classmethod
1417
+ def from_code(
1418
+ cls,
1419
+ code: Literal[ErrorCode.BAD_REQUEST, 400],
1420
+ *args: object,
1421
+ details: Any = None,
1422
+ operation_type: OperationType,
1423
+ application_context: OptApplicationContext = None,
1424
+ operation_id: OptUUID = None,
1425
+ operation_context: Context,
1426
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1427
+ resource: OptResource = None,
1428
+ operation_timestamp: OptTimestamp = None,
1429
+ operation_summary: OptStr = None,
1430
+ connection_context: OptConnectionContext = None,
1431
+ authentication: OptAnyAuthentication = None,
1432
+ authorization: OptAnyAuthorization = None,
1433
+ impersonation: OptImpersonation = None,
1434
+ response: OptBadRequestResponse = None,
1435
+ ) -> BadRequest: ...
1436
+ @overload
1437
+ @classmethod
1438
+ def from_code(
1439
+ cls,
1440
+ code: Literal[ErrorCode.UNAUTHORIZED, 401],
1441
+ *args: object,
1442
+ details: Any = None,
1443
+ operation_type: OperationType,
1444
+ application_context: OptApplicationContext = None,
1445
+ operation_id: OptUUID = None,
1446
+ operation_context: Context,
1447
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1448
+ resource: OptResource = None,
1449
+ operation_timestamp: OptTimestamp = None,
1450
+ operation_summary: OptStr = None,
1451
+ connection_context: OptConnectionContext = None,
1452
+ authentication: OptAnyAuthentication = None,
1453
+ authorization: OptAnyAuthorization = None,
1454
+ impersonation: OptImpersonation = None,
1455
+ response: OptUnauthorizedResponse = None,
1456
+ ) -> Unauthorized: ...
1457
+ @overload
1458
+ @classmethod
1459
+ def from_code(
1460
+ cls,
1461
+ code: Literal[ErrorCode.FORBIDDEN, 403],
1462
+ *args: object,
1463
+ details: Any = None,
1464
+ operation_type: OperationType,
1465
+ application_context: OptApplicationContext = None,
1466
+ operation_id: OptUUID = None,
1467
+ operation_context: Context,
1468
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1469
+ resource: OptResource = None,
1470
+ operation_timestamp: OptTimestamp = None,
1471
+ operation_summary: OptStr = None,
1472
+ connection_context: OptConnectionContext = None,
1473
+ authentication: OptAnyAuthentication = None,
1474
+ authorization: OptAnyAuthorization = None,
1475
+ impersonation: OptImpersonation = None,
1476
+ response: OptForbiddenResponse = None,
1477
+ ) -> Forbidden: ...
1478
+ @overload
1479
+ @classmethod
1480
+ def from_code(
1481
+ cls,
1482
+ code: Literal[ErrorCode.NOT_FOUND, 404],
1483
+ *args: object,
1484
+ details: Any = None,
1485
+ operation_type: OperationType,
1486
+ application_context: OptApplicationContext = None,
1487
+ operation_id: OptUUID = None,
1488
+ operation_context: Context,
1489
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1490
+ resource: OptResource = None,
1491
+ operation_timestamp: OptTimestamp = None,
1492
+ operation_summary: OptStr = None,
1493
+ connection_context: OptConnectionContext = None,
1494
+ authentication: OptAnyAuthentication = None,
1495
+ authorization: OptAnyAuthorization = None,
1496
+ impersonation: OptImpersonation = None,
1497
+ response: OptNotFoundResponse = None,
1498
+ ) -> NotFound: ...
1499
+ @overload
1500
+ @classmethod
1501
+ def from_code(
1502
+ cls,
1503
+ code: Literal[ErrorCode.METHOD_NOT_ALLOWED, 405],
1504
+ *args: object,
1505
+ details: Any = None,
1506
+ operation_type: OperationType,
1507
+ application_context: OptApplicationContext = None,
1508
+ operation_id: OptUUID = None,
1509
+ operation_context: Context,
1510
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1511
+ resource: OptResource = None,
1512
+ operation_timestamp: OptTimestamp = None,
1513
+ operation_summary: OptStr = None,
1514
+ connection_context: OptConnectionContext = None,
1515
+ authentication: OptAnyAuthentication = None,
1516
+ authorization: OptAnyAuthorization = None,
1517
+ impersonation: OptImpersonation = None,
1518
+ response: OptMethodNotAllowedResponse = None,
1519
+ ) -> MethodNotAllowed: ...
1520
+ @overload
1521
+ @classmethod
1522
+ def from_code(
1523
+ cls,
1524
+ code: Literal[ErrorCode.CONFLICT, 409],
1525
+ *args: object,
1526
+ details: Any = None,
1527
+ operation_type: OperationType,
1528
+ application_context: OptApplicationContext = None,
1529
+ operation_id: OptUUID = None,
1530
+ operation_context: Context,
1531
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1532
+ resource: OptResource = None,
1533
+ operation_timestamp: OptTimestamp = None,
1534
+ operation_summary: OptStr = None,
1535
+ connection_context: OptConnectionContext = None,
1536
+ authentication: OptAnyAuthentication = None,
1537
+ authorization: OptAnyAuthorization = None,
1538
+ impersonation: OptImpersonation = None,
1539
+ response: OptConflictResponse = None,
1540
+ ) -> Conflict: ...
1541
+ @overload
1542
+ @classmethod
1543
+ def from_code(
1544
+ cls,
1545
+ code: Literal[ErrorCode.UNPROCESSABLE_ENTITY, 422],
1546
+ *args: object,
1547
+ details: Any = None,
1548
+ operation_type: OperationType,
1549
+ application_context: OptApplicationContext = None,
1550
+ operation_id: OptUUID = None,
1551
+ operation_context: Context,
1552
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1553
+ resource: OptResource = None,
1554
+ operation_timestamp: OptTimestamp = None,
1555
+ operation_summary: OptStr = None,
1556
+ connection_context: OptConnectionContext = None,
1557
+ authentication: OptAnyAuthentication = None,
1558
+ authorization: OptAnyAuthorization = None,
1559
+ impersonation: OptImpersonation = None,
1560
+ response: OptUnprocessableEntityResponse = None,
1561
+ ) -> UnprocessableEntity: ...
1562
+ @overload
1563
+ @classmethod
1564
+ def from_code(
1565
+ cls,
1566
+ code: Literal[ErrorCode.TOO_MANY_REQUESTS, 429],
1567
+ *args: object,
1568
+ details: Any = None,
1569
+ operation_type: OperationType,
1570
+ application_context: OptApplicationContext = None,
1571
+ operation_id: OptUUID = None,
1572
+ operation_context: Context,
1573
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1574
+ resource: OptResource = None,
1575
+ operation_timestamp: OptTimestamp = None,
1576
+ operation_summary: OptStr = None,
1577
+ connection_context: OptConnectionContext = None,
1578
+ authentication: OptAnyAuthentication = None,
1579
+ authorization: OptAnyAuthorization = None,
1580
+ impersonation: OptImpersonation = None,
1581
+ response: OptTooManyRequestsResponse = None,
1582
+ ) -> TooManyRequests: ...
1583
+ @overload
1584
+ @classmethod
1585
+ def from_code(
1586
+ cls,
1587
+ code: Literal[ErrorCode.INTERNAL_SERVER_ERROR, 500],
1588
+ *args: object,
1589
+ details: Any = None,
1590
+ operation_type: OperationType,
1591
+ application_context: OptApplicationContext = None,
1592
+ operation_id: OptUUID = None,
1593
+ operation_context: Context,
1594
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1595
+ resource: OptResource = None,
1596
+ operation_timestamp: OptTimestamp = None,
1597
+ operation_summary: OptStr = None,
1598
+ connection_context: OptConnectionContext = None,
1599
+ authentication: OptAnyAuthentication = None,
1600
+ authorization: OptAnyAuthorization = None,
1601
+ impersonation: OptImpersonation = None,
1602
+ response: OptInternalServerErrorResponse = None,
1603
+ ) -> InternalServerError: ...
1604
+ @overload
1605
+ @classmethod
1606
+ def from_code(
1607
+ cls,
1608
+ code: Literal[ErrorCode.NOT_IMPLEMENTED, 501],
1609
+ *args: object,
1610
+ details: Any = None,
1611
+ operation_type: OperationType,
1612
+ application_context: OptApplicationContext = None,
1613
+ operation_id: OptUUID = None,
1614
+ operation_context: Context,
1615
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1616
+ resource: OptResource = None,
1617
+ operation_timestamp: OptTimestamp = None,
1618
+ operation_summary: OptStr = None,
1619
+ connection_context: OptConnectionContext = None,
1620
+ authentication: OptAnyAuthentication = None,
1621
+ authorization: OptAnyAuthorization = None,
1622
+ impersonation: OptImpersonation = None,
1623
+ response: OptNotImplementedResponse = None,
1624
+ ) -> NotImplemented: ...
1625
+ @overload
1626
+ @classmethod
1627
+ def from_code(
1628
+ cls,
1629
+ code: Literal[ErrorCode.BAD_GATEWAY, 502],
1630
+ *args: object,
1631
+ details: Any = None,
1632
+ operation_type: OperationType,
1633
+ application_context: OptApplicationContext = None,
1634
+ operation_id: OptUUID = None,
1635
+ operation_context: Context,
1636
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1637
+ resource: OptResource = None,
1638
+ operation_timestamp: OptTimestamp = None,
1639
+ operation_summary: OptStr = None,
1640
+ connection_context: OptConnectionContext = None,
1641
+ authentication: OptAnyAuthentication = None,
1642
+ authorization: OptAnyAuthorization = None,
1643
+ impersonation: OptImpersonation = None,
1644
+ response: OptBadGatewayResponse = None,
1645
+ ) -> BadGateway: ...
1646
+ @overload
1647
+ @classmethod
1648
+ def from_code(
1649
+ cls,
1650
+ code: Literal[ErrorCode.SERVICE_UNAVAILABLE, 503],
1651
+ *args: object,
1652
+ details: Any = None,
1653
+ operation_type: OperationType,
1654
+ application_context: OptApplicationContext = None,
1655
+ operation_id: OptUUID = None,
1656
+ operation_context: Context,
1657
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1658
+ resource: OptResource = None,
1659
+ operation_timestamp: OptTimestamp = None,
1660
+ operation_summary: OptStr = None,
1661
+ connection_context: OptConnectionContext = None,
1662
+ authentication: OptAnyAuthentication = None,
1663
+ authorization: OptAnyAuthorization = None,
1664
+ impersonation: OptImpersonation = None,
1665
+ response: OptServiceUnavailableResponse = None,
1666
+ ) -> ServiceUnavailable: ...
1667
+
1668
+ # Any code, specific operation_type
1669
+ @overload
1670
+ @classmethod
1671
+ def from_code(
1672
+ cls,
1673
+ code: ErrorCode | int,
1674
+ *args: object,
1675
+ details: Any = None,
1676
+ operation_type: Literal[OperationType.REQUEST],
1677
+ application_context: OptApplicationContext = None,
1678
+ operation_id: OptUUID = None,
1679
+ operation_context: Context,
1680
+ operation_action: AnyResourceOperationAction,
1681
+ operation_timestamp: OptTimestamp = None,
1682
+ operation_summary: OptStr = None,
1683
+ connection_context: ConnectionContext,
1684
+ authentication: OptAnyAuthentication = None,
1685
+ authorization: OptAnyAuthorization = None,
1686
+ impersonation: OptImpersonation = None,
1687
+ response: OptAnyErrorResponse = None,
1688
+ ) -> AnyException: ...
1689
+ @overload
1690
+ @classmethod
1691
+ def from_code(
1692
+ cls,
1693
+ code: ErrorCode | int,
1694
+ *args: object,
1695
+ details: Any = None,
1696
+ operation_type: Literal[OperationType.RESOURCE],
1697
+ application_context: OptApplicationContext = None,
1698
+ operation_id: OptUUID = None,
1699
+ operation_context: Context,
1700
+ operation_action: AnyResourceOperationAction,
1701
+ resource: Resource,
1702
+ operation_timestamp: OptTimestamp = None,
1703
+ operation_summary: OptStr = None,
1704
+ connection_context: OptConnectionContext = None,
1705
+ authentication: OptAnyAuthentication = None,
1706
+ authorization: OptAnyAuthorization = None,
1707
+ impersonation: OptImpersonation = None,
1708
+ response: OptAnyErrorResponse = None,
1709
+ ) -> AnyException: ...
1710
+ @overload
1711
+ @classmethod
1712
+ def from_code(
1713
+ cls,
1714
+ code: ErrorCode | int,
1715
+ *args: object,
1716
+ details: Any = None,
1717
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
1718
+ application_context: OptApplicationContext = None,
1719
+ operation_id: OptUUID = None,
1720
+ operation_context: Context,
1721
+ operation_action: AnyResourceOperationAction,
1722
+ resource: OptResource = None,
1723
+ operation_timestamp: OptTimestamp = None,
1724
+ operation_summary: OptStr = None,
1725
+ connection_context: OptConnectionContext = None,
1726
+ authentication: OptAnyAuthentication = None,
1727
+ authorization: OptAnyAuthorization = None,
1728
+ impersonation: OptImpersonation = None,
1729
+ response: OptAnyErrorResponse = None,
1730
+ ) -> AnyException: ...
1731
+ @overload
1732
+ @classmethod
1733
+ def from_code(
1734
+ cls,
1735
+ code: ErrorCode | int,
1736
+ *args: object,
1737
+ details: Any = None,
1738
+ operation_type: Literal[OperationType.SYSTEM],
1739
+ application_context: OptApplicationContext = None,
1740
+ operation_id: OptUUID = None,
1741
+ operation_context: Context,
1742
+ operation_action: SystemOperationAction,
1743
+ operation_timestamp: OptTimestamp = None,
1744
+ operation_summary: OptStr = None,
1745
+ connection_context: OptConnectionContext = None,
1746
+ authentication: OptAnyAuthentication = None,
1747
+ authorization: OptAnyAuthorization = None,
1748
+ impersonation: OptImpersonation = None,
1749
+ response: OptAnyErrorResponse = None,
1750
+ ) -> AnyException: ...
1751
+ @overload
1752
+ @classmethod
1753
+ def from_code(
1754
+ cls,
1755
+ code: ErrorCode | int,
1756
+ *args: object,
1757
+ details: Any = None,
1758
+ operation_type: Literal[OperationType.WEBSOCKET],
1759
+ application_context: OptApplicationContext = None,
1760
+ operation_id: OptUUID = None,
1761
+ operation_context: Context,
1762
+ operation_action: WebSocketOperationAction,
1763
+ operation_timestamp: OptTimestamp = None,
1764
+ operation_summary: OptStr = None,
1765
+ connection_context: OptConnectionContext = None,
1766
+ authentication: OptAnyAuthentication = None,
1767
+ authorization: OptAnyAuthorization = None,
1768
+ impersonation: OptImpersonation = None,
1769
+ response: OptAnyErrorResponse = None,
1770
+ ) -> AnyException: ...
1771
+
1772
+ # Catch all
1773
+ @overload
1774
+ @classmethod
1775
+ def from_code(
1776
+ cls,
1777
+ code: ErrorCode | int,
1778
+ *args: object,
1779
+ details: Any = None,
1780
+ operation_type: OperationType,
1781
+ application_context: OptApplicationContext = None,
1782
+ operation_id: OptUUID = None,
1783
+ operation_context: Context,
1784
+ operation_action: AnyResourceOperationAction | SystemOperationAction,
1785
+ resource: OptResource = None,
1786
+ operation_timestamp: OptTimestamp = None,
1787
+ operation_summary: OptStr = None,
1788
+ connection_context: OptConnectionContext = None,
1789
+ authentication: OptAnyAuthentication = None,
1790
+ authorization: OptAnyAuthorization = None,
1791
+ impersonation: OptImpersonation = None,
1792
+ response: OptAnyErrorResponse = None,
1793
+ ) -> AnyException: ...
1794
+ @classmethod
1795
+ def from_code(
1796
+ cls,
1797
+ code: ErrorCode | int,
1798
+ *args: object,
1799
+ details: Any = None,
1800
+ operation_type: OperationType,
1801
+ application_context: OptApplicationContext = None,
1802
+ operation_id: OptUUID = None,
1803
+ operation_context: Context,
1804
+ operation_action: (
1805
+ AnyResourceOperationAction
1806
+ | SystemOperationAction
1807
+ | WebSocketOperationAction
1808
+ ),
1809
+ resource: OptResource = None,
1810
+ operation_timestamp: OptTimestamp = None,
1811
+ operation_summary: OptStr = None,
1812
+ connection_context: OptConnectionContext = None,
1813
+ authentication: OptAnyAuthentication = None,
1814
+ authorization: OptAnyAuthorization = None,
1815
+ impersonation: OptImpersonation = None,
1816
+ response: OptAnyErrorResponse = None,
1817
+ ) -> AnyException:
1818
+ exception_cls = cls.cls_from_code(code)
1819
+
1820
+ exception = exception_cls(
1821
+ *args,
1822
+ details=details,
1823
+ operation_type=operation_type,
1824
+ application_context=application_context,
1825
+ operation_id=operation_id,
1826
+ operation_context=operation_context,
1827
+ operation_action=operation_action,
1828
+ resource=resource,
1829
+ operation_timestamp=operation_timestamp,
1830
+ operation_summary=operation_summary,
1831
+ connection_context=connection_context,
1832
+ authentication=authentication,
1833
+ authorization=authorization,
1834
+ impersonation=impersonation,
1835
+ response=response,
1836
+ )
1837
+
1838
+ return exception
1839
+
1840
+ @overload
1841
+ @classmethod
1842
+ def from_httpx(
1843
+ cls,
1844
+ response: httpx.Response,
1845
+ *,
1846
+ operation_type: Literal[OperationType.REQUEST],
1847
+ application_context: OptApplicationContext = None,
1848
+ operation_id: OptUUID = None,
1849
+ operation_context: Context,
1850
+ operation_action: AnyResourceOperationAction,
1851
+ operation_timestamp: OptTimestamp = None,
1852
+ operation_summary: OptStr = None,
1853
+ connection_context: OptConnectionContext = None,
1854
+ authentication: OptAnyAuthentication = None,
1855
+ authorization: OptAnyAuthorization = None,
1856
+ impersonation: OptImpersonation = None,
1857
+ logger: Base,
1858
+ ) -> AnyException: ...
1859
+ @overload
1860
+ @classmethod
1861
+ def from_httpx(
1862
+ cls,
1863
+ response: httpx.Response,
1864
+ *,
1865
+ operation_type: Literal[OperationType.RESOURCE],
1866
+ application_context: OptApplicationContext = None,
1867
+ operation_id: OptUUID = None,
1868
+ operation_context: Context,
1869
+ operation_action: AnyResourceOperationAction,
1870
+ resource: Resource,
1871
+ operation_timestamp: OptTimestamp = None,
1872
+ operation_summary: OptStr = None,
1873
+ connection_context: OptConnectionContext = None,
1874
+ authentication: OptAnyAuthentication = None,
1875
+ authorization: OptAnyAuthorization = None,
1876
+ impersonation: OptImpersonation = None,
1877
+ logger: Base,
1878
+ ) -> AnyException: ...
1879
+ @classmethod
1880
+ def from_httpx(
1881
+ cls,
1882
+ response: httpx.Response,
1883
+ *,
1884
+ operation_type: Literal[OperationType.REQUEST, OperationType.RESOURCE],
1885
+ application_context: OptApplicationContext = None,
1886
+ operation_id: OptUUID = None,
1887
+ operation_context: Context,
1888
+ operation_action: AnyResourceOperationAction,
1889
+ resource: OptResource = None,
1890
+ operation_timestamp: OptTimestamp = None,
1891
+ operation_summary: OptStr = None,
1892
+ connection_context: OptConnectionContext = None,
1893
+ authentication: OptAnyAuthentication = None,
1894
+ authorization: OptAnyAuthorization = None,
1895
+ impersonation: OptImpersonation = None,
1896
+ logger: Base,
1897
+ ) -> AnyException:
1898
+ if not response.is_error:
1899
+ raise ValueError(
1900
+ ErrorCode.BAD_REQUEST,
1901
+ "Failed generating MaleoException from httpx response, Response is not error",
1902
+ )
1903
+
1904
+ response_cls = ErrorResponseFactory.cls_from_code(response.status_code)
1905
+ validated_response = response_cls.model_validate(response.json())
1906
+
1907
+ exception = cls.from_code(
1908
+ response.status_code,
1909
+ details=None,
1910
+ operation_type=operation_type,
1911
+ application_context=application_context,
1912
+ operation_id=operation_id,
1913
+ operation_context=operation_context,
1914
+ operation_action=operation_action,
1915
+ resource=resource,
1916
+ operation_timestamp=operation_timestamp,
1917
+ operation_summary=operation_summary,
1918
+ connection_context=connection_context,
1919
+ authentication=authentication,
1920
+ authorization=authorization,
1921
+ impersonation=impersonation,
1922
+ response=validated_response,
1923
+ )
1924
+
1925
+ if logger is not None:
1926
+ exception.operation.log(logger, LogLevel.ERROR)
1927
+
1928
+ return exception