Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemberTang committed Mar 20, 2024
1 parent edbebc8 commit 7a5cc81
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions cdk/lib/snyk-tag-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ export class SnykTagMonitor extends GuStack {
new EmailSubscription('[email protected]'),
);

const metricProps: MetricProps = {
namespace: 'snyk-tag-monitor',
metricName: 'snykTagCount',
dimensionsMap: {
'stage': this.stage
},
period: Duration.days(1),
statistic: "Minimum"
}
const tagMetric = new Metric(metricProps)
const metricProps: MetricProps = {
namespace: 'snyk-tag-monitor',
metricName: 'snykTagCount',
dimensionsMap: {
stage: this.stage,
},
period: Duration.days(1),
statistic: 'Minimum',
};
const tagMetric = new Metric(metricProps);

const tagAlarmProps: GuAlarmProps = {
comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 4500,
evaluationPeriods: 1,
snsTopicName: topic.topicName,
metric: tagMetric,
app: app,
}
const tagAlarm = new GuAlarm(this, `${app}-alarm`, tagAlarmProps)
const tagAlarmProps: GuAlarmProps = {
comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 4500,
evaluationPeriods: 1,
snsTopicName: topic.topicName,
metric: tagMetric,
app: app,
};
const tagAlarm = new GuAlarm(this, `${app}-alarm`, tagAlarmProps);

Check warning on line 47 in cdk/lib/snyk-tag-monitor.ts

View workflow job for this annotation

GitHub Actions / CI

'tagAlarm' is assigned a value but never used

const lambdaProps: GuScheduledLambdaProps = {
rules: [{ schedule: Schedule.rate(Duration.days(7)) }],
Expand All @@ -60,13 +60,15 @@ export class SnykTagMonitor extends GuStack {
SNS_TOPIC_ARN: topic.topicArn,
},
timeout: Duration.minutes(5),
retryAttempts: 1
retryAttempts: 1,
};

const lambda = new GuScheduledLambda(this, app, lambdaProps);
topic.grantPublish(lambda);
const policyStatement = new PolicyStatement({actions: ['cloudwatch:PutMetricData'], resources: ['*']})
lambda.addToRolePolicy(policyStatement)

const policyStatement = new PolicyStatement({
actions: ['cloudwatch:PutMetricData'],
resources: ['*'],
});
lambda.addToRolePolicy(policyStatement);
}
}

0 comments on commit 7a5cc81

Please sign in to comment.