import { DriftMonitor } from 'cdk-drift-monitor'
new DriftMonitor(scope: Construct, id: string, props?: DriftMonitorProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
DriftMonitorProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: DriftMonitorProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
public toString(): string
Returns a string representation of this construct.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { DriftMonitor } from 'cdk-drift-monitor'
DriftMonitor.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
alarm |
aws-cdk-lib.aws_cloudwatch.Alarm |
No description. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly alarm: Alarm;
- Type: aws-cdk-lib.aws_cloudwatch.Alarm
import { DriftMonitorProps } from 'cdk-drift-monitor'
const driftMonitorProps: DriftMonitorProps = { ... }
Name | Type | Description |
---|---|---|
alarmOptions |
aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions |
Options to create alarm. |
metricNamespace |
string |
Namespace of published metric. |
runEvery |
aws-cdk-lib.Duration |
Run drift detection every X duration. |
stackNames |
string[] |
List of stack names to monitor for CloudFormation drifts. |
stacks |
aws-cdk-lib.Stack[] |
List of stack to monitor for CloudFormation drifts Either stacks or stackNames are required (though not both). |
public readonly alarmOptions: CreateAlarmOptions;
- Type: aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions
- Default: alarm on 1 drifted stacks or more, for 3 data points, for
Options to create alarm.
public readonly metricNamespace: string;
- Type: string
- Default: 'DriftMonitor'
Namespace of published metric.
public readonly runEvery: Duration;
- Type: aws-cdk-lib.Duration
- Default: Duration.hours(1)
Run drift detection every X duration.
public readonly stackNames: string[];
- Type: string[]
List of stack names to monitor for CloudFormation drifts.
Either stacks or stackNames are required (though not both)
public readonly stacks: Stack[];
- Type: aws-cdk-lib.Stack[]
List of stack to monitor for CloudFormation drifts Either stacks or stackNames are required (though not both).