UNPKG

cost-monitoring-construct

Version:

A CDK construct that helps track applications' costs separately and receive alerts in case of unpredicted resource usage

44 lines (43 loc) 1.61 kB
import { aws_budgets as budgets } from "aws-cdk-lib"; import { Construct } from "constructs"; import { TimeUnit, ITag, NotificationType, ThresholdType, ComparisonOperator } from "./utils"; export interface IBudgetProps { tags?: Array<ITag>; limit: number; subscribers: Array<budgets.CfnBudget.SubscriberProperty>; alertContdition: IBudgetAlertCondition; } export interface IBudgetAlertCondition { period: TimeUnit; comparisonOperator?: ComparisonOperator; notificationType?: NotificationType.ACTUAL; threshold: number; thresholdType?: ThresholdType; } export interface IOptionalBudgetAlertCondition { period?: TimeUnit; comparisonOperator?: ComparisonOperator; notificationType?: NotificationType.ACTUAL; threshold?: number; thresholdType?: ThresholdType; } export interface IOptionalBudgetProps { tags?: Array<ITag>; limit?: number; subscribers?: Array<budgets.CfnBudget.SubscriberProperty>; alertContdition?: IOptionalBudgetAlertCondition; } export declare class Budget extends Construct { private readonly props; private readonly scope; constructor(scope: Construct, id: string, props: IBudgetProps); private createCostFilters; /** * create a copy of the object with the provided changes. * * @param id - a unique CDK Construct identifier. * @param props - you can choose to optionally pass all the initializer parameters of this class as the changes you wish to have on the cloned object. * @returns - copy of the object */ clone(id: string, props: IOptionalBudgetProps): Budget; }