budgets
Creates, updates, deletes, gets or lists a budgets resource.
Overview
| Name | budgets |
| Type | Resource |
| Id | datadog.cloud_costs.budgets |
Fields
The following fields are returned by SELECT queries:
- get_budget
- list_budgets
| Name | Datatype | Description |
|---|---|---|
id | string | The BudgetWithEntriesData id. (example: 00000000-0a0a-0a0a-aaa0-00000000000a) |
attributes | object | The attributes of a budget. |
type | string | The type of the object, must be budget. (example: ) |
| Name | Datatype | Description |
|---|---|---|
id | string | The id of the budget. |
attributes | object | The attributes of a budget. |
type | string | The type of the object, must be budget. (example: ) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_budget | select | budget_id | actual, forecast, start, end | Get a budget by ID. Pass actual=true or forecast=true to include cost data in the response. Use start and end (millisecond epochs, both required) to set the cost window. When forecast=true, each entry also includes ootb_forecast (the ML forecast before overrides) and custom_forecast (null if no override is set, a number if one is). |
list_budgets | select | List budgets. | ||
upsert_budget | replace | Create a new budget or update an existing one. | ||
delete_budget | delete | budget_id | Delete a budget | |
validate_budget | exec | Validate a budget configuration without creating or modifying it |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
budget_id | string | Budget id. |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
actual | boolean | When true, includes actual cost data in the response. |
end | integer (int64) | End of the cost window in milliseconds since epoch. Must be used together with start. |
forecast | boolean | When true, includes forecast cost data in the response, including ootb_forecast and custom_forecast per entry. |
start | integer (int64) | Start of the cost window in milliseconds since epoch. Must be used together with end. |
SELECT examples
- get_budget
- list_budgets
Get a budget by ID. Pass actual=true or forecast=true to include cost data in the response. Use start and end (millisecond epochs, both required) to set the cost window. When forecast=true, each entry also includes ootb_forecast (the ML forecast before overrides) and custom_forecast (null if no override is set, a number if one is).
SELECT
id,
attributes,
type
FROM datadog.cloud_costs.budgets
WHERE budget_id = '{{ budget_id }}' -- required
AND actual = '{{ actual }}'
AND forecast = '{{ forecast }}'
AND start = '{{ start }}'
AND end = '{{ end }}'
;
List budgets.
SELECT
id,
attributes,
type
FROM datadog.cloud_costs.budgets
;
REPLACE examples
- upsert_budget
Create a new budget or update an existing one.
REPLACE datadog.cloud_costs.budgets
SET
data = '{{ data }}'
WHERE
RETURNING
data;
DELETE examples
- delete_budget
Delete a budget
DELETE FROM datadog.cloud_costs.budgets
WHERE budget_id = '{{ budget_id }}' --required
;
Lifecycle Methods
EXEC variables use wire (API) names.
- validate_budget
Validate a budget configuration without creating or modifying it
EXEC datadog.cloud_costs.budgets.validate_budget
@@json=
'{
"data": "{{ data }}"
}'
;