Skip to content

GCP.BillingBudgets reference

Source: src/GCP/BillingBudgets/BillingBudget.ts

A Cloud Billing budget.

Budgets have no labels field and the display name appears in alert emails, so Alchemy finds its budget by display name within the current project’s scope: read reports a budget as owned only when it carries the generated name (an explicit displayName is reported as unowned — adopt it with --adopt), and nuke cannot discover budgets. The physical id is a server-assigned UUID. Changing billingAccountId or budgetId replaces the budget. Amount, filter, thresholds, notifications, and display name update in place.

Project-scoped monthly budget

const budget = yield* GCP.BillingBudgets.BillingBudget("Spend", {
displayName: "cap",
amount: { specifiedAmount: { currencyCode: "USD", units: "10" } },
budgetFilter: {
projects: ["projects/my-project"],
calendarPeriod: "MONTH",
},
thresholdRules: [{ thresholdPercent: 0.5, spendBasis: "CURRENT_SPEND" }],
});

Last-period amount

const budget = yield* GCP.BillingBudgets.BillingBudget("Spend", {
amount: { lastPeriodAmount: {} },
budgetFilter: { calendarPeriod: "MONTH" },
});
const budget = yield* GCP.BillingBudgets.BillingBudget("Spend", {
displayName: "cap",
amount: { specifiedAmount: { currencyCode: "USD", units: "25" } },
budgetFilter: {
projects: ["projects/my-project"],
calendarPeriod: "MONTH",
},
thresholdRules: [
{ thresholdPercent: 0.5, spendBasis: "CURRENT_SPEND" },
{ thresholdPercent: 0.9, spendBasis: "FORECASTED_SPEND" },
],
});