Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 54 additions & 27 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144122,10 +144122,13 @@ components:
- modified_by
type: object
TagRuleCreateAttributes:
description: Attributes that can be supplied when creating a tag rule.
description: |-
Attributes that can be supplied when creating a tag rule. If `tag_value_patterns`
contains `*`, set `required` and `negated` to different values. If both are `false`,
the rule has no effect. If both are `true`, no value can satisfy the rule.
properties:
enabled:
description: Whether the rule is currently enforced. Defaults to `true` for newly created rules.
description: The API ignores this value on creation and always enables new rules. To disable a rule, use the "Update a tag rule" endpoint.
example: true
type: boolean
name:
Expand All @@ -144144,26 +144147,35 @@ components:
$ref: "#/components/schemas/TagRuleCreateType"
scope:
description: |-
The scope the rule applies within. Typically an environment, team, or
organization-level identifier used to limit where the rule is enforced.
example: "env"
The scope the rule applies within. For logs and spans, use a search query, such
as `env:prod`, or `*` to match all telemetry. For metrics, use a metric selector
with an optional tag filter, such as `system.cpu.*{env:prod}`. A metric wildcard
is allowed only once, at the end of the metric selector.
example: "env:prod"
type: string
source:
$ref: "#/components/schemas/TagRuleSource"
tag_key:
description: The tag key that the rule governs (for example, `service`).
description: |-
The tag key that the rule governs (for example, `service`). Allowed characters
are ASCII letters, digits, underscores, hyphens, periods, and slashes. The keys
`host` and `device` are not supported in any letter case.
example: "service"
pattern: '^[A-Za-z0-9_.\/-]+$'
type: string
tag_value_patterns:
description: |-
One or more patterns that valid values for the tag key must match. At least one
pattern is required.
Between 1 and 30 non-empty patterns that valid values for the tag key must match.
Allowed characters are ASCII letters, digits, underscores, colons, hyphens,
periods, commas, slashes, and asterisks.
example:
- "api"
- "web"
items:
description: A pattern that valid tag values must match.
pattern: '^[A-Za-z0-9_:.,\/*-]+$'
type: string
maxItems: 30
minItems: 1
type: array
required:
Expand Down Expand Up @@ -144246,13 +144258,15 @@ components:
$ref: "#/components/schemas/TagRuleScoreRelationship"
type: object
TagRuleResourceType:
description: JSON:API resource type for a tag rule.
description: JSON:API resource type for a tag rule. Requests accept `tag_rule` or `tag_policy`; responses use `tag_policy`.
enum:
- tag_rule
example: "tag_rule"
- tag_policy
example: "tag_policy"
type: string
x-enum-varnames:
- TAG_RULE
- TAG_POLICY
TagRuleResponse:
description: A single tag rule.
properties:
Expand Down Expand Up @@ -144333,13 +144347,15 @@ components:
- id
type: object
TagRuleScoreResourceType:
description: JSON:API resource type for a tag rule compliance score.
description: JSON:API resource type for a tag rule compliance score. Responses use `tag_policy_score`.
enum:
- tag_rule_score
example: "tag_rule_score"
- tag_policy_score
example: "tag_policy_score"
type: string
x-enum-varnames:
- TAG_RULE_SCORE
- TAG_POLICY_SCORE
TagRuleScoreResponse:
description: A tag rule compliance score.
properties:
Expand Down Expand Up @@ -144368,6 +144384,7 @@ components:
description: |-
How the rule is enforced. `blocking` rejects telemetry that violates the rule.
`surfacing` only highlights non-compliant telemetry without blocking it.
RUM supports only `surfacing` rules.
enum:
- blocking
- surfacing
Expand All @@ -144379,7 +144396,9 @@ components:
TagRuleUpdateAttributes:
description: |-
Mutable attributes of a tag rule. Each field is optional; omitting a field leaves its
current value unchanged. The `source` of a rule cannot be changed.
current value unchanged. The `source` of a rule cannot be changed. Tag keys, patterns,
and metrics scopes have the same constraints as on creation. If the effective
`tag_value_patterns` contains `*`, set `required` and `negated` to different values.
properties:
enabled:
description: Whether the rule is currently enforced.
Expand All @@ -144400,12 +144419,16 @@ components:
type: string
tag_key:
description: The tag key that the rule governs.
pattern: '^[A-Za-z0-9_.\/-]+$'
type: string
tag_value_patterns:
description: One or more patterns that valid values for the tag key must match.
items:
description: A pattern that valid tag values must match.
pattern: '^[A-Za-z0-9_:.,\/*-]+$'
type: string
maxItems: 30
minItems: 1
type: array
type: object
TagRuleUpdateData:
Expand Down Expand Up @@ -193212,7 +193235,7 @@ paths:
required: false
schema:
$ref: "#/components/schemas/TagRuleSource"
- description: 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.
- description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of `ts_end`.
example: 1779315066097
in: query
name: ts_start
Expand Down Expand Up @@ -193258,16 +193281,16 @@ paths:
score:
data:
id: "123-v1-1779315066097-1779401466097"
type: "tag_rule_score"
type: "tag_rule"
type: "tag_policy_score"
type: "tag_policy"
included:
- attributes:
score: 80
ts_end: 1779401466097
ts_start: 1779315066097
version: 1
id: "123-v1-1779315066097-1779401466097"
type: "tag_rule_score"
type: "tag_policy_score"
schema:
$ref: "#/components/schemas/TagRulesListResponse"
description: OK
Expand Down Expand Up @@ -193361,7 +193384,7 @@ paths:
- "web"
version: 1
id: "123"
type: "tag_rule"
type: "tag_policy"
schema:
$ref: "#/components/schemas/TagRuleResponse"
description: Created
Expand Down Expand Up @@ -193410,7 +193433,8 @@ paths:
description: |-
Delete a tag rule. By default the rule is soft-deleted so it can be recovered later
and so that historical score data remains queryable. Pass `hard_delete=true` to remove
the rule permanently.
the rule permanently. Deleting a `blocking` rule additionally requires the
`telemetry_rules_activate` permission.
operationId: DeleteTagRule
parameters:
- description: The unique identifier of the tag rule to delete.
Expand Down Expand Up @@ -193491,7 +193515,7 @@ paths:
required: false
schema:
$ref: "#/components/schemas/TagRuleInclude"
- description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
- description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of `ts_end`.
example: 1779315066097
in: query
name: ts_start
Expand Down Expand Up @@ -193537,16 +193561,16 @@ paths:
score:
data:
id: "123-v1-1779315066097-1779401466097"
type: "tag_rule_score"
type: "tag_rule"
type: "tag_policy_score"
type: "tag_policy"
included:
- attributes:
score: 80
ts_end: 1779401466097
ts_start: 1779315066097
version: 1
id: "123-v1-1779315066097-1779401466097"
type: "tag_rule_score"
type: "tag_policy_score"
schema:
$ref: "#/components/schemas/TagRuleResponse"
description: OK
Expand Down Expand Up @@ -193596,6 +193620,9 @@ paths:
Update one or more attributes of an existing tag rule. Only the fields supplied in the
request body are modified; omitted fields retain their current values. The rule's
`source` cannot be changed after creation.
Promoting a rule from `surfacing` to `blocking` additionally requires the
`telemetry_rules_activate` permission, and your organization must have access to
blocking rules. You can't promote RUM rules to `blocking`.
operationId: UpdateTagRule
parameters:
- description: The unique identifier of the tag rule to update.
Expand Down Expand Up @@ -193646,7 +193673,7 @@ paths:
- "web"
version: 2
id: "123"
type: "tag_rule"
type: "tag_policy"
schema:
$ref: "#/components/schemas/TagRuleResponse"
description: OK
Expand Down Expand Up @@ -193706,7 +193733,7 @@ paths:
required: true
schema:
type: string
- description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
- description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of `ts_end`.
example: 1779315066097
in: query
name: ts_start
Expand Down Expand Up @@ -193736,7 +193763,7 @@ paths:
ts_start: 1779315066097
version: 1
id: "123-v1-1779315066097-1779401466097"
type: "tag_rule_score"
type: "tag_policy_score"
schema:
$ref: "#/components/schemas/TagRuleScoreResponse"
description: OK
Expand Down Expand Up @@ -275485,7 +275512,7 @@ tags:
scoped to a particular telemetry source (such as logs, spans, or metrics). Rules can be
`blocking` (data not matching the rule is rejected) or `surfacing` (matching data is
highlighted but not blocked). Each rule reports a compliance `score` derived from how
much recent telemetry adheres to the rule.
much recent telemetry adheres to the rule. RUM supports only `surfacing` rules.
name: Tag Rules
- description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information.
name: Teams
Expand Down
4 changes: 2 additions & 2 deletions examples/v2/tag-rules/CreateTagRule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
negated: false,
required: true,
rule_type: DatadogAPIClient::V2::TagRuleCreateType::SURFACING,
scope: "env",
scope: "env:prod",
source: DatadogAPIClient::V2::TagRuleSource::LOGS,
tag_key: "service",
tag_value_patterns: [
"api",
"web",
],
}),
type: DatadogAPIClient::V2::TagRuleResourceType::TAG_RULE,
type: DatadogAPIClient::V2::TagRuleResourceType::TAG_POLICY,
}),
})
p api_instance.create_tag_rule(body)
2 changes: 1 addition & 1 deletion examples/v2/tag-rules/UpdateTagRule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
tag_value_patterns: [],
}),
id: "123",
type: DatadogAPIClient::V2::TagRuleResourceType::TAG_RULE,
type: DatadogAPIClient::V2::TagRuleResourceType::TAG_POLICY,
}),
})
p api_instance.update_tag_rule("rule_id", body)
14 changes: 7 additions & 7 deletions features/v2/tag_rules.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Tag Rules
spans, or metrics). Rules can be `blocking` (data not matching the rule is
rejected) or `surfacing` (matching data is highlighted but not blocked).
Each rule reports a compliance `score` derived from how much recent
telemetry adheres to the rule.
telemetry adheres to the rule. RUM supports only `surfacing` rules.

