@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.
Files changed (102) hide show
  1. package/dist/commonjs/alarm-config.d.ts.map +1 -0
  2. package/dist/commonjs/alarm-config.js +3 -0
  3. package/dist/{alarm-config.js.map → commonjs/alarm-config.js.map} +1 -1
  4. package/dist/{budget-alarm-builder.d.ts → commonjs/budget-alarm-builder.d.ts} +5 -2
  5. package/dist/commonjs/budget-alarm-builder.d.ts.map +1 -0
  6. package/dist/commonjs/budget-alarm-builder.js +149 -0
  7. package/dist/commonjs/budget-alarm-builder.js.map +1 -0
  8. package/dist/commonjs/budget-alarms.d.ts.map +1 -0
  9. package/dist/commonjs/budget-alarms.js +53 -0
  10. package/dist/commonjs/budget-alarms.js.map +1 -0
  11. package/dist/{budget-builder.d.ts → commonjs/budget-builder.d.ts} +3 -1
  12. package/dist/commonjs/budget-builder.d.ts.map +1 -0
  13. package/dist/commonjs/budget-builder.js +170 -0
  14. package/dist/commonjs/budget-builder.js.map +1 -0
  15. package/dist/commonjs/currency.d.ts.map +1 -0
  16. package/dist/commonjs/currency.js +39 -0
  17. package/dist/commonjs/currency.js.map +1 -0
  18. package/dist/commonjs/defaults.d.ts.map +1 -0
  19. package/dist/commonjs/defaults.js +94 -0
  20. package/dist/commonjs/defaults.js.map +1 -0
  21. package/dist/commonjs/email.d.ts.map +1 -0
  22. package/dist/commonjs/email.js +33 -0
  23. package/dist/commonjs/email.js.map +1 -0
  24. package/dist/commonjs/index.d.ts.map +1 -0
  25. package/dist/commonjs/index.js +18 -0
  26. package/dist/commonjs/index.js.map +1 -0
  27. package/dist/commonjs/notifications.d.ts.map +1 -0
  28. package/dist/commonjs/notifications.js +43 -0
  29. package/dist/commonjs/notifications.js.map +1 -0
  30. package/dist/commonjs/package.json +3 -0
  31. package/dist/commonjs/topic-policy.d.ts.map +1 -0
  32. package/dist/commonjs/topic-policy.js +45 -0
  33. package/dist/commonjs/topic-policy.js.map +1 -0
  34. package/dist/esm/alarm-config.d.ts +61 -0
  35. package/dist/esm/alarm-config.d.ts.map +1 -0
  36. package/dist/esm/alarm-config.js.map +1 -0
  37. package/dist/esm/budget-alarm-builder.d.ts +150 -0
  38. package/dist/esm/budget-alarm-builder.d.ts.map +1 -0
  39. package/dist/{budget-alarm-builder.js → esm/budget-alarm-builder.js} +8 -2
  40. package/dist/esm/budget-alarm-builder.js.map +1 -0
  41. package/dist/esm/budget-alarms.d.ts +22 -0
  42. package/dist/esm/budget-alarms.d.ts.map +1 -0
  43. package/dist/esm/budget-alarms.js.map +1 -0
  44. package/dist/esm/budget-builder.d.ts +192 -0
  45. package/dist/esm/budget-builder.d.ts.map +1 -0
  46. package/dist/{budget-builder.js → esm/budget-builder.js} +7 -1
  47. package/dist/esm/budget-builder.js.map +1 -0
  48. package/dist/esm/currency.d.ts +21 -0
  49. package/dist/esm/currency.d.ts.map +1 -0
  50. package/dist/esm/currency.js.map +1 -0
  51. package/dist/esm/defaults.d.ts +57 -0
  52. package/dist/esm/defaults.d.ts.map +1 -0
  53. package/dist/esm/defaults.js.map +1 -0
  54. package/dist/esm/email.d.ts +28 -0
  55. package/dist/esm/email.d.ts.map +1 -0
  56. package/dist/esm/email.js.map +1 -0
  57. package/dist/esm/index.d.ts +8 -0
  58. package/dist/esm/index.d.ts.map +1 -0
  59. package/dist/esm/index.js.map +1 -0
  60. package/dist/esm/notifications.d.ts +88 -0
  61. package/dist/esm/notifications.d.ts.map +1 -0
  62. package/dist/esm/notifications.js.map +1 -0
  63. package/dist/esm/package.json +3 -0
  64. package/dist/esm/topic-policy.d.ts +20 -0
  65. package/dist/esm/topic-policy.d.ts.map +1 -0
  66. package/dist/esm/topic-policy.js.map +1 -0
  67. package/package.json +35 -16
  68. package/dist/alarm-config.d.ts.map +0 -1
  69. package/dist/budget-alarm-builder.d.ts.map +0 -1
  70. package/dist/budget-alarm-builder.js.map +0 -1
  71. package/dist/budget-alarms.d.ts.map +0 -1
  72. package/dist/budget-alarms.js.map +0 -1
  73. package/dist/budget-builder.d.ts.map +0 -1
  74. package/dist/budget-builder.js.map +0 -1
  75. package/dist/currency.d.ts.map +0 -1
  76. package/dist/currency.js.map +0 -1
  77. package/dist/defaults.d.ts.map +0 -1
  78. package/dist/defaults.js.map +0 -1
  79. package/dist/email.d.ts.map +0 -1
  80. package/dist/email.js.map +0 -1
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js.map +0 -1
  83. package/dist/notifications.d.ts.map +0 -1
  84. package/dist/notifications.js.map +0 -1
  85. package/dist/topic-policy.d.ts.map +0 -1
  86. package/dist/topic-policy.js.map +0 -1
  87. /package/dist/{alarm-config.d.ts → commonjs/alarm-config.d.ts} +0 -0
  88. /package/dist/{budget-alarms.d.ts → commonjs/budget-alarms.d.ts} +0 -0
  89. /package/dist/{currency.d.ts → commonjs/currency.d.ts} +0 -0
  90. /package/dist/{defaults.d.ts → commonjs/defaults.d.ts} +0 -0
  91. /package/dist/{email.d.ts → commonjs/email.d.ts} +0 -0
  92. /package/dist/{index.d.ts → commonjs/index.d.ts} +0 -0
  93. /package/dist/{notifications.d.ts → commonjs/notifications.d.ts} +0 -0
  94. /package/dist/{topic-policy.d.ts → commonjs/topic-policy.d.ts} +0 -0
  95. /package/dist/{alarm-config.js → esm/alarm-config.js} +0 -0
  96. /package/dist/{budget-alarms.js → esm/budget-alarms.js} +0 -0
  97. /package/dist/{currency.js → esm/currency.js} +0 -0
  98. /package/dist/{defaults.js → esm/defaults.js} +0 -0
  99. /package/dist/{email.js → esm/email.js} +0 -0
  100. /package/dist/{index.js → esm/index.js} +0 -0
  101. /package/dist/{notifications.js → esm/notifications.js} +0 -0
  102. /package/dist/{topic-policy.js → esm/topic-policy.js} +0 -0
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.email = email;
4
+ const MAX_LEN = 50;
5
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
6
+ /**
7
+ * Validates and brands a string as an {@link Email}.
8
+ *
9
+ * The pattern intentionally errs on the side of acceptance — anything
10
+ * obviously not an email (whitespace, missing `@`, missing TLD) is
11
+ * rejected, but any address AWS Budgets will plausibly accept passes.
12
+ * The 50-char cap matches the Budgets API's documented per-subscriber
13
+ * limit.
14
+ *
15
+ * @throws If the input is empty, exceeds 50 characters, or doesn't
16
+ * contain `local@domain.tld`.
17
+ *
18
+ * @see https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Subscriber.html
19
+ */
20
+ function email(input) {
21
+ const trimmed = input.trim();
22
+ if (trimmed.length === 0) {
23
+ throw new Error("email cannot be empty");
24
+ }
25
+ if (trimmed.length > MAX_LEN) {
26
+ throw new Error(`email exceeds ${String(MAX_LEN)} chars (AWS Budgets per-subscriber limit): "${trimmed}"`);
27
+ }
28
+ if (!EMAIL_REGEX.test(trimmed)) {
29
+ throw new Error(`invalid email address: "${trimmed}"`);
30
+ }
31
+ return trimmed;
32
+ }
33
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/email.ts"],"names":[],"mappings":";;AA4BA,sBAcC;AA/BD,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,SAAgB,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 @@
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,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toCfnNotificationWithSubscribers = exports.resolveSubscribers = exports.email = exports.createBudgetsTopicPolicies = exports.DEFAULT_BUDGET_CURRENCIES = exports.BUDGET_DEFAULTS = exports.createBudgetAlarmBuilder = exports.createBudgetBuilder = void 0;
4
+ var budget_builder_js_1 = require("./budget-builder.js");
5
+ Object.defineProperty(exports, "createBudgetBuilder", { enumerable: true, get: function () { return budget_builder_js_1.createBudgetBuilder; } });
6
+ var budget_alarm_builder_js_1 = require("./budget-alarm-builder.js");
7
+ Object.defineProperty(exports, "createBudgetAlarmBuilder", { enumerable: true, get: function () { return budget_alarm_builder_js_1.createBudgetAlarmBuilder; } });
8
+ var defaults_js_1 = require("./defaults.js");
9
+ Object.defineProperty(exports, "BUDGET_DEFAULTS", { enumerable: true, get: function () { return defaults_js_1.BUDGET_DEFAULTS; } });
10
+ Object.defineProperty(exports, "DEFAULT_BUDGET_CURRENCIES", { enumerable: true, get: function () { return defaults_js_1.DEFAULT_BUDGET_CURRENCIES; } });
11
+ var topic_policy_js_1 = require("./topic-policy.js");
12
+ Object.defineProperty(exports, "createBudgetsTopicPolicies", { enumerable: true, get: function () { return topic_policy_js_1.createBudgetsTopicPolicies; } });
13
+ var email_js_1 = require("./email.js");
14
+ Object.defineProperty(exports, "email", { enumerable: true, get: function () { return email_js_1.email; } });
15
+ var notifications_js_1 = require("./notifications.js");
16
+ Object.defineProperty(exports, "resolveSubscribers", { enumerable: true, get: function () { return notifications_js_1.resolveSubscribers; } });
17
+ Object.defineProperty(exports, "toCfnNotificationWithSubscribers", { enumerable: true, get: function () { return notifications_js_1.toCfnNotificationWithSubscribers; } });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAM6B;AAL3B,wHAAA,mBAAmB,OAAA;AAMrB,qEAKmC;AAJjC,mIAAA,wBAAwB,OAAA;AAK1B,6CAA2E;AAAlE,8GAAA,eAAe,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAEnD,qDAA+D;AAAtD,6HAAA,0BAA0B,OAAA;AACnC,uCAA+C;AAAtC,iGAAA,KAAK,OAAA;AACd,uDAO4B;AAN1B,sHAAA,kBAAkB,OAAA;AAClB,oIAAA,gCAAgC,OAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications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,CAU/C"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveSubscribers = resolveSubscribers;
4
+ exports.toCfnNotificationWithSubscribers = toCfnNotificationWithSubscribers;
5
+ const core_1 = require("@composurecdk/core");
6
+ /**
7
+ * Resolve a {@link NotifySubscribers} into the CloudFormation shape for
8
+ * `AWS::Budgets::Budget`'s `Subscribers` array, plus any SNS topic
9
+ * referenced so the caller can create a matching topic policy.
10
+ *
11
+ * The SNS subscriber (if any) is emitted first, followed by emails in
12
+ * declaration order — the order is not load-bearing, but stable output
13
+ * keeps test snapshots steady.
14
+ */
15
+ function resolveSubscribers(subscribers, context) {
16
+ const cfn = [];
17
+ const snsTopics = [];
18
+ if (subscribers.sns !== undefined) {
19
+ const topic = (0, core_1.resolve)(subscribers.sns, context);
20
+ cfn.push({ address: topic.topicArn, subscriptionType: "SNS" });
21
+ snsTopics.push(topic);
22
+ }
23
+ for (const address of subscribers.emails ?? []) {
24
+ cfn.push({ address, subscriptionType: "EMAIL" });
25
+ }
26
+ return { cfn, snsTopics };
27
+ }
28
+ /**
29
+ * Convert a {@link NotificationEntry} plus resolved subscribers into the
30
+ * CloudFormation `NotificationWithSubscribersProperty` shape.
31
+ */
32
+ function toCfnNotificationWithSubscribers(entry, resolvedSubscribers) {
33
+ return {
34
+ notification: {
35
+ notificationType: entry.notificationType,
36
+ threshold: entry.threshold,
37
+ comparisonOperator: entry.comparisonOperator ?? "GREATER_THAN",
38
+ thresholdType: entry.thresholdType ?? "PERCENTAGE",
39
+ },
40
+ subscribers: resolvedSubscribers,
41
+ };
42
+ }
43
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/notifications.ts"],"names":[],"mappings":";;AAsFA,gDAkBC;AAMD,4EAaC;AAzHD,6CAA8D;AA2E9D;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAChC,WAA8B,E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E7C;;;;;;;;;;;;;;;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,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBudgetsTopicPolicies = createBudgetsTopicPolicies;
4
+ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
5
+ const aws_sns_1 = require("aws-cdk-lib/aws-sns");
6
+ /**
7
+ * Create an `AWS::SNS::TopicPolicy` granting the AWS Budgets service
8
+ * principal (`budgets.amazonaws.com`) permission to publish to each of
9
+ * the supplied topics.
10
+ *
11
+ * Without this policy, a budget notification configured with an SNS
12
+ * subscriber will silently fail to deliver — one of the most common
13
+ * footguns when wiring Budgets to SNS by hand. The builder wires it up
14
+ * automatically whenever at least one `SNS` subscriber is configured.
15
+ *
16
+ * Each topic gets its own `TopicPolicy` construct, keyed by the topic's
17
+ * fully-qualified CDK node path, so callers can inspect or extend them
18
+ * via the build result.
19
+ *
20
+ * @see https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-sns-policy.html
21
+ */
22
+ function createBudgetsTopicPolicies(scope, id, topics) {
23
+ const policies = {};
24
+ const seen = new Set();
25
+ for (const topic of topics) {
26
+ const key = topic.node.path;
27
+ if (seen.has(key))
28
+ continue;
29
+ seen.add(key);
30
+ const policy = new aws_sns_1.TopicPolicy(scope, `${id}TopicPolicy${topic.node.addr}`, {
31
+ topics: [topic],
32
+ policyDocument: undefined,
33
+ });
34
+ policy.document.addStatements(new aws_iam_1.PolicyStatement({
35
+ sid: "AllowBudgetsPublish",
36
+ effect: aws_iam_1.Effect.ALLOW,
37
+ principals: [new aws_iam_1.ServicePrincipal("budgets.amazonaws.com")],
38
+ actions: ["SNS:Publish"],
39
+ resources: [topic.topicArn],
40
+ }));
41
+ policies[key] = policy;
42
+ }
43
+ return policies;
44
+ }
45
+ //# sourceMappingURL=topic-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topic-policy.js","sourceRoot":"","sources":["../../src/topic-policy.ts"],"names":[],"mappings":";;AAoBA,gEA+BC;AAnDD,iDAAgF;AAChF,iDAA+D;AAG/D;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,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,qBAAW,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,yBAAe,CAAC;YAClB,GAAG,EAAE,qBAAqB;YAC1B,MAAM,EAAE,gBAAM,CAAC,KAAK;YACpB,UAAU,EAAE,CAAC,IAAI,0BAAgB,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"}
@@ -0,0 +1,61 @@
1
+ import type { AlarmConfig } from "@composurecdk/cloudwatch";
2
+ /**
3
+ * Extended {@link AlarmConfig} for the account-level `EstimatedCharges`
4
+ * billing alarm.
5
+ *
6
+ * The `EstimatedCharges` metric lives in the `AWS/Billing` namespace and
7
+ * is **only emitted in the `us-east-1` region**, regardless of where
8
+ * your resources run. The builder emits a synth-time warning when the
9
+ * surrounding stack is not in `us-east-1`; for non-`us-east-1` stacks,
10
+ * suppress this alarm with `recommendedAlarms: false` and create the
11
+ * alarm in a `us-east-1` stack via `createBudgetAlarmBuilder` (see
12
+ * ADR-0004).
13
+ *
14
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
15
+ */
16
+ export interface EstimatedChargesAlarmConfig extends AlarmConfig {
17
+ /**
18
+ * The absolute cost threshold (in `currency`) at which the alarm fires.
19
+ * This is a hard monetary value, **not** a percentage of the budget.
20
+ */
21
+ threshold: number;
22
+ /**
23
+ * ISO 4217 currency code that the `EstimatedCharges` metric is
24
+ * emitted in. AWS emits the metric with a `Currency` dimension that
25
+ * must match your billing currency.
26
+ *
27
+ * @default "USD"
28
+ */
29
+ currency?: string;
30
+ }
31
+ /**
32
+ * Controls which recommended CloudWatch alarms are created for an AWS
33
+ * Budget.
34
+ *
35
+ * AWS Budgets itself does not publish per-budget CloudWatch metrics.
36
+ * The recommended-alarm surface therefore mirrors the well-architected
37
+ * cost-monitoring pattern: a CloudWatch alarm on the account-level
38
+ * `AWS/Billing EstimatedCharges` metric that fires when total estimated
39
+ * charges cross a hard threshold.
40
+ *
41
+ * Off by default — the alarm only emits data when its stack is deployed
42
+ * to `us-east-1`, so callers must opt in explicitly.
43
+ *
44
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
45
+ */
46
+ export interface BudgetAlarmConfig {
47
+ /**
48
+ * Master switch.
49
+ * @default false
50
+ */
51
+ enabled?: boolean;
52
+ /**
53
+ * Configuration for the `EstimatedCharges` billing alarm.
54
+ *
55
+ * Pass `false` to disable, or supply an
56
+ * {@link EstimatedChargesAlarmConfig} to enable with a specific
57
+ * monetary threshold.
58
+ */
59
+ estimatedCharges?: EstimatedChargesAlarmConfig | false;
60
+ }
61
+ //# sourceMappingURL=alarm-config.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alarm-config.js","sourceRoot":"","sources":["../../src/alarm-config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,150 @@
1
+ import { type CfnBudget } from "aws-cdk-lib/aws-budgets";
2
+ import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
3
+ import { type IConstruct } from "constructs";
4
+ import { COPY_STATE, type Lifecycle, type Resolvable } from "@composurecdk/core";
5
+ import { type ITaggedBuilder } from "@composurecdk/cloudformation";
6
+ import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
7
+ import type { BudgetAlarmConfig } from "./alarm-config.js";
8
+ import type { BudgetBuilderResult } from "./budget-builder.js";
9
+ /**
10
+ * Configuration properties for {@link createBudgetAlarmBuilder}.
11
+ *
12
+ * The standalone alarm builder mirrors the alarm surface that
13
+ * {@link createBudgetBuilder} creates by default. It exists so that
14
+ * billing alarms can be created in a different stack from the budget
15
+ * itself — specifically a `us-east-1` stack, since the
16
+ * `AWS/Billing EstimatedCharges` metric is only emitted in `us-east-1`
17
+ * regardless of where the budget is deployed.
18
+ *
19
+ * @see ADR-0004 — Split-alarm builder pattern for fixed-region metrics
20
+ */
21
+ export interface BudgetAlarmBuilderProps {
22
+ /**
23
+ * Configuration for AWS-recommended CloudWatch alarms.
24
+ *
25
+ * Mirrors {@link BudgetBuilderProps.recommendedAlarms}. Off by default —
26
+ * pass an {@link BudgetAlarmConfig.estimatedCharges} entry to enable
27
+ * the account-level billing alarm. Set to `false` to suppress recommended
28
+ * alarms entirely; custom alarms added via
29
+ * {@link IBudgetAlarmBuilder.addAlarm} are unaffected.
30
+ *
31
+ * No alarm actions are configured by default. Use `alarmActionsPolicy`
32
+ * (or an `afterBuild` hook) to wire SNS or other actions onto the
33
+ * resulting alarms.
34
+ *
35
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
36
+ */
37
+ recommendedAlarms?: BudgetAlarmConfig | false;
38
+ }
39
+ /**
40
+ * The build output of an {@link IBudgetAlarmBuilder}.
41
+ */
42
+ export interface BudgetAlarmBuilderResult {
43
+ /**
44
+ * The CloudWatch alarms created by this builder, keyed by alarm name.
45
+ * Uses the same key scheme as {@link BudgetBuilderResult.alarms}.
46
+ */
47
+ alarms: Record<string, Alarm>;
48
+ }
49
+ /**
50
+ * A fluent builder for budget-related CloudWatch alarms, decoupled from
51
+ * the budget itself. Use this when the budget lives in a stack outside
52
+ * `us-east-1` — route this builder's component into a `us-east-1` stack
53
+ * via `compose().withStacks()` so the alarms land where the
54
+ * `AWS/Billing EstimatedCharges` metric actually emits.
55
+ *
56
+ * @see {@link createBudgetAlarmBuilder}
57
+ */
58
+ export type IBudgetAlarmBuilder = ITaggedBuilder<BudgetAlarmBuilderProps, BudgetAlarmBuilder>;
59
+ /**
60
+ * Shared alarm-assembly used by both {@link createBudgetBuilder} (in its
61
+ * own stack) and {@link createBudgetAlarmBuilder} (typically in a separate
62
+ * `us-east-1` stack). Materialises the recommended billing alarm and any
63
+ * user-supplied custom alarms, emits the region warning if the resulting
64
+ * scope is not in `us-east-1`, and creates the alarm constructs.
65
+ *
66
+ * The `target.budget` reference is only needed for custom alarms added
67
+ * via `addAlarm()` — the recommended `EstimatedCharges` alarm is
68
+ * account-level and does not key off the budget itself, so `target` may
69
+ * be omitted when only the recommended alarm is being created.
70
+ *
71
+ * @internal
72
+ */
73
+ export declare function buildBudgetAlarms(scope: IConstruct, id: string, target: Pick<BudgetBuilderResult, "budget"> | undefined, options?: {
74
+ recommendedAlarms?: BudgetAlarmConfig | false;
75
+ customAlarms?: AlarmDefinitionBuilder<CfnBudget>[];
76
+ }): Record<string, Alarm>;
77
+ declare class BudgetAlarmBuilder implements Lifecycle<BudgetAlarmBuilderResult> {
78
+ #private;
79
+ props: Partial<BudgetAlarmBuilderProps>;
80
+ /**
81
+ * Sets the budget to alarm on. Pass the result of
82
+ * {@link createBudgetBuilder} (or a {@link Ref} to it). The builder
83
+ * reads the underlying `CfnBudget` from the result so custom alarms
84
+ * added via {@link addAlarm} can reference it.
85
+ *
86
+ * Optional when only the recommended `EstimatedCharges` alarm is being
87
+ * created — that alarm is account-level and does not reference any
88
+ * specific budget. Required as soon as you call {@link addAlarm}.
89
+ *
90
+ * Pair with `compose().withStacks()` to route this component into a
91
+ * `us-east-1` stack while the budget itself lives elsewhere — set
92
+ * `crossRegionReferences: true` on both stacks so CDK can wire any
93
+ * cross-stack references automatically.
94
+ */
95
+ budget(budget: Resolvable<BudgetBuilderResult>): this;
96
+ /**
97
+ * Adds a custom alarm against the budget. The configure callback
98
+ * receives a fresh {@link AlarmDefinitionBuilder} pre-set with the
99
+ * alarm's key; configure metric, threshold, comparison and any other
100
+ * options.
101
+ *
102
+ * The created alarm is materialised in this builder's stack — useful
103
+ * for cross-region setups where you want all billing-related alarms to
104
+ * live with the recommended one.
105
+ */
106
+ addAlarm(key: string, configure: (alarm: AlarmDefinitionBuilder<CfnBudget>) => AlarmDefinitionBuilder<CfnBudget>): this;
107
+ /** @internal — see ADR-0005. */
108
+ [COPY_STATE](target: BudgetAlarmBuilder): void;
109
+ build(scope: IConstruct, id: string, context?: Record<string, object>): BudgetAlarmBuilderResult;
110
+ }
111
+ /**
112
+ * Creates a new {@link IBudgetAlarmBuilder} for materialising AWS Budget
113
+ * alarms in a stack separate from the budget itself.
114
+ *
115
+ * The recommended use is multi-region deployments: the budget lives in
116
+ * the application's stack (in any region — `AWS::Budgets::Budget` is a
117
+ * global resource), and the alarms must live in a `us-east-1` stack so
118
+ * they can read the `AWS/Billing EstimatedCharges` metric AWS emits
119
+ * there.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * compose(
124
+ * {
125
+ * account: createBudgetBuilder()
126
+ * .budgetName("Account")
127
+ * .limit({ amount: 1000 })
128
+ * .recommendedAlarms(false), // suppress alarms in the budget's own stack
129
+ *
130
+ * accountAlarms: createBudgetAlarmBuilder()
131
+ * .budget(ref<BudgetBuilderResult>("account"))
132
+ * .recommendedAlarms({
133
+ * estimatedCharges: { threshold: 1000, currency: "USD" },
134
+ * }),
135
+ * },
136
+ * { account: [], accountAlarms: ["account"] },
137
+ * )
138
+ * .withStacks({
139
+ * account: appStack, // any region — Budgets is a global service
140
+ * accountAlarms: monitoringStack, // us-east-1 — where AWS/Billing metrics live
141
+ * })
142
+ * .build(app, "App");
143
+ * ```
144
+ *
145
+ * Set `crossRegionReferences: true` on both stacks if you reference the
146
+ * budget from custom alarms via `.addAlarm()`.
147
+ */
148
+ export declare function createBudgetAlarmBuilder(): IBudgetAlarmBuilder;
149
+ export {};
150
+ //# sourceMappingURL=budget-alarm-builder.d.ts.map
@@ -0,0 +1 @@
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,E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IAI7C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAKrD;;;;;;;;;OASG;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,kBAAkB,GAAG,IAAI;IAK9C,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,wBAAwB;CASjG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,wBAAwB,IAAI,mBAAmB,CAE9D"}
@@ -1,5 +1,6 @@
1
1
  import { Annotations, Stack, Token } from "aws-cdk-lib";
