-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[workspace] | ||
members = [ | ||
"lambdas/*", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "query-metrics" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# Starting in Rust 1.62 you can use `cargo add` to add dependencies | ||
# to your project. | ||
# | ||
# If you're using an older Rust version, | ||
# download cargo-edit(https://github.com/killercup/cargo-edit#installation) | ||
# to install the `add` subcommand. | ||
# | ||
# Running `cargo add DEPENDENCY_NAME` will | ||
# add the latest version of a dependency to the list, | ||
# and it will keep the alphabetic ordering for you. | ||
|
||
[dependencies] | ||
aws_lambda_events = { version = "0.12.0", default-features = false, features = ["eventbridge"] } | ||
|
||
lambda_runtime = "0.8.3" | ||
tokio = { version = "1", features = ["macros"] } | ||
tracing = { version = "0.1", features = ["log"] } | ||
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use aws_lambda_events::event::eventbridge::EventBridgeEvent;use lambda_runtime::{run, service_fn, Error, LambdaEvent}; | ||
|
||
|
||
/// This is the main body for the function. | ||
/// Write your code inside it. | ||
/// There are some code example in the following URLs: | ||
/// - https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples | ||
/// - https://github.com/aws-samples/serverless-rust-demo/ | ||
async fn function_handler(event: LambdaEvent<EventBridgeEvent>) -> Result<(), Error> { | ||
// Extract some useful information from the request | ||
|
||
Ok(()) | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Error> { | ||
tracing_subscriber::fmt() | ||
.with_max_level(tracing::Level::INFO) | ||
// disable printing the name of the module in every log line. | ||
.with_target(false) | ||
// disabling time is handy because CloudWatch will add the ingestion time. | ||
.without_time() | ||
.init(); | ||
|
||
run(service_fn(function_handler)).await | ||
} |