Skip to content
Open
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
783 changes: 782 additions & 1 deletion .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/v2/case-management/CreateProject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
body = DatadogAPIClient::V2::ProjectCreateRequest.new({
data: DatadogAPIClient::V2::ProjectCreate.new({
attributes: DatadogAPIClient::V2::ProjectCreateAttributes.new({
enabled_custom_case_types: [],
key: "SEC",
name: "Security Investigation",
}),
Expand Down
30 changes: 30 additions & 0 deletions examples/v2/case-management/CreateProjectNotificationRule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Create a notification rule returns "CREATED" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

# there is a valid "project" in the system
PROJECT_ID = ENV["PROJECT_ID"]

body = DatadogAPIClient::V2::CaseNotificationRuleCreateRequest.new({
data: DatadogAPIClient::V2::CaseNotificationRuleCreate.new({
type: DatadogAPIClient::V2::CaseNotificationRuleResourceType::NOTIFICATION_RULE,
attributes: DatadogAPIClient::V2::CaseNotificationRuleCreateAttributes.new({
is_enabled: true,
recipients: [
DatadogAPIClient::V2::CaseNotificationRuleRecipient.new({
type: "email",
data: DatadogAPIClient::V2::CaseNotificationRuleRecipientData.new({
email: "test-Example-Case-Management@example.com",
}),
}),
],
triggers: [
DatadogAPIClient::V2::CaseNotificationRuleTrigger.new({
type: "case_created",
}),
],
}),
}),
})
p api_instance.create_project_notification_rule(PROJECT_ID, body)
11 changes: 11 additions & 0 deletions examples/v2/case-management/DeleteProjectNotificationRule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Delete a notification rule returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

# there is a valid "project" in the system
PROJECT_ID = ENV["PROJECT_ID"]

# there is a valid "case_notification_rule" in the system
CASE_NOTIFICATION_RULE_ID = ENV["CASE_NOTIFICATION_RULE_ID"]
api_instance.delete_project_notification_rule(PROJECT_ID, CASE_NOTIFICATION_RULE_ID)
8 changes: 8 additions & 0 deletions examples/v2/case-management/GetProjectNotificationRules.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get notification rules returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

# there is a valid "project" in the system
PROJECT_ID = ENV["PROJECT_ID"]
p api_instance.get_project_notification_rules(PROJECT_ID)
17 changes: 17 additions & 0 deletions examples/v2/case-management/UpdateProject.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Update a project returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

# there is a valid "project" in the system
PROJECT_ID = ENV["PROJECT_ID"]

body = DatadogAPIClient::V2::ProjectUpdateRequest.new({
data: DatadogAPIClient::V2::ProjectUpdate.new({
type: DatadogAPIClient::V2::ProjectResourceType::PROJECT,
attributes: DatadogAPIClient::V2::ProjectUpdateAttributes.new({
name: "Updated Project Name Example-Case-Management",
}),
}),
})
p api_instance.update_project(PROJECT_ID, body)
20 changes: 20 additions & 0 deletions examples/v2/case-management/UpdateProjectNotificationRule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Update a notification rule returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

# there is a valid "project" in the system
PROJECT_ID = ENV["PROJECT_ID"]

# there is a valid "case_notification_rule" in the system
CASE_NOTIFICATION_RULE_ID = ENV["CASE_NOTIFICATION_RULE_ID"]

body = DatadogAPIClient::V2::CaseNotificationRuleUpdateRequest.new({
data: DatadogAPIClient::V2::CaseNotificationRuleUpdate.new({
type: DatadogAPIClient::V2::CaseNotificationRuleResourceType::NOTIFICATION_RULE,
attributes: DatadogAPIClient::V2::CaseNotificationRuleAttributes.new({
is_enabled: false,
}),
}),
})
p api_instance.update_project_notification_rule(PROJECT_ID, CASE_NOTIFICATION_RULE_ID, body)
20 changes: 20 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,26 @@
"v2.GetProject" => {
"project_id" => "String",
},
"v2.UpdateProject" => {
"project_id" => "String",
"body" => "ProjectUpdateRequest",
},
"v2.GetProjectNotificationRules" => {
"project_id" => "String",
},
"v2.CreateProjectNotificationRule" => {
"project_id" => "String",
"body" => "CaseNotificationRuleCreateRequest",
},
"v2.DeleteProjectNotificationRule" => {
"project_id" => "String",
"notification_rule_id" => "String",
},
"v2.UpdateProjectNotificationRule" => {
"project_id" => "String",
"notification_rule_id" => "String",
"body" => "CaseNotificationRuleUpdateRequest",
},
"v2.GetCase" => {
"case_id" => "String",
},
Expand Down
145 changes: 142 additions & 3 deletions features/v2/case_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,79 @@ Feature: Case Management
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/case-management
Scenario: Create a notification rule returns "Bad Request" response
Given new "CreateProjectNotificationRule" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And body with value {"data": {"type": "notification_rule", "attributes": {"recipients": [], "triggers": []}}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/case-management
Scenario: Create a notification rule returns "CREATED" response
Given new "CreateProjectNotificationRule" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And body with value {"data": {"type": "notification_rule", "attributes": {"is_enabled": true, "recipients": [{"type": "email", "data": {"email": "test-{{ unique }}@example.com"}}], "triggers": [{"type": "case_created"}]}}}
When the request is sent
Then the response status is 201 CREATED
And the response "data" has field "id"
And the response "data.attributes.is_enabled" is equal to true

@team:DataDog/case-management
Scenario: Create a notification rule returns "Not Found" response
Given new "CreateProjectNotificationRule" request
And request contains "project_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
And body with value {"data": {"type": "notification_rule", "attributes": {"is_enabled": true, "recipients": [{"type": "email", "data": {"email": "test@example.com"}}], "triggers": [{"type": "case_created"}]}}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/case-management
Scenario: Create a project returns "Bad Request" response
Given new "CreateProject" request
And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}}
And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/case-management
Scenario: Create a project returns "CREATED" response
Given new "CreateProject" request
And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}}
And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}}
When the request is sent
Then the response status is 201 CREATED

