Budget
A Datatailr spend budget (cap, usage, prevent_overflow, ACL).
Fields match dt cost list-budgets / dt cost get-budget JSON (see
internal-docs/budgets.md). Optional fields may be omitted when the caller
only has operate visibility on a budget row.
Construct by name to load from the platform ::
b = Budget("my_budget")
The numeric :attr:id is the database budget id used in job definitions as
budget_id. Rows built via :meth:from_dict (e.g. from list-budgets)
reflect the JSON as returned by the API and do not trigger an extra fetch.
Parameters:
-
(namestr) –Non-empty budget name.
Raises:
-
ValueError–If name is empty or the API response is invalid.
acl
property
The budget ACL. Will be None if user does not have read permissions.
budget_usd
property
Cap in USD when visible to the caller.
id
property
Numeric budget id (budget_id in job JSON).
name
property
Budget name.
prevent_overflow
property
Whether the platform blocks spend past the limit when visible.
usage_percentage
property
Usage as a percent of cap when available.
usage_usd
property
Current-month usage in USD when visible.
add
staticmethod
Create a budget. Admin only.
add_acl
staticmethod
Merge ACL entries. Admin only.
from_dict
classmethod
Build a :class:Budget from CLI/JSON dict without an extra API call.
get
staticmethod
Load one budget by name.
get_acl
staticmethod
Returns the budget ACL. Admin only.
ls
staticmethod
Get a list of budgets visible to the current user.
remove
staticmethod
Remove a budget. Admin only.
remove_acl
staticmethod
Remove ACL entries. Admin only.
set_acl
staticmethod
Replace the budget ACL. Admin only.
update
staticmethod
Update budget cap and/or prevent_overflow. Admin only.