Allow multiple rule sets and update rust lambda runtime#155
Conversation
|
|
||
| SimpleLogger::new().with_level(LevelFilter::Info).init().unwrap(); | ||
| let func = handler_fn(call_cfn_guard); | ||
| lambda_runtime::run(func).await?; |
There was a problem hiding this comment.
What is the advantage of using async-await here?
There was a problem hiding this comment.
lambda-runtime v 0.3.0 expects a Future trait to be implemented for handler. I have basically followed the example in aws-lambda-rust-runtime repo.
gandhek
left a comment
There was a problem hiding this comment.
Shreyas, would you be able to paste the output from a test run in your PR description?
I have added the lambda output and Cloudwatch logs. Please let me know if you need more information. |
| Err(e) => (e.to_string()), | ||
| }; | ||
|
|
||
| pub(crate) async fn call_cfn_guard(e: CustomEvent, _c: Context) -> Result<CustomOutput, Error> { |
There was a problem hiding this comment.
With #154 we have support for output reporters that can provide lesser detail but sufficient for 80% of the use cases. Would you want to expose these options via lambda invocation as well? Take the look at example on that PR esp. with --show-summary none --output-format yaml
There was a problem hiding this comment.
Yes, I can make those changes. Thanks!
There was a problem hiding this comment.
Let us do that as a separate PR
* Update guard-lambda/README.md for reflecting the changes in #155
Description of changes:
This PR adds the functionality to pass multiple rule sets as a list. This will allow customers to scan their template using multiple rules at a time.
I will add a support to fetch rule sets from an S3 bucket once AWS SDK for Rust is stable.
Tests
aws lambda invoke --function-name rustTest \ --payload '{"data": "<input data>", "rules" : "[rule0, rule1]"}' \ output.jsonLambda output (returns serde_json::Value object)
CloudWatch logs snippet
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.