Skip to content

Commit a8f860f

Browse files
authored
Cloudwatch alarms (#760)
* Add CloudWatch Alarm events CloudWatch has added the ability to trigger Lambda functions base on alarms. See annoucement here: https://aws.amazon.com/about-aws/whats-new/2023/12/amazon-cloudwatch-alarms-lambda-change-action/ Signed-off-by: David Calavera <david.calavera@gmail.com> * Remove unnecessary import from tests. Signed-off-by: David Calavera <david.calavera@gmail.com> * Update events section in the readme. Signed-off-by: David Calavera <david.calavera@gmail.com> * Remove empty lines. Signed-off-by: David Calavera <david.calavera@gmail.com> * Implement custom serde interfaces with known reason data. Signed-off-by: David Calavera <david.calavera@gmail.com> * Add more docs Signed-off-by: David Calavera <david.calavera@gmail.com> --------- Signed-off-by: David Calavera <david.calavera@gmail.com>
1 parent ab3b809 commit a8f860f

File tree

41 files changed

+387
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+387
-65
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ check-event-features:
7272
cargo test --package aws_lambda_events --no-default-features --features bedrock_agent_runtime
7373
cargo test --package aws_lambda_events --no-default-features --features chime_bot
7474
cargo test --package aws_lambda_events --no-default-features --features clientvpn
75+
cargo test --package aws_lambda_events --no-default-features --features cloudwatch_alarms
7576
cargo test --package aws_lambda_events --no-default-features --features cloudwatch_events
7677
cargo test --package aws_lambda_events --no-default-features --features cloudwatch_logs
7778
cargo test --package aws_lambda_events --no-default-features --features code_commit

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ Lambdas can be run and debugged locally using a special [Lambda debug proxy](htt
374374

375375
## AWS event objects
376376

377-
This project does not currently include Lambda event struct definitions. Instead, the community-maintained [`aws_lambda_events`](https://crates.io/crates/aws_lambda_events) crate can be leveraged to provide strongly-typed Lambda event structs. You can create your own custom event objects and their corresponding structs as well.
377+
This project includes Lambda event struct definitions, [`aws_lambda_events`](https://crates.io/crates/aws_lambda_events). This crate can be leveraged to provide strongly-typed Lambda event structs. You can create your own custom event objects and their corresponding structs as well.
378378

379379
### Custom event objects
380380

lambda-events/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ default = [
4747
"chime_bot",
4848
"clientvpn",
4949
"cloudformation",
50+
"cloudwatch_alarms",
5051
"cloudwatch_events",
5152
"cloudwatch_logs",
5253
"code_commit",
@@ -90,6 +91,7 @@ bedrock_agent_runtime = []
9091
chime_bot = ["chrono"]
9192
clientvpn = []
9293
cloudformation = []
94+
cloudwatch_alarms = ["chrono"]
9395
cloudwatch_events = ["chrono"]
9496
cloudwatch_logs = ["flate2"]
9597
code_commit = ["chrono"]

lambda-events/src/custom_serde/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ where
9696
mod test {
9797
use super::*;
9898
use serde::{Deserialize, Serialize};
99-
use serde_json;
10099

101100
#[test]
102101
fn test_deserialize_base64() {

lambda-events/src/encodings/http.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ impl HttpBody for Body {
246246
#[cfg(test)]
247247
mod tests {
248248
use super::*;
249-
use serde_json;
250249
use std::collections::HashMap;
251250

252251
#[test]

lambda-events/src/encodings/time.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ where
215215
mod test {
216216
use super::*;
217217
use chrono::TimeZone;
218-
use serde_json;
219218

220219
#[test]
221220
fn test_deserialize_milliseconds() {

lambda-events/src/event/activemq/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ pub struct ActiveMqDestination {
5454
mod test {
5555
use super::*;
5656

57-
use serde_json;
58-
5957
#[test]
6058
#[cfg(feature = "activemq")]
6159
fn example_activemq_event() {

lambda-events/src/event/alb/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ pub struct AlbTargetGroupResponse {
6969
mod test {
7070
use super::*;
7171

72-
use serde_json;
73-
7472
#[test]
7573
#[cfg(feature = "alb")]
7674
fn example_alb_lambda_target_request_headers_only() {

lambda-events/src/event/apigw/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,6 @@ fn default_http_method() -> Method {
769769
mod test {
770770
use super::*;
771771

772-
use serde_json;
773-
774772
#[test]
775773
#[cfg(feature = "apigw")]
776774
fn example_apigw_custom_auth_request_type_request() {

lambda-events/src/event/appsync/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ where
122122
mod test {
123123
use super::*;
124124

125-
use serde_json;
126-
127125
#[test]
128126
#[cfg(feature = "appsync")]
129127
fn example_appsync_identity_cognito() {

0 commit comments

Comments
 (0)