-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into monitoring-6
- Loading branch information
Showing
15 changed files
with
120 additions
and
48 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
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 |
---|---|---|
|
@@ -2,8 +2,9 @@ import { Construct } from 'constructs'; | |
import * as sns from "aws-cdk-lib/aws-sns"; | ||
import * as subscriptions from "aws-cdk-lib/aws-sns-subscriptions"; | ||
import * as actions from "aws-cdk-lib/aws-cloudwatch-actions"; | ||
import { Canary } from 'aws-cdk-lib/aws-synthetics'; | ||
import {OpenSearchLambda} from "./lambda"; | ||
import Project from '../enums/project'; | ||
|
||
|
||
export interface SnsMonitorsProps { | ||
readonly region: string; | ||
|
@@ -33,7 +34,7 @@ export class SnsMonitors extends Construct { | |
|
||
// The email list for receiving alerts | ||
this.emailList = [ | ||
'[email protected]' | ||
Project.SNS_ALERT_EMAIL | ||
]; | ||
|
||
// Create alarms | ||
|
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 |
---|---|---|
|
@@ -9,5 +9,6 @@ enum Project{ | |
RESTRICTED_PREFIX = '', | ||
LAMBDA_PACKAGE = 'opensearch-metrics-1.0.zip', | ||
EC2_AMI_SSM = '', | ||
SNS_ALERT_EMAIL = '[email protected]' | ||
} | ||
export default Project; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
18 changes: 18 additions & 0 deletions
18
src/main/java/org/opensearchmetrics/model/alarm/AlarmData.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,18 @@ | ||
package org.opensearchmetrics.model.alarm; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class AlarmData { | ||
@JsonProperty("AlarmName") | ||
private String alarmName; | ||
@JsonProperty("AlarmDescription") | ||
private String alarmDescription; | ||
@JsonProperty("StateChangeTime") | ||
private String stateChangeTime; | ||
@JsonProperty("Region") | ||
private String region; | ||
@JsonProperty("AlarmArn") | ||
private String alarmArn; | ||
} |
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
52 changes: 52 additions & 0 deletions
52
src/test/java/org/opensearchmetrics/model/alarm/AlarmDataTest.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,52 @@ | ||
package org.opensearchmetrics.model.alarm; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class AlarmDataTest { | ||
@Mock | ||
ObjectMapper objectMapper; | ||
|
||
private AlarmData alarmData; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
MockitoAnnotations.openMocks(this); | ||
alarmData = new AlarmData(); | ||
} | ||
|
||
@Test | ||
public void testAlarmName() { | ||
alarmData.setAlarmName("testName"); | ||
assertEquals("testName", alarmData.getAlarmName()); | ||
} | ||
|
||
@Test | ||
public void testAlarmDescription() { | ||
alarmData.setAlarmDescription("testDescription"); | ||
assertEquals("testDescription", alarmData.getAlarmDescription()); | ||
} | ||
|
||
@Test | ||
public void testStateChangeTime() { | ||
alarmData.setStateChangeTime("testStateChangeTime"); | ||
assertEquals("testStateChangeTime", alarmData.getStateChangeTime()); | ||
} | ||
|
||
@Test | ||
public void testRegion() { | ||
alarmData.setRegion("testRegion"); | ||
assertEquals("testRegion", alarmData.getRegion()); | ||
} | ||
|
||
@Test | ||
public void testAlarmArn() { | ||
alarmData.setAlarmArn("testArn"); | ||
assertEquals("testArn", alarmData.getAlarmArn()); | ||
} | ||
} |