Skip to content

Commit

Permalink
chore: minor cleanup (#84)
Browse files Browse the repository at this point in the history
Some minor updates pulled out from #83

cf. commit messages for exact changes

---

_By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
  • Loading branch information
echeung-amzn authored Mar 25, 2022
1 parent 34a5684 commit a2b9445
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 83 deletions.
3 changes: 1 addition & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2703,11 +2703,10 @@ public readonly action: IAlarmActionStrategy;
```

- *Type:* <a href="#cdk-monitoring-constructs.IAlarmActionStrategy">IAlarmActionStrategy</a>
- *Default:* no action.

Default alarm action used for each alarm, unless it is overridden.

If you do not want any actions to be created, just use NoAlarmActionStrategy.

---

##### `annotationStrategy`<sup>Optional</sup> <a name="annotationStrategy" id="cdk-monitoring-constructs.AlarmFactoryDefaults.property.annotationStrategy"></a>
Expand Down
3 changes: 2 additions & 1 deletion lib/common/alarm/AlarmFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ export interface AlarmFactoryDefaults {

/**
* Default alarm action used for each alarm, unless it is overridden.
* If you do not want any actions to be created, just use NoAlarmActionStrategy.
*
* @default no action.
*/
readonly action?: IAlarmActionStrategy;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from "path";

import { Construct, Duration } from "monocdk";
import { Construct, Duration, Names } from "monocdk";
import { Rule, RuleTargetInput, Schedule } from "monocdk/aws-events";
import { LambdaFunction } from "monocdk/aws-events-targets";
import { Effect, PolicyStatement } from "monocdk/aws-iam";
Expand Down Expand Up @@ -60,7 +60,7 @@ export class SecretsManagerMetricsPublisher extends Construct {
}

static getInstance(scope: MonitoringScope) {
const key = scope.node.uniqueId;
const key = Names.nodeUniqueId(scope.node);
let instance = SecretsManagerMetricsPublisher.instances[key];
if (!instance) {
instance = new SecretsManagerMetricsPublisher(scope);
Expand All @@ -72,7 +72,7 @@ export class SecretsManagerMetricsPublisher extends Construct {

addSecret(secret: ISecret): void {
// run 1/hr so alarms can recover automatically
const rule = new Rule(this, `RuleFor${secret.node.id}`, {
const rule = new Rule(this, `RuleFor${Names.nodeUniqueId(secret.node)}`, {
schedule: Schedule.cron({
minute: "0",
}),
Expand Down
2 changes: 1 addition & 1 deletion test/facade/MonitoringAspect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe("MonitoringAspect", () => {
const facade = createDummyMonitoringFacade(stack);

new opensearch.Domain(stack, "DummyOSDomain", {
domainName: "DummyOSDomain",
domainName: "dummy-os-domain",
version: opensearch.EngineVersion.ELASTICSEARCH_7_10,
});
new elasticsearch.Domain(stack, "DummyESDomain", {
Expand Down
74 changes: 37 additions & 37 deletions test/facade/__snapshots__/MonitoringAspect.test.ts.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import { TestMonitoringScope } from "../TestMonitoringScope";
const stack = new Stack();
[
new elasticsearch.CfnDomain(stack, "ElasticsearchCfnDomain", {
domainName: "ElasticsearchCfnDomain",
domainName: "es-cfn-domain",
}),
new elasticsearch.Domain(stack, "ElasticsearchDomain", {
domainName: "ElasticsearchDomain",
domainName: "es-domain",
version: elasticsearch.ElasticsearchVersion.V7_7,
}),
new opensearch.CfnDomain(stack, "OpenSearchCfnDomain", {
domainName: "OpenSearchCfnDomain",
domainName: "os-cfn-domain",
}),
new opensearch.Domain(stack, "OpenSearchDomain", {
domainName: "OpenSearchDomain",
domainName: "os-domain",
version: opensearch.EngineVersion.OPENSEARCH_1_0,
}),
].forEach((domain) => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2b9445

Please sign in to comment.