import * from '@aws-cdk/aws-cloudwatch'

const BRANCH_NAME = "GraftonStreet"
const METRIC_NAME = "PotatoBags"
const THRESHOLD = 4

new cloudwatch.Alarm(this, "potatoBagsIncorrectYellowAlarm", {
      alarmDescription: 'This alarms monitors the number of potato bags in ${METRIC_NAME} at metric.',
      alarmName: `${BRANCH_NAME}-${METRIC_NAME}-YellowAlarm`,
      datapointsToAlarm: 1,
      evaluationPeriods: 1,
      metricName: `${METRIC_NAME}`,
      namespace: "AWS/Logs",
      dimensions:  [
        {
          name: "BranchName",
          value: `${BRANCH_NAME}`
        }
      ],
      period: Duration.minutes(5).toSeconds(),
      statistic: "Minimum",
      comparisonOperator: "LessThanOrEqualToThreshold",
      threshold: THRESHOLD,
      treatMissingData: "Missing"
})