usage_policy
Creates, updates, deletes, gets or lists a usage_policy resource.
Overview
| Name | usage_policy |
| Type | Resource |
| Id | databricks_account.billing.usage_policy |
Fields
The following fields are returned by SELECT queries:
- usage_policy_get
- usage_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. |
binding_workspace_ids | array | List of workspaces that this usage policy will be exclusively bound to. |
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. |
binding_workspace_ids | array | List of workspaces that this usage policy will be exclusively bound to. |
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 |
|---|---|---|---|---|
usage_policy_get | select | account_id, policy_id | Retrieves a usage policy by it's ID. | |
usage_policy_list | select | account_id | filter_by, page_size, page_token, sort_spec | Lists all usage policies. Policies are returned in the alphabetically ascending order of their names. |
usage_policy_create | insert | account_id | Creates a new usage policy. | |
usage_policy_update | update | account_id, policy_id, policy | limit_config | Updates a usage policy |
usage_policy_delete | delete | account_id, policy_id | Deletes a usage 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 UsagePolicy |
page_size | integer | The maximum number of usage policies to return. |
page_token | string | A page token, received from a previous ListUsagePolicies call. |
sort_spec | object | The sort specification. |
SELECT examples
- usage_policy_get
- usage_policy_list
Retrieves a usage policy by it's ID.
SELECT
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
FROM databricks_account.billing.usage_policy
WHERE account_id = '{{ account_id }}' -- required
AND policy_id = '{{ policy_id }}' -- required
;
Lists all usage 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.usage_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
- usage_policy_create
- Manifest
Creates a new usage policy.
INSERT INTO databricks_account.billing.usage_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: usage_policy
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the usage_policy resource.
- name: policy
description: |
The policy to create. ``policy_id`` needs to be empty as it will be generated
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.
UPDATE examples
- usage_policy_update
Updates a usage policy
UPDATE databricks_account.billing.usage_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
- usage_policy_delete
Deletes a usage policy
DELETE FROM databricks_account.billing.usage_policy
WHERE account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
;