UNPKG

@renovosolutions/cdk-library-cloudwatch-alarms

Version:

AWS CDK Construct Library to automatically create CloudWatch Alarms for resources in a CDK app based on resource type.

1,165 lines (704 loc) 4.59 MB
# API Reference <a name="API Reference" id="api-reference"></a> ## Constructs <a name="Constructs" id="Constructs"></a> ### ApiGatewayRestApi4XXErrorAlarm <a name="ApiGatewayRestApi4XXErrorAlarm" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm"></a> This alarm detects a high number of client-side errors. This can indicate an issue in the authorization or client request parameters. It could also mean that a resource was removed or a client is requesting one that doesn't exist. Consider enabling CloudWatch Logs and checking for any errors that may be causing the 4XX errors. Moreover, consider enabling detailed CloudWatch metrics to view this metric per resource and method and narrow down the source of the errors. Errors could also be caused by exceeding the configured throttling limit. The alarm is triggered when number of client-errors exceeds the threshold. #### Initializers <a name="Initializers" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' new ApiGatewayRestApi4XXErrorAlarm(scope: IConstruct, id: string, props: ApiGatewayRestApi4XXErrorAlarmProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.scope">scope</a></code> | <code>constructs.IConstruct</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.props">props</a></code> | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarmProps">ApiGatewayRestApi4XXErrorAlarmProps</a></code> | *No description.* | --- ##### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.scope"></a> - *Type:* constructs.IConstruct --- ##### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.id"></a> - *Type:* string --- ##### `props`<sup>Required</sup> <a name="props" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.Initializer.parameter.props"></a> - *Type:* <a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarmProps">ApiGatewayRestApi4XXErrorAlarmProps</a> --- #### Methods <a name="Methods" id="Methods"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.toString">toString</a></code> | Returns a string representation of this construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addAlarmAction">addAlarmAction</a></code> | Trigger this action if the alarm fires. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addInsufficientDataAction">addInsufficientDataAction</a></code> | Trigger this action if there is insufficient data to evaluate the alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addOkAction">addOkAction</a></code> | Trigger this action if the alarm returns from breaching state into ok state. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.renderAlarmRule">renderAlarmRule</a></code> | AlarmRule indicating ALARM state for Alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.toAnnotation">toAnnotation</a></code> | Turn this alarm into a horizontal annotation. | --- ##### `toString` <a name="toString" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.toString"></a> ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.applyRemovalPolicy"></a> ```typescript public applyRemovalPolicy(policy: RemovalPolicy): void ``` Apply the given removal policy to this resource. The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced. The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ###### `policy`<sup>Required</sup> <a name="policy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.applyRemovalPolicy.parameter.policy"></a> - *Type:* aws-cdk-lib.RemovalPolicy --- ##### `addAlarmAction` <a name="addAlarmAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addAlarmAction"></a> ```typescript public addAlarmAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm fires. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addAlarmAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addInsufficientDataAction` <a name="addInsufficientDataAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addInsufficientDataAction"></a> ```typescript public addInsufficientDataAction(actions: ...IAlarmAction[]): void ``` Trigger this action if there is insufficient data to evaluate the alarm. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addInsufficientDataAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addOkAction` <a name="addOkAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addOkAction"></a> ```typescript public addOkAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm returns from breaching state into ok state. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.addOkAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `renderAlarmRule` <a name="renderAlarmRule" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.renderAlarmRule"></a> ```typescript public renderAlarmRule(): string ``` AlarmRule indicating ALARM state for Alarm. ##### `toAnnotation` <a name="toAnnotation" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.toAnnotation"></a> ```typescript public toAnnotation(): HorizontalAnnotation ``` Turn this alarm into a horizontal annotation. This is useful if you want to represent an Alarm in a non-AlarmWidget. An `AlarmWidget` can directly show an alarm, but it can only show a single alarm and no other metrics. Instead, you can convert the alarm to a HorizontalAnnotation and add it as an annotation to another graph. This might be useful if: - You want to show multiple alarms inside a single graph, for example if you have both a "small margin/long period" alarm as well as a "large margin/short period" alarm. - You want to show an Alarm line in a graph with multiple metrics in it. #### Static Functions <a name="Static Functions" id="Static Functions"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isResource">isResource</a></code> | Check whether the given construct is a Resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn">fromAlarmArn</a></code> | Import an existing CloudWatch alarm provided an ARN. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmName">fromAlarmName</a></code> | Import an existing CloudWatch alarm provided an Name. | --- ##### ~~`isConstruct`~~ <a name="isConstruct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isConstruct"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi4XXErrorAlarm.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`<sup>Required</sup> <a name="x" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isConstruct.parameter.x"></a> - *Type:* any Any object. --- ##### `isOwnedResource` <a name="isOwnedResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isOwnedResource"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi4XXErrorAlarm.isOwnedResource(construct: IConstruct) ``` Returns true if the construct was created by CDK, and false otherwise. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isOwnedResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `isResource` <a name="isResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isResource"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi4XXErrorAlarm.isResource(construct: IConstruct) ``` Check whether the given construct is a Resource. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.isResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `fromAlarmArn` <a name="fromAlarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn(scope: Construct, id: string, alarmArn: string) ``` Import an existing CloudWatch alarm provided an ARN. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmArn`<sup>Required</sup> <a name="alarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmArn.parameter.alarmArn"></a> - *Type:* string Alarm ARN (i.e. arn:aws:cloudwatch:<region>:<account-id>:alarm:Foo). --- ##### `fromAlarmName` <a name="fromAlarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmName"></a> ```typescript import { ApiGatewayRestApi4XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi4XXErrorAlarm.fromAlarmName(scope: Construct, id: string, alarmName: string) ``` Import an existing CloudWatch alarm provided an Name. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmName.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmName.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmName`<sup>Required</sup> <a name="alarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.fromAlarmName.parameter.alarmName"></a> - *Type:* string Alarm Name. --- #### Properties <a name="Properties" id="Properties"></a> | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.alarmArn">alarmArn</a></code> | <code>string</code> | ARN of this alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.alarmName">alarmName</a></code> | <code>string</code> | Name of this alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.metric">metric</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IMetric</code> | The metric object this alarm was based on. | --- ##### `node`<sup>Required</sup> <a name="node" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.node"></a> ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `env`<sup>Required</sup> <a name="env" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.env"></a> ```typescript public readonly env: ResourceEnvironment; ``` - *Type:* aws-cdk-lib.ResourceEnvironment The environment this resource belongs to. For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into. --- ##### `stack`<sup>Required</sup> <a name="stack" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.stack"></a> ```typescript public readonly stack: Stack; ``` - *Type:* aws-cdk-lib.Stack The stack in which this resource is defined. --- ##### `alarmArn`<sup>Required</sup> <a name="alarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.alarmArn"></a> ```typescript public readonly alarmArn: string; ``` - *Type:* string ARN of this alarm. --- ##### `alarmName`<sup>Required</sup> <a name="alarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.alarmName"></a> ```typescript public readonly alarmName: string; ``` - *Type:* string Name of this alarm. --- ##### `metric`<sup>Required</sup> <a name="metric" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.metric"></a> ```typescript public readonly metric: IMetric; ``` - *Type:* aws-cdk-lib.aws_cloudwatch.IMetric The metric object this alarm was based on. --- #### Constants <a name="Constants" id="Constants"></a> | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.ANOMALY_DETECTION_NO_THRESHOLD">ANOMALY_DETECTION_NO_THRESHOLD</a></code> | <code>number</code> | Conventional value for the threshold property when creating anomaly detection alarms. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.PROPERTY_INJECTION_ID">PROPERTY_INJECTION_ID</a></code> | <code>string</code> | Uniquely identifies this class. | --- ##### `ANOMALY_DETECTION_NO_THRESHOLD`<sup>Required</sup> <a name="ANOMALY_DETECTION_NO_THRESHOLD" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.ANOMALY_DETECTION_NO_THRESHOLD"></a> ```typescript public readonly ANOMALY_DETECTION_NO_THRESHOLD: number; ``` - *Type:* number Conventional value for the threshold property when creating anomaly detection alarms. Anomaly detection alarms don't have numbered threshold. Instead, they have a dynamically calculated threshold based on the metric math expression that contains a metric expression. The `threshold` property is required, but the value is ignored. This constant has the value 0, and has a symbolic name to indicate why the threshold is 0. You can use `new AnomalyDetectionAlarm()` to avoid having to pass the `threshold` property at all. --- ##### `PROPERTY_INJECTION_ID`<sup>Required</sup> <a name="PROPERTY_INJECTION_ID" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi4XXErrorAlarm.property.PROPERTY_INJECTION_ID"></a> ```typescript public readonly PROPERTY_INJECTION_ID: string; ``` - *Type:* string Uniquely identifies this class. --- ### ApiGatewayRestApi5XXErrorAlarm <a name="ApiGatewayRestApi5XXErrorAlarm" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm"></a> This alarm detects a high number of server-side errors. This can indicate that there is something wrong on the API backend, the network, or the integration between the API gateway and the backend API. The alarm is triggered when number of server-errors exceeds the threshold. #### Initializers <a name="Initializers" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' new ApiGatewayRestApi5XXErrorAlarm(scope: IConstruct, id: string, props: ApiGatewayRestApi5XXErrorAlarmProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.scope">scope</a></code> | <code>constructs.IConstruct</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.props">props</a></code> | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarmProps">ApiGatewayRestApi5XXErrorAlarmProps</a></code> | *No description.* | --- ##### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.scope"></a> - *Type:* constructs.IConstruct --- ##### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.id"></a> - *Type:* string --- ##### `props`<sup>Required</sup> <a name="props" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.Initializer.parameter.props"></a> - *Type:* <a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarmProps">ApiGatewayRestApi5XXErrorAlarmProps</a> --- #### Methods <a name="Methods" id="Methods"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.toString">toString</a></code> | Returns a string representation of this construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addAlarmAction">addAlarmAction</a></code> | Trigger this action if the alarm fires. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addInsufficientDataAction">addInsufficientDataAction</a></code> | Trigger this action if there is insufficient data to evaluate the alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addOkAction">addOkAction</a></code> | Trigger this action if the alarm returns from breaching state into ok state. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.renderAlarmRule">renderAlarmRule</a></code> | AlarmRule indicating ALARM state for Alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.toAnnotation">toAnnotation</a></code> | Turn this alarm into a horizontal annotation. | --- ##### `toString` <a name="toString" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.toString"></a> ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.applyRemovalPolicy"></a> ```typescript public applyRemovalPolicy(policy: RemovalPolicy): void ``` Apply the given removal policy to this resource. The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced. The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ###### `policy`<sup>Required</sup> <a name="policy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.applyRemovalPolicy.parameter.policy"></a> - *Type:* aws-cdk-lib.RemovalPolicy --- ##### `addAlarmAction` <a name="addAlarmAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addAlarmAction"></a> ```typescript public addAlarmAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm fires. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addAlarmAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addInsufficientDataAction` <a name="addInsufficientDataAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addInsufficientDataAction"></a> ```typescript public addInsufficientDataAction(actions: ...IAlarmAction[]): void ``` Trigger this action if there is insufficient data to evaluate the alarm. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addInsufficientDataAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addOkAction` <a name="addOkAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addOkAction"></a> ```typescript public addOkAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm returns from breaching state into ok state. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.addOkAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `renderAlarmRule` <a name="renderAlarmRule" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.renderAlarmRule"></a> ```typescript public renderAlarmRule(): string ``` AlarmRule indicating ALARM state for Alarm. ##### `toAnnotation` <a name="toAnnotation" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.toAnnotation"></a> ```typescript public toAnnotation(): HorizontalAnnotation ``` Turn this alarm into a horizontal annotation. This is useful if you want to represent an Alarm in a non-AlarmWidget. An `AlarmWidget` can directly show an alarm, but it can only show a single alarm and no other metrics. Instead, you can convert the alarm to a HorizontalAnnotation and add it as an annotation to another graph. This might be useful if: - You want to show multiple alarms inside a single graph, for example if you have both a "small margin/long period" alarm as well as a "large margin/short period" alarm. - You want to show an Alarm line in a graph with multiple metrics in it. #### Static Functions <a name="Static Functions" id="Static Functions"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isResource">isResource</a></code> | Check whether the given construct is a Resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn">fromAlarmArn</a></code> | Import an existing CloudWatch alarm provided an ARN. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmName">fromAlarmName</a></code> | Import an existing CloudWatch alarm provided an Name. | --- ##### ~~`isConstruct`~~ <a name="isConstruct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isConstruct"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi5XXErrorAlarm.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`<sup>Required</sup> <a name="x" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isConstruct.parameter.x"></a> - *Type:* any Any object. --- ##### `isOwnedResource` <a name="isOwnedResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isOwnedResource"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi5XXErrorAlarm.isOwnedResource(construct: IConstruct) ``` Returns true if the construct was created by CDK, and false otherwise. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isOwnedResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `isResource` <a name="isResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isResource"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi5XXErrorAlarm.isResource(construct: IConstruct) ``` Check whether the given construct is a Resource. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.isResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `fromAlarmArn` <a name="fromAlarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn(scope: Construct, id: string, alarmArn: string) ``` Import an existing CloudWatch alarm provided an ARN. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmArn`<sup>Required</sup> <a name="alarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmArn.parameter.alarmArn"></a> - *Type:* string Alarm ARN (i.e. arn:aws:cloudwatch:<region>:<account-id>:alarm:Foo). --- ##### `fromAlarmName` <a name="fromAlarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmName"></a> ```typescript import { ApiGatewayRestApi5XXErrorAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApi5XXErrorAlarm.fromAlarmName(scope: Construct, id: string, alarmName: string) ``` Import an existing CloudWatch alarm provided an Name. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmName.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmName.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmName`<sup>Required</sup> <a name="alarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.fromAlarmName.parameter.alarmName"></a> - *Type:* string Alarm Name. --- #### Properties <a name="Properties" id="Properties"></a> | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.alarmArn">alarmArn</a></code> | <code>string</code> | ARN of this alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.alarmName">alarmName</a></code> | <code>string</code> | Name of this alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.metric">metric</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IMetric</code> | The metric object this alarm was based on. | --- ##### `node`<sup>Required</sup> <a name="node" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.node"></a> ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `env`<sup>Required</sup> <a name="env" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.env"></a> ```typescript public readonly env: ResourceEnvironment; ``` - *Type:* aws-cdk-lib.ResourceEnvironment The environment this resource belongs to. For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into. --- ##### `stack`<sup>Required</sup> <a name="stack" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.stack"></a> ```typescript public readonly stack: Stack; ``` - *Type:* aws-cdk-lib.Stack The stack in which this resource is defined. --- ##### `alarmArn`<sup>Required</sup> <a name="alarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.alarmArn"></a> ```typescript public readonly alarmArn: string; ``` - *Type:* string ARN of this alarm. --- ##### `alarmName`<sup>Required</sup> <a name="alarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.alarmName"></a> ```typescript public readonly alarmName: string; ``` - *Type:* string Name of this alarm. --- ##### `metric`<sup>Required</sup> <a name="metric" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.metric"></a> ```typescript public readonly metric: IMetric; ``` - *Type:* aws-cdk-lib.aws_cloudwatch.IMetric The metric object this alarm was based on. --- #### Constants <a name="Constants" id="Constants"></a> | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.ANOMALY_DETECTION_NO_THRESHOLD">ANOMALY_DETECTION_NO_THRESHOLD</a></code> | <code>number</code> | Conventional value for the threshold property when creating anomaly detection alarms. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.PROPERTY_INJECTION_ID">PROPERTY_INJECTION_ID</a></code> | <code>string</code> | Uniquely identifies this class. | --- ##### `ANOMALY_DETECTION_NO_THRESHOLD`<sup>Required</sup> <a name="ANOMALY_DETECTION_NO_THRESHOLD" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.ANOMALY_DETECTION_NO_THRESHOLD"></a> ```typescript public readonly ANOMALY_DETECTION_NO_THRESHOLD: number; ``` - *Type:* number Conventional value for the threshold property when creating anomaly detection alarms. Anomaly detection alarms don't have numbered threshold. Instead, they have a dynamically calculated threshold based on the metric math expression that contains a metric expression. The `threshold` property is required, but the value is ignored. This constant has the value 0, and has a symbolic name to indicate why the threshold is 0. You can use `new AnomalyDetectionAlarm()` to avoid having to pass the `threshold` property at all. --- ##### `PROPERTY_INJECTION_ID`<sup>Required</sup> <a name="PROPERTY_INJECTION_ID" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApi5XXErrorAlarm.property.PROPERTY_INJECTION_ID"></a> ```typescript public readonly PROPERTY_INJECTION_ID: string; ``` - *Type:* string Uniquely identifies this class. --- ### ApiGatewayRestApiCountAlarm <a name="ApiGatewayRestApiCountAlarm" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm"></a> This alarm helps to detect low traffic volume for the REST API stage. This can be an indicator of an issue with the application calling the API such as using incorrect endpoints. It could also be an indicator of an issue with the configuration or permissions of the API making it unreachable for clients. The alarm is triggered when the number of requests in a given period is less than threshold. #### Initializers <a name="Initializers" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' new ApiGatewayRestApiCountAlarm(scope: IConstruct, id: string, props: ApiGatewayRestApiCountAlarmProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.scope">scope</a></code> | <code>constructs.IConstruct</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.props">props</a></code> | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarmProps">ApiGatewayRestApiCountAlarmProps</a></code> | *No description.* | --- ##### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.scope"></a> - *Type:* constructs.IConstruct --- ##### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.id"></a> - *Type:* string --- ##### `props`<sup>Required</sup> <a name="props" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.Initializer.parameter.props"></a> - *Type:* <a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarmProps">ApiGatewayRestApiCountAlarmProps</a> --- #### Methods <a name="Methods" id="Methods"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.toString">toString</a></code> | Returns a string representation of this construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addAlarmAction">addAlarmAction</a></code> | Trigger this action if the alarm fires. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addInsufficientDataAction">addInsufficientDataAction</a></code> | Trigger this action if there is insufficient data to evaluate the alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addOkAction">addOkAction</a></code> | Trigger this action if the alarm returns from breaching state into ok state. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.renderAlarmRule">renderAlarmRule</a></code> | AlarmRule indicating ALARM state for Alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.toAnnotation">toAnnotation</a></code> | Turn this alarm into a horizontal annotation. | --- ##### `toString` <a name="toString" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.toString"></a> ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.applyRemovalPolicy"></a> ```typescript public applyRemovalPolicy(policy: RemovalPolicy): void ``` Apply the given removal policy to this resource. The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced. The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ###### `policy`<sup>Required</sup> <a name="policy" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.applyRemovalPolicy.parameter.policy"></a> - *Type:* aws-cdk-lib.RemovalPolicy --- ##### `addAlarmAction` <a name="addAlarmAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addAlarmAction"></a> ```typescript public addAlarmAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm fires. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addAlarmAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addInsufficientDataAction` <a name="addInsufficientDataAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addInsufficientDataAction"></a> ```typescript public addInsufficientDataAction(actions: ...IAlarmAction[]): void ``` Trigger this action if there is insufficient data to evaluate the alarm. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addInsufficientDataAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `addOkAction` <a name="addOkAction" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addOkAction"></a> ```typescript public addOkAction(actions: ...IAlarmAction[]): void ``` Trigger this action if the alarm returns from breaching state into ok state. Typically SnsAction or AutoScalingAction. ###### `actions`<sup>Required</sup> <a name="actions" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.addOkAction.parameter.actions"></a> - *Type:* ...aws-cdk-lib.aws_cloudwatch.IAlarmAction[] --- ##### `renderAlarmRule` <a name="renderAlarmRule" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.renderAlarmRule"></a> ```typescript public renderAlarmRule(): string ``` AlarmRule indicating ALARM state for Alarm. ##### `toAnnotation` <a name="toAnnotation" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.toAnnotation"></a> ```typescript public toAnnotation(): HorizontalAnnotation ``` Turn this alarm into a horizontal annotation. This is useful if you want to represent an Alarm in a non-AlarmWidget. An `AlarmWidget` can directly show an alarm, but it can only show a single alarm and no other metrics. Instead, you can convert the alarm to a HorizontalAnnotation and add it as an annotation to another graph. This might be useful if: - You want to show multiple alarms inside a single graph, for example if you have both a "small margin/long period" alarm as well as a "large margin/short period" alarm. - You want to show an Alarm line in a graph with multiple metrics in it. #### Static Functions <a name="Static Functions" id="Static Functions"></a> | **Name** | **Description** | | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isResource">isResource</a></code> | Check whether the given construct is a Resource. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmArn">fromAlarmArn</a></code> | Import an existing CloudWatch alarm provided an ARN. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmName">fromAlarmName</a></code> | Import an existing CloudWatch alarm provided an Name. | --- ##### ~~`isConstruct`~~ <a name="isConstruct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isConstruct"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApiCountAlarm.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`<sup>Required</sup> <a name="x" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isConstruct.parameter.x"></a> - *Type:* any Any object. --- ##### `isOwnedResource` <a name="isOwnedResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isOwnedResource"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApiCountAlarm.isOwnedResource(construct: IConstruct) ``` Returns true if the construct was created by CDK, and false otherwise. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isOwnedResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `isResource` <a name="isResource" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isResource"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApiCountAlarm.isResource(construct: IConstruct) ``` Check whether the given construct is a Resource. ###### `construct`<sup>Required</sup> <a name="construct" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.isResource.parameter.construct"></a> - *Type:* constructs.IConstruct --- ##### `fromAlarmArn` <a name="fromAlarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmArn"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApiCountAlarm.fromAlarmArn(scope: Construct, id: string, alarmArn: string) ``` Import an existing CloudWatch alarm provided an ARN. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmArn.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmArn.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmArn`<sup>Required</sup> <a name="alarmArn" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmArn.parameter.alarmArn"></a> - *Type:* string Alarm ARN (i.e. arn:aws:cloudwatch:<region>:<account-id>:alarm:Foo). --- ##### `fromAlarmName` <a name="fromAlarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmName"></a> ```typescript import { ApiGatewayRestApiCountAlarm } from '@renovosolutions/cdk-library-cloudwatch-alarms' ApiGatewayRestApiCountAlarm.fromAlarmName(scope: Construct, id: string, alarmName: string) ``` Import an existing CloudWatch alarm provided an Name. ###### `scope`<sup>Required</sup> <a name="scope" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmName.parameter.scope"></a> - *Type:* constructs.Construct The parent creating construct (usually `this`). --- ###### `id`<sup>Required</sup> <a name="id" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmName.parameter.id"></a> - *Type:* string The construct's name. --- ###### `alarmName`<sup>Required</sup> <a name="alarmName" id="@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.fromAlarmName.parameter.alarmName"></a> - *Type:* string Alarm Name. --- #### Properties <a name="Properties" id="Properties"></a> | **Name** | **Type** | **Description** | | --- | --- | --- | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.property.alarmArn">alarmArn</a></code> | <code>string</code> | ARN of this alarm. | | <code><a href="#@renovosolutions/cdk-library-cloudwatch-alarms.ApiGatewayRestApiCountAlarm.pro