2
- import { Builder, resolve, } from "@composurecdk/core";
2
+ import { COPY_STATE, resolve } from "@composurecdk/core";
3
+ import { taggedBuilder } from "@composurecdk/cloudformation";
3
4
  import { AlarmDefinitionBuilder, createAlarms } from "@composurecdk/cloudwatch";
4
5
  import { resolveBudgetAlarmDefinitions } from "./budget-alarms.js";
5
6
  /**
@@ -86,6 +87,11 @@ class BudgetAlarmBuilder {
86
87
  this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
87
88
  return this;
88
89
  }
90
+ /** @internal — see ADR-0005. */
91
+ [COPY_STATE](target) {
92
+ target.#budget = this.#budget;
93
+ target.#customAlarms.push(...this.#customAlarms);
94
+ }
89
95
  build(scope, id, context) {
90
96
  const target = this.#budget ? resolve(this.#budget, context ?? {}) : undefined;
91
97
  return {
@@ -134,6 +140,6 @@ class BudgetAlarmBuilder {
134
140
  * budget from custom alarms via `.addAlarm()`.
135
141
  */
136
142
  export function createBudgetAlarmBuilder() {
137
- return Builder(BudgetAlarmBuilder);
143
+ return taggedBuilder(BudgetAlarmBuilder);
138
144
  }
139
145
  //# sourceMappingURL=budget-alarm-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget-alarm-builder.js","sourceRoot":"","sources":["../../src/budget-alarm-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,UAAU,EAAkB,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAuB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAwDnE;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,KAAiB;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;QAAE,OAAO;IACvC,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO;IACnC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,YAAY,CAChC,oCAAoC,EACpC,+EAA+E;QAC7E,gBAAgB,MAAM,8DAA8D;QACpF,oEAAoE;QACpE,6CAA6C,CAChD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAiB,EACjB,EAAU,EACV,MAAuD,EACvD,UAGI,EAAE;IAEN,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAC9C,MAAM,eAAe,GACnB,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;IAE1E,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAA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AAC;IACnD,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,aAAa,CAA8C,kBAAkB,CAAC,CAAC;AACxF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { AlarmDefinition } from "@composurecdk/cloudwatch";
2
+ import type { BudgetAlarmConfig } from "./alarm-config.js";
3
+ /**
4
+ * Resolves the recommended alarm configuration into fully-resolved
5
+ * {@link AlarmDefinition}s for an AWS Budget.
6
+ *
7
+ * AWS Budgets does not publish per-budget CloudWatch metrics — the only
8
+ * recommended alarm is the account-level `AWS/Billing EstimatedCharges`
9
+ * billing alarm. Off by default: callers must pass an
10
+ * {@link BudgetAlarmConfig.estimatedCharges} config to opt in.
11
+ *
12
+ * Period and statistic are fixed at the AWS-recommended values
13
+ * (6 hours, Maximum) and not exposed as configuration knobs — billing
14
+ * metrics only update every ~6 hours, so a shorter period would
15
+ * oversample. Threshold, currency, evaluation periods, datapoints and
16
+ * missing-data behaviour remain user-configurable via
17
+ * {@link EstimatedChargesAlarmConfig}.
18
+ *
19
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
20
+ */
21
+ export declare function resolveBudgetAlarmDefinitions(config: BudgetAlarmConfig | undefined): AlarmDefinition[];
22
+ //# sourceMappingURL=budget-alarms.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,qBAAqB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAqC;IAErC,IAAI,MAAM,EAAE,OAAO,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,gBAAgB;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC;IACvC,yBAAyB,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IAE7E,OAAO;QACL;YACE,GAAG,EAAE,kBAAkB;YACvB,MAAM,EAAE,IAAI,MAAM,CAAC;gBACjB,SAAS,EAAE,aAAa;gBACxB,UAAU,EAAE,kB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