diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..4af00bc --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,4 @@ +[workspace] +members = [ + "lambdas/*", +] diff --git a/lambdas/query-metrics/.gitignore b/lambdas/query-metrics/.gitignore new file mode 100644 index 0000000..c41cc9e --- /dev/null +++ b/lambdas/query-metrics/.gitignore @@ -0,0 +1 @@ +/target \ No newline at end of file diff --git a/lambdas/query-metrics/Cargo.toml b/lambdas/query-metrics/Cargo.toml new file mode 100644 index 0000000..232c233 --- /dev/null +++ b/lambdas/query-metrics/Cargo.toml @@ -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"] } + diff --git a/lambdas/query-metrics/src/main.rs b/lambdas/query-metrics/src/main.rs new file mode 100644 index 0000000..4299027 --- /dev/null +++ b/lambdas/query-metrics/src/main.rs @@ -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) -> 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 +}