Python: Allow injecting Lambda Context (#1985)
* Provide Python wrappers for Lambda related types * Introduce `PyContext` to wrap raw context object * Use new `PyContext` in handlers * Expose `lambda` module to Python * Use `LambdaContext` in example service * Start Lambda handler in a different thread * Print summary of Lambda context in Pokemon service * Make sure to include Python `builtins` in tests * Make `lambda_ctx` optional Co-authored-by:Matteo Bigoi <1781140+crisidev@users.noreply.github.com> * Only inject types if they are type-hinted as `Optional[T]` * Export Lambda module as `aws_lambda` instead of `lambda_` * Comment why we need to run Hyper server in a background thread * Move `is_optional_of` to `util` module * Use `HeaderMap::from_iter` to build headers * Support edge case of `(None, T)` in `util::is_optional_of` * Make Lambda related types feature gated * Remove feature gate for Lambda * Make `xray_trace_id` an `Option` * Remove `aws-lambda` feature from generated `Cargo.toml`s * Fix linting issues * Pin `lambda_runtime` to `0.7.1` * Remove duplicate dependency in `Cargo.toml` Co-authored-by:
Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
Loading
Please register or sign in to comment