Skip to content

Latest commit

 

History

History
219 lines (134 loc) · 7 KB

API.md

File metadata and controls

219 lines (134 loc) · 7 KB

API Reference

Constructs

DriftMonitor

Initializers

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.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsOptional

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
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.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
alarm aws-cdk-lib.aws_cloudwatch.Alarm No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


alarmRequired
public readonly alarm: Alarm;
  • Type: aws-cdk-lib.aws_cloudwatch.Alarm

Structs

DriftMonitorProps

Initializer

import { DriftMonitorProps } from 'cdk-drift-monitor'

const driftMonitorProps: DriftMonitorProps = { ... }

Properties

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).

alarmOptionsOptional
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.


metricNamespaceOptional
public readonly metricNamespace: string;
  • Type: string
  • Default: 'DriftMonitor'

Namespace of published metric.


runEveryOptional
public readonly runEvery: Duration;
  • Type: aws-cdk-lib.Duration
  • Default: Duration.hours(1)

Run drift detection every X duration.


stackNamesOptional
public readonly stackNames: string[];
  • Type: string[]

List of stack names to monitor for CloudFormation drifts.

Either stacks or stackNames are required (though not both)


stacksOptional
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).