From 0cd59d7045812b443cf6a182acc69dc3f45045da Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 13 Nov 2026 13:06:01 +0000 Subject: [PATCH] Regenerate client from commit 55a8011 of spec repo --- .generator/schemas/v2/openapi.yaml | 81 ++++++++++++------- examples/v2/tag-rules/CreateTagRule.py | 4 +- examples/v2/tag-rules/UpdateTagRule.py | 2 +- .../v2/api/tag_rules_api.py | 14 ++-- .../v2/model/tag_rule_attributes.py | 1 + .../v2/model/tag_rule_create_attributes.py | 23 ++++-- .../v2/model/tag_rule_create_data.py | 6 +- .../v2/model/tag_rule_data.py | 2 +- .../v2/model/tag_rule_resource_type.py | 7 +- .../v2/model/tag_rule_score_data.py | 2 +- .../model/tag_rule_score_relationship_data.py | 2 +- .../v2/model/tag_rule_score_resource_type.py | 7 +- .../v2/model/tag_rule_type.py | 1 + .../v2/model/tag_rule_update_attributes.py | 13 ++- .../v2/model/tag_rule_update_data.py | 6 +- tests/v2/features/tag_rules.feature | 14 ++-- 16 files changed, 124 insertions(+), 61 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 54ca38f72f..819800a977 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -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: @@ -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: @@ -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: @@ -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 @@ -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. @@ -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: @@ -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 @@ -193258,8 +193281,8 @@ 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 @@ -193267,7 +193290,7 @@ paths: 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 @@ -193361,7 +193384,7 @@ paths: - "web" version: 1 id: "123" - type: "tag_rule" + type: "tag_policy" schema: $ref: "#/components/schemas/TagRuleResponse" description: Created @@ -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. @@ -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 @@ -193537,8 +193561,8 @@ 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 @@ -193546,7 +193570,7 @@ paths: 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 @@ -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. @@ -193646,7 +193673,7 @@ paths: - "web" version: 2 id: "123" - type: "tag_rule" + type: "tag_policy" schema: $ref: "#/components/schemas/TagRuleResponse" description: OK @@ -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 @@ -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 @@ -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 diff --git a/examples/v2/tag-rules/CreateTagRule.py b/examples/v2/tag-rules/CreateTagRule.py index d5abba88c4..b377d54cca 100644 --- a/examples/v2/tag-rules/CreateTagRule.py +++ b/examples/v2/tag-rules/CreateTagRule.py @@ -20,7 +20,7 @@ negated=False, required=True, rule_type=TagRuleCreateType.SURFACING, - scope="env", + scope="env:prod", source=TagRuleSource.LOGS, tag_key="service", tag_value_patterns=[ @@ -28,7 +28,7 @@ "web", ], ), - type=TagRuleResourceType.TAG_RULE, + type=TagRuleResourceType.TAG_POLICY, ), ) diff --git a/examples/v2/tag-rules/UpdateTagRule.py b/examples/v2/tag-rules/UpdateTagRule.py index b23592dcfe..5e3d05b825 100644 --- a/examples/v2/tag-rules/UpdateTagRule.py +++ b/examples/v2/tag-rules/UpdateTagRule.py @@ -18,7 +18,7 @@ tag_value_patterns=[], ), id="123", - type=TagRuleResourceType.TAG_RULE, + type=TagRuleResourceType.TAG_POLICY, ), ) diff --git a/src/datadog_api_client/v2/api/tag_rules_api.py b/src/datadog_api_client/v2/api/tag_rules_api.py index d9795c19fe..9ac31830c5 100644 --- a/src/datadog_api_client/v2/api/tag_rules_api.py +++ b/src/datadog_api_client/v2/api/tag_rules_api.py @@ -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): @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/datadog_api_client/v2/model/tag_rule_attributes.py b/src/datadog_api_client/v2/model/tag_rule_attributes.py index 953282eabc..338bf0d816 100644 --- a/src/datadog_api_client/v2/model/tag_rule_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_attributes.py @@ -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. diff --git a/src/datadog_api_client/v2/model/tag_rule_create_attributes.py b/src/datadog_api_client/v2/model/tag_rule_create_attributes.py index 4f51780356..d9a024a705 100644 --- a/src/datadog_api_client/v2/model/tag_rule_create_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_create_attributes.py @@ -20,7 +20,9 @@ class TagRuleCreateAttributes(ModelNormal): validations = { + "tag_key": {}, "tag_value_patterns": { + "max_items": 30, "min_items": 1, }, } @@ -68,9 +70,11 @@ def __init__( **kwargs, ): """ - Attributes that can be supplied when creating a tag rule. + 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. - :param enabled: Whether the rule is currently enforced. Defaults to ``true`` for newly created rules. + :param enabled: The API ignores this value on creation and always enables new rules. To disable a rule, use the "Update a tag rule" endpoint. :type enabled: bool, optional :param name: Human-readable name for the tag rule. @@ -86,18 +90,23 @@ def __init__( creation time. :type rule_type: TagRuleCreateType - :param scope: The scope the rule applies within. Typically an environment, team, or - organization-level identifier used to limit where the rule is enforced. + :param scope: 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. :type scope: str :param source: The telemetry source that a tag rule applies to. :type source: TagRuleSource - :param tag_key: The tag key that the rule governs (for example, ``service`` ). + :param tag_key: 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. :type tag_key: str - :param tag_value_patterns: One or more patterns that valid values for the tag key must match. At least one - pattern is required. + :param tag_value_patterns: 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. :type tag_value_patterns: [str] """ if enabled is not unset: diff --git a/src/datadog_api_client/v2/model/tag_rule_create_data.py b/src/datadog_api_client/v2/model/tag_rule_create_data.py index 2358c06603..b31fe1fc50 100644 --- a/src/datadog_api_client/v2/model/tag_rule_create_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_create_data.py @@ -36,10 +36,12 @@ def __init__(self_, attributes: TagRuleCreateAttributes, type: TagRuleResourceTy """ Data object for creating a tag rule. - :param attributes: Attributes that can be supplied when creating a tag rule. + :param attributes: 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. :type attributes: TagRuleCreateAttributes - :param type: JSON:API resource type for a tag rule. + :param type: JSON:API resource type for a tag rule. Requests accept ``tag_rule`` or ``tag_policy`` ; responses use ``tag_policy``. :type type: TagRuleResourceType """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_rule_data.py b/src/datadog_api_client/v2/model/tag_rule_data.py index 5f5c427f74..745b3dd9a8 100644 --- a/src/datadog_api_client/v2/model/tag_rule_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_data.py @@ -60,7 +60,7 @@ def __init__( :param relationships: Related resources for a tag rule. Only present when the corresponding ``include`` query parameter is supplied. :type relationships: TagRuleRelationships, optional - :param type: JSON:API resource type for a tag rule. + :param type: JSON:API resource type for a tag rule. Requests accept ``tag_rule`` or ``tag_policy`` ; responses use ``tag_policy``. :type type: TagRuleResourceType """ if relationships is not unset: diff --git a/src/datadog_api_client/v2/model/tag_rule_resource_type.py b/src/datadog_api_client/v2/model/tag_rule_resource_type.py index 436f4ba020..388e167600 100644 --- a/src/datadog_api_client/v2/model/tag_rule_resource_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_resource_type.py @@ -14,16 +14,18 @@ class TagRuleResourceType(ModelSimple): """ - JSON:API resource type for a tag rule. + JSON:API resource type for a tag rule. Requests accept `tag_rule` or `tag_policy`; responses use `tag_policy`. - :param value: If omitted defaults to "tag_rule". Must be one of ["tag_rule"]. + :param value: Must be one of ["tag_rule", "tag_policy"]. :type value: str """ allowed_values = { "tag_rule", + "tag_policy", } TAG_RULE: ClassVar["TagRuleResourceType"] + TAG_POLICY: ClassVar["TagRuleResourceType"] @cached_property def openapi_types(_): @@ -33,3 +35,4 @@ def openapi_types(_): TagRuleResourceType.TAG_RULE = TagRuleResourceType("tag_rule") +TagRuleResourceType.TAG_POLICY = TagRuleResourceType("tag_policy") diff --git a/src/datadog_api_client/v2/model/tag_rule_score_data.py b/src/datadog_api_client/v2/model/tag_rule_score_data.py index 8a6e731024..68ee0ce629 100644 --- a/src/datadog_api_client/v2/model/tag_rule_score_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_data.py @@ -44,7 +44,7 @@ def __init__(self_, attributes: TagRuleScoreAttributes, id: str, type: TagRuleSc :param id: The unique identifier of the compliance score resource. :type id: str - :param type: JSON:API resource type for a tag rule compliance score. + :param type: JSON:API resource type for a tag rule compliance score. Responses use ``tag_policy_score``. :type type: TagRuleScoreResourceType """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py b/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py index 2b7603a714..49f682a7d6 100644 --- a/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py @@ -37,7 +37,7 @@ def __init__(self_, id: str, type: TagRuleScoreResourceType, **kwargs): :param id: The unique identifier of the related compliance score resource. :type id: str - :param type: JSON:API resource type for a tag rule compliance score. + :param type: JSON:API resource type for a tag rule compliance score. Responses use ``tag_policy_score``. :type type: TagRuleScoreResourceType """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py b/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py index c327bc9147..c55a6b30f8 100644 --- a/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py @@ -14,16 +14,18 @@ class TagRuleScoreResourceType(ModelSimple): """ - JSON:API resource type for a tag rule compliance score. + JSON:API resource type for a tag rule compliance score. Responses use `tag_policy_score`. - :param value: If omitted defaults to "tag_rule_score". Must be one of ["tag_rule_score"]. + :param value: Must be one of ["tag_rule_score", "tag_policy_score"]. :type value: str """ allowed_values = { "tag_rule_score", + "tag_policy_score", } TAG_RULE_SCORE: ClassVar["TagRuleScoreResourceType"] + TAG_POLICY_SCORE: ClassVar["TagRuleScoreResourceType"] @cached_property def openapi_types(_): @@ -33,3 +35,4 @@ def openapi_types(_): TagRuleScoreResourceType.TAG_RULE_SCORE = TagRuleScoreResourceType("tag_rule_score") +TagRuleScoreResourceType.TAG_POLICY_SCORE = TagRuleScoreResourceType("tag_policy_score") diff --git a/src/datadog_api_client/v2/model/tag_rule_type.py b/src/datadog_api_client/v2/model/tag_rule_type.py index 2af092988b..a9435a8b4d 100644 --- a/src/datadog_api_client/v2/model/tag_rule_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_type.py @@ -16,6 +16,7 @@ class TagRuleType(ModelSimple): """ 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. :param value: Must be one of ["blocking", "surfacing"]. :type value: str diff --git a/src/datadog_api_client/v2/model/tag_rule_update_attributes.py b/src/datadog_api_client/v2/model/tag_rule_update_attributes.py index 6d9f7e2e88..9bbeebe729 100644 --- a/src/datadog_api_client/v2/model/tag_rule_update_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_update_attributes.py @@ -18,6 +18,14 @@ class TagRuleUpdateAttributes(ModelNormal): + validations = { + "tag_key": {}, + "tag_value_patterns": { + "max_items": 30, + "min_items": 1, + }, + } + @cached_property def openapi_types(_): from datadog_api_client.v2.model.tag_rule_type import TagRuleType @@ -58,7 +66,9 @@ def __init__( ): """ 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. :param enabled: Whether the rule is currently enforced. :type enabled: bool, optional @@ -74,6 +84,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, optional :param scope: The scope the rule applies within. diff --git a/src/datadog_api_client/v2/model/tag_rule_update_data.py b/src/datadog_api_client/v2/model/tag_rule_update_data.py index 4f9ab84d0c..c5931a7d4f 100644 --- a/src/datadog_api_client/v2/model/tag_rule_update_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_update_data.py @@ -47,13 +47,15 @@ def __init__( Data object for updating a tag rule. :param attributes: 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. :type attributes: TagRuleUpdateAttributes, optional :param id: The unique identifier of the tag rule being updated. :type id: str - :param type: JSON:API resource type for a tag rule. + :param type: JSON:API resource type for a tag rule. Requests accept ``tag_rule`` or ``tag_policy`` ; responses use ``tag_policy``. :type type: TagRuleResourceType """ if attributes is not unset: diff --git a/tests/v2/features/tag_rules.feature b/tests/v2/features/tag_rules.feature index 1d70a47958..be904add87 100644 --- a/tests/v2/features/tag_rules.feature +++ b/tests/v2/features/tag_rules.feature @@ -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 @@ -16,7 +16,7 @@ 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 @@ -24,7 +24,7 @@ Feature: Tag Rules 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 @@ -32,7 +32,7 @@ Feature: Tag Rules 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 @@ -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 @@ -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 @@ -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