@generated @skip @team:DataDog/case-management
Scenario: Create a project returns "Not Found" response
Given new "CreateProject" request
And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}}
And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/case-management
Scenario: Delete a notification rule returns "API error response" response
Given new "DeleteProjectNotificationRule" request
And request contains "project_id" parameter from "REPLACE.ME"
And request contains "notification_rule_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 API error response

@team:DataDog/case-management
Scenario: Delete a notification rule returns "No Content" response
Given new "DeleteProjectNotificationRule" request
And there is a valid "project" in the system
And there is a valid "case_notification_rule" in the system
And request contains "project_id" parameter from "project.id"
And request contains "notification_rule_id" parameter from "case_notification_rule.id"
When the request is sent
Then the response status is 204 No Content

@team:DataDog/case-management
Scenario: Delete a notification rule returns "Not Found" response
Given new "DeleteProjectNotificationRule" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And request contains "notification_rule_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
When the request is sent
Then the response status is 404 Not Found

Expand Down Expand Up @@ -203,6 +258,28 @@ Feature: Case Management
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/case-management
Scenario: Get notification rules returns "Bad Request" response
Given new "GetProjectNotificationRules" request
And request contains "project_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/case-management
Scenario: Get notification rules returns "Not Found" response
Given new "GetProjectNotificationRules" request
And request contains "project_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/case-management
Scenario: Get notification rules returns "OK" response
Given new "GetProjectNotificationRules" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
When the request is sent
Then the response status is 200 OK

@skip @team:DataDog/case-management
Scenario: Get the details of a case returns "Bad Request" response
Given new "GetCase" request
Expand Down Expand Up @@ -337,6 +414,68 @@ Feature: Case Management
When the request is sent
Then the response status is 200 OK