Background:
Given a valid "apiKeyAuth" key in the system
Expand All @@ -16,23 +16,23 @@ Feature: Tag Rules
Scenario: Create a tag rule returns "Bad Request" response
Given operation "CreateTagRule" enabled
And new "CreateTagRule" request
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_rule"}}
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env:prod", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:ddoghq/aaa-governance-console
Scenario: Create a tag rule returns "Conflict" response
Given operation "CreateTagRule" enabled
And new "CreateTagRule" request
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_rule"}}
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env:prod", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:ddoghq/aaa-governance-console
Scenario: Create a tag rule returns "Created" response
Given operation "CreateTagRule" enabled
And new "CreateTagRule" request
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_rule"}}
And body with value {"data": {"attributes": {"enabled": true, "name": "Service tag must be one of api or web", "negated": false, "required": true, "rule_type": "surfacing", "scope": "env:prod", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}}
When the request is sent
Then the response status is 201 Created

Expand Down Expand Up @@ -127,7 +127,7 @@ Feature: Tag Rules
Given operation "UpdateTagRule" enabled
And new "UpdateTagRule" request
And request contains "rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_rule"}}
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_policy"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -136,7 +136,7 @@ Feature: Tag Rules
Given operation "UpdateTagRule" enabled
And new "UpdateTagRule" request
And request contains "rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_rule"}}
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_policy"}}
When the request is sent
Then the response status is 404 Not Found

Expand All @@ -145,6 +145,6 @@ Feature: Tag Rules
Given operation "UpdateTagRule" enabled
And new "UpdateTagRule" request
And request contains "rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_rule"}}
And body with value {"data": {"attributes": {"rule_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_policy"}}
When the request is sent
Then the response status is 200 OK
Loading
Loading