budget_policy
Creates, updates, deletes, gets or lists a budget_policy resource.
Overview
| Name | budget_policy |
| Type | Resource |
| Id | databricks_account.billing.budget_policy |
Fields
The following fields are returned by SELECT queries:
- budget_policy_get
- budget_policy_list
| Name | Datatype | Description |
|---|---|---|
policy_id | string | The Id of the policy. This field is generated by Databricks and globally unique. |
policy_name | string | The name of the policy. - Must be unique among active policies. - Can contain only characters from the ISO 8859-1 (latin1) set. - Can't start with reserved keywords such as `databricks:default-policy`. |
binding_workspace_ids | array | List of workspaces that this budget policy will be exclusively bound to. An empty binding implies that this budget policy is open to any workspace in the account. |
custom_tags | string | A list of tags defined by the customer. At most 20 entries are allowed per policy. |
| Name | Datatype | Description |
|---|---|---|
policy_id | string | The Id of the policy. This field is generated by Databricks and globally unique. |
policy_name | string | The name of the policy. - Must be unique among active policies. - Can contain only characters from the ISO 8859-1 (latin1) set. - Can't start with reserved keywords such as `databricks:default-policy`. |
binding_workspace_ids | array | List of workspaces that this budget policy will be exclusively bound to. An empty binding implies that this budget policy is open to any workspace in the account. |
custom_tags | string | A list of tags defined by the customer. At most 20 entries are allowed per policy. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
budget_policy_get | select | account_id, policy_id | Retrieves a policy by it's ID. | |
budget_policy_list | select | account_id | filter_by, page_size, page_token, sort_spec | Lists all policies. Policies are returned in the alphabetically ascending order of their names. |
budget_policy_create | insert | account_id | Creates a new policy. | |
budget_policy_update | update | account_id, policy_id, policy | limit_config | Updates a policy |
budget_policy_delete | delete | account_id, policy_id | Deletes a policy |
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 |
|---|---|---|
account_id | string | |
policy_id | string | The Id of the policy. |
filter_by | object | A filter to apply to the list of policies. |
limit_config | object | DEPRECATED. This is redundant field as LimitConfig is part of the BudgetPolicy |
page_size | integer | The maximum number of budget policies to return. If unspecified, at most 100 budget policies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
page_token | string | A page token, received from a previous ListServerlessPolicies call. Provide this to retrieve the subsequent page. If unspecified, the first page will be returned. When paginating, all other parameters provided to ListServerlessPoliciesRequest must match the call that provided the page token. |
sort_spec | object | The sort specification. |
SELECT examples
- budget_policy_get
- budget_policy_list
Retrieves a policy by it's ID.
SELECT
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
FROM databricks_account.billing.budget_policy
WHERE account_id = '{{ account_id }}' -- required
AND policy_id = '{{ policy_id }}' -- required
;
Lists all policies. Policies are returned in the alphabetically ascending order of their names.
SELECT
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
FROM databricks_account.billing.budget_policy
WHERE account_id = '{{ account_id }}' -- required
AND filter_by = '{{ filter_by }}'
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
AND sort_spec = '{{ sort_spec }}'
;
INSERT examples
- budget_policy_create
- Manifest
Creates a new policy.
INSERT INTO databricks_account.billing.budget_policy (
policy,
request_id,
account_id
)
SELECT
'{{ policy }}',
'{{ request_id }}',
'{{ account_id }}'
RETURNING
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
;
# Description fields are for documentation purposes
- name: budget_policy
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the budget_policy resource.
- name: policy
description: |
The policy to create. `policy_id` needs to be empty as it will be generated `policy_name` must be provided, custom_tags may need to be provided depending on the cloud provider. All other fields are optional.
value:
binding_workspace_ids:
- {{ binding_workspace_ids }}
custom_tags: "{{ custom_tags }}"
policy_id: "{{ policy_id }}"
policy_name: "{{ policy_name }}"
- name: request_id
value: "{{ request_id }}"
description: |
A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is only idempotent if a `request_id` is provided.
UPDATE examples
- budget_policy_update
Updates a policy
UPDATE databricks_account.billing.budget_policy
SET
policy = '{{ policy }}'
WHERE
account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
AND policy = '{{ policy }}' --required
AND limit_config = '{{ limit_config}}'
RETURNING
policy_id,
policy_name,
binding_workspace_ids,
custom_tags;
DELETE examples
- budget_policy_delete
Deletes a policy
DELETE FROM databricks_account.billing.budget_policy
WHERE account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
;