@team:DataDog/case-management
Scenario: Update a notification rule returns "Bad Request" response
Given new "UpdateProjectNotificationRule" request
And there is a valid "project" in the system
And there is a valid "case_notification_rule" in the system
And request contains "project_id" parameter from "project.id"
And request contains "notification_rule_id" parameter from "case_notification_rule.id"
And body with value {"data": {"type": "invalid_type"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/case-management
Scenario: Update a notification rule returns "Not Found" response
Given new "UpdateProjectNotificationRule" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And request contains "notification_rule_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
And body with value {"data": {"type": "notification_rule", "attributes": {"is_enabled": false}}}
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/case-management
Scenario: Update a notification rule returns "OK" response
Given new "UpdateProjectNotificationRule" request
And there is a valid "project" in the system
And there is a valid "case_notification_rule" in the system
And request contains "project_id" parameter from "project.id"
And request contains "notification_rule_id" parameter from "case_notification_rule.id"
And body with value {"data": {"type": "notification_rule", "attributes": {"is_enabled": false}}}
When the request is sent
Then the response status is 200 OK
And the response "data" has field "id"
And the response "data.attributes.is_enabled" is equal to false

@team:DataDog/case-management
Scenario: Update a project returns "Bad Request" response
Given new "UpdateProject" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And body with value {"data": {"type": "invalid_type"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/case-management
Scenario: Update a project returns "Not Found" response
Given new "UpdateProject" request
And request contains "project_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
And body with value {"data": {"type": "project", "attributes": {"name": "Updated Project Name"}}}
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/case-management
Scenario: Update a project returns "OK" response
Given new "UpdateProject" request
And there is a valid "project" in the system
And request contains "project_id" parameter from "project.id"
And body with value {"data": {"type": "project", "attributes": {"name": "Updated Project Name {{ unique }}"}}}
When the request is sent
Then the response status is 200 OK
And the response "data" has field "id"
And the response "data.attributes.name" is equal to "Updated Project Name {{ unique }}"

@skip @team:DataDog/case-management
Scenario: Update case attributes returns "Bad Request" response
Given new "UpdateAttributes" request
Expand Down
30 changes: 30 additions & 0 deletions features/v2/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,36 @@
"tag": "Case Management",
"operationId": "CreateCase"
},
{
"parameters": [
{
"name": "body",
"value": "{\n \"data\": {\n \"type\": \"project\",\n \"attributes\": {\n \"key\": \"TST\",\n \"name\": \"Test Project {{ unique }}\"\n }\n }\n}"
}
],
"source": "data",
"step": "there is a valid \"project\" in the system",
"key": "project",
"tag": "Case Management",
"operationId": "CreateProject"
},
{
"parameters": [
{
"name": "project_id",
"source": "project.id"
},
{
"name": "body",
"value": "{\n \"data\": {\n \"type\": \"notification_rule\",\n \"attributes\": {\n \"is_enabled\": true,\n \"triggers\": [{\"type\": \"case_created\"}],\n \"recipients\": [{\"type\": \"email\", \"data\": {\"email\": \"test-{{ unique }}@example.com\"}}]\n }\n }\n}"
}
],
"source": "data",
"step": "there is a valid \"case_notification_rule\" in the system",
"key": "case_notification_rule",
"tag": "Case Management",
"operationId": "CreateProjectNotificationRule"
},
{
"parameters": [
{
Expand Down
41 changes: 41 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,47 @@
"type": "safe"
}
},
"UpdateProject": {
"tag": "Case Management",
"undo": {
"type": "idempotent"
}
},
"GetProjectNotificationRules": {
"tag": "Case Management",
"undo": {
"type": "safe"
}
},
"CreateProjectNotificationRule": {
"tag": "Case Management",
"undo": {
"operationId": "DeleteProjectNotificationRule",
"parameters": [
{
"name": "project_id",
"source": "path.project_id"
},
{
"name": "notification_rule_id",
"source": "data.id"
}
],
"type": "unsafe"
}
},
"DeleteProjectNotificationRule": {
"tag": "Case Management",
"undo": {
"type": "idempotent"
}
},
"UpdateProjectNotificationRule": {
"tag": "Case Management",
"undo": {
"type": "idempotent"
}
},
"GetAllCaseTypes": {
"tag": "Case Management Type",
"undo": {
Expand Down
Loading
Loading