Skip to main content

governance_tag_rules

Creates, updates, deletes, gets or lists a governance_tag_rules resource.

Overview

Namegovernance_tag_rules
TypeResource
Iddatadog.organization.governance_tag_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the tag rule. (example: 123)
attributesobjectThe attributes of a tag rule resource.
relationshipsobjectRelated resources for a tag rule. Only present when the corresponding include query parameter is supplied.
typestringJSON:API resource type for a tag rule. (tag_rule) (example: tag_rule)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_tag_ruleselectrule_idinclude, ts_start, ts_endRetrieve 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_rulesselectinclude_disabled, include_deleted, include, filter[source], ts_start, ts_endRetrieve 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_ruleinsertdataCreate 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_ruleupdaterule_id, dataUpdate 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_ruledeleterule_idhard_deleteDelete 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.

NameDatatypeDescription
rule_idstringThe unique identifier of the tag rule to delete. (example: 123)
sitestringThe 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]stringRestrict the result set to rules whose source matches the given value.
hard_deletebooleanWhether to permanently delete the rule instead of performing a soft delete. Defaults to false. (example: false)
includestringComma-separated list of related resources to include alongside each rule in the response. Currently the only supported value is score.
include_deletedbooleanWhether to include rules that have been soft-deleted. Defaults to false. (example: false)
include_disabledbooleanWhether to include rules that are currently disabled. Defaults to false. (example: false)
ts_endinteger (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_startinteger (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

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 }}'
;

INSERT examples

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
;

UPDATE examples

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 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 }}'
;