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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
968 changes: 968 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions examples/v2/tag-policies/CreateTagPolicy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create a tag policy returns "Created" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.create_tag_policy".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new

body = DatadogAPIClient::V2::TagPolicyCreateRequest.new({
data: DatadogAPIClient::V2::TagPolicyCreateData.new({
attributes: DatadogAPIClient::V2::TagPolicyCreateAttributes.new({
enabled: true,
negated: false,
policy_name: "Service tag must be one of api or web",
policy_type: DatadogAPIClient::V2::TagPolicyCreateType::SURFACING,
required: true,
scope: "env",
source: DatadogAPIClient::V2::TagPolicySource::LOGS,
tag_key: "service",
tag_value_patterns: [
"api",
"web",
],
}),
type: DatadogAPIClient::V2::TagPolicyResourceType::TAG_POLICY,
}),
})
p api_instance.create_tag_policy(body)
8 changes: 8 additions & 0 deletions examples/v2/tag-policies/DeleteTagPolicy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Delete a tag policy returns "No Content" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.delete_tag_policy".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new
api_instance.delete_tag_policy("policy_id")
8 changes: 8 additions & 0 deletions examples/v2/tag-policies/GetTagPolicy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get a tag policy returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_tag_policy".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new
p api_instance.get_tag_policy("policy_id")
8 changes: 8 additions & 0 deletions examples/v2/tag-policies/GetTagPolicyScore.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get a tag policy compliance score returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_tag_policy_score".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new
p api_instance.get_tag_policy_score("policy_id")
8 changes: 8 additions & 0 deletions examples/v2/tag-policies/ListTagPolicies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List tag policies returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_tag_policies".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new
p api_instance.list_tag_policies()
19 changes: 19 additions & 0 deletions examples/v2/tag-policies/UpdateTagPolicy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Update a tag policy returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.update_tag_policy".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new

body = DatadogAPIClient::V2::TagPolicyUpdateRequest.new({
data: DatadogAPIClient::V2::TagPolicyUpdateData.new({
attributes: DatadogAPIClient::V2::TagPolicyUpdateAttributes.new({
policy_type: DatadogAPIClient::V2::TagPolicyType::SURFACING,
tag_value_patterns: [],
}),
id: "123",
type: DatadogAPIClient::V2::TagPolicyResourceType::TAG_POLICY,
}),
})
p api_instance.update_tag_policy("policy_id", body)
30 changes: 30 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5641,6 +5641,36 @@
"variable_id" => "String",
"body" => "GlobalVariableJsonPatchRequest",
},
"v2.ListTagPolicies" => {
"include_disabled" => "Boolean",
"include_deleted" => "Boolean",
"include" => "TagPolicyInclude",
"filter_source" => "TagPolicySource",
"ts_start" => "Integer",
"ts_end" => "Integer",
},
"v2.CreateTagPolicy" => {
"body" => "TagPolicyCreateRequest",
},
"v2.DeleteTagPolicy" => {
"policy_id" => "String",
"hard_delete" => "Boolean",
},
"v2.GetTagPolicy" => {
"policy_id" => "String",
"include" => "TagPolicyInclude",
"ts_start" => "Integer",
"ts_end" => "Integer",
},
"v2.UpdateTagPolicy" => {
"policy_id" => "String",
"body" => "TagPolicyUpdateRequest",
},
"v2.GetTagPolicyScore" => {
"policy_id" => "String",
"ts_start" => "Integer",
"ts_end" => "Integer",
},
"v2.ListTeams" => {
"page_number" => "Integer",
"page_size" => "Integer",
Expand Down
150 changes: 150 additions & 0 deletions features/v2/tag_policies.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
@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
43 changes: 43 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8655,6 +8655,49 @@
"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": {
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ def initialize
"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,
Expand Down
23 changes: 23 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7097,6 +7097,28 @@ def overrides
"v2.tag_indexing_rule_update_attributes" => "TagIndexingRuleUpdateAttributes",
"v2.tag_indexing_rule_update_data" => "TagIndexingRuleUpdateData",
"v2.tag_indexing_rule_update_request" => "TagIndexingRuleUpdateRequest",
"v2.tag_policies_list_response" => "TagPoliciesListResponse",
"v2.tag_policy_attributes" => "TagPolicyAttributes",
"v2.tag_policy_create_attributes" => "TagPolicyCreateAttributes",
"v2.tag_policy_create_data" => "TagPolicyCreateData",
"v2.tag_policy_create_request" => "TagPolicyCreateRequest",
"v2.tag_policy_create_type" => "TagPolicyCreateType",
"v2.tag_policy_data" => "TagPolicyData",
"v2.tag_policy_include" => "TagPolicyInclude",
"v2.tag_policy_relationships" => "TagPolicyRelationships",
"v2.tag_policy_resource_type" => "TagPolicyResourceType",
"v2.tag_policy_response" => "TagPolicyResponse",
"v2.tag_policy_score_attributes" => "TagPolicyScoreAttributes",
"v2.tag_policy_score_data" => "TagPolicyScoreData",
"v2.tag_policy_score_relationship" => "TagPolicyScoreRelationship",
"v2.tag_policy_score_relationship_data" => "TagPolicyScoreRelationshipData",
"v2.tag_policy_score_resource_type" => "TagPolicyScoreResourceType",
"v2.tag_policy_score_response" => "TagPolicyScoreResponse",
"v2.tag_policy_source" => "TagPolicySource",
"v2.tag_policy_type" => "TagPolicyType",
"v2.tag_policy_update_attributes" => "TagPolicyUpdateAttributes",
"v2.tag_policy_update_data" => "TagPolicyUpdateData",
"v2.tag_policy_update_request" => "TagPolicyUpdateRequest",
"v2.targeting_rule" => "TargetingRule",
"v2.targeting_rule_request" => "TargetingRuleRequest",
"v2.team" => "Team",
Expand Down Expand Up @@ -7793,6 +7815,7 @@ def overrides
"v2.stegadography_api" => "StegadographyAPI",
"v2.storage_management_api" => "StorageManagementAPI",
"v2.synthetics_api" => "SyntheticsAPI",
"v2.tag_policies_api" => "TagPoliciesAPI",
"v2.teams_api" => "TeamsAPI",
"v2.test_optimization_api" => "TestOptimizationAPI",
"v2.usage_metering_api" => "UsageMeteringAPI",
Expand Down
Loading
Loading