import * as cloudfront from '@aws-cdk/aws-cloudfront'; import * as docdb from '@aws-cdk/aws-docdb'; import * as dynamodb from '@aws-cdk/aws-dynamodb'; import * as ecs from '@aws-cdk/aws-ecs'; import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; import * as lambda from '@aws-cdk/aws-lambda'; import * as rds from '@aws-cdk/aws-rds'; import * as sns from '@aws-cdk/aws-sns'; import * as cdk from '@aws-cdk/core'; import { WatchLambdaFunctionOptions, WatchCloudfrontDistributionOptions, WatchApplicationLoadBalancerOptions, WatchEcsServiceOptions, WatchApplicationTargetGroupOptions, MetricAlarmProps, WatchDocDbClusterOptions, WatchDatabaseClusterOptions, WatchDynamoDbTableOptions, LogAlarmProps } from '..'; /** * Interface for Watchful implementation. * * @stability stable */ export interface IWatchful extends cdk.IConstruct { /** * Adds and alert for error logs. * * @param serviceName The name of the service. * @stability stable */ createLogAlarm(scope: cdk.Construct, serviceName: string, alarm: LogAlarmProps): void; /** * Adds the alarmTopic as alarm action to the given alarm. * * @param alarm The watchful to add those resources to. * @stability stable */ createAlarm(scope: cdk.Construct, id: string, alarm: MetricAlarmProps): void; } /** * Properties for defining Watchful. * * @stability stable */ export interface WatchfulProps { /** * An SNS topic as target for alarm actions. * * @default : The SNS topic provided by OpsGenie Integration account module. * @stability stable */ readonly alarmSns?: sns.ITopic; /** * The service token for the DataDog Monitor custom resource. * * @default : Empty. * @stability stable */ readonly dataDogMonitorServiceToken?: string; /** * The service name. * * @default : The stack anme. * @stability stable */ readonly dataDogMonitorServiceName?: string; /** * The OpsGenie handle used in DataDog to forward the DD monitor to OpsGenie. * * @default : Empty if dataDogMonitorServiceToken is not set. Otherwise, team SSM parameter from LandingZone is used. * @stability stable */ readonly dataDogOpsGenieIntegrationName?: string; } /** * A construct to watch given scope or resources. * * Opinionated DataDog alarms are automatically created for watched resources. * * @stability stable */ export declare class Watchful extends cdk.Construct implements IWatchful { private readonly alarmTopic?; private readonly dataDogMonitorServiceToken?; private readonly dataDogOpsGenieIntegrationName?; private readonly dataDogMonitorServiceName; /** * @stability stable */ constructor(scope: cdk.Construct, id: string, props?: WatchfulProps); /** * Adds the alarmTopic as alarm action to the given alarm. * * @param alarm The watchful to add those resources to. * @stability stable */ createAlarm(scope: cdk.Construct, id: string, alarm: MetricAlarmProps): void; /** * Adds an alert for error logs. * * @stability stable */ createLogAlarm(scope: cdk.Construct, id: string, alarm: LogAlarmProps): void; /** * Watches the given scope and adds alarms for known resources. * * @stability stable */ watchScope(scope: cdk.Construct): void; /** * Adds alarms for the given lambda function. * * @param fn A lambda function that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchLambdaFunction(fn: lambda.Function, options?: WatchLambdaFunctionOptions): void; /** * Adds alarms for the given Cloudfront Distribution. * * @param cf A Cloudfront Distribution that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchCloudfrontDistribution(cf: cloudfront.Distribution, options?: WatchCloudfrontDistributionOptions): void; /** * Adds alarms for the given ECS service. * * @param service An ECS service that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchEcsService(service: ecs.BaseService, options?: WatchEcsServiceOptions): void; /** * Adds alarms for the given application load balancer. * * @param alb An application load balancer that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchAlb(alb: elbv2.ApplicationLoadBalancer, options?: WatchApplicationLoadBalancerOptions): void; /** * Adds alarms for the given application target gorup. * * @param atg An application target group that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchApplicationTargetGroup(atg: elbv2.ApplicationTargetGroup, options?: WatchApplicationTargetGroupOptions): void; /** * Adds alarms for the given DocDb cluster. * * @param docDb An DocDb cluster that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchDocDb(docDb: docdb.DatabaseCluster, options?: WatchDocDbClusterOptions): void; /** * Adds alarms for the given database cluster. * * @param databaseCluster An database cluster that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchDatabaseCluster(databaseCluster: rds.DatabaseCluster, options?: WatchDatabaseClusterOptions): void; /** * Adds alarms for the given DynamoDb table. * * @param dynamoDbTable An database cluster that should be watched [disable-awslint:ref-via-interface]. * @stability stable */ watchDynamoDbTable(dynamoDbTable: dynamodb.Table, options?: WatchDynamoDbTableOptions): void; }