From 379643efdae80a50db9828dc5eb7e111ad0c4310 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 24 Aug 2026 15:46:37 +0000 Subject: [PATCH] Regenerate client from commit 07e6013 of spec repo --- .generator/schemas/v2/openapi.yaml | 1764 ++++++++--------- docs/datadog_api_client.v2.api.rst | 6 +- docs/datadog_api_client.v2.model.rst | 132 +- examples/v2/tag-policies/CreateTagPolicy.py | 40 - examples/v2/tag-policies/DeleteTagPolicy.py | 14 - examples/v2/tag-policies/GetTagPolicy.py | 16 - examples/v2/tag-policies/GetTagPolicyScore.py | 16 - examples/v2/tag-policies/ListTagPolicies.py | 14 - examples/v2/tag-policies/UpdateTagPolicy.py | 30 - examples/v2/tag-rules/CreateTagRule.py | 40 + examples/v2/tag-rules/DeleteTagRule.py | 14 + examples/v2/tag-rules/GetTagRule.py | 16 + examples/v2/tag-rules/GetTagRuleScore.py | 16 + examples/v2/tag-rules/ListTagRules.py | 14 + examples/v2/tag-rules/UpdateTagRule.py | 30 + src/datadog_api_client/configuration.py | 12 +- .../{tag_policies_api.py => tag_rules_api.py} | 242 +-- src/datadog_api_client/v2/apis/__init__.py | 4 +- .../v2/model/tag_policies_list_response.py | 53 - .../v2/model/tag_policy_create_data.py | 48 - .../v2/model/tag_policy_data.py | 72 - .../v2/model/tag_policy_score_data.py | 54 - .../v2/model/tag_policy_update_data.py | 64 - ...y_attributes.py => tag_rule_attributes.py} | 70 +- ...butes.py => tag_rule_create_attributes.py} | 60 +- .../v2/model/tag_rule_create_data.py | 48 + ...response.py => tag_rule_create_request.py} | 16 +- ...create_type.py => tag_rule_create_type.py} | 8 +- .../v2/model/tag_rule_data.py | 72 + ..._policy_include.py => tag_rule_include.py} | 8 +- ...tionships.py => tag_rule_relationships.py} | 16 +- ...urce_type.py => tag_rule_resource_type.py} | 12 +- ...olicy_response.py => tag_rule_response.py} | 26 +- ...ibutes.py => tag_rule_score_attributes.py} | 8 +- .../v2/model/tag_rule_score_data.py | 54 + ...ship.py => tag_rule_score_relationship.py} | 14 +- ...py => tag_rule_score_relationship_data.py} | 14 +- ...ype.py => tag_rule_score_resource_type.py} | 12 +- ..._request.py => tag_rule_score_response.py} | 16 +- ...ag_policy_source.py => tag_rule_source.py} | 24 +- .../{tag_policy_type.py => tag_rule_type.py} | 12 +- ...butes.py => tag_rule_update_attributes.py} | 52 +- .../v2/model/tag_rule_update_data.py | 64 + ..._request.py => tag_rule_update_request.py} | 16 +- .../v2/model/tag_rules_list_response.py | 51 + src/datadog_api_client/v2/models/__init__.py | 88 +- tests/v2/features/tag_policies.feature | 150 -- tests/v2/features/tag_rules.feature | 150 ++ tests/v2/features/undo.json | 86 +- 49 files changed, 1928 insertions(+), 1930 deletions(-) delete mode 100644 examples/v2/tag-policies/CreateTagPolicy.py delete mode 100644 examples/v2/tag-policies/DeleteTagPolicy.py delete mode 100644 examples/v2/tag-policies/GetTagPolicy.py delete mode 100644 examples/v2/tag-policies/GetTagPolicyScore.py delete mode 100644 examples/v2/tag-policies/ListTagPolicies.py delete mode 100644 examples/v2/tag-policies/UpdateTagPolicy.py create mode 100644 examples/v2/tag-rules/CreateTagRule.py create mode 100644 examples/v2/tag-rules/DeleteTagRule.py create mode 100644 examples/v2/tag-rules/GetTagRule.py create mode 100644 examples/v2/tag-rules/GetTagRuleScore.py create mode 100644 examples/v2/tag-rules/ListTagRules.py create mode 100644 examples/v2/tag-rules/UpdateTagRule.py rename src/datadog_api_client/v2/api/{tag_policies_api.py => tag_rules_api.py} (58%) delete mode 100644 src/datadog_api_client/v2/model/tag_policies_list_response.py delete mode 100644 src/datadog_api_client/v2/model/tag_policy_create_data.py delete mode 100644 src/datadog_api_client/v2/model/tag_policy_data.py delete mode 100644 src/datadog_api_client/v2/model/tag_policy_score_data.py delete mode 100644 src/datadog_api_client/v2/model/tag_policy_update_data.py rename src/datadog_api_client/v2/model/{tag_policy_attributes.py => tag_rule_attributes.py} (67%) rename src/datadog_api_client/v2/model/{tag_policy_create_attributes.py => tag_rule_create_attributes.py} (58%) create mode 100644 src/datadog_api_client/v2/model/tag_rule_create_data.py rename src/datadog_api_client/v2/model/{tag_policy_score_response.py => tag_rule_create_request.py} (57%) rename src/datadog_api_client/v2/model/{tag_policy_create_type.py => tag_rule_create_type.py} (74%) create mode 100644 src/datadog_api_client/v2/model/tag_rule_data.py rename src/datadog_api_client/v2/model/{tag_policy_include.py => tag_rule_include.py} (72%) rename src/datadog_api_client/v2/model/{tag_policy_relationships.py => tag_rule_relationships.py} (55%) rename src/datadog_api_client/v2/model/{tag_policy_resource_type.py => tag_rule_resource_type.py} (63%) rename src/datadog_api_client/v2/model/{tag_policy_response.py => tag_rule_response.py} (50%) rename src/datadog_api_client/v2/model/{tag_policy_score_attributes.py => tag_rule_score_attributes.py} (83%) create mode 100644 src/datadog_api_client/v2/model/tag_rule_score_data.py rename src/datadog_api_client/v2/model/{tag_policy_score_relationship.py => tag_rule_score_relationship.py} (62%) rename src/datadog_api_client/v2/model/{tag_policy_score_relationship_data.py => tag_rule_score_relationship_data.py} (62%) rename src/datadog_api_client/v2/model/{tag_policy_score_resource_type.py => tag_rule_score_resource_type.py} (58%) rename src/datadog_api_client/v2/model/{tag_policy_create_request.py => tag_rule_score_response.py} (56%) rename src/datadog_api_client/v2/model/{tag_policy_source.py => tag_rule_source.py} (57%) rename src/datadog_api_client/v2/model/{tag_policy_type.py => tag_rule_type.py} (70%) rename src/datadog_api_client/v2/model/{tag_policy_update_attributes.py => tag_rule_update_attributes.py} (63%) create mode 100644 src/datadog_api_client/v2/model/tag_rule_update_data.py rename src/datadog_api_client/v2/model/{tag_policy_update_request.py => tag_rule_update_request.py} (54%) create mode 100644 src/datadog_api_client/v2/model/tag_rules_list_response.py delete mode 100644 tests/v2/features/tag_policies.feature create mode 100644 tests/v2/features/tag_rules.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6e7246fb7b..e04f80259e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -113742,72 +113742,62 @@ components: format: int64 type: integer type: object - TagPoliciesListResponse: - description: A page of tag policies. - properties: - data: - $ref: "#/components/schemas/TagPolicyDataArray" - included: - $ref: "#/components/schemas/TagPolicyIncludedResources" - required: - - data - type: object - TagPolicyAttributes: - description: The attributes of a tag policy resource. + TagRuleAttributes: + description: The attributes of a tag rule resource. properties: created_at: - description: The RFC 3339 timestamp at which the policy was created. + description: The RFC 3339 timestamp at which the rule was created. example: "2026-05-21T22:11:06.108696Z" format: date-time type: string created_by: - description: The identifier of the user who created the policy. + description: The identifier of the user who created the rule. example: "test-user" type: string deleted_at: - description: The RFC 3339 timestamp at which the policy was soft-deleted. `null` if the policy has not been deleted. Only present when `include_deleted=true` is requested. + description: The RFC 3339 timestamp at which the rule was soft-deleted. `null` if the rule has not been deleted. Only present when `include_deleted=true` is requested. format: date-time nullable: true type: string deleted_by: - description: The identifier of the user who soft-deleted the policy. `null` if the policy has not been deleted. + description: The identifier of the user who soft-deleted the rule. `null` if the rule has not been deleted. nullable: true type: string enabled: - description: Whether the policy is currently enforced. + description: Whether the rule is currently enforced. example: true type: boolean modified_at: - description: The RFC 3339 timestamp at which the policy was last modified. + description: The RFC 3339 timestamp at which the rule was last modified. example: "2026-05-21T22:11:06.108696Z" format: date-time type: string modified_by: - description: The identifier of the user who last modified the policy. + description: The identifier of the user who last modified the rule. example: "test-user" type: string + name: + description: Human-readable name for the tag rule. + example: "Service tag must be one of api or web" + type: string negated: - description: When `true`, the policy matches tag values that do NOT match any of the supplied patterns. + description: When `true`, the rule matches tag values that do NOT match any of the supplied patterns. example: false type: boolean - policy_name: - description: Human-readable name for the tag policy. - example: "Service tag must be one of api or web" - type: string - policy_type: - $ref: "#/components/schemas/TagPolicyType" required: description: When `true`, telemetry without this tag is treated as a violation. example: true type: boolean + rule_type: + $ref: "#/components/schemas/TagRuleType" scope: - description: The scope the policy applies within. + description: The scope the rule applies within. example: "env" type: string source: - $ref: "#/components/schemas/TagPolicySource" + $ref: "#/components/schemas/TagRuleSource" tag_key: - description: The tag key that the policy governs. + description: The tag key that the rule governs. example: "service" type: string tag_value_patterns: @@ -113825,7 +113815,7 @@ components: format: int64 type: integer required: - - policy_name + - name - source - scope - tag_key @@ -113833,44 +113823,44 @@ components: - negated - required - enabled - - policy_type + - rule_type - version - created_at - created_by - modified_at - modified_by type: object - TagPolicyCreateAttributes: - description: Attributes that can be supplied when creating a tag policy. + TagRuleCreateAttributes: + description: Attributes that can be supplied when creating a tag rule. properties: enabled: - description: Whether the policy is currently enforced. Defaults to `true` for newly created policies. + description: Whether the rule is currently enforced. Defaults to `true` for newly created rules. example: true type: boolean + name: + description: Human-readable name for the tag rule. + example: "Service tag must be one of api or web" + type: string negated: - description: When `true`, the policy matches tag values that do NOT match any of the supplied patterns. Defaults to `false`. + description: When `true`, the rule matches tag values that do NOT match any of the supplied patterns. Defaults to `false`. example: false type: boolean - policy_name: - description: Human-readable name for the tag policy. - example: "Service tag must be one of api or web" - type: string - policy_type: - $ref: "#/components/schemas/TagPolicyCreateType" required: description: When `true`, telemetry without this tag is treated as a violation. Defaults to `false`. example: true type: boolean + rule_type: + $ref: "#/components/schemas/TagRuleCreateType" scope: description: |- - The scope the policy applies within. Typically an environment, team, or - organization-level identifier used to limit where the policy is enforced. + The scope the rule applies within. Typically an environment, team, or + organization-level identifier used to limit where the rule is enforced. example: "env" type: string source: - $ref: "#/components/schemas/TagPolicySource" + $ref: "#/components/schemas/TagRuleSource" tag_key: - description: The tag key that the policy governs (for example, `service`). + description: The tag key that the rule governs (for example, `service`). example: "service" type: string tag_value_patterns: @@ -113886,35 +113876,35 @@ components: minItems: 1 type: array required: - - policy_name + - name - source - scope - tag_key - tag_value_patterns - - policy_type + - rule_type type: object - TagPolicyCreateData: - description: Data object for creating a tag policy. + TagRuleCreateData: + description: Data object for creating a tag rule. properties: attributes: - $ref: "#/components/schemas/TagPolicyCreateAttributes" + $ref: "#/components/schemas/TagRuleCreateAttributes" type: - $ref: "#/components/schemas/TagPolicyResourceType" + $ref: "#/components/schemas/TagRuleResourceType" required: - type - attributes type: object - TagPolicyCreateRequest: - description: Payload for creating a new tag policy. + TagRuleCreateRequest: + description: Payload for creating a new tag rule. properties: data: - $ref: "#/components/schemas/TagPolicyCreateData" + $ref: "#/components/schemas/TagRuleCreateData" required: - data type: object - TagPolicyCreateType: + TagRuleCreateType: description: |- - The policy type allowed when creating a tag policy. Only `surfacing` is accepted at + The rule type allowed when creating a tag rule. Only `surfacing` is accepted at creation time. enum: - surfacing @@ -113922,72 +113912,72 @@ components: type: string x-enum-varnames: - SURFACING - TagPolicyData: - description: A tag policy resource. + TagRuleData: + description: A tag rule resource. properties: attributes: - $ref: "#/components/schemas/TagPolicyAttributes" + $ref: "#/components/schemas/TagRuleAttributes" id: - description: The unique identifier of the tag policy. + description: The unique identifier of the tag rule. example: "123" type: string relationships: - $ref: "#/components/schemas/TagPolicyRelationships" + $ref: "#/components/schemas/TagRuleRelationships" type: - $ref: "#/components/schemas/TagPolicyResourceType" + $ref: "#/components/schemas/TagRuleResourceType" required: - type - id - attributes type: object - TagPolicyDataArray: - description: An array of tag policy data objects. + TagRuleDataArray: + description: An array of tag rule data objects. items: - $ref: "#/components/schemas/TagPolicyData" + $ref: "#/components/schemas/TagRuleData" type: array - TagPolicyInclude: - description: A related resource to include alongside a tag policy in the response. Currently the only supported value is `score`. + TagRuleInclude: + description: A related resource to include alongside a tag rule in the response. Currently the only supported value is `score`. enum: - score example: "score" type: string x-enum-varnames: - SCORE - TagPolicyIncludedResources: - description: Related resources fetched alongside the primary tag policies. Populated when an `include` query parameter is supplied. + TagRuleIncludedResources: + description: Related resources fetched alongside the primary tag rules. Populated when an `include` query parameter is supplied. items: - $ref: "#/components/schemas/TagPolicyScoreData" + $ref: "#/components/schemas/TagRuleScoreData" type: array - TagPolicyRelationships: - description: Related resources for a tag policy. Only present when the corresponding `include` query parameter is supplied. + TagRuleRelationships: + description: Related resources for a tag rule. Only present when the corresponding `include` query parameter is supplied. properties: score: - $ref: "#/components/schemas/TagPolicyScoreRelationship" + $ref: "#/components/schemas/TagRuleScoreRelationship" type: object - TagPolicyResourceType: - description: JSON:API resource type for a tag policy. + TagRuleResourceType: + description: JSON:API resource type for a tag rule. enum: - - tag_policy - example: "tag_policy" + - tag_rule + example: "tag_rule" type: string x-enum-varnames: - - TAG_POLICY - TagPolicyResponse: - description: A single tag policy. + - TAG_RULE + TagRuleResponse: + description: A single tag rule. properties: data: - $ref: "#/components/schemas/TagPolicyData" + $ref: "#/components/schemas/TagRuleData" included: - $ref: "#/components/schemas/TagPolicyIncludedResources" + $ref: "#/components/schemas/TagRuleIncludedResources" required: - data type: object - TagPolicyScoreAttributes: - description: Attributes of a tag policy compliance score. + TagRuleScoreAttributes: + description: Attributes of a tag rule compliance score. properties: score: description: |- - The compliance score for the policy over the requested time window, as a percentage + The compliance score for the rule over the requested time window, as a percentage between 0 and 100. `null` indicates that no relevant telemetry was found. example: 80 format: double @@ -114004,7 +113994,7 @@ components: format: int64 type: integer version: - description: The version of the tag policy that the score was computed against. + description: The version of the tag rule that the score was computed against. example: 1 format: int64 type: integer @@ -114014,31 +114004,31 @@ components: - ts_end - version type: object - TagPolicyScoreData: - description: A compliance score resource for a tag policy. + TagRuleScoreData: + description: A compliance score resource for a tag rule. properties: attributes: - $ref: "#/components/schemas/TagPolicyScoreAttributes" + $ref: "#/components/schemas/TagRuleScoreAttributes" id: description: The unique identifier of the compliance score resource. example: "123-v1-1779315066097-1779401466097" type: string type: - $ref: "#/components/schemas/TagPolicyScoreResourceType" + $ref: "#/components/schemas/TagRuleScoreResourceType" required: - type - id - attributes type: object - TagPolicyScoreRelationship: - description: A relationship to the compliance score resource for this policy. + TagRuleScoreRelationship: + description: A relationship to the compliance score resource for this rule. properties: data: - $ref: "#/components/schemas/TagPolicyScoreRelationshipData" + $ref: "#/components/schemas/TagRuleScoreRelationshipData" required: - data type: object - TagPolicyScoreRelationshipData: + TagRuleScoreRelationshipData: description: Identifier of the related compliance score resource. properties: id: @@ -114046,29 +114036,29 @@ components: example: "123-v1-1779315066097-1779401466097" type: string type: - $ref: "#/components/schemas/TagPolicyScoreResourceType" + $ref: "#/components/schemas/TagRuleScoreResourceType" required: - type - id type: object - TagPolicyScoreResourceType: - description: JSON:API resource type for a tag policy compliance score. + TagRuleScoreResourceType: + description: JSON:API resource type for a tag rule compliance score. enum: - - tag_policy_score - example: "tag_policy_score" + - tag_rule_score + example: "tag_rule_score" type: string x-enum-varnames: - - TAG_POLICY_SCORE - TagPolicyScoreResponse: - description: A tag policy compliance score. + - TAG_RULE_SCORE + TagRuleScoreResponse: + description: A tag rule compliance score. properties: data: - $ref: "#/components/schemas/TagPolicyScoreData" + $ref: "#/components/schemas/TagRuleScoreData" required: - data type: object - TagPolicySource: - description: The telemetry source that a tag policy applies to. + TagRuleSource: + description: The telemetry source that a tag rule applies to. enum: - logs - spans @@ -114083,9 +114073,9 @@ components: - METRICS - RUM - FEED - TagPolicyType: + TagRuleType: description: |- - How the policy is enforced. `blocking` rejects telemetry that violates the policy. + How the rule is enforced. `blocking` rejects telemetry that violates the rule. `surfacing` only highlights non-compliant telemetry without blocking it. enum: - blocking @@ -114095,30 +114085,30 @@ components: x-enum-varnames: - BLOCKING - SURFACING - TagPolicyUpdateAttributes: + TagRuleUpdateAttributes: description: |- - Mutable attributes of a tag policy. Each field is optional; omitting a field leaves its - current value unchanged. The `source` of a policy cannot be changed. + 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. properties: enabled: - description: Whether the policy is currently enforced. + description: Whether the rule is currently enforced. type: boolean + name: + description: Human-readable name for the tag rule. + type: string negated: - description: When `true`, the policy matches tag values that do NOT match any of the supplied patterns. + description: When `true`, the rule matches tag values that do NOT match any of the supplied patterns. type: boolean - policy_name: - description: Human-readable name for the tag policy. - type: string - policy_type: - $ref: "#/components/schemas/TagPolicyType" required: description: When `true`, telemetry without this tag is treated as a violation. type: boolean + rule_type: + $ref: "#/components/schemas/TagRuleType" scope: - description: The scope the policy applies within. + description: The scope the rule applies within. type: string tag_key: - description: The tag key that the policy governs. + description: The tag key that the rule governs. type: string tag_value_patterns: description: One or more patterns that valid values for the tag key must match. @@ -114127,26 +114117,36 @@ components: type: string type: array type: object - TagPolicyUpdateData: - description: Data object for updating a tag policy. + TagRuleUpdateData: + description: Data object for updating a tag rule. properties: attributes: - $ref: "#/components/schemas/TagPolicyUpdateAttributes" + $ref: "#/components/schemas/TagRuleUpdateAttributes" id: - description: The unique identifier of the tag policy being updated. + description: The unique identifier of the tag rule being updated. example: "123" type: string type: - $ref: "#/components/schemas/TagPolicyResourceType" + $ref: "#/components/schemas/TagRuleResourceType" required: - type - id type: object - TagPolicyUpdateRequest: - description: Payload for updating an existing tag policy. Only the supplied fields are modified. + TagRuleUpdateRequest: + description: Payload for updating an existing tag rule. Only the supplied fields are modified. + properties: + data: + $ref: "#/components/schemas/TagRuleUpdateData" + required: + - data + type: object + TagRulesListResponse: + description: A page of tag rules. properties: data: - $ref: "#/components/schemas/TagPolicyUpdateData" + $ref: "#/components/schemas/TagRuleDataArray" + included: + $ref: "#/components/schemas/TagRuleIncludedResources" required: - data type: object @@ -150542,13 +150542,57 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/hamr: + /api/v2/governance/tag_rules: get: description: |- - Retrieve the High Availability Multi-Region (HAMR) organization connection details for the authenticated organization. - This endpoint returns information about the HAMR connection configuration, including the target organization, - datacenter, status, and whether this is the primary or secondary organization in the HAMR relationship. - operationId: GetHamrOrgConnection + Retrieve all tag rules for the organization. Optionally include disabled or deleted + rules, filter by telemetry source, and include each rule's current compliance score + via the `include=score` query parameter. + operationId: ListTagRules + parameters: + - description: Whether to include rules that are currently disabled. Defaults to `false`. + example: false + in: query + name: include_disabled + required: false + schema: + type: boolean + - description: Whether to include rules that have been soft-deleted. Defaults to `false`. + example: false + in: query + name: include_deleted + required: false + schema: + type: boolean + - description: Comma-separated list of related resources to include alongside each rule in the response. Currently the only supported value is `score`. + example: "score" + in: query + name: include + required: false + schema: + $ref: "#/components/schemas/TagRuleInclude" + - description: Restrict the result set to rules whose source matches the given value. + in: query + name: filter[source] + 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. + example: 1779315066097 + in: query + name: ts_start + required: false + schema: + format: int64 + type: integer + - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. + example: 1779401466097 + in: query + name: ts_end + required: false + schema: + format: int64 + type: integer responses: "200": content: @@ -150557,18 +150601,40 @@ paths: default: value: data: - attributes: - hamr_status: 4 - is_primary: true - modified_at: "2024-01-01T00:00:00+00:00" - modified_by: test@example.com - target_org_datacenter: us1 - target_org_name: Production Backup Org - target_org_uuid: 00000000-0000-0000-0000-000000000001 - id: 00000000-0000-0000-0000-000000000001 - type: hamr_org_connections + - attributes: + created_at: "2026-05-21T22:11:06.108696Z" + created_by: "test-user" + enabled: true + modified_at: "2026-05-21T22:11:06.108696Z" + modified_by: "test-user" + 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" + version: 1 + id: "123" + relationships: + score: + data: + id: "123-v1-1779315066097-1779401466097" + type: "tag_rule_score" + type: "tag_rule" + included: + - attributes: + score: 80 + ts_end: 1779401466097 + ts_start: 1779315066097 + version: 1 + id: "123-v1-1779315066097-1779401466097" + type: "tag_rule_score" schema: - $ref: "#/components/schemas/HamrOrgConnectionResponse" + $ref: "#/components/schemas/TagRulesListResponse" description: OK "400": content: @@ -150576,35 +150642,40 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Bad Request - "403": + "401": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "404": + description: Unauthorized + "403": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found + description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: Get HAMR organization connection + summary: List tag rules tags: - - High Availability MultiRegion + - Tag Rules + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_read x-unstable: |- - **Note**: This endpoint is in public beta and is subject to change. + **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: |- - Create or update the High Availability Multi-Region (HAMR) organization connection. - This endpoint allows you to configure the HAMR connection between the authenticated organization - and a target organization, including setting the connection status (ONBOARDING, PASSIVE, FAILOVER, ACTIVE, RECOVERY) - operationId: CreateHamrOrgConnection + Create a new tag rule for the organization. The caller's organization is derived from + the authenticated user; cross-organization creation is not supported. Fields such as + `rule_id`, `version`, and the timestamp/audit fields are assigned by the server. + operationId: CreateTagRule requestBody: content: application/json: @@ -150613,19 +150684,23 @@ paths: value: data: attributes: - hamr_status: 4 - is_primary: true - modified_by: admin@example.com - target_org_datacenter: us1 - target_org_name: Production Backup Org - target_org_uuid: 660f9511-f3ac-52e5-b827-557766551111 - id: 550e8400-e29b-41d4-a716-446655440000 - type: hamr_org_connections + 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" schema: - $ref: "#/components/schemas/HamrOrgConnectionRequest" + $ref: "#/components/schemas/TagRuleCreateRequest" required: true responses: - "200": + "201": content: application/json: examples: @@ -150633,51 +150708,167 @@ paths: value: data: attributes: - hamr_status: 4 - is_primary: true - modified_at: "2024-01-01T00:00:00+00:00" - modified_by: test@example.com - target_org_datacenter: us1 - target_org_name: Production Backup Org - target_org_uuid: 00000000-0000-0000-0000-000000000001 - id: 00000000-0000-0000-0000-000000000002 - type: hamr_org_connections + created_at: "2026-05-21T22:11:06.108696Z" + created_by: "test-user" + enabled: true + modified_at: "2026-05-21T22:11:06.108696Z" + modified_by: "test-user" + 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" + version: 1 + id: "123" + type: "tag_rule" schema: - $ref: "#/components/schemas/HamrOrgConnectionResponse" - description: OK + $ref: "#/components/schemas/TagRuleResponse" + description: Created "400": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized "403": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict "429": $ref: "#/components/responses/TooManyRequestsResponse" - "500": + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a tag rule + tags: + - Tag Rules + "x-permission": + operator: AND + permissions: + - telemetry_rules_create + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/tag_rules/{rule_id}: + delete: + 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. + operationId: DeleteTagRule + parameters: + - description: The unique identifier of the tag rule to delete. + example: "123" + in: path + name: rule_id + required: true + schema: + type: string + - description: Whether to permanently delete the rule instead of performing a soft delete. Defaults to `false`. + example: false + in: query + name: hard_delete + required: false + schema: + type: boolean + responses: + "204": + description: No Content + "400": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Internal Server Error + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: Create or update HAMR organization connection + summary: Delete a tag rule tags: - - High Availability MultiRegion + - Tag Rules + "x-permission": + operator: AND + permissions: + - telemetry_rules_create x-unstable: |- - **Note**: This endpoint is in public beta and is subject to change. + **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/identity_providers: get: - description: Get all identity providers available for the current organization. - operationId: ListIdentityProviders + description: |- + Retrieve a single tag rule by ID. Optionally include the rule's current compliance + score via the `include=score` query parameter. Rules belonging to other organizations + cannot be retrieved. + operationId: GetTagRule + parameters: + - description: The unique identifier of the tag rule. + example: "123" + in: path + name: rule_id + required: true + schema: + type: string + - description: Comma-separated list of related resources to include alongside the rule. Currently the only supported value is `score`. + example: "score" + in: query + name: include + required: false + schema: + $ref: "#/components/schemas/TagRuleInclude" + - description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. + example: 1779315066097 + in: query + name: ts_start + required: false + schema: + format: int64 + type: integer + - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. + example: 1779401466097 + in: query + name: ts_end + required: false + schema: + format: int64 + type: integer responses: "200": content: @@ -150686,51 +150877,95 @@ paths: default: value: data: + attributes: + created_at: "2026-05-21T22:11:06.108696Z" + created_by: "test-user" + enabled: true + modified_at: "2026-05-21T22:11:06.108696Z" + modified_by: "test-user" + 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" + version: 1 + id: "123" + relationships: + score: + data: + id: "123-v1-1779315066097-1779401466097" + type: "tag_rule_score" + type: "tag_rule" + included: - attributes: - authentication_method: "SAML" - enabled: true - id: "00000000-0000-0000-0000-000000000001" - type: identity_providers - - attributes: - authentication_method: google_oidc - enabled: false - id: "00000000-0000-0000-0000-000000000002" - type: identity_providers - - attributes: - authentication_method: standard - enabled: false - id: "00000000-0000-0000-0000-000000000003" - type: identity_providers + score: 80 + ts_end: 1779401466097 + ts_start: 1779315066097 + version: 1 + id: "123-v1-1779315066097-1779401466097" + type: "tag_rule_score" schema: - $ref: "#/components/schemas/IdentityProvidersResponse" + $ref: "#/components/schemas/TagRuleResponse" description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized "403": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Authentication error + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - org_management - summary: List identity providers + summary: Get a tag rule tags: - - Identity Providers + - Tag Rules "x-permission": operator: OR permissions: - - org_management - - user_access_manage - /api/v2/identity_providers/{idp_id}: + - telemetry_rules_read + - metrics_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: - description: Enable or disable an identity provider for the current organization. - operationId: UpdateIdentityProvider + description: |- + 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. + operationId: UpdateTagRule parameters: - - $ref: "#/components/parameters/IdentityProviderId" + - description: The unique identifier of the tag rule to update. + example: "123" + in: path + name: rule_id + required: true + schema: + type: string requestBody: content: application/json: @@ -150740,10 +150975,11 @@ paths: data: attributes: enabled: true - id: "00000000-0000-0000-0000-000000000001" - type: identity_providers + name: "Service tag must be one of api, web, or worker" + id: "123" + type: "tag_rule" schema: - $ref: "#/components/schemas/IdentityProviderUpdateRequest" + $ref: "#/components/schemas/TagRuleUpdateRequest" required: true responses: "200": @@ -150754,12 +150990,26 @@ paths: value: data: attributes: - authentication_method: "SAML" + created_at: "2026-05-21T22:11:06.108696Z" + created_by: "test-user" enabled: true - id: "00000000-0000-0000-0000-000000000001" - type: identity_providers + modified_at: "2026-05-21T22:25:01.000000Z" + modified_by: "test-user" + name: "Service tag must be one of api, web, or worker" + negated: false + required: true + rule_type: "surfacing" + scope: "env" + source: "logs" + tag_key: "service" + tag_value_patterns: + - "api" + - "web" + version: 2 + id: "123" + type: "tag_rule" schema: - $ref: "#/components/schemas/IdentityProviderResponse" + $ref: "#/components/schemas/TagRuleResponse" description: OK "400": content: @@ -150767,73 +151017,71 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized "403": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Authentication error + description: Forbidden "404": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not found + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - org_management - summary: Update an identity provider + summary: Update a tag rule tags: - - Identity Providers - x-codegen-request-body-name: body + - Tag Rules "x-permission": - operator: OR + operator: AND permissions: - - org_management - /api/v2/identity_providers/{idp_id}/users: + - telemetry_rules_create + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/tag_rules/{rule_id}/score: get: description: |- - Get all users in the organization whose login method has been overridden - to use the specified identity provider. - operationId: ListIdentityProviderUsers + Retrieve the compliance score for a single tag rule. The score is computed over the + requested time window (or a source-appropriate default) and represents the percentage of + telemetry within that window that conforms to the rule. A `null` score indicates that + no relevant telemetry was found. + operationId: GetTagRuleScore parameters: - - $ref: "#/components/parameters/IdentityProviderId" - - $ref: "#/components/parameters/PageSize" - - $ref: "#/components/parameters/PageNumber" - - description: User attribute to order results by. Options include `email` and `name`. - in: query - name: sort - required: false + - description: The unique identifier of the tag rule. + example: "123" + in: path + name: rule_id + required: true schema: - default: email - example: email type: string - - description: "Direction of sort. Options: `asc`, `desc`." - in: query - name: sort_dir - required: false - schema: - $ref: "#/components/schemas/QuerySortOrder" - - description: Filter users by the given string. Defaults to no filtering. + - description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. + example: 1779315066097 in: query - name: filter + name: ts_start required: false schema: - type: string - - description: |- - Filter on status attribute. - Comma-separated list, with possible values `Active`, `Pending`, and `Disabled`. - Defaults to no filtering. + format: int64 + type: integer + - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. + example: 1779401466097 in: query - name: filter[status] + name: ts_end required: false schema: - example: Active - type: string + format: int64 + type: integer responses: "200": content: @@ -150842,19 +151090,15 @@ paths: default: value: data: - - attributes: - email: example@datadoghq.com - handle: example-user - name: Example User - status: Active - id: "00000000-0000-9999-0000-000000000001" - type: users - meta: - page: - total_count: 1 - total_filtered_count: 1 + attributes: + score: 80 + ts_end: 1779401466097 + ts_start: 1779315066097 + version: 1 + id: "123-v1-1779315066097-1779401466097" + type: "tag_rule_score" schema: - $ref: "#/components/schemas/UsersResponse" + $ref: "#/components/schemas/TagRuleScoreResponse" description: OK "400": content: @@ -150862,37 +151106,391 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized "403": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Authentication error + description: Forbidden "404": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not found + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - org_management - summary: List users with an identity provider override + summary: Get a tag rule compliance score tags: - - Identity Providers - x-pagination: - limitParam: page[size] - pageParam: page[number] - resultsPath: data + - Tag Rules "x-permission": operator: OR permissions: - - org_management - /api/v2/idp/entity_integrations/{integration_id}: + - telemetry_rules_read + - metrics_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/hamr: + get: + description: |- + Retrieve the High Availability Multi-Region (HAMR) organization connection details for the authenticated organization. + This endpoint returns information about the HAMR connection configuration, including the target organization, + datacenter, status, and whether this is the primary or secondary organization in the HAMR relationship. + operationId: GetHamrOrgConnection + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + hamr_status: 4 + is_primary: true + modified_at: "2024-01-01T00:00:00+00:00" + modified_by: test@example.com + target_org_datacenter: us1 + target_org_name: Production Backup Org + target_org_uuid: 00000000-0000-0000-0000-000000000001 + id: 00000000-0000-0000-0000-000000000001 + type: hamr_org_connections + schema: + $ref: "#/components/schemas/HamrOrgConnectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get HAMR organization connection + tags: + - High Availability MultiRegion + x-unstable: |- + **Note**: This endpoint is in public beta and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: |- + Create or update the High Availability Multi-Region (HAMR) organization connection. + This endpoint allows you to configure the HAMR connection between the authenticated organization + and a target organization, including setting the connection status (ONBOARDING, PASSIVE, FAILOVER, ACTIVE, RECOVERY) + operationId: CreateHamrOrgConnection + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + hamr_status: 4 + is_primary: true + modified_by: admin@example.com + target_org_datacenter: us1 + target_org_name: Production Backup Org + target_org_uuid: 660f9511-f3ac-52e5-b827-557766551111 + id: 550e8400-e29b-41d4-a716-446655440000 + type: hamr_org_connections + schema: + $ref: "#/components/schemas/HamrOrgConnectionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + hamr_status: 4 + is_primary: true + modified_at: "2024-01-01T00:00:00+00:00" + modified_by: test@example.com + target_org_datacenter: us1 + target_org_name: Production Backup Org + target_org_uuid: 00000000-0000-0000-0000-000000000001 + id: 00000000-0000-0000-0000-000000000002 + type: hamr_org_connections + schema: + $ref: "#/components/schemas/HamrOrgConnectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create or update HAMR organization connection + tags: + - High Availability MultiRegion + x-unstable: |- + **Note**: This endpoint is in public beta and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/identity_providers: + get: + description: Get all identity providers available for the current organization. + operationId: ListIdentityProviders + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + authentication_method: "SAML" + enabled: true + id: "00000000-0000-0000-0000-000000000001" + type: identity_providers + - attributes: + authentication_method: google_oidc + enabled: false + id: "00000000-0000-0000-0000-000000000002" + type: identity_providers + - attributes: + authentication_method: standard + enabled: false + id: "00000000-0000-0000-0000-000000000003" + type: identity_providers + schema: + $ref: "#/components/schemas/IdentityProvidersResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Authentication error + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: List identity providers + tags: + - Identity Providers + "x-permission": + operator: OR + permissions: + - org_management + - user_access_manage + /api/v2/identity_providers/{idp_id}: + patch: + description: Enable or disable an identity provider for the current organization. + operationId: UpdateIdentityProvider + parameters: + - $ref: "#/components/parameters/IdentityProviderId" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: true + id: "00000000-0000-0000-0000-000000000001" + type: identity_providers + schema: + $ref: "#/components/schemas/IdentityProviderUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication_method: "SAML" + enabled: true + id: "00000000-0000-0000-0000-000000000001" + type: identity_providers + schema: + $ref: "#/components/schemas/IdentityProviderResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Authentication error + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Update an identity provider + tags: + - Identity Providers + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - org_management + /api/v2/identity_providers/{idp_id}/users: + get: + description: |- + Get all users in the organization whose login method has been overridden + to use the specified identity provider. + operationId: ListIdentityProviderUsers + parameters: + - $ref: "#/components/parameters/IdentityProviderId" + - $ref: "#/components/parameters/PageSize" + - $ref: "#/components/parameters/PageNumber" + - description: User attribute to order results by. Options include `email` and `name`. + in: query + name: sort + required: false + schema: + default: email + example: email + type: string + - description: "Direction of sort. Options: `asc`, `desc`." + in: query + name: sort_dir + required: false + schema: + $ref: "#/components/schemas/QuerySortOrder" + - description: Filter users by the given string. Defaults to no filtering. + in: query + name: filter + required: false + schema: + type: string + - description: |- + Filter on status attribute. + Comma-separated list, with possible values `Active`, `Pending`, and `Disabled`. + Defaults to no filtering. + in: query + name: filter[status] + required: false + schema: + example: Active + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + email: example@datadoghq.com + handle: example-user + name: Example User + status: Active + id: "00000000-0000-9999-0000-000000000001" + type: users + meta: + page: + total_count: 1 + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/UsersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Authentication error + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: List users with an identity provider override + tags: + - Identity Providers + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + "x-permission": + operator: OR + permissions: + - org_management + /api/v2/idp/entity_integrations/{integration_id}: delete: description: Delete the configuration stored for a given integration in the caller's organization. operationId: DeleteEntityIntegrationConfig @@ -212346,604 +212944,6 @@ paths: operator: OR permissions: - synthetics_global_variable_write - /api/v2/tag_policies: - get: - description: |- - Retrieve all tag policies for the organization. Optionally include disabled or deleted - policies, filter by telemetry source, and include each policy's current compliance score - via the `include=score` query parameter. - operationId: ListTagPolicies - parameters: - - description: Whether to include policies that are currently disabled. Defaults to `false`. - example: false - in: query - name: include_disabled - required: false - schema: - type: boolean - - description: Whether to include policies that have been soft-deleted. Defaults to `false`. - example: false - in: query - name: include_deleted - required: false - schema: - type: boolean - - description: Comma-separated list of related resources to include alongside each policy in the response. Currently the only supported value is `score`. - example: "score" - in: query - name: include - required: false - schema: - $ref: "#/components/schemas/TagPolicyInclude" - - description: Restrict the result set to policies whose source matches the given value. - in: query - name: filter[source] - required: false - schema: - $ref: "#/components/schemas/TagPolicySource" - - 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. - example: 1779315066097 - in: query - name: ts_start - required: false - schema: - format: int64 - type: integer - - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. - example: 1779401466097 - in: query - name: ts_end - required: false - schema: - format: int64 - type: integer - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - - attributes: - created_at: "2026-05-21T22:11:06.108696Z" - created_by: "test-user" - enabled: true - modified_at: "2026-05-21T22:11:06.108696Z" - modified_by: "test-user" - negated: false - policy_name: "Service tag must be one of api or web" - policy_type: "surfacing" - required: true - scope: "env" - source: "logs" - tag_key: "service" - tag_value_patterns: - - "api" - - "web" - version: 1 - id: "123" - relationships: - score: - data: - id: "123-v1-1779315066097-1779401466097" - 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_policy_score" - schema: - $ref: "#/components/schemas/TagPoliciesListResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: List tag policies - tags: - - Tag Policies - "x-permission": - operator: OR - permissions: - - telemetry_rules_read - - metrics_read - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - post: - description: |- - Create a new tag policy for the organization. The caller's organization is derived from - the authenticated user; cross-organization creation is not supported. Fields such as - `policy_id`, `version`, and the timestamp/audit fields are assigned by the server. - operationId: CreateTagPolicy - requestBody: - content: - application/json: - examples: - default: - value: - data: - attributes: - enabled: true - negated: false - policy_name: "Service tag must be one of api or web" - policy_type: "surfacing" - required: true - scope: "env" - source: "logs" - tag_key: "service" - tag_value_patterns: - - "api" - - "web" - type: "tag_policy" - schema: - $ref: "#/components/schemas/TagPolicyCreateRequest" - required: true - responses: - "201": - content: - application/json: - examples: - default: - value: - data: - attributes: - created_at: "2026-05-21T22:11:06.108696Z" - created_by: "test-user" - enabled: true - modified_at: "2026-05-21T22:11:06.108696Z" - modified_by: "test-user" - negated: false - policy_name: "Service tag must be one of api or web" - policy_type: "surfacing" - required: true - scope: "env" - source: "logs" - tag_key: "service" - tag_value_patterns: - - "api" - - "web" - version: 1 - id: "123" - type: "tag_policy" - schema: - $ref: "#/components/schemas/TagPolicyResponse" - description: Created - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "409": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Conflict - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Create a tag policy - tags: - - Tag Policies - "x-permission": - operator: AND - permissions: - - telemetry_rules_create - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/tag_policies/{policy_id}: - delete: - description: |- - Delete a tag policy. By default the policy is soft-deleted so it can be recovered later - and so that historical score data remains queryable. Pass `hard_delete=true` to remove - the policy permanently. - operationId: DeleteTagPolicy - parameters: - - description: The unique identifier of the tag policy to delete. - example: "123" - in: path - name: policy_id - required: true - schema: - type: string - - description: Whether to permanently delete the policy instead of performing a soft delete. Defaults to `false`. - example: false - in: query - name: hard_delete - required: false - schema: - type: boolean - responses: - "204": - description: No Content - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Delete a tag policy - tags: - - Tag Policies - "x-permission": - operator: AND - permissions: - - telemetry_rules_create - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - get: - description: |- - Retrieve a single tag policy by ID. Optionally include the policy's current compliance - score via the `include=score` query parameter. Policies belonging to other organizations - cannot be retrieved. - operationId: GetTagPolicy - parameters: - - description: The unique identifier of the tag policy. - example: "123" - in: path - name: policy_id - required: true - schema: - type: string - - description: Comma-separated list of related resources to include alongside the policy. Currently the only supported value is `score`. - example: "score" - in: query - name: include - required: false - schema: - $ref: "#/components/schemas/TagPolicyInclude" - - description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. - example: 1779315066097 - in: query - name: ts_start - required: false - schema: - format: int64 - type: integer - - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. - example: 1779401466097 - in: query - name: ts_end - required: false - schema: - format: int64 - type: integer - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - created_at: "2026-05-21T22:11:06.108696Z" - created_by: "test-user" - enabled: true - modified_at: "2026-05-21T22:11:06.108696Z" - modified_by: "test-user" - negated: false - policy_name: "Service tag must be one of api or web" - policy_type: "surfacing" - required: true - scope: "env" - source: "logs" - tag_key: "service" - tag_value_patterns: - - "api" - - "web" - version: 1 - id: "123" - relationships: - score: - data: - id: "123-v1-1779315066097-1779401466097" - 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_policy_score" - schema: - $ref: "#/components/schemas/TagPolicyResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Get a tag policy - tags: - - Tag Policies - "x-permission": - operator: OR - permissions: - - telemetry_rules_read - - metrics_read - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - patch: - description: |- - Update one or more attributes of an existing tag policy. Only the fields supplied in the - request body are modified; omitted fields retain their current values. The policy's - `source` cannot be changed after creation. - operationId: UpdateTagPolicy - parameters: - - description: The unique identifier of the tag policy to update. - example: "123" - in: path - name: policy_id - required: true - schema: - type: string - requestBody: - content: - application/json: - examples: - default: - value: - data: - attributes: - enabled: true - policy_name: "Service tag must be one of api, web, or worker" - id: "123" - type: "tag_policy" - schema: - $ref: "#/components/schemas/TagPolicyUpdateRequest" - required: true - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - created_at: "2026-05-21T22:11:06.108696Z" - created_by: "test-user" - enabled: true - modified_at: "2026-05-21T22:25:01.000000Z" - modified_by: "test-user" - negated: false - policy_name: "Service tag must be one of api, web, or worker" - policy_type: "surfacing" - required: true - scope: "env" - source: "logs" - tag_key: "service" - tag_value_patterns: - - "api" - - "web" - version: 2 - id: "123" - type: "tag_policy" - schema: - $ref: "#/components/schemas/TagPolicyResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Update a tag policy - tags: - - Tag Policies - "x-permission": - operator: AND - permissions: - - telemetry_rules_create - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/tag_policies/{policy_id}/score: - get: - description: |- - Retrieve the compliance score for a single tag policy. The score is computed over the - requested time window (or a source-appropriate default) and represents the percentage of - telemetry within that window that conforms to the policy. A `null` score indicates that - no relevant telemetry was found. - operationId: GetTagPolicyScore - parameters: - - description: The unique identifier of the tag policy. - example: "123" - in: path - name: policy_id - required: true - schema: - type: string - - description: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. - example: 1779315066097 - in: query - name: ts_start - required: false - schema: - format: int64 - type: integer - - description: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than `ts_start`. - example: 1779401466097 - in: query - name: ts_end - required: false - schema: - format: int64 - type: integer - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - score: 80 - ts_end: 1779401466097 - ts_start: 1779315066097 - version: 1 - id: "123-v1-1779315066097-1779401466097" - type: "tag_policy_score" - schema: - $ref: "#/components/schemas/TagPolicyScoreResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Get a tag policy compliance score - tags: - - Tag Policies - "x-permission": - operator: OR - permissions: - - telemetry_rules_read - - metrics_read - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/tags/enrichment: get: description: List all tag pipeline rulesets - Retrieve a list of all tag pipeline rulesets for the organization @@ -219429,12 +219429,12 @@ tags: For more information, see the [Synthetic Monitoring documentation](https://docs.datadoghq.com/synthetics/). name: Synthetics - description: |- - Tag Policies define rules that govern which tag values are accepted for a given tag key, - scoped to a particular telemetry source (such as logs, spans, or metrics). Policies can be - `blocking` (data not matching the policy is rejected) or `surfacing` (matching data is - highlighted but not blocked). Each policy reports a compliance `score` derived from how - much recent telemetry adheres to the policy. - name: Tag Policies + Tag Rules define rules that govern which tag values are accepted for a given tag key, + 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. + 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 - description: |- diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index b8f19dca90..c37950cf77 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -935,10 +935,10 @@ datadog\_api\_client.v2.api.synthetics\_api module :members: :show-inheritance: -datadog\_api\_client.v2.api.tag\_policies\_api module ------------------------------------------------------ +datadog\_api\_client.v2.api.tag\_rules\_api module +-------------------------------------------------- -.. automodule:: datadog_api_client.v2.api.tag_policies_api +.. automodule:: datadog_api_client.v2.api.tag_rules_api :members: :show-inheritance: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 988f9dd375..27ad2ec884 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -48696,157 +48696,157 @@ datadog\_api\_client.v2.model.tag\_indexing\_rules\_response\_meta module :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policies\_list\_response module ------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_attributes module +---------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policies_list_response +.. automodule:: datadog_api_client.v2.model.tag_rule_attributes :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_attributes module ------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_create\_attributes module +------------------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_attributes +.. automodule:: datadog_api_client.v2.model.tag_rule_create_attributes :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_create\_attributes module --------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_create\_data module +------------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_create_attributes +.. automodule:: datadog_api_client.v2.model.tag_rule_create_data :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_create\_data module --------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_create\_request module +--------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_create_data +.. automodule:: datadog_api_client.v2.model.tag_rule_create_request :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_create\_request module ------------------------------------------------------------------ +datadog\_api\_client.v2.model.tag\_rule\_create\_type module +------------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_create_request +.. automodule:: datadog_api_client.v2.model.tag_rule_create_type :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_create\_type module --------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_data module +---------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_create_type +.. automodule:: datadog_api_client.v2.model.tag_rule_data :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_data module ------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_include module +------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_data +.. automodule:: datadog_api_client.v2.model.tag_rule_include :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_include module ---------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_relationships module +------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_include +.. automodule:: datadog_api_client.v2.model.tag_rule_relationships :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_relationships module ---------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_resource\_type module +-------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_relationships +.. automodule:: datadog_api_client.v2.model.tag_rule_resource_type :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_resource\_type module ----------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_response module +-------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_resource_type +.. automodule:: datadog_api_client.v2.model.tag_rule_response :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_response module ----------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_score\_attributes module +----------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_response +.. automodule:: datadog_api_client.v2.model.tag_rule_score_attributes :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_attributes module -------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_score\_data module +----------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_score_attributes +.. automodule:: datadog_api_client.v2.model.tag_rule_score_data :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_data module -------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_score\_relationship module +------------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_score_data +.. automodule:: datadog_api_client.v2.model.tag_rule_score_relationship :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_relationship module ---------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_score\_relationship\_data module +------------------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_score_relationship +.. automodule:: datadog_api_client.v2.model.tag_rule_score_relationship_data :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_relationship\_data module ---------------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_score\_resource\_type module +--------------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_score_relationship_data +.. automodule:: datadog_api_client.v2.model.tag_rule_score_resource_type :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_resource\_type module ------------------------------------------------------------------------ +datadog\_api\_client.v2.model.tag\_rule\_score\_response module +--------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_score_resource_type +.. automodule:: datadog_api_client.v2.model.tag_rule_score_response :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_score\_response module ------------------------------------------------------------------ +datadog\_api\_client.v2.model.tag\_rule\_source module +------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_score_response +.. automodule:: datadog_api_client.v2.model.tag_rule_source :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_source module --------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_type module +---------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_source +.. automodule:: datadog_api_client.v2.model.tag_rule_type :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_type module ------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_update\_attributes module +------------------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_type +.. automodule:: datadog_api_client.v2.model.tag_rule_update_attributes :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_update\_attributes module --------------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_update\_data module +------------------------------------------------------------ -.. automodule:: datadog_api_client.v2.model.tag_policy_update_attributes +.. automodule:: datadog_api_client.v2.model.tag_rule_update_data :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_update\_data module --------------------------------------------------------------- +datadog\_api\_client.v2.model.tag\_rule\_update\_request module +--------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_update_data +.. automodule:: datadog_api_client.v2.model.tag_rule_update_request :members: :show-inheritance: -datadog\_api\_client.v2.model.tag\_policy\_update\_request module ------------------------------------------------------------------ +datadog\_api\_client.v2.model.tag\_rules\_list\_response module +--------------------------------------------------------------- -.. automodule:: datadog_api_client.v2.model.tag_policy_update_request +.. automodule:: datadog_api_client.v2.model.tag_rules_list_response :members: :show-inheritance: diff --git a/examples/v2/tag-policies/CreateTagPolicy.py b/examples/v2/tag-policies/CreateTagPolicy.py deleted file mode 100644 index b50dcb3704..0000000000 --- a/examples/v2/tag-policies/CreateTagPolicy.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Create a tag policy returns "Created" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi -from datadog_api_client.v2.model.tag_policy_create_attributes import TagPolicyCreateAttributes -from datadog_api_client.v2.model.tag_policy_create_data import TagPolicyCreateData -from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest -from datadog_api_client.v2.model.tag_policy_create_type import TagPolicyCreateType -from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType -from datadog_api_client.v2.model.tag_policy_source import TagPolicySource - -body = TagPolicyCreateRequest( - data=TagPolicyCreateData( - attributes=TagPolicyCreateAttributes( - enabled=True, - negated=False, - policy_name="Service tag must be one of api or web", - policy_type=TagPolicyCreateType.SURFACING, - required=True, - scope="env", - source=TagPolicySource.LOGS, - tag_key="service", - tag_value_patterns=[ - "api", - "web", - ], - ), - type=TagPolicyResourceType.TAG_POLICY, - ), -) - -configuration = Configuration() -configuration.unstable_operations["create_tag_policy"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - response = api_instance.create_tag_policy(body=body) - - print(response) diff --git a/examples/v2/tag-policies/DeleteTagPolicy.py b/examples/v2/tag-policies/DeleteTagPolicy.py deleted file mode 100644 index c6b7e1e043..0000000000 --- a/examples/v2/tag-policies/DeleteTagPolicy.py +++ /dev/null @@ -1,14 +0,0 @@ -""" -Delete a tag policy returns "No Content" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi - -configuration = Configuration() -configuration.unstable_operations["delete_tag_policy"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - api_instance.delete_tag_policy( - policy_id="policy_id", - ) diff --git a/examples/v2/tag-policies/GetTagPolicy.py b/examples/v2/tag-policies/GetTagPolicy.py deleted file mode 100644 index ee938812ec..0000000000 --- a/examples/v2/tag-policies/GetTagPolicy.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -Get a tag policy returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi - -configuration = Configuration() -configuration.unstable_operations["get_tag_policy"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - response = api_instance.get_tag_policy( - policy_id="policy_id", - ) - - print(response) diff --git a/examples/v2/tag-policies/GetTagPolicyScore.py b/examples/v2/tag-policies/GetTagPolicyScore.py deleted file mode 100644 index de9e925751..0000000000 --- a/examples/v2/tag-policies/GetTagPolicyScore.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -Get a tag policy compliance score returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi - -configuration = Configuration() -configuration.unstable_operations["get_tag_policy_score"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - response = api_instance.get_tag_policy_score( - policy_id="policy_id", - ) - - print(response) diff --git a/examples/v2/tag-policies/ListTagPolicies.py b/examples/v2/tag-policies/ListTagPolicies.py deleted file mode 100644 index 822c24d305..0000000000 --- a/examples/v2/tag-policies/ListTagPolicies.py +++ /dev/null @@ -1,14 +0,0 @@ -""" -List tag policies returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi - -configuration = Configuration() -configuration.unstable_operations["list_tag_policies"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - response = api_instance.list_tag_policies() - - print(response) diff --git a/examples/v2/tag-policies/UpdateTagPolicy.py b/examples/v2/tag-policies/UpdateTagPolicy.py deleted file mode 100644 index 3730a5bf05..0000000000 --- a/examples/v2/tag-policies/UpdateTagPolicy.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Update a tag policy returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi -from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType -from datadog_api_client.v2.model.tag_policy_type import TagPolicyType -from datadog_api_client.v2.model.tag_policy_update_attributes import TagPolicyUpdateAttributes -from datadog_api_client.v2.model.tag_policy_update_data import TagPolicyUpdateData -from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest - -body = TagPolicyUpdateRequest( - data=TagPolicyUpdateData( - attributes=TagPolicyUpdateAttributes( - policy_type=TagPolicyType.SURFACING, - tag_value_patterns=[], - ), - id="123", - type=TagPolicyResourceType.TAG_POLICY, - ), -) - -configuration = Configuration() -configuration.unstable_operations["update_tag_policy"] = True -with ApiClient(configuration) as api_client: - api_instance = TagPoliciesApi(api_client) - response = api_instance.update_tag_policy(policy_id="policy_id", body=body) - - print(response) diff --git a/examples/v2/tag-rules/CreateTagRule.py b/examples/v2/tag-rules/CreateTagRule.py new file mode 100644 index 0000000000..7d3d915004 --- /dev/null +++ b/examples/v2/tag-rules/CreateTagRule.py @@ -0,0 +1,40 @@ +""" +Create a tag rule returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi +from datadog_api_client.v2.model.tag_rule_create_attributes import TagRuleCreateAttributes +from datadog_api_client.v2.model.tag_rule_create_data import TagRuleCreateData +from datadog_api_client.v2.model.tag_rule_create_request import TagRuleCreateRequest +from datadog_api_client.v2.model.tag_rule_create_type import TagRuleCreateType +from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType +from datadog_api_client.v2.model.tag_rule_source import TagRuleSource + +body = TagRuleCreateRequest( + data=TagRuleCreateData( + attributes=TagRuleCreateAttributes( + enabled=True, + name="Service tag must be one of api or web", + negated=False, + required=True, + rule_type=TagRuleCreateType.SURFACING, + scope="env", + source=TagRuleSource.LOGS, + tag_key="service", + tag_value_patterns=[ + "api", + "web", + ], + ), + type=TagRuleResourceType.TAG_RULE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_tag_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + response = api_instance.create_tag_rule(body=body) + + print(response) diff --git a/examples/v2/tag-rules/DeleteTagRule.py b/examples/v2/tag-rules/DeleteTagRule.py new file mode 100644 index 0000000000..23caf193dd --- /dev/null +++ b/examples/v2/tag-rules/DeleteTagRule.py @@ -0,0 +1,14 @@ +""" +Delete a tag rule returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi + +configuration = Configuration() +configuration.unstable_operations["delete_tag_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + api_instance.delete_tag_rule( + rule_id="rule_id", + ) diff --git a/examples/v2/tag-rules/GetTagRule.py b/examples/v2/tag-rules/GetTagRule.py new file mode 100644 index 0000000000..57d0c29563 --- /dev/null +++ b/examples/v2/tag-rules/GetTagRule.py @@ -0,0 +1,16 @@ +""" +Get a tag rule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi + +configuration = Configuration() +configuration.unstable_operations["get_tag_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + response = api_instance.get_tag_rule( + rule_id="rule_id", + ) + + print(response) diff --git a/examples/v2/tag-rules/GetTagRuleScore.py b/examples/v2/tag-rules/GetTagRuleScore.py new file mode 100644 index 0000000000..f898891ad1 --- /dev/null +++ b/examples/v2/tag-rules/GetTagRuleScore.py @@ -0,0 +1,16 @@ +""" +Get a tag rule compliance score returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi + +configuration = Configuration() +configuration.unstable_operations["get_tag_rule_score"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + response = api_instance.get_tag_rule_score( + rule_id="rule_id", + ) + + print(response) diff --git a/examples/v2/tag-rules/ListTagRules.py b/examples/v2/tag-rules/ListTagRules.py new file mode 100644 index 0000000000..f8e58fd73d --- /dev/null +++ b/examples/v2/tag-rules/ListTagRules.py @@ -0,0 +1,14 @@ +""" +List tag rules returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi + +configuration = Configuration() +configuration.unstable_operations["list_tag_rules"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + response = api_instance.list_tag_rules() + + print(response) diff --git a/examples/v2/tag-rules/UpdateTagRule.py b/examples/v2/tag-rules/UpdateTagRule.py new file mode 100644 index 0000000000..5657ae6706 --- /dev/null +++ b/examples/v2/tag-rules/UpdateTagRule.py @@ -0,0 +1,30 @@ +""" +Update a tag rule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi +from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType +from datadog_api_client.v2.model.tag_rule_type import TagRuleType +from datadog_api_client.v2.model.tag_rule_update_attributes import TagRuleUpdateAttributes +from datadog_api_client.v2.model.tag_rule_update_data import TagRuleUpdateData +from datadog_api_client.v2.model.tag_rule_update_request import TagRuleUpdateRequest + +body = TagRuleUpdateRequest( + data=TagRuleUpdateData( + attributes=TagRuleUpdateAttributes( + rule_type=TagRuleType.SURFACING, + tag_value_patterns=[], + ), + id="123", + type=TagRuleResourceType.TAG_RULE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_tag_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = TagRulesApi(api_client) + response = api_instance.update_tag_rule(rule_id="rule_id", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 0c8c9f5fc5..1a88c184cc 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -527,6 +527,12 @@ def __init__( "v2.update_governance_control_notification_settings": False, "v2.update_governance_detection": False, "v2.update_governance_notification_settings": False, + "v2.create_tag_rule": False, + "v2.delete_tag_rule": False, + "v2.get_tag_rule": False, + "v2.get_tag_rule_score": False, + "v2.list_tag_rules": False, + "v2.update_tag_rule": False, "v2.create_hamr_org_connection": False, "v2.get_hamr_org_connection": False, "v2.delete_entity_integration_config": False, @@ -808,12 +814,6 @@ def __init__( "v2.revert_custom_rule_revision": False, "v2.update_ai_custom_ruleset": False, "v2.update_custom_ruleset": False, - "v2.create_tag_policy": False, - "v2.delete_tag_policy": False, - "v2.get_tag_policy": False, - "v2.get_tag_policy_score": False, - "v2.list_tag_policies": False, - "v2.update_tag_policy": False, "v2.add_member_team": False, "v2.list_member_teams": False, "v2.remove_member_team": False, diff --git a/src/datadog_api_client/v2/api/tag_policies_api.py b/src/datadog_api_client/v2/api/tag_rules_api.py similarity index 58% rename from src/datadog_api_client/v2/api/tag_policies_api.py rename to src/datadog_api_client/v2/api/tag_rules_api.py index 8dfd7eae90..1418abbb0f 100644 --- a/src/datadog_api_client/v2/api/tag_policies_api.py +++ b/src/datadog_api_client/v2/api/tag_rules_api.py @@ -11,22 +11,22 @@ UnsetType, unset, ) -from datadog_api_client.v2.model.tag_policies_list_response import TagPoliciesListResponse -from datadog_api_client.v2.model.tag_policy_include import TagPolicyInclude -from datadog_api_client.v2.model.tag_policy_source import TagPolicySource -from datadog_api_client.v2.model.tag_policy_response import TagPolicyResponse -from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest -from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest -from datadog_api_client.v2.model.tag_policy_score_response import TagPolicyScoreResponse +from datadog_api_client.v2.model.tag_rules_list_response import TagRulesListResponse +from datadog_api_client.v2.model.tag_rule_include import TagRuleInclude +from datadog_api_client.v2.model.tag_rule_source import TagRuleSource +from datadog_api_client.v2.model.tag_rule_response import TagRuleResponse +from datadog_api_client.v2.model.tag_rule_create_request import TagRuleCreateRequest +from datadog_api_client.v2.model.tag_rule_update_request import TagRuleUpdateRequest +from datadog_api_client.v2.model.tag_rule_score_response import TagRuleScoreResponse -class TagPoliciesApi: +class TagRulesApi: """ - Tag Policies define rules that govern which tag values are accepted for a given tag key, - scoped to a particular telemetry source (such as logs, spans, or metrics). Policies can be - ``blocking`` (data not matching the policy is rejected) or ``surfacing`` (matching data is - highlighted but not blocked). Each policy reports a compliance ``score`` derived from how - much recent telemetry adheres to the policy. + Tag Rules define rules that govern which tag values are accepted for a given tag key, + 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. """ def __init__(self, api_client=None): @@ -34,19 +34,19 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client - self._create_tag_policy_endpoint = _Endpoint( + self._create_tag_rule_endpoint = _Endpoint( settings={ - "response_type": (TagPolicyResponse,), + "response_type": (TagRuleResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies", - "operation_id": "create_tag_policy", + "endpoint_path": "/api/v2/governance/tag_rules", + "operation_id": "create_tag_rule", "http_method": "POST", "version": "v2", }, params_map={ "body": { "required": True, - "openapi_types": (TagPolicyCreateRequest,), + "openapi_types": (TagRuleCreateRequest,), "location": "body", }, }, @@ -54,20 +54,20 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._delete_tag_policy_endpoint = _Endpoint( + self._delete_tag_rule_endpoint = _Endpoint( settings={ "response_type": None, "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies/{policy_id}", - "operation_id": "delete_tag_policy", + "endpoint_path": "/api/v2/governance/tag_rules/{rule_id}", + "operation_id": "delete_tag_rule", "http_method": "DELETE", "version": "v2", }, params_map={ - "policy_id": { + "rule_id": { "required": True, "openapi_types": (str,), - "attribute": "policy_id", + "attribute": "rule_id", "location": "path", }, "hard_delete": { @@ -82,24 +82,24 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._get_tag_policy_endpoint = _Endpoint( + self._get_tag_rule_endpoint = _Endpoint( settings={ - "response_type": (TagPolicyResponse,), + "response_type": (TagRuleResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies/{policy_id}", - "operation_id": "get_tag_policy", + "endpoint_path": "/api/v2/governance/tag_rules/{rule_id}", + "operation_id": "get_tag_rule", "http_method": "GET", "version": "v2", }, params_map={ - "policy_id": { + "rule_id": { "required": True, "openapi_types": (str,), - "attribute": "policy_id", + "attribute": "rule_id", "location": "path", }, "include": { - "openapi_types": (TagPolicyInclude,), + "openapi_types": (TagRuleInclude,), "attribute": "include", "location": "query", }, @@ -120,20 +120,20 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._get_tag_policy_score_endpoint = _Endpoint( + self._get_tag_rule_score_endpoint = _Endpoint( settings={ - "response_type": (TagPolicyScoreResponse,), + "response_type": (TagRuleScoreResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies/{policy_id}/score", - "operation_id": "get_tag_policy_score", + "endpoint_path": "/api/v2/governance/tag_rules/{rule_id}/score", + "operation_id": "get_tag_rule_score", "http_method": "GET", "version": "v2", }, params_map={ - "policy_id": { + "rule_id": { "required": True, "openapi_types": (str,), - "attribute": "policy_id", + "attribute": "rule_id", "location": "path", }, "ts_start": { @@ -153,12 +153,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._list_tag_policies_endpoint = _Endpoint( + self._list_tag_rules_endpoint = _Endpoint( settings={ - "response_type": (TagPoliciesListResponse,), + "response_type": (TagRulesListResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies", - "operation_id": "list_tag_policies", + "endpoint_path": "/api/v2/governance/tag_rules", + "operation_id": "list_tag_rules", "http_method": "GET", "version": "v2", }, @@ -174,12 +174,12 @@ def __init__(self, api_client=None): "location": "query", }, "include": { - "openapi_types": (TagPolicyInclude,), + "openapi_types": (TagRuleInclude,), "attribute": "include", "location": "query", }, "filter_source": { - "openapi_types": (TagPolicySource,), + "openapi_types": (TagRuleSource,), "attribute": "filter[source]", "location": "query", }, @@ -200,25 +200,25 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._update_tag_policy_endpoint = _Endpoint( + self._update_tag_rule_endpoint = _Endpoint( settings={ - "response_type": (TagPolicyResponse,), + "response_type": (TagRuleResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/tag_policies/{policy_id}", - "operation_id": "update_tag_policy", + "endpoint_path": "/api/v2/governance/tag_rules/{rule_id}", + "operation_id": "update_tag_rule", "http_method": "PATCH", "version": "v2", }, params_map={ - "policy_id": { + "rule_id": { "required": True, "openapi_types": (str,), - "attribute": "policy_id", + "attribute": "rule_id", "location": "path", }, "body": { "required": True, - "openapi_types": (TagPolicyUpdateRequest,), + "openapi_types": (TagRuleUpdateRequest,), "location": "body", }, }, @@ -226,76 +226,76 @@ def __init__(self, api_client=None): api_client=api_client, ) - def create_tag_policy( + def create_tag_rule( self, - body: TagPolicyCreateRequest, - ) -> TagPolicyResponse: - """Create a tag policy. + body: TagRuleCreateRequest, + ) -> TagRuleResponse: + """Create a tag rule. - Create a new tag policy for the organization. The caller's organization is derived from + Create a new tag rule for the organization. The caller's organization is derived from the authenticated user; cross-organization creation is not supported. Fields such as - ``policy_id`` , ``version`` , and the timestamp/audit fields are assigned by the server. + ``rule_id`` , ``version`` , and the timestamp/audit fields are assigned by the server. - :type body: TagPolicyCreateRequest - :rtype: TagPolicyResponse + :type body: TagRuleCreateRequest + :rtype: TagRuleResponse """ kwargs: Dict[str, Any] = {} kwargs["body"] = body - return self._create_tag_policy_endpoint.call_with_http_info(**kwargs) + return self._create_tag_rule_endpoint.call_with_http_info(**kwargs) - def delete_tag_policy( + def delete_tag_rule( self, - policy_id: str, + rule_id: str, *, hard_delete: Union[bool, UnsetType] = unset, ) -> None: - """Delete a tag policy. + """Delete a tag rule. - Delete a tag policy. By default the policy is soft-deleted so it can be recovered later + 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 policy permanently. + the rule permanently. - :param policy_id: The unique identifier of the tag policy to delete. - :type policy_id: str - :param hard_delete: Whether to permanently delete the policy instead of performing a soft delete. Defaults to ``false``. + :param rule_id: The unique identifier of the tag rule to delete. + :type rule_id: str + :param hard_delete: Whether to permanently delete the rule instead of performing a soft delete. Defaults to ``false``. :type hard_delete: bool, optional :rtype: None """ kwargs: Dict[str, Any] = {} - kwargs["policy_id"] = policy_id + kwargs["rule_id"] = rule_id if hard_delete is not unset: kwargs["hard_delete"] = hard_delete - return self._delete_tag_policy_endpoint.call_with_http_info(**kwargs) + return self._delete_tag_rule_endpoint.call_with_http_info(**kwargs) - def get_tag_policy( + def get_tag_rule( self, - policy_id: str, + rule_id: str, *, - include: Union[TagPolicyInclude, UnsetType] = unset, + include: Union[TagRuleInclude, UnsetType] = unset, ts_start: Union[int, UnsetType] = unset, ts_end: Union[int, UnsetType] = unset, - ) -> TagPolicyResponse: - """Get a tag policy. + ) -> TagRuleResponse: + """Get a tag rule. - Retrieve a single tag policy by ID. Optionally include the policy's current compliance - score via the ``include=score`` query parameter. Policies belonging to other organizations + Retrieve a single tag rule by ID. Optionally include the rule's current compliance + score via the ``include=score`` query parameter. Rules belonging to other organizations cannot be retrieved. - :param policy_id: The unique identifier of the tag policy. - :type policy_id: str - :param include: Comma-separated list of related resources to include alongside the policy. Currently the only supported value is ``score``. - :type include: TagPolicyInclude, optional + :param rule_id: The unique identifier of the 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. :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 - :rtype: TagPolicyResponse + :rtype: TagRuleResponse """ kwargs: Dict[str, Any] = {} - kwargs["policy_id"] = policy_id + kwargs["rule_id"] = rule_id if include is not unset: kwargs["include"] = include @@ -306,32 +306,32 @@ def get_tag_policy( if ts_end is not unset: kwargs["ts_end"] = ts_end - return self._get_tag_policy_endpoint.call_with_http_info(**kwargs) + return self._get_tag_rule_endpoint.call_with_http_info(**kwargs) - def get_tag_policy_score( + def get_tag_rule_score( self, - policy_id: str, + rule_id: str, *, ts_start: Union[int, UnsetType] = unset, ts_end: Union[int, UnsetType] = unset, - ) -> TagPolicyScoreResponse: - """Get a tag policy compliance score. + ) -> TagRuleScoreResponse: + """Get a tag rule compliance score. - Retrieve the compliance score for a single tag policy. The score is computed over the + Retrieve the compliance score for a single tag rule. The score is computed over the requested time window (or a source-appropriate default) and represents the percentage of - telemetry within that window that conforms to the policy. A ``null`` score indicates that + telemetry within that window that conforms to the rule. A ``null`` score indicates that no relevant telemetry was found. - :param policy_id: The unique identifier of the tag policy. - :type policy_id: str + :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. :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 - :rtype: TagPolicyScoreResponse + :rtype: TagRuleScoreResponse """ kwargs: Dict[str, Any] = {} - kwargs["policy_id"] = policy_id + kwargs["rule_id"] = rule_id if ts_start is not unset: kwargs["ts_start"] = ts_start @@ -339,37 +339,37 @@ def get_tag_policy_score( if ts_end is not unset: kwargs["ts_end"] = ts_end - return self._get_tag_policy_score_endpoint.call_with_http_info(**kwargs) + return self._get_tag_rule_score_endpoint.call_with_http_info(**kwargs) - def list_tag_policies( + def list_tag_rules( self, *, include_disabled: Union[bool, UnsetType] = unset, include_deleted: Union[bool, UnsetType] = unset, - include: Union[TagPolicyInclude, UnsetType] = unset, - filter_source: Union[TagPolicySource, UnsetType] = unset, + include: Union[TagRuleInclude, UnsetType] = unset, + filter_source: Union[TagRuleSource, UnsetType] = unset, ts_start: Union[int, UnsetType] = unset, ts_end: Union[int, UnsetType] = unset, - ) -> TagPoliciesListResponse: - """List tag policies. + ) -> TagRulesListResponse: + """List tag rules. - Retrieve all tag policies for the organization. Optionally include disabled or deleted - policies, filter by telemetry source, and include each policy's current compliance score + Retrieve all tag rules for the organization. Optionally include disabled or deleted + rules, filter by telemetry source, and include each rule's current compliance score via the ``include=score`` query parameter. - :param include_disabled: Whether to include policies that are currently disabled. Defaults to ``false``. + :param include_disabled: Whether to include rules that are currently disabled. Defaults to ``false``. :type include_disabled: bool, optional - :param include_deleted: Whether to include policies that have been soft-deleted. Defaults to ``false``. + :param include_deleted: Whether to include rules that have been soft-deleted. Defaults to ``false``. :type include_deleted: bool, optional - :param include: Comma-separated list of related resources to include alongside each policy in the response. Currently the only supported value is ``score``. - :type include: TagPolicyInclude, optional - :param filter_source: Restrict the result set to policies whose source matches the given value. - :type filter_source: TagPolicySource, optional + :param include: Comma-separated list of related resources to include alongside each rule in the response. Currently the only supported value is ``score``. + :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. :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 - :rtype: TagPoliciesListResponse + :rtype: TagRulesListResponse """ kwargs: Dict[str, Any] = {} if include_disabled is not unset: @@ -390,27 +390,27 @@ def list_tag_policies( if ts_end is not unset: kwargs["ts_end"] = ts_end - return self._list_tag_policies_endpoint.call_with_http_info(**kwargs) + return self._list_tag_rules_endpoint.call_with_http_info(**kwargs) - def update_tag_policy( + def update_tag_rule( self, - policy_id: str, - body: TagPolicyUpdateRequest, - ) -> TagPolicyResponse: - """Update a tag policy. + rule_id: str, + body: TagRuleUpdateRequest, + ) -> TagRuleResponse: + """Update a tag rule. - Update one or more attributes of an existing tag policy. Only the fields supplied in the - request body are modified; omitted fields retain their current values. The policy's + 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. - :param policy_id: The unique identifier of the tag policy to update. - :type policy_id: str - :type body: TagPolicyUpdateRequest - :rtype: TagPolicyResponse + :param rule_id: The unique identifier of the tag rule to update. + :type rule_id: str + :type body: TagRuleUpdateRequest + :rtype: TagRuleResponse """ kwargs: Dict[str, Any] = {} - kwargs["policy_id"] = policy_id + kwargs["rule_id"] = rule_id kwargs["body"] = body - return self._update_tag_policy_endpoint.call_with_http_info(**kwargs) + return self._update_tag_rule_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 885008ec74..23c3aba159 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -131,7 +131,7 @@ from datadog_api_client.v2.api.stegadography_api import StegadographyApi from datadog_api_client.v2.api.storage_management_api import StorageManagementApi from datadog_api_client.v2.api.synthetics_api import SyntheticsApi -from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi +from datadog_api_client.v2.api.tag_rules_api import TagRulesApi from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi @@ -277,7 +277,7 @@ "StegadographyApi", "StorageManagementApi", "SyntheticsApi", - "TagPoliciesApi", + "TagRulesApi", "TeamsApi", "TestOptimizationApi", "UsageMeteringApi", diff --git a/src/datadog_api_client/v2/model/tag_policies_list_response.py b/src/datadog_api_client/v2/model/tag_policies_list_response.py deleted file mode 100644 index 6973a9f365..0000000000 --- a/src/datadog_api_client/v2/model/tag_policies_list_response.py +++ /dev/null @@ -1,53 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import List, Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_data import TagPolicyData - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData - - -class TagPoliciesListResponse(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_data import TagPolicyData - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData - - return { - "data": ([TagPolicyData],), - "included": ([TagPolicyScoreData],), - } - - attribute_map = { - "data": "data", - "included": "included", - } - - def __init__( - self_, data: List[TagPolicyData], included: Union[List[TagPolicyScoreData], UnsetType] = unset, **kwargs - ): - """ - A page of tag policies. - - :param data: An array of tag policy data objects. - :type data: [TagPolicyData] - - :param included: Related resources fetched alongside the primary tag policies. Populated when an ``include`` query parameter is supplied. - :type included: [TagPolicyScoreData], optional - """ - if included is not unset: - kwargs["included"] = included - super().__init__(kwargs) - - self_.data = data diff --git a/src/datadog_api_client/v2/model/tag_policy_create_data.py b/src/datadog_api_client/v2/model/tag_policy_create_data.py deleted file mode 100644 index c99b2f280f..0000000000 --- a/src/datadog_api_client/v2/model/tag_policy_create_data.py +++ /dev/null @@ -1,48 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_create_attributes import TagPolicyCreateAttributes - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - -class TagPolicyCreateData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_create_attributes import TagPolicyCreateAttributes - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - return { - "attributes": (TagPolicyCreateAttributes,), - "type": (TagPolicyResourceType,), - } - - attribute_map = { - "attributes": "attributes", - "type": "type", - } - - def __init__(self_, attributes: TagPolicyCreateAttributes, type: TagPolicyResourceType, **kwargs): - """ - Data object for creating a tag policy. - - :param attributes: Attributes that can be supplied when creating a tag policy. - :type attributes: TagPolicyCreateAttributes - - :param type: JSON:API resource type for a tag policy. - :type type: TagPolicyResourceType - """ - super().__init__(kwargs) - - self_.attributes = attributes - self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_data.py b/src/datadog_api_client/v2/model/tag_policy_data.py deleted file mode 100644 index 1546583602..0000000000 --- a/src/datadog_api_client/v2/model/tag_policy_data.py +++ /dev/null @@ -1,72 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_attributes import TagPolicyAttributes - from datadog_api_client.v2.model.tag_policy_relationships import TagPolicyRelationships - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - -class TagPolicyData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_attributes import TagPolicyAttributes - from datadog_api_client.v2.model.tag_policy_relationships import TagPolicyRelationships - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - return { - "attributes": (TagPolicyAttributes,), - "id": (str,), - "relationships": (TagPolicyRelationships,), - "type": (TagPolicyResourceType,), - } - - attribute_map = { - "attributes": "attributes", - "id": "id", - "relationships": "relationships", - "type": "type", - } - - def __init__( - self_, - attributes: TagPolicyAttributes, - id: str, - type: TagPolicyResourceType, - relationships: Union[TagPolicyRelationships, UnsetType] = unset, - **kwargs, - ): - """ - A tag policy resource. - - :param attributes: The attributes of a tag policy resource. - :type attributes: TagPolicyAttributes - - :param id: The unique identifier of the tag policy. - :type id: str - - :param relationships: Related resources for a tag policy. Only present when the corresponding ``include`` query parameter is supplied. - :type relationships: TagPolicyRelationships, optional - - :param type: JSON:API resource type for a tag policy. - :type type: TagPolicyResourceType - """ - if relationships is not unset: - kwargs["relationships"] = relationships - super().__init__(kwargs) - - self_.attributes = attributes - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_score_data.py b/src/datadog_api_client/v2/model/tag_policy_score_data.py deleted file mode 100644 index c00fe9bb99..0000000000 --- a/src/datadog_api_client/v2/model/tag_policy_score_data.py +++ /dev/null @@ -1,54 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_score_attributes import TagPolicyScoreAttributes - from datadog_api_client.v2.model.tag_policy_score_resource_type import TagPolicyScoreResourceType - - -class TagPolicyScoreData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_score_attributes import TagPolicyScoreAttributes - from datadog_api_client.v2.model.tag_policy_score_resource_type import TagPolicyScoreResourceType - - return { - "attributes": (TagPolicyScoreAttributes,), - "id": (str,), - "type": (TagPolicyScoreResourceType,), - } - - attribute_map = { - "attributes": "attributes", - "id": "id", - "type": "type", - } - - def __init__(self_, attributes: TagPolicyScoreAttributes, id: str, type: TagPolicyScoreResourceType, **kwargs): - """ - A compliance score resource for a tag policy. - - :param attributes: Attributes of a tag policy compliance score. - :type attributes: TagPolicyScoreAttributes - - :param id: The unique identifier of the compliance score resource. - :type id: str - - :param type: JSON:API resource type for a tag policy compliance score. - :type type: TagPolicyScoreResourceType - """ - super().__init__(kwargs) - - self_.attributes = attributes - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_update_data.py b/src/datadog_api_client/v2/model/tag_policy_update_data.py deleted file mode 100644 index 3a91003167..0000000000 --- a/src/datadog_api_client/v2/model/tag_policy_update_data.py +++ /dev/null @@ -1,64 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_update_attributes import TagPolicyUpdateAttributes - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - -class TagPolicyUpdateData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_update_attributes import TagPolicyUpdateAttributes - from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType - - return { - "attributes": (TagPolicyUpdateAttributes,), - "id": (str,), - "type": (TagPolicyResourceType,), - } - - attribute_map = { - "attributes": "attributes", - "id": "id", - "type": "type", - } - - def __init__( - self_, - id: str, - type: TagPolicyResourceType, - attributes: Union[TagPolicyUpdateAttributes, UnsetType] = unset, - **kwargs, - ): - """ - Data object for updating a tag policy. - - :param attributes: Mutable attributes of a tag policy. Each field is optional; omitting a field leaves its - current value unchanged. The ``source`` of a policy cannot be changed. - :type attributes: TagPolicyUpdateAttributes, optional - - :param id: The unique identifier of the tag policy being updated. - :type id: str - - :param type: JSON:API resource type for a tag policy. - :type type: TagPolicyResourceType - """ - if attributes is not unset: - kwargs["attributes"] = attributes - super().__init__(kwargs) - - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_attributes.py b/src/datadog_api_client/v2/model/tag_rule_attributes.py similarity index 67% rename from src/datadog_api_client/v2/model/tag_policy_attributes.py rename to src/datadog_api_client/v2/model/tag_rule_attributes.py index ae103a9f63..953282eabc 100644 --- a/src/datadog_api_client/v2/model/tag_policy_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_attributes.py @@ -16,15 +16,15 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_type import TagPolicyType - from datadog_api_client.v2.model.tag_policy_source import TagPolicySource + from datadog_api_client.v2.model.tag_rule_type import TagRuleType + from datadog_api_client.v2.model.tag_rule_source import TagRuleSource -class TagPolicyAttributes(ModelNormal): +class TagRuleAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_type import TagPolicyType - from datadog_api_client.v2.model.tag_policy_source import TagPolicySource + from datadog_api_client.v2.model.tag_rule_type import TagRuleType + from datadog_api_client.v2.model.tag_rule_source import TagRuleSource return { "created_at": (datetime,), @@ -34,12 +34,12 @@ def openapi_types(_): "enabled": (bool,), "modified_at": (datetime,), "modified_by": (str,), + "name": (str,), "negated": (bool,), - "policy_name": (str,), - "policy_type": (TagPolicyType,), "required": (bool,), + "rule_type": (TagRuleType,), "scope": (str,), - "source": (TagPolicySource,), + "source": (TagRuleSource,), "tag_key": (str,), "tag_value_patterns": ([str],), "version": (int,), @@ -53,10 +53,10 @@ def openapi_types(_): "enabled": "enabled", "modified_at": "modified_at", "modified_by": "modified_by", + "name": "name", "negated": "negated", - "policy_name": "policy_name", - "policy_type": "policy_type", "required": "required", + "rule_type": "rule_type", "scope": "scope", "source": "source", "tag_key": "tag_key", @@ -71,12 +71,12 @@ def __init__( enabled: bool, modified_at: datetime, modified_by: str, + name: str, negated: bool, - policy_name: str, - policy_type: TagPolicyType, required: bool, + rule_type: TagRuleType, scope: str, - source: TagPolicySource, + source: TagRuleSource, tag_key: str, tag_value_patterns: List[str], version: int, @@ -85,49 +85,49 @@ def __init__( **kwargs, ): """ - The attributes of a tag policy resource. + The attributes of a tag rule resource. - :param created_at: The RFC 3339 timestamp at which the policy was created. + :param created_at: The RFC 3339 timestamp at which the rule was created. :type created_at: datetime - :param created_by: The identifier of the user who created the policy. + :param created_by: The identifier of the user who created the rule. :type created_by: str - :param deleted_at: The RFC 3339 timestamp at which the policy was soft-deleted. ``null`` if the policy has not been deleted. Only present when ``include_deleted=true`` is requested. + :param deleted_at: The RFC 3339 timestamp at which the rule was soft-deleted. ``null`` if the rule has not been deleted. Only present when ``include_deleted=true`` is requested. :type deleted_at: datetime, none_type, optional - :param deleted_by: The identifier of the user who soft-deleted the policy. ``null`` if the policy has not been deleted. + :param deleted_by: The identifier of the user who soft-deleted the rule. ``null`` if the rule has not been deleted. :type deleted_by: str, none_type, optional - :param enabled: Whether the policy is currently enforced. + :param enabled: Whether the rule is currently enforced. :type enabled: bool - :param modified_at: The RFC 3339 timestamp at which the policy was last modified. + :param modified_at: The RFC 3339 timestamp at which the rule was last modified. :type modified_at: datetime - :param modified_by: The identifier of the user who last modified the policy. + :param modified_by: The identifier of the user who last modified the rule. :type modified_by: str - :param negated: When ``true`` , the policy matches tag values that do NOT match any of the supplied patterns. - :type negated: bool - - :param policy_name: Human-readable name for the tag policy. - :type policy_name: str + :param name: Human-readable name for the tag rule. + :type name: str - :param policy_type: How the policy is enforced. ``blocking`` rejects telemetry that violates the policy. - ``surfacing`` only highlights non-compliant telemetry without blocking it. - :type policy_type: TagPolicyType + :param negated: When ``true`` , the rule matches tag values that do NOT match any of the supplied patterns. + :type negated: bool :param required: When ``true`` , telemetry without this tag is treated as a violation. :type required: bool - :param scope: The scope the policy applies within. + :param rule_type: How the rule is enforced. ``blocking`` rejects telemetry that violates the rule. + ``surfacing`` only highlights non-compliant telemetry without blocking it. + :type rule_type: TagRuleType + + :param scope: The scope the rule applies within. :type scope: str - :param source: The telemetry source that a tag policy applies to. - :type source: TagPolicySource + :param source: The telemetry source that a tag rule applies to. + :type source: TagRuleSource - :param tag_key: The tag key that the policy governs. + :param tag_key: The tag key that the rule governs. :type tag_key: str :param tag_value_patterns: The patterns that valid values for the tag key must match. @@ -147,10 +147,10 @@ def __init__( self_.enabled = enabled self_.modified_at = modified_at self_.modified_by = modified_by + self_.name = name self_.negated = negated - self_.policy_name = policy_name - self_.policy_type = policy_type self_.required = required + self_.rule_type = rule_type self_.scope = scope self_.source = source self_.tag_key = tag_key diff --git a/src/datadog_api_client/v2/model/tag_policy_create_attributes.py b/src/datadog_api_client/v2/model/tag_rule_create_attributes.py similarity index 58% rename from src/datadog_api_client/v2/model/tag_policy_create_attributes.py rename to src/datadog_api_client/v2/model/tag_rule_create_attributes.py index d19e212167..4f51780356 100644 --- a/src/datadog_api_client/v2/model/tag_policy_create_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_create_attributes.py @@ -14,11 +14,11 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_create_type import TagPolicyCreateType - from datadog_api_client.v2.model.tag_policy_source import TagPolicySource + from datadog_api_client.v2.model.tag_rule_create_type import TagRuleCreateType + from datadog_api_client.v2.model.tag_rule_source import TagRuleSource -class TagPolicyCreateAttributes(ModelNormal): +class TagRuleCreateAttributes(ModelNormal): validations = { "tag_value_patterns": { "min_items": 1, @@ -27,27 +27,27 @@ class TagPolicyCreateAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_create_type import TagPolicyCreateType - from datadog_api_client.v2.model.tag_policy_source import TagPolicySource + from datadog_api_client.v2.model.tag_rule_create_type import TagRuleCreateType + from datadog_api_client.v2.model.tag_rule_source import TagRuleSource return { "enabled": (bool,), + "name": (str,), "negated": (bool,), - "policy_name": (str,), - "policy_type": (TagPolicyCreateType,), "required": (bool,), + "rule_type": (TagRuleCreateType,), "scope": (str,), - "source": (TagPolicySource,), + "source": (TagRuleSource,), "tag_key": (str,), "tag_value_patterns": ([str],), } attribute_map = { "enabled": "enabled", + "name": "name", "negated": "negated", - "policy_name": "policy_name", - "policy_type": "policy_type", "required": "required", + "rule_type": "rule_type", "scope": "scope", "source": "source", "tag_key": "tag_key", @@ -56,10 +56,10 @@ def openapi_types(_): def __init__( self_, - policy_name: str, - policy_type: TagPolicyCreateType, + name: str, + rule_type: TagRuleCreateType, scope: str, - source: TagPolicySource, + source: TagRuleSource, tag_key: str, tag_value_patterns: List[str], enabled: Union[bool, UnsetType] = unset, @@ -68,32 +68,32 @@ def __init__( **kwargs, ): """ - Attributes that can be supplied when creating a tag policy. + Attributes that can be supplied when creating a tag rule. - :param enabled: Whether the policy is currently enforced. Defaults to ``true`` for newly created policies. + :param enabled: Whether the rule is currently enforced. Defaults to ``true`` for newly created rules. :type enabled: bool, optional - :param negated: When ``true`` , the policy matches tag values that do NOT match any of the supplied patterns. Defaults to ``false``. - :type negated: bool, optional - - :param policy_name: Human-readable name for the tag policy. - :type policy_name: str + :param name: Human-readable name for the tag rule. + :type name: str - :param policy_type: The policy type allowed when creating a tag policy. Only ``surfacing`` is accepted at - creation time. - :type policy_type: TagPolicyCreateType + :param negated: When ``true`` , the rule matches tag values that do NOT match any of the supplied patterns. Defaults to ``false``. + :type negated: bool, optional :param required: When ``true`` , telemetry without this tag is treated as a violation. Defaults to ``false``. :type required: bool, optional - :param scope: The scope the policy applies within. Typically an environment, team, or - organization-level identifier used to limit where the policy is enforced. + :param rule_type: The rule type allowed when creating a tag rule. Only ``surfacing`` is accepted at + 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. :type scope: str - :param source: The telemetry source that a tag policy applies to. - :type source: TagPolicySource + :param source: The telemetry source that a tag rule applies to. + :type source: TagRuleSource - :param tag_key: The tag key that the policy governs (for example, ``service`` ). + :param tag_key: The tag key that the rule governs (for example, ``service`` ). :type tag_key: str :param tag_value_patterns: One or more patterns that valid values for the tag key must match. At least one @@ -108,8 +108,8 @@ def __init__( kwargs["required"] = required super().__init__(kwargs) - self_.policy_name = policy_name - self_.policy_type = policy_type + self_.name = name + self_.rule_type = rule_type self_.scope = scope self_.source = source self_.tag_key = tag_key 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 new file mode 100644 index 0000000000..2358c06603 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_rule_create_data.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_rule_create_attributes import TagRuleCreateAttributes + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + +class TagRuleCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_rule_create_attributes import TagRuleCreateAttributes + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + return { + "attributes": (TagRuleCreateAttributes,), + "type": (TagRuleResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: TagRuleCreateAttributes, type: TagRuleResourceType, **kwargs): + """ + Data object for creating a tag rule. + + :param attributes: Attributes that can be supplied when creating a tag rule. + :type attributes: TagRuleCreateAttributes + + :param type: JSON:API resource type for a tag rule. + :type type: TagRuleResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_score_response.py b/src/datadog_api_client/v2/model/tag_rule_create_request.py similarity index 57% rename from src/datadog_api_client/v2/model/tag_policy_score_response.py rename to src/datadog_api_client/v2/model/tag_rule_create_request.py index 45456e3535..6b42a3e6e3 100644 --- a/src/datadog_api_client/v2/model/tag_policy_score_response.py +++ b/src/datadog_api_client/v2/model/tag_rule_create_request.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData + from datadog_api_client.v2.model.tag_rule_create_data import TagRuleCreateData -class TagPolicyScoreResponse(ModelNormal): +class TagRuleCreateRequest(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData + from datadog_api_client.v2.model.tag_rule_create_data import TagRuleCreateData return { - "data": (TagPolicyScoreData,), + "data": (TagRuleCreateData,), } attribute_map = { "data": "data", } - def __init__(self_, data: TagPolicyScoreData, **kwargs): + def __init__(self_, data: TagRuleCreateData, **kwargs): """ - A tag policy compliance score. + Payload for creating a new tag rule. - :param data: A compliance score resource for a tag policy. - :type data: TagPolicyScoreData + :param data: Data object for creating a tag rule. + :type data: TagRuleCreateData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_policy_create_type.py b/src/datadog_api_client/v2/model/tag_rule_create_type.py similarity index 74% rename from src/datadog_api_client/v2/model/tag_policy_create_type.py rename to src/datadog_api_client/v2/model/tag_rule_create_type.py index 88f46445ed..f12f419eba 100644 --- a/src/datadog_api_client/v2/model/tag_policy_create_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_create_type.py @@ -12,9 +12,9 @@ from typing import ClassVar -class TagPolicyCreateType(ModelSimple): +class TagRuleCreateType(ModelSimple): """ - The policy type allowed when creating a tag policy. Only `surfacing` is accepted at + The rule type allowed when creating a tag rule. Only `surfacing` is accepted at creation time. :param value: If omitted defaults to "surfacing". Must be one of ["surfacing"]. @@ -24,7 +24,7 @@ class TagPolicyCreateType(ModelSimple): allowed_values = { "surfacing", } - SURFACING: ClassVar["TagPolicyCreateType"] + SURFACING: ClassVar["TagRuleCreateType"] @cached_property def openapi_types(_): @@ -33,4 +33,4 @@ def openapi_types(_): } -TagPolicyCreateType.SURFACING = TagPolicyCreateType("surfacing") +TagRuleCreateType.SURFACING = TagRuleCreateType("surfacing") diff --git a/src/datadog_api_client/v2/model/tag_rule_data.py b/src/datadog_api_client/v2/model/tag_rule_data.py new file mode 100644 index 0000000000..5f5c427f74 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_rule_data.py @@ -0,0 +1,72 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_rule_attributes import TagRuleAttributes + from datadog_api_client.v2.model.tag_rule_relationships import TagRuleRelationships + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + +class TagRuleData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_rule_attributes import TagRuleAttributes + from datadog_api_client.v2.model.tag_rule_relationships import TagRuleRelationships + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + return { + "attributes": (TagRuleAttributes,), + "id": (str,), + "relationships": (TagRuleRelationships,), + "type": (TagRuleResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: TagRuleAttributes, + id: str, + type: TagRuleResourceType, + relationships: Union[TagRuleRelationships, UnsetType] = unset, + **kwargs, + ): + """ + A tag rule resource. + + :param attributes: The attributes of a tag rule resource. + :type attributes: TagRuleAttributes + + :param id: The unique identifier of the tag rule. + :type id: str + + :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. + :type type: TagRuleResourceType + """ + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_include.py b/src/datadog_api_client/v2/model/tag_rule_include.py similarity index 72% rename from src/datadog_api_client/v2/model/tag_policy_include.py rename to src/datadog_api_client/v2/model/tag_rule_include.py index bb0691bcc5..b1766bd1a9 100644 --- a/src/datadog_api_client/v2/model/tag_policy_include.py +++ b/src/datadog_api_client/v2/model/tag_rule_include.py @@ -12,9 +12,9 @@ from typing import ClassVar -class TagPolicyInclude(ModelSimple): +class TagRuleInclude(ModelSimple): """ - A related resource to include alongside a tag policy in the response. Currently the only supported value is `score`. + A related resource to include alongside a tag rule in the response. Currently the only supported value is `score`. :param value: If omitted defaults to "score". Must be one of ["score"]. :type value: str @@ -23,7 +23,7 @@ class TagPolicyInclude(ModelSimple): allowed_values = { "score", } - SCORE: ClassVar["TagPolicyInclude"] + SCORE: ClassVar["TagRuleInclude"] @cached_property def openapi_types(_): @@ -32,4 +32,4 @@ def openapi_types(_): } -TagPolicyInclude.SCORE = TagPolicyInclude("score") +TagRuleInclude.SCORE = TagRuleInclude("score") diff --git a/src/datadog_api_client/v2/model/tag_policy_relationships.py b/src/datadog_api_client/v2/model/tag_rule_relationships.py similarity index 55% rename from src/datadog_api_client/v2/model/tag_policy_relationships.py rename to src/datadog_api_client/v2/model/tag_rule_relationships.py index 39ab37a666..1ebba4c6ba 100644 --- a/src/datadog_api_client/v2/model/tag_policy_relationships.py +++ b/src/datadog_api_client/v2/model/tag_rule_relationships.py @@ -14,28 +14,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_score_relationship import TagPolicyScoreRelationship + from datadog_api_client.v2.model.tag_rule_score_relationship import TagRuleScoreRelationship -class TagPolicyRelationships(ModelNormal): +class TagRuleRelationships(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_score_relationship import TagPolicyScoreRelationship + from datadog_api_client.v2.model.tag_rule_score_relationship import TagRuleScoreRelationship return { - "score": (TagPolicyScoreRelationship,), + "score": (TagRuleScoreRelationship,), } attribute_map = { "score": "score", } - def __init__(self_, score: Union[TagPolicyScoreRelationship, UnsetType] = unset, **kwargs): + def __init__(self_, score: Union[TagRuleScoreRelationship, UnsetType] = unset, **kwargs): """ - Related resources for a tag policy. Only present when the corresponding ``include`` query parameter is supplied. + Related resources for a tag rule. Only present when the corresponding ``include`` query parameter is supplied. - :param score: A relationship to the compliance score resource for this policy. - :type score: TagPolicyScoreRelationship, optional + :param score: A relationship to the compliance score resource for this rule. + :type score: TagRuleScoreRelationship, optional """ if score is not unset: kwargs["score"] = score diff --git a/src/datadog_api_client/v2/model/tag_policy_resource_type.py b/src/datadog_api_client/v2/model/tag_rule_resource_type.py similarity index 63% rename from src/datadog_api_client/v2/model/tag_policy_resource_type.py rename to src/datadog_api_client/v2/model/tag_rule_resource_type.py index 8bedc6962f..436f4ba020 100644 --- a/src/datadog_api_client/v2/model/tag_policy_resource_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_resource_type.py @@ -12,18 +12,18 @@ from typing import ClassVar -class TagPolicyResourceType(ModelSimple): +class TagRuleResourceType(ModelSimple): """ - JSON:API resource type for a tag policy. + JSON:API resource type for a tag rule. - :param value: If omitted defaults to "tag_policy". Must be one of ["tag_policy"]. + :param value: If omitted defaults to "tag_rule". Must be one of ["tag_rule"]. :type value: str """ allowed_values = { - "tag_policy", + "tag_rule", } - TAG_POLICY: ClassVar["TagPolicyResourceType"] + TAG_RULE: ClassVar["TagRuleResourceType"] @cached_property def openapi_types(_): @@ -32,4 +32,4 @@ def openapi_types(_): } -TagPolicyResourceType.TAG_POLICY = TagPolicyResourceType("tag_policy") +TagRuleResourceType.TAG_RULE = TagRuleResourceType("tag_rule") diff --git a/src/datadog_api_client/v2/model/tag_policy_response.py b/src/datadog_api_client/v2/model/tag_rule_response.py similarity index 50% rename from src/datadog_api_client/v2/model/tag_policy_response.py rename to src/datadog_api_client/v2/model/tag_rule_response.py index 578210f123..f5341cc3f0 100644 --- a/src/datadog_api_client/v2/model/tag_policy_response.py +++ b/src/datadog_api_client/v2/model/tag_rule_response.py @@ -14,19 +14,19 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_data import TagPolicyData - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData + from datadog_api_client.v2.model.tag_rule_data import TagRuleData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData -class TagPolicyResponse(ModelNormal): +class TagRuleResponse(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_data import TagPolicyData - from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData + from datadog_api_client.v2.model.tag_rule_data import TagRuleData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData return { - "data": (TagPolicyData,), - "included": ([TagPolicyScoreData],), + "data": (TagRuleData,), + "included": ([TagRuleScoreData],), } attribute_map = { @@ -34,15 +34,15 @@ def openapi_types(_): "included": "included", } - def __init__(self_, data: TagPolicyData, included: Union[List[TagPolicyScoreData], UnsetType] = unset, **kwargs): + def __init__(self_, data: TagRuleData, included: Union[List[TagRuleScoreData], UnsetType] = unset, **kwargs): """ - A single tag policy. + A single tag rule. - :param data: A tag policy resource. - :type data: TagPolicyData + :param data: A tag rule resource. + :type data: TagRuleData - :param included: Related resources fetched alongside the primary tag policies. Populated when an ``include`` query parameter is supplied. - :type included: [TagPolicyScoreData], optional + :param included: Related resources fetched alongside the primary tag rules. Populated when an ``include`` query parameter is supplied. + :type included: [TagRuleScoreData], optional """ if included is not unset: kwargs["included"] = included diff --git a/src/datadog_api_client/v2/model/tag_policy_score_attributes.py b/src/datadog_api_client/v2/model/tag_rule_score_attributes.py similarity index 83% rename from src/datadog_api_client/v2/model/tag_policy_score_attributes.py rename to src/datadog_api_client/v2/model/tag_rule_score_attributes.py index 20f6a43bc7..7b3671c050 100644 --- a/src/datadog_api_client/v2/model/tag_policy_score_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_attributes.py @@ -12,7 +12,7 @@ ) -class TagPolicyScoreAttributes(ModelNormal): +class TagRuleScoreAttributes(ModelNormal): @cached_property def openapi_types(_): return { @@ -31,9 +31,9 @@ def openapi_types(_): def __init__(self_, score: Union[float, none_type], ts_end: int, ts_start: int, version: int, **kwargs): """ - Attributes of a tag policy compliance score. + Attributes of a tag rule compliance score. - :param score: The compliance score for the policy over the requested time window, as a percentage + :param score: The compliance score for the rule over the requested time window, as a percentage between 0 and 100. ``null`` indicates that no relevant telemetry was found. :type score: float, none_type @@ -43,7 +43,7 @@ def __init__(self_, score: Union[float, none_type], ts_end: int, ts_start: int, :param ts_start: Start of the time window the score was computed over, as a Unix timestamp in milliseconds. :type ts_start: int - :param version: The version of the tag policy that the score was computed against. + :param version: The version of the tag rule that the score was computed against. :type version: int """ super().__init__(kwargs) 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 new file mode 100644 index 0000000000..8a6e731024 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_rule_score_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_rule_score_attributes import TagRuleScoreAttributes + from datadog_api_client.v2.model.tag_rule_score_resource_type import TagRuleScoreResourceType + + +class TagRuleScoreData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_rule_score_attributes import TagRuleScoreAttributes + from datadog_api_client.v2.model.tag_rule_score_resource_type import TagRuleScoreResourceType + + return { + "attributes": (TagRuleScoreAttributes,), + "id": (str,), + "type": (TagRuleScoreResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: TagRuleScoreAttributes, id: str, type: TagRuleScoreResourceType, **kwargs): + """ + A compliance score resource for a tag rule. + + :param attributes: Attributes of a tag rule compliance score. + :type attributes: TagRuleScoreAttributes + + :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. + :type type: TagRuleScoreResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_score_relationship.py b/src/datadog_api_client/v2/model/tag_rule_score_relationship.py similarity index 62% rename from src/datadog_api_client/v2/model/tag_policy_score_relationship.py rename to src/datadog_api_client/v2/model/tag_rule_score_relationship.py index 2e23c42019..0e9c805d5a 100644 --- a/src/datadog_api_client/v2/model/tag_policy_score_relationship.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_relationship.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_score_relationship_data import TagPolicyScoreRelationshipData + from datadog_api_client.v2.model.tag_rule_score_relationship_data import TagRuleScoreRelationshipData -class TagPolicyScoreRelationship(ModelNormal): +class TagRuleScoreRelationship(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_score_relationship_data import TagPolicyScoreRelationshipData + from datadog_api_client.v2.model.tag_rule_score_relationship_data import TagRuleScoreRelationshipData return { - "data": (TagPolicyScoreRelationshipData,), + "data": (TagRuleScoreRelationshipData,), } attribute_map = { "data": "data", } - def __init__(self_, data: TagPolicyScoreRelationshipData, **kwargs): + def __init__(self_, data: TagRuleScoreRelationshipData, **kwargs): """ - A relationship to the compliance score resource for this policy. + A relationship to the compliance score resource for this rule. :param data: Identifier of the related compliance score resource. - :type data: TagPolicyScoreRelationshipData + :type data: TagRuleScoreRelationshipData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_policy_score_relationship_data.py b/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py similarity index 62% rename from src/datadog_api_client/v2/model/tag_policy_score_relationship_data.py rename to src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py index 0624a2b4cc..2b7603a714 100644 --- a/src/datadog_api_client/v2/model/tag_policy_score_relationship_data.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_relationship_data.py @@ -12,17 +12,17 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_score_resource_type import TagPolicyScoreResourceType + from datadog_api_client.v2.model.tag_rule_score_resource_type import TagRuleScoreResourceType -class TagPolicyScoreRelationshipData(ModelNormal): +class TagRuleScoreRelationshipData(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_score_resource_type import TagPolicyScoreResourceType + from datadog_api_client.v2.model.tag_rule_score_resource_type import TagRuleScoreResourceType return { "id": (str,), - "type": (TagPolicyScoreResourceType,), + "type": (TagRuleScoreResourceType,), } attribute_map = { @@ -30,15 +30,15 @@ def openapi_types(_): "type": "type", } - def __init__(self_, id: str, type: TagPolicyScoreResourceType, **kwargs): + def __init__(self_, id: str, type: TagRuleScoreResourceType, **kwargs): """ Identifier of the related compliance score resource. :param id: The unique identifier of the related compliance score resource. :type id: str - :param type: JSON:API resource type for a tag policy compliance score. - :type type: TagPolicyScoreResourceType + :param type: JSON:API resource type for a tag rule compliance score. + :type type: TagRuleScoreResourceType """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_policy_score_resource_type.py b/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py similarity index 58% rename from src/datadog_api_client/v2/model/tag_policy_score_resource_type.py rename to src/datadog_api_client/v2/model/tag_rule_score_resource_type.py index 109ea20ec6..c327bc9147 100644 --- a/src/datadog_api_client/v2/model/tag_policy_score_resource_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_resource_type.py @@ -12,18 +12,18 @@ from typing import ClassVar -class TagPolicyScoreResourceType(ModelSimple): +class TagRuleScoreResourceType(ModelSimple): """ - JSON:API resource type for a tag policy compliance score. + JSON:API resource type for a tag rule compliance score. - :param value: If omitted defaults to "tag_policy_score". Must be one of ["tag_policy_score"]. + :param value: If omitted defaults to "tag_rule_score". Must be one of ["tag_rule_score"]. :type value: str """ allowed_values = { - "tag_policy_score", + "tag_rule_score", } - TAG_POLICY_SCORE: ClassVar["TagPolicyScoreResourceType"] + TAG_RULE_SCORE: ClassVar["TagRuleScoreResourceType"] @cached_property def openapi_types(_): @@ -32,4 +32,4 @@ def openapi_types(_): } -TagPolicyScoreResourceType.TAG_POLICY_SCORE = TagPolicyScoreResourceType("tag_policy_score") +TagRuleScoreResourceType.TAG_RULE_SCORE = TagRuleScoreResourceType("tag_rule_score") diff --git a/src/datadog_api_client/v2/model/tag_policy_create_request.py b/src/datadog_api_client/v2/model/tag_rule_score_response.py similarity index 56% rename from src/datadog_api_client/v2/model/tag_policy_create_request.py rename to src/datadog_api_client/v2/model/tag_rule_score_response.py index c531b82719..c554125ff3 100644 --- a/src/datadog_api_client/v2/model/tag_policy_create_request.py +++ b/src/datadog_api_client/v2/model/tag_rule_score_response.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_create_data import TagPolicyCreateData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData -class TagPolicyCreateRequest(ModelNormal): +class TagRuleScoreResponse(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_create_data import TagPolicyCreateData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData return { - "data": (TagPolicyCreateData,), + "data": (TagRuleScoreData,), } attribute_map = { "data": "data", } - def __init__(self_, data: TagPolicyCreateData, **kwargs): + def __init__(self_, data: TagRuleScoreData, **kwargs): """ - Payload for creating a new tag policy. + A tag rule compliance score. - :param data: Data object for creating a tag policy. - :type data: TagPolicyCreateData + :param data: A compliance score resource for a tag rule. + :type data: TagRuleScoreData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_policy_source.py b/src/datadog_api_client/v2/model/tag_rule_source.py similarity index 57% rename from src/datadog_api_client/v2/model/tag_policy_source.py rename to src/datadog_api_client/v2/model/tag_rule_source.py index 49f0a4fe34..9b664e00a2 100644 --- a/src/datadog_api_client/v2/model/tag_policy_source.py +++ b/src/datadog_api_client/v2/model/tag_rule_source.py @@ -12,9 +12,9 @@ from typing import ClassVar -class TagPolicySource(ModelSimple): +class TagRuleSource(ModelSimple): """ - The telemetry source that a tag policy applies to. + The telemetry source that a tag rule applies to. :param value: Must be one of ["logs", "spans", "metrics", "rum", "feed"]. :type value: str @@ -27,11 +27,11 @@ class TagPolicySource(ModelSimple): "rum", "feed", } - LOGS: ClassVar["TagPolicySource"] - SPANS: ClassVar["TagPolicySource"] - METRICS: ClassVar["TagPolicySource"] - RUM: ClassVar["TagPolicySource"] - FEED: ClassVar["TagPolicySource"] + LOGS: ClassVar["TagRuleSource"] + SPANS: ClassVar["TagRuleSource"] + METRICS: ClassVar["TagRuleSource"] + RUM: ClassVar["TagRuleSource"] + FEED: ClassVar["TagRuleSource"] @cached_property def openapi_types(_): @@ -40,8 +40,8 @@ def openapi_types(_): } -TagPolicySource.LOGS = TagPolicySource("logs") -TagPolicySource.SPANS = TagPolicySource("spans") -TagPolicySource.METRICS = TagPolicySource("metrics") -TagPolicySource.RUM = TagPolicySource("rum") -TagPolicySource.FEED = TagPolicySource("feed") +TagRuleSource.LOGS = TagRuleSource("logs") +TagRuleSource.SPANS = TagRuleSource("spans") +TagRuleSource.METRICS = TagRuleSource("metrics") +TagRuleSource.RUM = TagRuleSource("rum") +TagRuleSource.FEED = TagRuleSource("feed") diff --git a/src/datadog_api_client/v2/model/tag_policy_type.py b/src/datadog_api_client/v2/model/tag_rule_type.py similarity index 70% rename from src/datadog_api_client/v2/model/tag_policy_type.py rename to src/datadog_api_client/v2/model/tag_rule_type.py index 86b7beedc4..2af092988b 100644 --- a/src/datadog_api_client/v2/model/tag_policy_type.py +++ b/src/datadog_api_client/v2/model/tag_rule_type.py @@ -12,9 +12,9 @@ from typing import ClassVar -class TagPolicyType(ModelSimple): +class TagRuleType(ModelSimple): """ - How the policy is enforced. `blocking` rejects telemetry that violates the policy. + How the rule is enforced. `blocking` rejects telemetry that violates the rule. `surfacing` only highlights non-compliant telemetry without blocking it. :param value: Must be one of ["blocking", "surfacing"]. @@ -25,8 +25,8 @@ class TagPolicyType(ModelSimple): "blocking", "surfacing", } - BLOCKING: ClassVar["TagPolicyType"] - SURFACING: ClassVar["TagPolicyType"] + BLOCKING: ClassVar["TagRuleType"] + SURFACING: ClassVar["TagRuleType"] @cached_property def openapi_types(_): @@ -35,5 +35,5 @@ def openapi_types(_): } -TagPolicyType.BLOCKING = TagPolicyType("blocking") -TagPolicyType.SURFACING = TagPolicyType("surfacing") +TagRuleType.BLOCKING = TagRuleType("blocking") +TagRuleType.SURFACING = TagRuleType("surfacing") diff --git a/src/datadog_api_client/v2/model/tag_policy_update_attributes.py b/src/datadog_api_client/v2/model/tag_rule_update_attributes.py similarity index 63% rename from src/datadog_api_client/v2/model/tag_policy_update_attributes.py rename to src/datadog_api_client/v2/model/tag_rule_update_attributes.py index 379fec2747..6d9f7e2e88 100644 --- a/src/datadog_api_client/v2/model/tag_policy_update_attributes.py +++ b/src/datadog_api_client/v2/model/tag_rule_update_attributes.py @@ -14,20 +14,20 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + from datadog_api_client.v2.model.tag_rule_type import TagRuleType -class TagPolicyUpdateAttributes(ModelNormal): +class TagRuleUpdateAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + from datadog_api_client.v2.model.tag_rule_type import TagRuleType return { "enabled": (bool,), + "name": (str,), "negated": (bool,), - "policy_name": (str,), - "policy_type": (TagPolicyType,), "required": (bool,), + "rule_type": (TagRuleType,), "scope": (str,), "tag_key": (str,), "tag_value_patterns": ([str],), @@ -35,10 +35,10 @@ def openapi_types(_): attribute_map = { "enabled": "enabled", + "name": "name", "negated": "negated", - "policy_name": "policy_name", - "policy_type": "policy_type", "required": "required", + "rule_type": "rule_type", "scope": "scope", "tag_key": "tag_key", "tag_value_patterns": "tag_value_patterns", @@ -47,39 +47,39 @@ def openapi_types(_): def __init__( self_, enabled: Union[bool, UnsetType] = unset, + name: Union[str, UnsetType] = unset, negated: Union[bool, UnsetType] = unset, - policy_name: Union[str, UnsetType] = unset, - policy_type: Union[TagPolicyType, UnsetType] = unset, required: Union[bool, UnsetType] = unset, + rule_type: Union[TagRuleType, UnsetType] = unset, scope: Union[str, UnsetType] = unset, tag_key: Union[str, UnsetType] = unset, tag_value_patterns: Union[List[str], UnsetType] = unset, **kwargs, ): """ - Mutable attributes of a tag policy. Each field is optional; omitting a field leaves its - current value unchanged. The ``source`` of a policy cannot be changed. + 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. - :param enabled: Whether the policy is currently enforced. + :param enabled: Whether the rule is currently enforced. :type enabled: bool, optional - :param negated: When ``true`` , the policy matches tag values that do NOT match any of the supplied patterns. - :type negated: bool, optional - - :param policy_name: Human-readable name for the tag policy. - :type policy_name: str, optional + :param name: Human-readable name for the tag rule. + :type name: str, optional - :param policy_type: How the policy is enforced. ``blocking`` rejects telemetry that violates the policy. - ``surfacing`` only highlights non-compliant telemetry without blocking it. - :type policy_type: TagPolicyType, optional + :param negated: When ``true`` , the rule matches tag values that do NOT match any of the supplied patterns. + :type negated: bool, optional :param required: When ``true`` , telemetry without this tag is treated as a violation. :type required: bool, optional - :param scope: The scope the policy applies within. + :param rule_type: How the rule is enforced. ``blocking`` rejects telemetry that violates the rule. + ``surfacing`` only highlights non-compliant telemetry without blocking it. + :type rule_type: TagRuleType, optional + + :param scope: The scope the rule applies within. :type scope: str, optional - :param tag_key: The tag key that the policy governs. + :param tag_key: The tag key that the rule governs. :type tag_key: str, optional :param tag_value_patterns: One or more patterns that valid values for the tag key must match. @@ -87,14 +87,14 @@ def __init__( """ if enabled is not unset: kwargs["enabled"] = enabled + if name is not unset: + kwargs["name"] = name if negated is not unset: kwargs["negated"] = negated - if policy_name is not unset: - kwargs["policy_name"] = policy_name - if policy_type is not unset: - kwargs["policy_type"] = policy_type if required is not unset: kwargs["required"] = required + if rule_type is not unset: + kwargs["rule_type"] = rule_type if scope is not unset: kwargs["scope"] = scope if tag_key is not unset: 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 new file mode 100644 index 0000000000..4f9ab84d0c --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_rule_update_data.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_rule_update_attributes import TagRuleUpdateAttributes + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + +class TagRuleUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_rule_update_attributes import TagRuleUpdateAttributes + from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType + + return { + "attributes": (TagRuleUpdateAttributes,), + "id": (str,), + "type": (TagRuleResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + id: str, + type: TagRuleResourceType, + attributes: Union[TagRuleUpdateAttributes, UnsetType] = unset, + **kwargs, + ): + """ + 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. + :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. + :type type: TagRuleResourceType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_update_request.py b/src/datadog_api_client/v2/model/tag_rule_update_request.py similarity index 54% rename from src/datadog_api_client/v2/model/tag_policy_update_request.py rename to src/datadog_api_client/v2/model/tag_rule_update_request.py index 447438b7ed..f74dd67350 100644 --- a/src/datadog_api_client/v2/model/tag_policy_update_request.py +++ b/src/datadog_api_client/v2/model/tag_rule_update_request.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.tag_policy_update_data import TagPolicyUpdateData + from datadog_api_client.v2.model.tag_rule_update_data import TagRuleUpdateData -class TagPolicyUpdateRequest(ModelNormal): +class TagRuleUpdateRequest(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.tag_policy_update_data import TagPolicyUpdateData + from datadog_api_client.v2.model.tag_rule_update_data import TagRuleUpdateData return { - "data": (TagPolicyUpdateData,), + "data": (TagRuleUpdateData,), } attribute_map = { "data": "data", } - def __init__(self_, data: TagPolicyUpdateData, **kwargs): + def __init__(self_, data: TagRuleUpdateData, **kwargs): """ - Payload for updating an existing tag policy. Only the supplied fields are modified. + Payload for updating an existing tag rule. Only the supplied fields are modified. - :param data: Data object for updating a tag policy. - :type data: TagPolicyUpdateData + :param data: Data object for updating a tag rule. + :type data: TagRuleUpdateData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_rules_list_response.py b/src/datadog_api_client/v2/model/tag_rules_list_response.py new file mode 100644 index 0000000000..2d1307eb82 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_rules_list_response.py @@ -0,0 +1,51 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_rule_data import TagRuleData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData + + +class TagRulesListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_rule_data import TagRuleData + from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData + + return { + "data": ([TagRuleData],), + "included": ([TagRuleScoreData],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__(self_, data: List[TagRuleData], included: Union[List[TagRuleScoreData], UnsetType] = unset, **kwargs): + """ + A page of tag rules. + + :param data: An array of tag rule data objects. + :type data: [TagRuleData] + + :param included: Related resources fetched alongside the primary tag rules. Populated when an ``include`` query parameter is supplied. + :type included: [TagRuleScoreData], optional + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index f615b0a052..60368c2ccd 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -10110,28 +10110,28 @@ from datadog_api_client.v2.model.tag_indexing_rule_update_request import TagIndexingRuleUpdateRequest from datadog_api_client.v2.model.tag_indexing_rules_response import TagIndexingRulesResponse from datadog_api_client.v2.model.tag_indexing_rules_response_meta import TagIndexingRulesResponseMeta -from datadog_api_client.v2.model.tag_policies_list_response import TagPoliciesListResponse -from datadog_api_client.v2.model.tag_policy_attributes import TagPolicyAttributes -from datadog_api_client.v2.model.tag_policy_create_attributes import TagPolicyCreateAttributes -from datadog_api_client.v2.model.tag_policy_create_data import TagPolicyCreateData -from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest -from datadog_api_client.v2.model.tag_policy_create_type import TagPolicyCreateType -from datadog_api_client.v2.model.tag_policy_data import TagPolicyData -from datadog_api_client.v2.model.tag_policy_include import TagPolicyInclude -from datadog_api_client.v2.model.tag_policy_relationships import TagPolicyRelationships -from datadog_api_client.v2.model.tag_policy_resource_type import TagPolicyResourceType -from datadog_api_client.v2.model.tag_policy_response import TagPolicyResponse -from datadog_api_client.v2.model.tag_policy_score_attributes import TagPolicyScoreAttributes -from datadog_api_client.v2.model.tag_policy_score_data import TagPolicyScoreData -from datadog_api_client.v2.model.tag_policy_score_relationship import TagPolicyScoreRelationship -from datadog_api_client.v2.model.tag_policy_score_relationship_data import TagPolicyScoreRelationshipData -from datadog_api_client.v2.model.tag_policy_score_resource_type import TagPolicyScoreResourceType -from datadog_api_client.v2.model.tag_policy_score_response import TagPolicyScoreResponse -from datadog_api_client.v2.model.tag_policy_source import TagPolicySource -from datadog_api_client.v2.model.tag_policy_type import TagPolicyType -from datadog_api_client.v2.model.tag_policy_update_attributes import TagPolicyUpdateAttributes -from datadog_api_client.v2.model.tag_policy_update_data import TagPolicyUpdateData -from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest +from datadog_api_client.v2.model.tag_rule_attributes import TagRuleAttributes +from datadog_api_client.v2.model.tag_rule_create_attributes import TagRuleCreateAttributes +from datadog_api_client.v2.model.tag_rule_create_data import TagRuleCreateData +from datadog_api_client.v2.model.tag_rule_create_request import TagRuleCreateRequest +from datadog_api_client.v2.model.tag_rule_create_type import TagRuleCreateType +from datadog_api_client.v2.model.tag_rule_data import TagRuleData +from datadog_api_client.v2.model.tag_rule_include import TagRuleInclude +from datadog_api_client.v2.model.tag_rule_relationships import TagRuleRelationships +from datadog_api_client.v2.model.tag_rule_resource_type import TagRuleResourceType +from datadog_api_client.v2.model.tag_rule_response import TagRuleResponse +from datadog_api_client.v2.model.tag_rule_score_attributes import TagRuleScoreAttributes +from datadog_api_client.v2.model.tag_rule_score_data import TagRuleScoreData +from datadog_api_client.v2.model.tag_rule_score_relationship import TagRuleScoreRelationship +from datadog_api_client.v2.model.tag_rule_score_relationship_data import TagRuleScoreRelationshipData +from datadog_api_client.v2.model.tag_rule_score_resource_type import TagRuleScoreResourceType +from datadog_api_client.v2.model.tag_rule_score_response import TagRuleScoreResponse +from datadog_api_client.v2.model.tag_rule_source import TagRuleSource +from datadog_api_client.v2.model.tag_rule_type import TagRuleType +from datadog_api_client.v2.model.tag_rule_update_attributes import TagRuleUpdateAttributes +from datadog_api_client.v2.model.tag_rule_update_data import TagRuleUpdateData +from datadog_api_client.v2.model.tag_rule_update_request import TagRuleUpdateRequest +from datadog_api_client.v2.model.tag_rules_list_response import TagRulesListResponse from datadog_api_client.v2.model.tags_event_attribute import TagsEventAttribute from datadog_api_client.v2.model.targeting_rule import TargetingRule from datadog_api_client.v2.model.targeting_rule_request import TargetingRuleRequest @@ -17960,28 +17960,28 @@ "TagIndexingRuleUpdateRequest", "TagIndexingRulesResponse", "TagIndexingRulesResponseMeta", - "TagPoliciesListResponse", - "TagPolicyAttributes", - "TagPolicyCreateAttributes", - "TagPolicyCreateData", - "TagPolicyCreateRequest", - "TagPolicyCreateType", - "TagPolicyData", - "TagPolicyInclude", - "TagPolicyRelationships", - "TagPolicyResourceType", - "TagPolicyResponse", - "TagPolicyScoreAttributes", - "TagPolicyScoreData", - "TagPolicyScoreRelationship", - "TagPolicyScoreRelationshipData", - "TagPolicyScoreResourceType", - "TagPolicyScoreResponse", - "TagPolicySource", - "TagPolicyType", - "TagPolicyUpdateAttributes", - "TagPolicyUpdateData", - "TagPolicyUpdateRequest", + "TagRuleAttributes", + "TagRuleCreateAttributes", + "TagRuleCreateData", + "TagRuleCreateRequest", + "TagRuleCreateType", + "TagRuleData", + "TagRuleInclude", + "TagRuleRelationships", + "TagRuleResourceType", + "TagRuleResponse", + "TagRuleScoreAttributes", + "TagRuleScoreData", + "TagRuleScoreRelationship", + "TagRuleScoreRelationshipData", + "TagRuleScoreResourceType", + "TagRuleScoreResponse", + "TagRuleSource", + "TagRuleType", + "TagRuleUpdateAttributes", + "TagRuleUpdateData", + "TagRuleUpdateRequest", + "TagRulesListResponse", "TagsEventAttribute", "TargetingRule", "TargetingRuleRequest", diff --git a/tests/v2/features/tag_policies.feature b/tests/v2/features/tag_policies.feature deleted file mode 100644 index b5d064c202..0000000000 --- a/tests/v2/features/tag_policies.feature +++ /dev/null @@ -1,150 +0,0 @@ -@endpoint(tag-policies) @endpoint(tag-policies-v2) -Feature: Tag Policies - Tag Policies define rules that govern which tag values are accepted for a - given tag key, scoped to a particular telemetry source (such as logs, - spans, or metrics). Policies can be `blocking` (data not matching the - policy is rejected) or `surfacing` (matching data is highlighted but not - blocked). Each policy reports a compliance `score` derived from how much - recent telemetry adheres to the policy. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "TagPolicies" API - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Create a tag policy returns "Bad Request" response - Given operation "CreateTagPolicy" enabled - And new "CreateTagPolicy" request - And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "Service tag must be one of api or web", "policy_type": "surfacing", "required": true, "scope": "env", "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:DataDog/aaa-governance-console - Scenario: Create a tag policy returns "Conflict" response - Given operation "CreateTagPolicy" enabled - And new "CreateTagPolicy" request - And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "Service tag must be one of api or web", "policy_type": "surfacing", "required": true, "scope": "env", "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:DataDog/aaa-governance-console - Scenario: Create a tag policy returns "Created" response - Given operation "CreateTagPolicy" enabled - And new "CreateTagPolicy" request - And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "Service tag must be one of api or web", "policy_type": "surfacing", "required": true, "scope": "env", "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 - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Delete a tag policy returns "Bad Request" response - Given operation "DeleteTagPolicy" enabled - And new "DeleteTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Delete a tag policy returns "No Content" response - Given operation "DeleteTagPolicy" enabled - And new "DeleteTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Delete a tag policy returns "Not Found" response - Given operation "DeleteTagPolicy" enabled - And new "DeleteTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy compliance score returns "Bad Request" response - Given operation "GetTagPolicyScore" enabled - And new "GetTagPolicyScore" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy compliance score returns "Not Found" response - Given operation "GetTagPolicyScore" enabled - And new "GetTagPolicyScore" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy compliance score returns "OK" response - Given operation "GetTagPolicyScore" enabled - And new "GetTagPolicyScore" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy returns "Bad Request" response - Given operation "GetTagPolicy" enabled - And new "GetTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy returns "Not Found" response - Given operation "GetTagPolicy" enabled - And new "GetTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a tag policy returns "OK" response - Given operation "GetTagPolicy" enabled - And new "GetTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List tag policies returns "Bad Request" response - Given operation "ListTagPolicies" enabled - And new "ListTagPolicies" request - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List tag policies returns "OK" response - Given operation "ListTagPolicies" enabled - And new "ListTagPolicies" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a tag policy returns "Bad Request" response - Given operation "UpdateTagPolicy" enabled - And new "UpdateTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"policy_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_policy"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a tag policy returns "Not Found" response - Given operation "UpdateTagPolicy" enabled - And new "UpdateTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"policy_type": "surfacing", "tag_value_patterns": []}, "id": "123", "type": "tag_policy"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a tag policy returns "OK" response - Given operation "UpdateTagPolicy" enabled - And new "UpdateTagPolicy" request - And request contains "policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"policy_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/tests/v2/features/tag_rules.feature b/tests/v2/features/tag_rules.feature new file mode 100644 index 0000000000..ad456e68c0 --- /dev/null +++ b/tests/v2/features/tag_rules.feature @@ -0,0 +1,150 @@ +@endpoint(tag-rules) @endpoint(tag-rules-v2) +Feature: Tag Rules + Tag Rules define rules that govern which tag values are accepted for a + given tag key, 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. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "TagRules" API + + @generated @skip @team:DataDog/aaa-governance-console + 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/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"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/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"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Delete a tag rule returns "Bad Request" response + Given operation "DeleteTagRule" enabled + And new "DeleteTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Delete a tag rule returns "No Content" response + Given operation "DeleteTagRule" enabled + And new "DeleteTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Delete a tag rule returns "Not Found" response + Given operation "DeleteTagRule" enabled + And new "DeleteTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule compliance score returns "Bad Request" response + Given operation "GetTagRuleScore" enabled + And new "GetTagRuleScore" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule compliance score returns "Not Found" response + Given operation "GetTagRuleScore" enabled + And new "GetTagRuleScore" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule compliance score returns "OK" response + Given operation "GetTagRuleScore" enabled + And new "GetTagRuleScore" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule returns "Bad Request" response + Given operation "GetTagRule" enabled + And new "GetTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule returns "Not Found" response + Given operation "GetTagRule" enabled + And new "GetTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a tag rule returns "OK" response + Given operation "GetTagRule" enabled + And new "GetTagRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List tag rules returns "Bad Request" response + Given operation "ListTagRules" enabled + And new "ListTagRules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List tag rules returns "OK" response + Given operation "ListTagRules" enabled + And new "ListTagRules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a tag rule returns "Bad Request" response + 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a tag rule returns "Not Found" response + 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"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a tag rule returns "OK" response + 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"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 7a5c39bdd9..e08b831526 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2967,6 +2967,49 @@ "type": "idempotent" } }, + "ListTagRules": { + "tag": "Tag Rules", + "undo": { + "type": "safe" + } + }, + "CreateTagRule": { + "tag": "Tag Rules", + "undo": { + "operationId": "DeleteTagRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteTagRule": { + "tag": "Tag Rules", + "undo": { + "type": "idempotent" + } + }, + "GetTagRule": { + "tag": "Tag Rules", + "undo": { + "type": "safe" + } + }, + "UpdateTagRule": { + "tag": "Tag Rules", + "undo": { + "type": "idempotent" + } + }, + "GetTagRuleScore": { + "tag": "Tag Rules", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": { @@ -9654,49 +9697,6 @@ "type": "safe" } }, - "ListTagPolicies": { - "tag": "Tag Policies", - "undo": { - "type": "safe" - } - }, - "CreateTagPolicy": { - "tag": "Tag Policies", - "undo": { - "operationId": "DeleteTagPolicy", - "parameters": [ - { - "name": "policy_id", - "source": "data.id" - } - ], - "type": "unsafe" - } - }, - "DeleteTagPolicy": { - "tag": "Tag Policies", - "undo": { - "type": "idempotent" - } - }, - "GetTagPolicy": { - "tag": "Tag Policies", - "undo": { - "type": "safe" - } - }, - "UpdateTagPolicy": { - "tag": "Tag Policies", - "undo": { - "type": "idempotent" - } - }, - "GetTagPolicyScore": { - "tag": "Tag Policies", - "undo": { - "type": "safe" - } - }, "ListTagPipelinesRulesets": { "tag": "Cloud Cost Management", "undo": {