governance_tag_rules
Creates, updates, deletes, gets or lists a governance_tag_rules resource.
Overview
| Name | governance_tag_rules |
| Type | Resource |
| Id | datadog.organization.governance_tag_rules |
Fields
The following fields are returned by SELECT queries:
- get_tag_rule
- list_tag_rules
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the tag rule. (example: 123) |
attributes | object | The attributes of a tag rule resource. |
relationships | object | Related resources for a tag rule. Only present when the corresponding include query parameter is supplied. |
type | string | JSON:API resource type for a tag rule. (tag_rule) (example: tag_rule) |
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the tag rule. (example: 123) |
attributes | object | The attributes of a tag rule resource. |
relationships | object | Related resources for a tag rule. Only present when the corresponding include query parameter is supplied. |
type | string | JSON:API resource type for a tag rule. (tag_rule) (example: tag_rule) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_tag_rule | select | rule_id | include, ts_start, ts_end | Retrieve a single tag rule by ID. Optionally include the rule's current compliance<br />score via the include=score query parameter. Rules belonging to other organizations<br />cannot be retrieved. |
list_tag_rules | select | include_disabled, include_deleted, include, filter[source], ts_start, ts_end | Retrieve all tag rules for the organization. Optionally include disabled or deleted<br />rules, filter by telemetry source, and include each rule's current compliance score<br />via the include=score query parameter. | |
create_tag_rule | insert | data | Create a new tag rule for the organization. The caller's organization is derived from<br />the authenticated user; cross-organization creation is not supported. Fields such as<br />rule_id, version, and the timestamp/audit fields are assigned by the server. | |
update_tag_rule | update | rule_id, data | Update one or more attributes of an existing tag rule. Only the fields supplied in the<br />request body are modified; omitted fields retain their current values. The rule's<br />source cannot be changed after creation. | |
delete_tag_rule | delete | rule_id | hard_delete | Delete a tag rule. By default the rule is soft-deleted so it can be recovered later<br />and so that historical score data remains queryable. Pass hard_delete=true to remove<br />the rule permanently. |
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 | string | The unique identifier of the tag rule to delete. (example: 123) |
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. |
filter[source] | string | Restrict the result set to rules whose source matches the given value. |
hard_delete | boolean | Whether to permanently delete the rule instead of performing a soft delete. Defaults to false. (example: false) |
include | string | Comma-separated list of related resources to include alongside each rule in the response. Currently the only supported value is score. |
include_deleted | boolean | Whether to include rules that have been soft-deleted. Defaults to false. (example: false) |
include_disabled | boolean | Whether to include rules that are currently disabled. Defaults to false. (example: false) |
ts_end | integer (int64) | End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than ts_start. (example: 1779401466097) |
ts_start | integer (int64) | Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to a recent window appropriate for the source. (example: 1779315066097) |
SELECT examples
- get_tag_rule
- list_tag_rules
Retrieve a single tag rule by ID. Optionally include the rule's current compliance<br />score via the include=score query parameter. Rules belonging to other organizations<br />cannot be retrieved.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.governance_tag_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND include = '{{ include }}'
AND ts_start = '{{ ts_start }}'
AND ts_end = '{{ ts_end }}'
;
Retrieve all tag rules for the organization. Optionally include disabled or deleted<br />rules, filter by telemetry source, and include each rule's current compliance score<br />via the include=score query parameter.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.governance_tag_rules
WHERE include_disabled = '{{ include_disabled }}'
AND include_deleted = '{{ include_deleted }}'
AND include = '{{ include }}'
AND filter[source] = '{{ filter[source] }}'
AND ts_start = '{{ ts_start }}'
AND ts_end = '{{ ts_end }}'
;
INSERT examples
- create_tag_rule
- Manifest
Create a new tag rule for the organization. The caller's organization is derived from<br />the authenticated user; cross-organization creation is not supported. Fields such as<br />rule_id, version, and the timestamp/audit fields are assigned by the server.
INSERT INTO datadog.organization.governance_tag_rules (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data,
included
;
# Description fields are for documentation purposes
- name: governance_tag_rules
props:
- name: data
description: |
Data object for creating a tag rule.
value:
attributes:
enabled: {{ enabled }}
name: "{{ name }}"
negated: {{ negated }}
required: {{ required }}
rule_type: "{{ rule_type }}"
scope: "{{ scope }}"
source: "{{ source }}"
tag_key: "{{ tag_key }}"
tag_value_patterns:
- "{{ tag_value_patterns }}"
type: "{{ type }}"
UPDATE examples
- update_tag_rule
Update one or more attributes of an existing tag rule. Only the fields supplied in the<br />request body are modified; omitted fields retain their current values. The rule's<br />source cannot be changed after creation.
UPDATE datadog.organization.governance_tag_rules
SET
data = '{{ data }}'
WHERE
rule_id = '{{ rule_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;
DELETE examples
- delete_tag_rule
Delete a tag rule. By default the rule is soft-deleted so it can be recovered later<br />and so that historical score data remains queryable. Pass hard_delete=true to remove<br />the rule permanently.
DELETE FROM datadog.organization.governance_tag_rules
WHERE rule_id = '{{ rule_id }}' --required
AND hard_delete = '{{ hard_delete }}'
;