-
Notifications
You must be signed in to change notification settings - Fork 231
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
8 changed files
with
389 additions
and
2 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
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
70 changes: 70 additions & 0 deletions
70
...main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchCompositeAlarmEvent.java
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,70 @@ | ||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Represents an CloudWatch Composite Alarm event. This event occurs when a composite alarm is triggered. | ||
* | ||
* @see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-actions">Using Amazon CloudWatch alarms</a> | ||
*/ | ||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CloudWatchCompositeAlarmEvent { | ||
private String source; | ||
private String alarmArn; | ||
private String accountId; | ||
private String time; | ||
private String region; | ||
private AlarmData alarmData; | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class AlarmData { | ||
private String alarmName; | ||
private State state; | ||
private PreviousState previousState; | ||
private Configuration configuration; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class State { | ||
private String value; | ||
private String reason; | ||
private String reasonData; | ||
private String timestamp; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class PreviousState { | ||
private String value; | ||
private String reason; | ||
private String reasonData; | ||
private String timestamp; | ||
private String actionsSuppressedBy; | ||
private String actionsSuppressedReason; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Configuration { | ||
private String alarmRule; | ||
private String actionsSuppressor; | ||
private Integer actionsSuppressorWaitPeriod; | ||
private Integer actionsSuppressorExtensionPeriod; | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
...rc/main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchMetricAlarmEvent.java
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,99 @@ | ||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents an CloudWatch Metric Alarm event. This event occurs when a metric alarm is triggered. | ||
* | ||
* @see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-actions">Using Amazon CloudWatch alarms</a> | ||
*/ | ||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CloudWatchMetricAlarmEvent { | ||
private String source; | ||
private String alarmArn; | ||
private String accountId; | ||
private String time; | ||
private String region; | ||
private AlarmData alarmData; | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class AlarmData { | ||
private String alarmName; | ||
private State state; | ||
private PreviousState previousState; | ||
private Configuration configuration; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class State { | ||
private String value; | ||
private String reason; | ||
private String timestamp; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class PreviousState { | ||
private String value; | ||
private String reason; | ||
private String reasonData; | ||
private String timestamp; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Configuration { | ||
private String description; | ||
private List<Metric> metrics; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Metric { | ||
private String id; | ||
private MetricStat metricStat; | ||
private Boolean returnData; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class MetricStat { | ||
private MetricDetail metric; | ||
private Integer period; | ||
private String stat; | ||
private String unit; | ||
} | ||
|
||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class MetricDetail { | ||
private String namespace; | ||
private String name; | ||
private Map<String, String> dimensions; | ||
} | ||
} |
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
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
30 changes: 30 additions & 0 deletions
30
aws-lambda-java-tests/src/test/resources/cloudwatch_composite_alarm.json
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,30 @@ | ||
{ | ||
"source": "aws.cloudwatch", | ||
"alarmArn": "arn:aws:cloudwatch:us-east-1:111122223333:alarm:SuppressionDemo.Main", | ||
"accountId": "111122223333", | ||
"time": "2023-08-04T12:56:46.138+0000", | ||
"region": "us-east-1", | ||
"alarmData": { | ||
"alarmName": "CompositeDemo.Main", | ||
"state": { | ||
"value": "ALARM", | ||
"reason": "arn:aws:cloudwatch:us-east-1:111122223333:alarm:CompositeDemo.FirstChild transitioned to ALARM at Friday 04 August, 2023 12:54:46 UTC", | ||
"reasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us-east-1:111122223333:alarm:CompositeDemo.FirstChild\",\"state\":{\"value\":\"ALARM\",\"timestamp\":\"2023-08-04T12:54:46.138+0000\"}}]}", | ||
"timestamp": "2023-08-04T12:56:46.138+0000" | ||
}, | ||
"previousState": { | ||
"value": "ALARM", | ||
"reason": "arn:aws:cloudwatch:us-east-1:111122223333:alarm:CompositeDemo.FirstChild transitioned to ALARM at Friday 04 August, 2023 12:54:46 UTC", | ||
"reasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us-east-1:111122223333:alarm:CompositeDemo.FirstChild\",\"state\":{\"value\":\"ALARM\",\"timestamp\":\"2023-08-04T12:54:46.138+0000\"}}]}", | ||
"timestamp": "2023-08-04T12:54:46.138+0000", | ||
"actionsSuppressedBy": "WaitPeriod", | ||
"actionsSuppressedReason": "Actions suppressed by WaitPeriod" | ||
}, | ||
"configuration": { | ||
"alarmRule": "ALARM(CompositeDemo.FirstChild) OR ALARM(CompositeDemo.SecondChild)", | ||
"actionsSuppressor": "CompositeDemo.ActionsSuppressor", | ||
"actionsSuppressorWaitPeriod": 120, | ||
"actionsSuppressorExtensionPeriod": 180 | ||
} | ||
} | ||
} |
Oops, something went wrong.