@composurecdk/budgets 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/alarm-config.d.ts.map +1 -0
- package/dist/commonjs/alarm-config.js +3 -0
- package/dist/{alarm-config.js.map → commonjs/alarm-config.js.map} +1 -1
- package/dist/{budget-alarm-builder.d.ts → commonjs/budget-alarm-builder.d.ts} +5 -2
- package/dist/commonjs/budget-alarm-builder.d.ts.map +1 -0
- package/dist/commonjs/budget-alarm-builder.js +149 -0
- package/dist/commonjs/budget-alarm-builder.js.map +1 -0
- package/dist/commonjs/budget-alarms.d.ts.map +1 -0
- package/dist/commonjs/budget-alarms.js +53 -0
- package/dist/commonjs/budget-alarms.js.map +1 -0
- package/dist/{budget-builder.d.ts → commonjs/budget-builder.d.ts} +3 -1
- package/dist/commonjs/budget-builder.d.ts.map +1 -0
- package/dist/commonjs/budget-builder.js +170 -0
- package/dist/commonjs/budget-builder.js.map +1 -0
- package/dist/commonjs/currency.d.ts.map +1 -0
- package/dist/commonjs/currency.js +39 -0
- package/dist/commonjs/currency.js.map +1 -0
- package/dist/commonjs/defaults.d.ts.map +1 -0
- package/dist/commonjs/defaults.js +94 -0
- package/dist/commonjs/defaults.js.map +1 -0
- package/dist/commonjs/email.d.ts.map +1 -0
- package/dist/commonjs/email.js +33 -0
- package/dist/commonjs/email.js.map +1 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +18 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/notifications.d.ts.map +1 -0
- package/dist/commonjs/notifications.js +43 -0
- package/dist/commonjs/notifications.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/topic-policy.d.ts.map +1 -0
- package/dist/commonjs/topic-policy.js +45 -0
- package/dist/commonjs/topic-policy.js.map +1 -0
- package/dist/esm/alarm-config.d.ts +61 -0
- package/dist/esm/alarm-config.d.ts.map +1 -0
- package/dist/esm/alarm-config.js.map +1 -0
- package/dist/esm/budget-alarm-builder.d.ts +150 -0
- package/dist/esm/budget-alarm-builder.d.ts.map +1 -0
- package/dist/{budget-alarm-builder.js → esm/budget-alarm-builder.js} +8 -2
- package/dist/esm/budget-alarm-builder.js.map +1 -0
- package/dist/esm/budget-alarms.d.ts +22 -0
- package/dist/esm/budget-alarms.d.ts.map +1 -0
- package/dist/esm/budget-alarms.js.map +1 -0
- package/dist/esm/budget-builder.d.ts +192 -0
- package/dist/esm/budget-builder.d.ts.map +1 -0
- package/dist/{budget-builder.js → esm/budget-builder.js} +7 -1
- package/dist/esm/budget-builder.js.map +1 -0
- package/dist/esm/currency.d.ts +21 -0
- package/dist/esm/currency.d.ts.map +1 -0
- package/dist/esm/currency.js.map +1 -0
- package/dist/esm/defaults.d.ts +57 -0
- package/dist/esm/defaults.d.ts.map +1 -0
- package/dist/esm/defaults.js.map +1 -0
- package/dist/esm/email.d.ts +28 -0
- package/dist/esm/email.d.ts.map +1 -0
- package/dist/esm/email.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/notifications.d.ts +88 -0
- package/dist/esm/notifications.d.ts.map +1 -0
- package/dist/esm/notifications.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/topic-policy.d.ts +20 -0
- package/dist/esm/topic-policy.d.ts.map +1 -0
- package/dist/esm/topic-policy.js.map +1 -0
- package/package.json +35 -16
- package/dist/alarm-config.d.ts.map +0 -1
- package/dist/budget-alarm-builder.d.ts.map +0 -1
- package/dist/budget-alarm-builder.js.map +0 -1
- package/dist/budget-alarms.d.ts.map +0 -1
- package/dist/budget-alarms.js.map +0 -1
- package/dist/budget-builder.d.ts.map +0 -1
- package/dist/budget-builder.js.map +0 -1
- package/dist/currency.d.ts.map +0 -1
- package/dist/currency.js.map +0 -1
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js.map +0 -1
- package/dist/email.d.ts.map +0 -1
- package/dist/email.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/notifications.d.ts.map +0 -1
- package/dist/notifications.js.map +0 -1
- package/dist/topic-policy.d.ts.map +0 -1
- package/dist/topic-policy.js.map +0 -1
- /package/dist/{alarm-config.d.ts → commonjs/alarm-config.d.ts} +0 -0
- /package/dist/{budget-alarms.d.ts → commonjs/budget-alarms.d.ts} +0 -0
- /package/dist/{currency.d.ts → commonjs/currency.d.ts} +0 -0
- /package/dist/{defaults.d.ts → commonjs/defaults.d.ts} +0 -0
- /package/dist/{email.d.ts → commonjs/email.d.ts} +0 -0
- /package/dist/{index.d.ts → commonjs/index.d.ts} +0 -0
- /package/dist/{notifications.d.ts → commonjs/notifications.d.ts} +0 -0
- /package/dist/{topic-policy.d.ts → commonjs/topic-policy.d.ts} +0 -0
- /package/dist/{alarm-config.js → esm/alarm-config.js} +0 -0
- /package/dist/{budget-alarms.js → esm/budget-alarms.js} +0 -0
- /package/dist/{currency.js → esm/currency.js} +0 -0
- /package/dist/{defaults.js → esm/defaults.js} +0 -0
- /package/dist/{email.js → esm/email.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{notifications.js → esm/notifications.js} +0 -0
- /package/dist/{topic-policy.js → esm/topic-policy.js} +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { CfnBudget } from "aws-cdk-lib/aws-budgets";
|
|
2
|
+
import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
|
|
3
|
+
import type { TopicPolicy } from "aws-cdk-lib/aws-sns";
|
|
4
|
+
import type { IConstruct } from "constructs";
|
|
5
|
+
import { COPY_STATE, type IBuilder, type Lifecycle } from "@composurecdk/core";
|
|
6
|
+
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
7
|
+
import type { BudgetAlarmConfig } from "./alarm-config.js";
|
|
8
|
+
import { type NotificationEntry, type NotifySubscribers } from "./notifications.js";
|
|
9
|
+
/**
|
|
10
|
+
* Spend limit for a cost or usage budget.
|
|
11
|
+
*/
|
|
12
|
+
export interface BudgetLimit {
|
|
13
|
+
/** Numeric limit. */
|
|
14
|
+
amount: number;
|
|
15
|
+
/**
|
|
16
|
+
* Currency or usage unit. Defaults to
|
|
17
|
+
* {@link BUDGET_DEFAULTS.limitUnit} when omitted.
|
|
18
|
+
*
|
|
19
|
+
* For `COST` budgets, must be a recognised AWS Budgets currency
|
|
20
|
+
* (validated at synth — see {@link DEFAULT_BUDGET_CURRENCIES}). The
|
|
21
|
+
* builder also emits a non-fatal warning when this is anything other
|
|
22
|
+
* than `"USD"`, since the account's billing currency isn't visible
|
|
23
|
+
* at synth and a mismatch is rejected at deploy time.
|
|
24
|
+
*/
|
|
25
|
+
unit?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Configuration properties for the budget builder.
|
|
29
|
+
*/
|
|
30
|
+
export interface BudgetBuilderProps {
|
|
31
|
+
/** Name used for `BudgetName` in the `BudgetData` property. */
|
|
32
|
+
budgetName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* One of `COST`, `USAGE`, `RI_UTILIZATION`, `RI_COVERAGE`,
|
|
35
|
+
* `SAVINGS_PLANS_UTILIZATION`, `SAVINGS_PLANS_COVERAGE`.
|
|
36
|
+
*
|
|
37
|
+
* @default "COST"
|
|
38
|
+
*/
|
|
39
|
+
budgetType?: string;
|
|
40
|
+
/** @default "MONTHLY" */
|
|
41
|
+
timeUnit?: string;
|
|
42
|
+
/** Spend limit (required for COST and USAGE budgets). */
|
|
43
|
+
limit?: BudgetLimit;
|
|
44
|
+
/**
|
|
45
|
+
* CloudFormation `CostFilters` map. Keys are filter dimensions
|
|
46
|
+
* (`Service`, `Region`, `LinkedAccount`, `TagKeyValue`, …) and values
|
|
47
|
+
* are arrays of filter values.
|
|
48
|
+
*/
|
|
49
|
+
costFilters?: Record<string, string[]>;
|
|
50
|
+
/** CloudFormation `CostTypes` passthrough. */
|
|
51
|
+
costTypes?: CfnBudget.CostTypesProperty;
|
|
52
|
+
/**
|
|
53
|
+
* Configuration for the AWS-recommended billing alarm.
|
|
54
|
+
*
|
|
55
|
+
* Off by default — pass an
|
|
56
|
+
* {@link BudgetAlarmConfig.estimatedCharges} entry to opt in. Set to
|
|
57
|
+
* `false` to suppress recommended alarms entirely; custom alarms added
|
|
58
|
+
* via {@link IBudgetBuilder.addAlarm} are unaffected.
|
|
59
|
+
*
|
|
60
|
+
* Note: `AWS/Billing EstimatedCharges` is emitted in `us-east-1` only.
|
|
61
|
+
* If this builder is used outside `us-east-1`, the synthesised alarm
|
|
62
|
+
* will never receive data — the builder emits a synth-time warning.
|
|
63
|
+
* For non-`us-east-1` stacks, suppress this builder's alarms with
|
|
64
|
+
* `recommendedAlarms: false` and create alarms in a `us-east-1` stack
|
|
65
|
+
* via {@link createBudgetAlarmBuilder}.
|
|
66
|
+
*
|
|
67
|
+
* @see BudgetAlarmConfig
|
|
68
|
+
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
|
|
69
|
+
*/
|
|
70
|
+
recommendedAlarms?: BudgetAlarmConfig | false;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The build output of an {@link IBudgetBuilder}.
|
|
74
|
+
*/
|
|
75
|
+
export interface BudgetBuilderResult {
|
|
76
|
+
/** The `AWS::Budgets::Budget` construct. */
|
|
77
|
+
budget: CfnBudget;
|
|
78
|
+
/**
|
|
79
|
+
* `AWS::SNS::TopicPolicy` constructs created automatically for any SNS
|
|
80
|
+
* topic referenced as a notification subscriber, keyed by the topic's
|
|
81
|
+
* fully-qualified node path. Grants `budgets.amazonaws.com` permission
|
|
82
|
+
* to publish.
|
|
83
|
+
*
|
|
84
|
+
* `{}` when no SNS subscribers were configured.
|
|
85
|
+
*/
|
|
86
|
+
topicPolicies: Record<string, TopicPolicy>;
|
|
87
|
+
/**
|
|
88
|
+
* CloudWatch alarms created for the budget.
|
|
89
|
+
*
|
|
90
|
+
* Includes both AWS-recommended alarms (`estimatedCharges`, off by
|
|
91
|
+
* default) and any custom alarms added via
|
|
92
|
+
* {@link IBudgetBuilder.addAlarm}. Empty unless the caller opts in via
|
|
93
|
+
* `recommendedAlarms` or `addAlarm`.
|
|
94
|
+
*
|
|
95
|
+
* No alarm actions are configured — apply them via the result or an
|
|
96
|
+
* `afterBuild` hook.
|
|
97
|
+
*/
|
|
98
|
+
alarms: Record<string, Alarm>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A fluent builder for configuring and creating an AWS Budget.
|
|
102
|
+
*
|
|
103
|
+
* Wraps the {@link CfnBudget} L1 construct (the CDK does not ship an L2
|
|
104
|
+
* for Budgets) with well-architected defaults, helpers for the
|
|
105
|
+
* percentage-threshold notification shape, and automatic
|
|
106
|
+
* `AWS::SNS::TopicPolicy` wiring for SNS subscribers.
|
|
107
|
+
*
|
|
108
|
+
* The builder can also create the AWS-recommended `EstimatedCharges`
|
|
109
|
+
* billing alarm; opt in via `recommendedAlarms`. For non-`us-east-1`
|
|
110
|
+
* stacks, route the alarms separately via
|
|
111
|
+
* {@link createBudgetAlarmBuilder}.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* createBudgetBuilder()
|
|
116
|
+
* .budgetName("AgentBudget")
|
|
117
|
+
* .limit({ amount: 50 })
|
|
118
|
+
* .notifyOnActual(100, {
|
|
119
|
+
* emails: [email("ops@example.com")],
|
|
120
|
+
* sns: ref("alerts", r => r.topic),
|
|
121
|
+
* })
|
|
122
|
+
* .withRecommendedThresholds({ emails: [email("ops@example.com")] })
|
|
123
|
+
* .build(stack, "AgentBudget");
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export type IBudgetBuilder = IBuilder<BudgetBuilderProps, BudgetBuilder>;
|
|
127
|
+
declare class BudgetBuilder implements Lifecycle<BudgetBuilderResult> {
|
|
128
|
+
#private;
|
|
129
|
+
props: Partial<BudgetBuilderProps>;
|
|
130
|
+
/**
|
|
131
|
+
* Add a notification that fires when ACTUAL spend crosses the given
|
|
132
|
+
* percentage of the budget limit.
|
|
133
|
+
*
|
|
134
|
+
* @param thresholdPercent - Percentage of the budget limit (e.g. `80`).
|
|
135
|
+
* For absolute-value thresholds, use {@link addNotification} directly.
|
|
136
|
+
* @param subscribers - Up to one SNS topic plus up to ten validated
|
|
137
|
+
* email addresses. AWS Budgets caps each notification at 1 SNS + up
|
|
138
|
+
* to 10 EMAIL subscribers.
|
|
139
|
+
*/
|
|
140
|
+
notifyOnActual(thresholdPercent: number, subscribers: NotifySubscribers): this;
|
|
141
|
+
/**
|
|
142
|
+
* Add a notification that fires when FORECASTED spend crosses the
|
|
143
|
+
* given percentage of the budget limit.
|
|
144
|
+
*
|
|
145
|
+
* @param thresholdPercent - Percentage of the budget limit (e.g. `100`).
|
|
146
|
+
* For absolute-value thresholds, use {@link addNotification} directly.
|
|
147
|
+
* @param subscribers - Up to one SNS topic plus up to ten validated
|
|
148
|
+
* email addresses.
|
|
149
|
+
*/
|
|
150
|
+
notifyOnForecasted(thresholdPercent: number, subscribers: NotifySubscribers): this;
|
|
151
|
+
/**
|
|
152
|
+
* Raw notification passthrough for callers that need the full
|
|
153
|
+
* CloudFormation surface (e.g. absolute-value thresholds).
|
|
154
|
+
*/
|
|
155
|
+
addNotification(entry: NotificationEntry): this;
|
|
156
|
+
/**
|
|
157
|
+
* Apply the well-architected recommended notification thresholds:
|
|
158
|
+
*
|
|
159
|
+
* - `ACTUAL` at 80% — early warning before breach.
|
|
160
|
+
* - `FORECASTED` at 100% — trending-over-budget alert.
|
|
161
|
+
*
|
|
162
|
+
* Must be called with at least one subscriber; the same subscriber
|
|
163
|
+
* set is used for both thresholds.
|
|
164
|
+
*
|
|
165
|
+
* @see https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-best-practices.html
|
|
166
|
+
*/
|
|
167
|
+
withRecommendedThresholds(subscribers: NotifySubscribers): this;
|
|
168
|
+
/**
|
|
169
|
+
* Adds a custom CloudWatch alarm against the budget. The configure
|
|
170
|
+
* callback receives a fresh {@link AlarmDefinitionBuilder} pre-set with
|
|
171
|
+
* the alarm's key; configure metric, threshold, comparison and any
|
|
172
|
+
* other options.
|
|
173
|
+
*
|
|
174
|
+
* Custom alarms are materialised in this builder's stack alongside any
|
|
175
|
+
* recommended alarms. Like the recommended `EstimatedCharges` alarm,
|
|
176
|
+
* custom alarms on `AWS/Billing` metrics will only fire when this
|
|
177
|
+
* stack is in `us-east-1` — the builder emits the same synth-time
|
|
178
|
+
* warning (`@composurecdk/budgets:alarm-region`) when used elsewhere.
|
|
179
|
+
* For non-`us-east-1` stacks, route alarms via
|
|
180
|
+
* {@link createBudgetAlarmBuilder} into a `us-east-1` stack.
|
|
181
|
+
*/
|
|
182
|
+
addAlarm(key: string, configure: (alarm: AlarmDefinitionBuilder<CfnBudget>) => AlarmDefinitionBuilder<CfnBudget>): this;
|
|
183
|
+
/** @internal — see ADR-0005. */
|
|
184
|
+
[COPY_STATE](target: BudgetBuilder): void;
|
|
185
|
+
build(scope: IConstruct, id: string, context?: Record<string, object>): BudgetBuilderResult;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Creates a new {@link IBudgetBuilder} for configuring an AWS Budget.
|
|
189
|
+
*/
|
|
190
|
+
export declare function createBudgetBuilder(): IBudgetBuilder;
|
|
191
|
+
export {};
|
|
192
|
+
//# sourceMappingURL=budget-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget-builder.d.ts","sourceRoot":"","sources":["../../src/budget-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO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;;;;;;;GAyBG;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;AAEzE,cAAM,aAAc,YAAW,SAAS,CAAC,mBAAmB,CAAC;;IAC3D,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAM;IAIxC;;;;;;;;;OASG;IACH,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAI9E;;;;;;;;OAQG;IACH,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAIlF;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAK/C;;;;;;;;;;OAUG;IACH,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAc/D;;;;;;;;;;;;;OAaG;IACH,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,SAAS,CAAC,KAAK,sBAAsB,CAAC,SAAS,CAAC,GACzF,IAAI;IAKP,gCAAgC;IAChC,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAKzC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,mBAAmB;CAkGhG;AAWD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAGpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CfnBudget } from "aws-cdk-lib/aws-budgets";
|
|
2
|
-
import { Builder } from "@composurecdk/core";
|
|
2
|
+
import { Builder, COPY_STATE } from "@composurecdk/core";
|
|
3
3
|
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
4
4
|
import { buildBudgetAlarms } from "./budget-alarm-builder.js";
|
|
5
5
|
import { assertValidBudgetCurrency, warnIfNonUsdCurrency } from "./currency.js";
|
|
@@ -81,6 +81,11 @@ class BudgetBuilder {
|
|
|
81
81
|
this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
|
|
82
82
|
return this;
|
|
83
83
|
}
|
|
84
|
+
/** @internal — see ADR-0005. */
|
|
85
|
+
[COPY_STATE](target) {
|
|
86
|
+
target.#notifications.push(...this.#notifications);
|
|
87
|
+
target.#customAlarms.push(...this.#customAlarms);
|
|
88
|
+
}
|
|
84
89
|
build(scope, id, context = {}) {
|
|
85
90
|
const { recommendedAlarms: alarmConfig, ...budgetProps } = this.props;
|
|
86
91
|
const budgetType = budgetProps.budgetType ?? BUDGET_DEFAULTS.budgetType;
|
|
@@ -156,6 +161,7 @@ function describeNotification(entry) {
|
|
|
156
161
|
* Creates a new {@link IBudgetBuilder} for configuring an AWS Budget.
|
|
157
162
|
*/
|
|
158
163
|
export function createBudgetBuilder() {
|
|
164
|
+
// eslint-disable-next-line composurecdk/builder-must-be-tagged -- AWS::Budgets::Budget has no Tags property
|
|
159
165
|
return Builder(BudgetBuilder);
|
|
160
166
|
}
|
|
161
167
|
//# sourceMappingURL=budget-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget-builder.js","sourceRoot":"","sources":["../../src/budget-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AAIzE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAiC,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAIL,kBAAkB,EAClB,gCAAgC,GACjC,MAA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C,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAwB;IACpD,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,YAAY,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,OAAO,gBAAgB,KAAK,CAAC,gBAAgB,MAAM,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,4GAA4G;IAC5G,OAAO,OAAO,CAAoC,aAAa,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IConstruct } from "constructs";
|
|
2
|
+
/**
|
|
3
|
+
* Throws if `unit` is not in {@link DEFAULT_BUDGET_CURRENCIES}.
|
|
4
|
+
*
|
|
5
|
+
* `context` is woven into the message (e.g. `BudgetBuilder "X": limit
|
|
6
|
+
* unit ...`) so callers can blame the right field. Catches typos like
|
|
7
|
+
* `"USDD"` or `"ZZZ"` at synth instead of mid-deploy.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertValidBudgetCurrency(unit: string, context: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Annotates `scope` with a non-fatal warning when `unit` is anything
|
|
12
|
+
* other than `USD`. The synth context cannot see an account's billing
|
|
13
|
+
* currency, and AWS Budgets rejects `BudgetLimit.Unit` values that
|
|
14
|
+
* don't match it — so a non-USD configuration deserves a "make sure
|
|
15
|
+
* this matches your billing currency" nudge.
|
|
16
|
+
*
|
|
17
|
+
* Short-circuits on unresolved tokens so env-agnostic stacks aren't
|
|
18
|
+
* spammed.
|
|
19
|
+
*/
|
|
20
|
+
export declare function warnIfNonUsdCurrency(scope: IConstruct, unit: string, context: string): void;
|
|
21
|
+
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../src/currency.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAM7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAS3F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../src/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,OAAe;IACrE,IAAI,yBAAyB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO;IACrD,MAAM,IAAI,KAAK,CACb,GAAG,OAAO,MAAM,IAAI,mDAAmD;QACrE,oBAAoB,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9D,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAiB,EAAE,IAAY,EAAE,OAAe;IACnF,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO;IACrC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO;IAC3B,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,YAAY,CAChC,sCAAsC,EACtC,GAAG,OAAO,eAAe,IAAI,6DAA6D;QACxF,yFAAyF;QACzF,uCAAuC,CAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-architected defaults for {@link createBudgetBuilder}. Each can be
|
|
3
|
+
* overridden via the builder's fluent API.
|
|
4
|
+
*
|
|
5
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html
|
|
6
|
+
*/
|
|
7
|
+
export declare const BUDGET_DEFAULTS: {
|
|
8
|
+
/**
|
|
9
|
+
* Default budget type — most budgets are cost budgets.
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html
|
|
12
|
+
*/
|
|
13
|
+
budgetType: "COST";
|
|
14
|
+
/**
|
|
15
|
+
* Default tracking period — monthly is the most common granularity and
|
|
16
|
+
* aligns with AWS billing cycles.
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-create.html
|
|
19
|
+
*/
|
|
20
|
+
timeUnit: "MONTHLY";
|
|
21
|
+
/**
|
|
22
|
+
* Default spend currency — most customers need to set this; the builder
|
|
23
|
+
* defaults to USD to align with the AWS Billing reporting default.
|
|
24
|
+
*
|
|
25
|
+
* @see https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Spend.html
|
|
26
|
+
*/
|
|
27
|
+
limitUnit: string;
|
|
28
|
+
/**
|
|
29
|
+
* Recommended percentage thresholds applied by
|
|
30
|
+
* {@link IBudgetBuilder.withRecommendedThresholds}.
|
|
31
|
+
*
|
|
32
|
+
* - `ACTUAL` at 80% — early warning before you breach the budget.
|
|
33
|
+
* - `FORECASTED` at 100% — notifies when forecasted spend trends over
|
|
34
|
+
* budget for the period.
|
|
35
|
+
*
|
|
36
|
+
* @see https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-best-practices.html
|
|
37
|
+
*/
|
|
38
|
+
recommendedThresholds: {
|
|
39
|
+
actualPercent: number;
|
|
40
|
+
forecastedPercent: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* ISO 4217 currency codes accepted by AWS Budgets for `COST` budgets'
|
|
45
|
+
* `BudgetLimit.Unit` and the `EstimatedCharges` alarm's `Currency`
|
|
46
|
+
* dimension. Sourced from the AWS Billing supported-currencies list.
|
|
47
|
+
*
|
|
48
|
+
* The synth context cannot see an account's billing currency, so the
|
|
49
|
+
* builder uses this set for shape validation only — a hard error on
|
|
50
|
+
* anything outside it (catches typos like `"ZZZ"`/`"USDD"`) — and emits
|
|
51
|
+
* a soft warning when the configured unit is anything other than `USD`,
|
|
52
|
+
* since most accounts default to USD billing.
|
|
53
|
+
*
|
|
54
|
+
* @see https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/manage-account-payment.html
|
|
55
|
+
*/
|
|
56
|
+
export declare const DEFAULT_BUDGET_CURRENCIES: readonly string[];
|
|
57
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;;;;CAKJ,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAkCtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;;;OAIG;IACH,UAAU,EAAE,MAAe;IAE3B;;;;;OAKG;IACH,QAAQ,EAAE,SAAkB;IAE5B;;;;;OAKG;IACH,SAAS,EAAE,KAAK;IAEhB;;;;;;;;;OASG;IACH,qBAAqB,EAAE;QACrB,aAAa,EAAE,EAAE;QACjB,iBAAiB,EAAE,GAAG;KACvB;CACF,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const emailBrand: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* A validated email address suitable for use as a budget notification
|
|
4
|
+
* subscriber. Construct via {@link email}; the brand prevents bare
|
|
5
|
+
* strings from being passed where an `Email` is required, ensuring the
|
|
6
|
+
* value has been syntactically validated and length-checked against
|
|
7
|
+
* AWS Budgets' per-subscriber limit.
|
|
8
|
+
*/
|
|
9
|
+
export type Email = string & {
|
|
10
|
+
readonly [emailBrand]: true;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Validates and brands a string as an {@link Email}.
|
|
14
|
+
*
|
|
15
|
+
* The pattern intentionally errs on the side of acceptance — anything
|
|
16
|
+
* obviously not an email (whitespace, missing `@`, missing TLD) is
|
|
17
|
+
* rejected, but any address AWS Budgets will plausibly accept passes.
|
|
18
|
+
* The 50-char cap matches the Budgets API's documented per-subscriber
|
|
19
|
+
* limit.
|
|
20
|
+
*
|
|
21
|
+
* @throws If the input is empty, exceeds 50 characters, or doesn't
|
|
22
|
+
* contain `local@domain.tld`.
|
|
23
|
+
*
|
|
24
|
+
* @see https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Subscriber.html
|
|
25
|
+
*/
|
|
26
|
+
export declare function email(input: string): Email;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAK7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAc1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/email.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,iBAAiB,MAAM,CAAC,OAAO,CAAC,+CAA+C,OAAO,GAAG,CAC1F,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,GAAG,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,OAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createBudgetBuilder, type IBudgetBuilder, type BudgetBuilderProps, type BudgetBuilderResult, type BudgetLimit, } from "./budget-builder.js";
|
|
2
|
+
export { createBudgetAlarmBuilder, type IBudgetAlarmBuilder, type BudgetAlarmBuilderProps, type BudgetAlarmBuilderResult, } from "./budget-alarm-builder.js";
|
|
3
|
+
export { BUDGET_DEFAULTS, DEFAULT_BUDGET_CURRENCIES } from "./defaults.js";
|
|
4
|
+
export { type BudgetAlarmConfig, type EstimatedChargesAlarmConfig } from "./alarm-config.js";
|
|
5
|
+
export { createBudgetsTopicPolicies } from "./topic-policy.js";
|
|
6
|
+
export { email, type Email } from "./email.js";
|
|
7
|
+
export { resolveSubscribers, toCfnNotificationWithSubscribers, type NotificationEntry, type NotificationType, type NotifySubscribers, type ResolvedSubscribers, } from "./notifications.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAKpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,GAIzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,gCAAgC,GAKjC,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CfnBudget } from "aws-cdk-lib/aws-budgets";
|
|
2
|
+
import type { ITopic } from "aws-cdk-lib/aws-sns";
|
|
3
|
+
import { type Resolvable } from "@composurecdk/core";
|
|
4
|
+
import type { Email } from "./email.js";
|
|
5
|
+
/**
|
|
6
|
+
* Subscribers attached to a budget notification.
|
|
7
|
+
*
|
|
8
|
+
* AWS Budgets enforces an asymmetric per-notification subscriber rule
|
|
9
|
+
* that CloudFormation does not model:
|
|
10
|
+
*
|
|
11
|
+
* - up to 10 subscribers per notification
|
|
12
|
+
* - **at most one** with `SubscriptionType=SNS`
|
|
13
|
+
* - the remainder must be `EMAIL`
|
|
14
|
+
*
|
|
15
|
+
* This shape encodes that constraint in the type system: `sns` is
|
|
16
|
+
* singular, so passing two SNS topics is unrepresentable. The
|
|
17
|
+
* combined-count cap is enforced at synth time.
|
|
18
|
+
*
|
|
19
|
+
* @see https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_NotificationWithSubscribers.html
|
|
20
|
+
*/
|
|
21
|
+
export interface NotifySubscribers {
|
|
22
|
+
/**
|
|
23
|
+
* Optional SNS topic to publish notifications to. AWS Budgets allows
|
|
24
|
+
* at most one SNS subscriber per notification; route fan-out by
|
|
25
|
+
* adding additional subscriptions to this single topic.
|
|
26
|
+
*/
|
|
27
|
+
sns?: ITopic | Resolvable<ITopic>;
|
|
28
|
+
/**
|
|
29
|
+
* Optional list of validated email addresses. Construct each value
|
|
30
|
+
* via {@link email}; bare strings are rejected at compile time. The
|
|
31
|
+
* combined `sns` + `emails` count must be ≤ 10.
|
|
32
|
+
*/
|
|
33
|
+
emails?: Email[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Which side of spend a notification triggers on.
|
|
37
|
+
*
|
|
38
|
+
* - `ACTUAL` — fires when real, posted spend crosses the threshold.
|
|
39
|
+
* - `FORECASTED` — fires when AWS projects you will cross the threshold
|
|
40
|
+
* during the current budget period.
|
|
41
|
+
*/
|
|
42
|
+
export type NotificationType = "ACTUAL" | "FORECASTED";
|
|
43
|
+
/**
|
|
44
|
+
* Raw notification entry accepted by {@link IBudgetBuilder.addNotification}.
|
|
45
|
+
*
|
|
46
|
+
* Callers that need the full CloudFormation surface (custom comparison
|
|
47
|
+
* operators, absolute-value thresholds) should use this shape; for the
|
|
48
|
+
* common percentage case, prefer
|
|
49
|
+
* {@link IBudgetBuilder.notifyOnActual} /
|
|
50
|
+
* {@link IBudgetBuilder.notifyOnForecasted}.
|
|
51
|
+
*/
|
|
52
|
+
export interface NotificationEntry {
|
|
53
|
+
notificationType: NotificationType;
|
|
54
|
+
/**
|
|
55
|
+
* Threshold value. Interpreted as a percentage of the budget limit
|
|
56
|
+
* when `thresholdType` is `PERCENTAGE` (the default), or as an
|
|
57
|
+
* absolute amount when `thresholdType` is `ABSOLUTE_VALUE`.
|
|
58
|
+
*/
|
|
59
|
+
threshold: number;
|
|
60
|
+
subscribers: NotifySubscribers;
|
|
61
|
+
comparisonOperator?: "GREATER_THAN" | "LESS_THAN" | "EQUAL_TO";
|
|
62
|
+
thresholdType?: "PERCENTAGE" | "ABSOLUTE_VALUE";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolved subscribers in the CloudFormation shape required by
|
|
66
|
+
* `AWS::Budgets::Budget`, plus any SNS topic referenced (so the caller
|
|
67
|
+
* can create matching `AWS::SNS::TopicPolicy` grants).
|
|
68
|
+
*/
|
|
69
|
+
export interface ResolvedSubscribers {
|
|
70
|
+
cfn: CfnBudget.SubscriberProperty[];
|
|
71
|
+
snsTopics: ITopic[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resolve a {@link NotifySubscribers} into the CloudFormation shape for
|
|
75
|
+
* `AWS::Budgets::Budget`'s `Subscribers` array, plus any SNS topic
|
|
76
|
+
* referenced so the caller can create a matching topic policy.
|
|
77
|
+
*
|
|
78
|
+
* The SNS subscriber (if any) is emitted first, followed by emails in
|
|
79
|
+
* declaration order — the order is not load-bearing, but stable output
|
|
80
|
+
* keeps test snapshots steady.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveSubscribers(subscribers: NotifySubscribers, context: Record<string, object>): ResolvedSubscribers;
|
|
83
|
+
/**
|
|
84
|
+
* Convert a {@link NotificationEntry} plus resolved subscribers into the
|
|
85
|
+
* CloudFormation `NotificationWithSubscribersProperty` shape.
|
|
86
|
+
*/
|
|
87
|
+
export declare function toCfnNotificationWithSubscribers(entry: NotificationEntry, resolvedSubscribers: CfnBudget.SubscriberProperty[]): CfnBudget.NotificationWithSubscribersProperty;
|
|
88
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KA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OAA+B;IAE/B,MAAM,GAAG,GAAmC,EAAE,CAAC;IAC/C,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,IAAI,WAAW,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/D,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAC/C,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAwB,EACxB,mBAAmD;IAEnD,OAAO;QACL,YAAY,EAAE;YACZ,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,IAAI,cAAc;YAC9D,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,YAAY;SACnD;QACD,WAAW,EAAE,mBAAmB;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ITopic, TopicPolicy } from "aws-cdk-lib/aws-sns";
|
|
2
|
+
import type { IConstruct } from "constructs";
|
|
3
|
+
/**
|
|
4
|
+
* Create an `AWS::SNS::TopicPolicy` granting the AWS Budgets service
|
|
5
|
+
* principal (`budgets.amazonaws.com`) permission to publish to each of
|
|
6
|
+
* the supplied topics.
|
|
7
|
+
*
|
|
8
|
+
* Without this policy, a budget notification configured with an SNS
|
|
9
|
+
* subscriber will silently fail to deliver — one of the most common
|
|
10
|
+
* footguns when wiring Budgets to SNS by hand. The builder wires it up
|
|
11
|
+
* automatically whenever at least one `SNS` subscriber is configured.
|
|
12
|
+
*
|
|
13
|
+
* Each topic gets its own `TopicPolicy` construct, keyed by the topic's
|
|
14
|
+
* fully-qualified CDK node path, so callers can inspect or extend them
|
|
15
|
+
* via the build result.
|
|
16
|
+
*
|
|
17
|
+
* @see https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-sns-policy.html
|
|
18
|
+
*/
|
|
19
|
+
export declare function createBudgetsTopicPolicies(scope: IConstruct, id: string, topics: ITopic[]): Record<string, TopicPolicy>;
|
|
20
|
+
//# sourceMappingURL=topic-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic-policy.d.ts","sourceRoot":"","sources":["../../src/topic-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,UAAU,EACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA2B7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic-policy.js","sourceRoot":"","sources":["../../src/topic-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAe,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAiB,EACjB,EAAU,EACV,MAAgB;IAEhB,MAAM,QAAQ,GAAgC,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEd,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,cAAc,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE;YAC1E,MAAM,EAAE,CAAC,KAAK,CAAC;YACf,cAAc,EAAE,SAAS;SAC1B,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,aAAa,CAC3B,IAAI,eAAe,CAAC;YAClB,GAAG,EAAE,qBAAqB;YAC1B,MAAM,EAAE,MAAM,CAAC,KAAK;YACpB,UAAU,EAAE,CAAC,IAAI,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;YAC3D,OAAO,EAAE,CAAC,aAAa,CAAC;YACxB,SAAS,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC5B,CAAC,CACH,CAAC;QAEF,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composurecdk/budgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Composable AWS Budgets builder with well-architected defaults and automatic SNS topic policies",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/laazyj/composureCDK",
|
|
8
8
|
"directory": "packages/budgets"
|
|
9
9
|
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"import": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
10
|
"files": [
|
|
19
11
|
"dist",
|
|
20
12
|
"README.md",
|
|
21
13
|
"LICENSE"
|
|
22
14
|
],
|
|
23
15
|
"scripts": {
|
|
24
|
-
"clean": "rm -rf dist",
|
|
25
|
-
"build": "
|
|
16
|
+
"clean": "rm -rf dist .tshy .tshy-build",
|
|
17
|
+
"build": "tshy",
|
|
26
18
|
"typecheck": "tsc --noEmit",
|
|
19
|
+
"check:exports": "attw --pack . --profile node16 && publint",
|
|
27
20
|
"test": "vitest run --passWithNoTests",
|
|
28
21
|
"test:watch": "vitest"
|
|
29
22
|
},
|
|
@@ -34,17 +27,43 @@
|
|
|
34
27
|
"access": "public"
|
|
35
28
|
},
|
|
36
29
|
"type": "module",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20"
|
|
32
|
+
},
|
|
33
|
+
"tshy": {
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
".": "./src/index.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
37
39
|
"peerDependencies": {
|
|
38
|
-
"@composurecdk/
|
|
39
|
-
"@composurecdk/
|
|
40
|
+
"@composurecdk/cloudformation": "^0.8.0",
|
|
41
|
+
"@composurecdk/cloudwatch": "^0.8.0",
|
|
42
|
+
"@composurecdk/core": "^0.8.0",
|
|
40
43
|
"aws-cdk-lib": "^2.0.0",
|
|
41
44
|
"constructs": "^10.0.0"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^25.6.
|
|
45
|
-
"aws-cdk-lib": "^2.
|
|
47
|
+
"@types/node": "^25.6.2",
|
|
48
|
+
"aws-cdk-lib": "^2.253.1",
|
|
46
49
|
"constructs": "^10.6.0",
|
|
47
50
|
"typescript": "^6.0.3",
|
|
48
51
|
"vitest": "^4.1.4"
|
|
49
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"exports": {
|
|
54
|
+
"./package.json": "./package.json",
|
|
55
|
+
".": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/esm/index.d.ts",
|
|
58
|
+
"default": "./dist/esm/index.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
62
|
+
"default": "./dist/commonjs/index.js"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"main": "./dist/commonjs/index.js",
|
|
67
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
68
|
+
"module": "./dist/esm/index.js"
|
|
50
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alarm-config.d.ts","sourceRoot":"","sources":["../src/alarm-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,2BAA4B,SAAQ,WAAW;IAC9D;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;CACxD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"budget-alarm-builder.d.ts","sourceRoot":"","sources":["../src/budget-alarm-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEx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AsB,CAAY,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAiB,EAAE,EAAU,EAAE,OAAgC;QACnE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/E,OAAO;YACL,MAAM,EAAE,iBAAiB,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE;gBAC3C,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;gBAC/C,YAAY,EAAE,IAAI,CAAC,aAAa;aACjC,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,OAAO,CAA8C,kBAAkB,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"budget-alarms.d.ts","sourceRoot":"","sources":["../src/budget-alarms.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAK3D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,eAAe,EAAE,CA0BnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"budget-alarms.js","sourceRoot":"","sources":["../src/budget-alarms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG1F,OAAO,EAAE,y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