From c78012b3d45bf9a21644d54754eb2691ba41628c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 13 Nov 2026 13:04:27 +0000 Subject: [PATCH] Regenerate client from commit 55a8011 of spec repo --- .generator/schemas/v2/openapi.yaml | 81 ++++++++++++------- examples/v2/tag-rules/CreateTagRule.rb | 4 +- examples/v2/tag-rules/UpdateTagRule.rb | 2 +- features/v2/tag_rules.feature | 14 ++-- .../v2/api/tag_rules_api.rb | 12 ++- .../v2/models/tag_rule_attributes.rb | 1 + .../v2/models/tag_rule_create_attributes.rb | 31 +++++-- .../v2/models/tag_rule_create_data.rb | 6 +- .../v2/models/tag_rule_data.rb | 2 +- .../v2/models/tag_rule_resource_type.rb | 3 +- .../v2/models/tag_rule_score_data.rb | 2 +- .../tag_rule_score_relationship_data.rb | 2 +- .../v2/models/tag_rule_score_resource_type.rb | 3 +- .../v2/models/tag_rule_type.rb | 1 + .../v2/models/tag_rule_update_attributes.rb | 44 +++++++++- .../v2/models/tag_rule_update_data.rb | 6 +- 16 files changed, 154 insertions(+), 60 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 54ca38f72fdd..819800a97760 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.rb b/examples/v2/tag-rules/CreateTagRule.rb index 6e44c48ec222..b1a6b5c6e9e8 100644 --- a/examples/v2/tag-rules/CreateTagRule.rb +++ b/examples/v2/tag-rules/CreateTagRule.rb @@ -15,7 +15,7 @@ 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: [ @@ -23,7 +23,7 @@ "web", ], }), - type: DatadogAPIClient::V2::TagRuleResourceType::TAG_RULE, + type: DatadogAPIClient::V2::TagRuleResourceType::TAG_POLICY, }), }) p api_instance.create_tag_rule(body) diff --git a/examples/v2/tag-rules/UpdateTagRule.rb b/examples/v2/tag-rules/UpdateTagRule.rb index 246c2e1b8dd2..caa6ac8304bd 100644 --- a/examples/v2/tag-rules/UpdateTagRule.rb +++ b/examples/v2/tag-rules/UpdateTagRule.rb @@ -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) diff --git a/features/v2/tag_rules.feature b/features/v2/tag_rules.feature index 1d70a47958a2..be904add87c3 100644 --- a/features/v2/tag_rules.feature +++ b/features/v2/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 diff --git a/lib/datadog_api_client/v2/api/tag_rules_api.rb b/lib/datadog_api_client/v2/api/tag_rules_api.rb index 4685f61e9665..05334177426c 100644 --- a/lib/datadog_api_client/v2/api/tag_rules_api.rb +++ b/lib/datadog_api_client/v2/api/tag_rules_api.rb @@ -110,7 +110,8 @@ def delete_tag_rule(rule_id, opts = {}) # # 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 [String] The unique identifier of the tag rule to delete. # @param opts [Hash] the optional parameters @@ -190,7 +191,7 @@ def get_tag_rule(rule_id, opts = {}) # @param rule_id [String] The unique identifier of the tag rule. # @param opts [Hash] the optional parameters # @option opts [TagRuleInclude] :include Comma-separated list of related resources to include alongside the rule. Currently the only supported value is `score`. - # @option opts [Integer] :ts_start Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. + # @option opts [Integer] :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`. # @option opts [Integer] :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`. # @return [Array<(TagRuleResponse, Integer, Hash)>] TagRuleResponse data, response status code and response headers def get_tag_rule_with_http_info(rule_id, opts = {}) @@ -273,7 +274,7 @@ def get_tag_rule_score(rule_id, opts = {}) # # @param rule_id [String] The unique identifier of the tag rule. # @param opts [Hash] the optional parameters - # @option opts [Integer] :ts_start Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. + # @option opts [Integer] :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`. # @option opts [Integer] :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`. # @return [Array<(TagRuleScoreResponse, Integer, Hash)>] TagRuleScoreResponse data, response status code and response headers def get_tag_rule_score_with_http_info(rule_id, opts = {}) @@ -353,7 +354,7 @@ def list_tag_rules(opts = {}) # @option opts [Boolean] :include_deleted Whether to include rules that have been soft-deleted. Defaults to `false`. # @option opts [TagRuleInclude] :include Comma-separated list of related resources to include alongside each rule in the response. Currently the only supported value is `score`. # @option opts [TagRuleSource] :filter_source Restrict the result set to rules whose source matches the given value. - # @option opts [Integer] :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. + # @option opts [Integer] :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`. # @option opts [Integer] :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`. # @return [Array<(TagRulesListResponse, Integer, Hash)>] TagRulesListResponse data, response status code and response headers def list_tag_rules_with_http_info(opts = {}) @@ -435,6 +436,9 @@ def update_tag_rule(rule_id, body, opts = {}) # 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 [String] The unique identifier of the tag rule to update. # @param body [TagRuleUpdateRequest] diff --git a/lib/datadog_api_client/v2/models/tag_rule_attributes.rb b/lib/datadog_api_client/v2/models/tag_rule_attributes.rb index 395acf35d933..597ab1816df9 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_attributes.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_attributes.rb @@ -53,6 +53,7 @@ class TagRuleAttributes # 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. attr_reader :rule_type # The scope the rule applies within. diff --git a/lib/datadog_api_client/v2/models/tag_rule_create_attributes.rb b/lib/datadog_api_client/v2/models/tag_rule_create_attributes.rb index a8c58f228635..714c230f0e18 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_create_attributes.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_create_attributes.rb @@ -17,11 +17,13 @@ require 'time' module DatadogAPIClient::V2 - # 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. class TagRuleCreateAttributes include BaseGenericModel - # Whether the rule is currently enforced. Defaults to `true` for newly created rules. + # The API ignores this value on creation and always enables new rules. To disable a rule, use the "Update a tag rule" endpoint. attr_accessor :enabled # Human-readable name for the tag rule. @@ -37,18 +39,23 @@ class TagRuleCreateAttributes # creation time. attr_reader :rule_type - # The scope the rule applies within. Typically an environment, team, or - # organization-level identifier used to limit where the rule is enforced. + # 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. attr_reader :scope # The telemetry source that a tag rule applies to. attr_reader :source - # The tag key that the rule governs (for example, `service`). + # 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. attr_reader :tag_key - # 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. attr_reader :tag_value_patterns attr_accessor :additional_properties @@ -151,7 +158,10 @@ def valid? return false if @scope.nil? return false if @source.nil? return false if @tag_key.nil? + pattern = Regexp.new(/^[A-Za-z0-9_.\/-]+$/) + return false if @tag_key !~ pattern return false if @tag_value_patterns.nil? + return false if @tag_value_patterns.length > 30 return false if @tag_value_patterns.length < 1 true end @@ -203,6 +213,10 @@ def tag_key=(tag_key) if tag_key.nil? fail ArgumentError, 'invalid value for "tag_key", tag_key cannot be nil.' end + pattern = Regexp.new(/^[A-Za-z0-9_.\/-]+$/) + if tag_key !~ pattern + fail ArgumentError, "invalid value for \"tag_key\", must conform to the pattern #{pattern}." + end @tag_key = tag_key end @@ -213,6 +227,9 @@ def tag_value_patterns=(tag_value_patterns) if tag_value_patterns.nil? fail ArgumentError, 'invalid value for "tag_value_patterns", tag_value_patterns cannot be nil.' end + if tag_value_patterns.length > 30 + fail ArgumentError, 'invalid value for "tag_value_patterns", number of items must be less than or equal to 30.' + end if tag_value_patterns.length < 1 fail ArgumentError, 'invalid value for "tag_value_patterns", number of items must be greater than or equal to 1.' end diff --git a/lib/datadog_api_client/v2/models/tag_rule_create_data.rb b/lib/datadog_api_client/v2/models/tag_rule_create_data.rb index 9497c887d188..f4511494b762 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_create_data.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_create_data.rb @@ -21,10 +21,12 @@ module DatadogAPIClient::V2 class TagRuleCreateData include BaseGenericModel - # 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. attr_reader :attributes - # 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`. attr_reader :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/tag_rule_data.rb b/lib/datadog_api_client/v2/models/tag_rule_data.rb index bc0c724288d2..8e3f8077cf0f 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_data.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_data.rb @@ -30,7 +30,7 @@ class TagRuleData # Related resources for a tag rule. Only present when the corresponding `include` query parameter is supplied. attr_accessor :relationships - # 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`. attr_reader :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/tag_rule_resource_type.rb b/lib/datadog_api_client/v2/models/tag_rule_resource_type.rb index ca2b7c066c6d..426e74813b13 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_resource_type.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_resource_type.rb @@ -17,10 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # 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`. class TagRuleResourceType include BaseEnumModel TAG_RULE = "tag_rule".freeze + TAG_POLICY = "tag_policy".freeze end end diff --git a/lib/datadog_api_client/v2/models/tag_rule_score_data.rb b/lib/datadog_api_client/v2/models/tag_rule_score_data.rb index dd2536c14e9b..7808beec7d03 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_score_data.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_score_data.rb @@ -27,7 +27,7 @@ class TagRuleScoreData # The unique identifier of the compliance score resource. attr_reader :id - # 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`. attr_reader :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/tag_rule_score_relationship_data.rb b/lib/datadog_api_client/v2/models/tag_rule_score_relationship_data.rb index 14a55ddbb7fc..eb8f3f278ebf 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_score_relationship_data.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_score_relationship_data.rb @@ -24,7 +24,7 @@ class TagRuleScoreRelationshipData # The unique identifier of the related compliance score resource. attr_reader :id - # 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`. attr_reader :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/tag_rule_score_resource_type.rb b/lib/datadog_api_client/v2/models/tag_rule_score_resource_type.rb index a99833a1b40d..3fc656c78a11 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_score_resource_type.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_score_resource_type.rb @@ -17,10 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # 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`. class TagRuleScoreResourceType include BaseEnumModel TAG_RULE_SCORE = "tag_rule_score".freeze + TAG_POLICY_SCORE = "tag_policy_score".freeze end end diff --git a/lib/datadog_api_client/v2/models/tag_rule_type.rb b/lib/datadog_api_client/v2/models/tag_rule_type.rb index 57dfd1993638..6f0334456d5f 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_type.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_type.rb @@ -19,6 +19,7 @@ module DatadogAPIClient::V2 # 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. class TagRuleType include BaseEnumModel diff --git a/lib/datadog_api_client/v2/models/tag_rule_update_attributes.rb b/lib/datadog_api_client/v2/models/tag_rule_update_attributes.rb index a6f1870719aa..38f381ae4bf5 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_update_attributes.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_update_attributes.rb @@ -18,7 +18,9 @@ module DatadogAPIClient::V2 # 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. class TagRuleUpdateAttributes include BaseGenericModel @@ -36,16 +38,17 @@ class TagRuleUpdateAttributes # 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. attr_accessor :rule_type # The scope the rule applies within. attr_accessor :scope # The tag key that the rule governs. - attr_accessor :tag_key + attr_reader :tag_key # One or more patterns that valid values for the tag key must match. - attr_accessor :tag_value_patterns + attr_reader :tag_value_patterns attr_accessor :additional_properties @@ -132,6 +135,41 @@ def initialize(attributes = {}) end end + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + pattern = Regexp.new(/^[A-Za-z0-9_.\/-]+$/) + return false if !@tag_key.nil? && @tag_key !~ pattern + return false if !@tag_value_patterns.nil? && @tag_value_patterns.length > 30 + return false if !@tag_value_patterns.nil? && @tag_value_patterns.length < 1 + true + end + + # Custom attribute writer method with validation + # @param tag_key [Object] Object to be assigned + # @!visibility private + def tag_key=(tag_key) + pattern = Regexp.new(/^[A-Za-z0-9_.\/-]+$/) + if !tag_key.nil? && tag_key !~ pattern + fail ArgumentError, "invalid value for \"tag_key\", must conform to the pattern #{pattern}." + end + @tag_key = tag_key + end + + # Custom attribute writer method with validation + # @param tag_value_patterns [Object] Object to be assigned + # @!visibility private + def tag_value_patterns=(tag_value_patterns) + if !tag_value_patterns.nil? && tag_value_patterns.length > 30 + fail ArgumentError, 'invalid value for "tag_value_patterns", number of items must be less than or equal to 30.' + end + if !tag_value_patterns.nil? && tag_value_patterns.length < 1 + fail ArgumentError, 'invalid value for "tag_value_patterns", number of items must be greater than or equal to 1.' + end + @tag_value_patterns = tag_value_patterns + end + # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/tag_rule_update_data.rb b/lib/datadog_api_client/v2/models/tag_rule_update_data.rb index 67149617fc44..b2f78d16ded4 100644 --- a/lib/datadog_api_client/v2/models/tag_rule_update_data.rb +++ b/lib/datadog_api_client/v2/models/tag_rule_update_data.rb @@ -22,13 +22,15 @@ class TagRuleUpdateData include BaseGenericModel # 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. attr_accessor :attributes # The unique identifier of the tag rule being updated. attr_reader :id - # 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`. attr_reader :type attr_accessor :additional_properties