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.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
negated=False,
required=True,
rule_type=TagRuleCreateType.SURFACING,
scope="env",
scope="env:prod",
source=TagRuleSource.LOGS,
tag_key="service",
tag_value_patterns=[
"api",
"web",
],
),
type=TagRuleResourceType.TAG_RULE,
type=TagRuleResourceType.TAG_POLICY,
),
)

Expand Down
2 changes: 1 addition & 1 deletion examples/v2/tag-rules/UpdateTagRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
tag_value_patterns=[],
),
id="123",
type=TagRuleResourceType.TAG_RULE,
type=TagRuleResourceType.TAG_POLICY,
),
)

Expand Down
14 changes: 9 additions & 5 deletions src/datadog_api_client/v2/api/tag_rules_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TagRulesApi:
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.
"""

def __init__(self, api_client=None):
Expand Down Expand Up @@ -254,7 +254,8 @@ def delete_tag_rule(

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.

:param rule_id: The unique identifier of the tag rule to delete.
:type rule_id: str
Expand Down Expand Up @@ -288,7 +289,7 @@ def get_tag_rule(
:type rule_id: str
:param include: Comma-separated list of related resources to include alongside the rule. Currently the only supported value is ``score``.
:type include: TagRuleInclude, optional
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
:param ts_start: 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``.
:type ts_start: int, optional
:param ts_end: 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``.
:type ts_end: int, optional
Expand Down Expand Up @@ -324,7 +325,7 @@ def get_tag_rule_score(

:param rule_id: The unique identifier of the tag rule.
:type rule_id: str
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
:param ts_start: 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``.
:type ts_start: int, optional
:param ts_end: 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``.
:type ts_end: int, optional
Expand Down Expand Up @@ -365,7 +366,7 @@ def list_tag_rules(
:type include: TagRuleInclude, optional
:param filter_source: Restrict the result set to rules whose source matches the given value.
:type filter_source: TagRuleSource, optional
:param ts_start: 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.
:param ts_start: 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``.
:type ts_start: int, optional
:param ts_end: 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``.
:type ts_end: int, optional
Expand Down Expand Up @@ -402,6 +403,9 @@ def update_tag_rule(
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``.

:param rule_id: The unique identifier of the tag rule to update.
:type rule_id: str
Expand Down
1 change: 1 addition & 0 deletions src/datadog_api_client/v2/model/tag_rule_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(

:param rule_type: 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.
:type rule_type: TagRuleType

:param scope: The scope the rule applies within.
Expand Down
Loading
Loading