arbitrary_rules
Creates, updates, deletes, gets or lists an arbitrary_rules resource.
Overview
| Name | arbitrary_rules |
| Type | Resource |
| Id | datadog.cloud_costs.arbitrary_rules |
Fields
The following fields are returned by SELECT queries:
- get_custom_allocation_rule
- list_custom_allocation_rules
| Name | Datatype | Description |
|---|---|---|
id | string | The ArbitraryRuleResponseData id. |
attributes | object | The definition of ArbitraryRuleResponseDataAttributes object. |
type | string | Arbitrary rule resource type. (arbitrary_rule) (default: arbitrary_rule, example: arbitrary_rule) |
| Name | Datatype | Description |
|---|---|---|
id | string | The ArbitraryRuleResponseData id. |
attributes | object | The definition of ArbitraryRuleResponseDataAttributes object. |
type | string | Arbitrary rule resource type. (arbitrary_rule) (default: arbitrary_rule, example: arbitrary_rule) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_custom_allocation_rule | select | rule_id | Get a specific custom allocation rule - Retrieve a specific custom allocation rule by its ID | |
list_custom_allocation_rules | select | List all custom allocation rules - Retrieve a list of all custom allocation rules for the organization | ||
create_custom_allocation_rule | insert | Create a new custom allocation rule with the specified filters and allocation strategy.<br /><br />Strategy Methods:<br />- PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.<br />- PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.<br />- PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).<br /><br />Filter Conditions:<br />- Use value for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like"<br />- Use values for multi-value conditions: "in", "not in"<br />- Cannot use both value and values simultaneously.<br /><br />Supported operators: is, is not, contains, in, not in, =, !=, like, not like | ||
update_custom_allocation_rule | update | rule_id | Update an existing custom allocation rule with new filters and allocation strategy.<br /><br />Strategy Methods:<br />- PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.<br />- PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.<br />- PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).<br />- USAGE_METRIC: Allocates based on usage metrics (implementation varies).<br /><br />Filter Conditions:<br />- Use value for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like"<br />- Use values for multi-value conditions: "in", "not in"<br />- Cannot use both value and values simultaneously.<br /><br />Supported operators: is, is not, contains, in, not in, =, !=, like, not like | |
delete_custom_allocation_rule | delete | rule_id | Delete a custom allocation rule - Delete an existing custom allocation rule by its ID | |
reorder_custom_allocation_rules | exec | data | Reorder custom allocation rules - Change the execution order of custom allocation rules.<br /><br />Important: You must provide the complete list of all rule IDs in the desired execution order. The API will reorder ALL rules according to the provided sequence.<br /><br />Rules are executed in the order specified, with lower indices (earlier in the array) having higher priority.<br /><br />Example: If you have rules with IDs [123, 456, 789] and want to change order from 123→456→789 to 456→123→789, send: [{"id": "456"}, {"id": "123"}, {"id": "789"}] |
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 |
|---|---|---|
rule_id | integer (int64) | The unique identifier of the custom allocation rule |
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. |
SELECT examples
- get_custom_allocation_rule
- list_custom_allocation_rules
Get a specific custom allocation rule - Retrieve a specific custom allocation rule by its ID
SELECT
id,
attributes,
type
FROM datadog.cloud_costs.arbitrary_rules
WHERE rule_id = '{{ rule_id }}' -- required
;
List all custom allocation rules - Retrieve a list of all custom allocation rules for the organization
SELECT
id,
attributes,
type
FROM datadog.cloud_costs.arbitrary_rules
;
INSERT examples
- create_custom_allocation_rule
- Manifest
Create a new custom allocation rule with the specified filters and allocation strategy.<br /><br />Strategy Methods:<br />- PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.<br />- PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.<br />- PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).<br /><br />Filter Conditions:<br />- Use value for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like"<br />- Use values for multi-value conditions: "in", "not in"<br />- Cannot use both value and values simultaneously.<br /><br />Supported operators: is, is not, contains, in, not in, =, !=, like, not like
INSERT INTO datadog.cloud_costs.arbitrary_rules (
data
)
SELECT
'{{ data }}'
RETURNING
data
;
# Description fields are for documentation purposes
- name: arbitrary_rules
props:
- name: data
description: |
The definition of `ArbitraryCostUpsertRequestData` object.
value:
attributes:
costs_to_allocate:
- condition: "{{ condition }}"
tag: "{{ tag }}"
value: "{{ value }}"
values: "{{ values }}"
enabled: {{ enabled }}
order_id: {{ order_id }}
provider:
- "{{ provider }}"
rejected: {{ rejected }}
rule_name: "{{ rule_name }}"
strategy:
allocated_by:
- allocated_tags: "{{ allocated_tags }}"
percentage: {{ percentage }}
allocated_by_filters:
- condition: "{{ condition }}"
tag: "{{ tag }}"
value: "{{ value }}"
values: "{{ values }}"
allocated_by_tag_keys:
- "{{ allocated_by_tag_keys }}"
based_on_costs:
- condition: "{{ condition }}"
tag: "{{ tag }}"
value: "{{ value }}"
values: "{{ values }}"
based_on_timeseries: "{{ based_on_timeseries }}"
evaluate_grouped_by_filters:
- condition: "{{ condition }}"
tag: "{{ tag }}"
value: "{{ value }}"
values: "{{ values }}"
evaluate_grouped_by_tag_keys:
- "{{ evaluate_grouped_by_tag_keys }}"
granularity: "{{ granularity }}"
method: "{{ method }}"
type: "{{ type }}"
id: "{{ id }}"
type: "{{ type }}"
UPDATE examples
- update_custom_allocation_rule
Update an existing custom allocation rule with new filters and allocation strategy.<br /><br />Strategy Methods:<br />- PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.<br />- PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.<br />- PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).<br />- USAGE_METRIC: Allocates based on usage metrics (implementation varies).<br /><br />Filter Conditions:<br />- Use value for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like"<br />- Use values for multi-value conditions: "in", "not in"<br />- Cannot use both value and values simultaneously.<br /><br />Supported operators: is, is not, contains, in, not in, =, !=, like, not like
UPDATE datadog.cloud_costs.arbitrary_rules
SET
data = '{{ data }}'
WHERE
rule_id = '{{ rule_id }}' --required
RETURNING
data;
DELETE examples
- delete_custom_allocation_rule
Delete a custom allocation rule - Delete an existing custom allocation rule by its ID
DELETE FROM datadog.cloud_costs.arbitrary_rules
WHERE rule_id = '{{ rule_id }}' --required
;
Lifecycle Methods
EXEC variables use wire (API) names.
- reorder_custom_allocation_rules
Reorder custom allocation rules - Change the execution order of custom allocation rules.<br /><br />Important: You must provide the complete list of all rule IDs in the desired execution order. The API will reorder ALL rules according to the provided sequence.<br /><br />Rules are executed in the order specified, with lower indices (earlier in the array) having higher priority.<br /><br />Example: If you have rules with IDs [123, 456, 789] and want to change order from 123→456→789 to 456→123→789, send: [{"id": "456"}, {"id": "123"}, {"id": "789"}]
EXEC datadog.cloud_costs.arbitrary_rules.reorder_custom_allocation_rules
@@json=
'{
"data": "{{ data }}"
}'
;