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
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "c3e3e39",
"generated": "2025-08-13 13:37:24.916"
"spec_repo_commit": "8001cbb",
"generated": "2025-08-13 20:28:47.526"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

// there is a valid "security_rule" in the system
String SECURITY_RULE_ID = System.getenv("SECURITY_RULE_ID");
// there is a valid "security_rule_hash" in the system
String SECURITY_RULE_HASH_ID = System.getenv("SECURITY_RULE_HASH_ID");

try {
SecurityMonitoringRuleConvertResponse result =
apiInstance.convertExistingSecurityMonitoringRule(SECURITY_RULE_ID);
apiInstance.convertExistingSecurityMonitoringRule(SECURITY_RULE_HASH_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void main(String[] args) {
SecurityMonitoringRuleConvertPayload body =
new SecurityMonitoringRuleConvertPayload(
new SecurityMonitoringStandardRulePayload()
.name("Example-Security-Monitoring")
.name("_49768568946de993")
.queries(
Collections.singletonList(
new SecurityMonitoringStandardRuleQuery()
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-04-24T11:34:50.866Z
2025-08-13T20:13:44.192Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"Test-Convert_a_rule_from_JSON_to_Terraform_returns_OK_response-1745494490\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metric\":\"\",\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
"json": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"_b87eac89722bbff0\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metric\":\"\",\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
},
"headers": {},
"method": "POST",
Expand All @@ -12,7 +12,7 @@
"secure": true
},
"httpResponse": {
"body": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"test-convert_a_rule_from_json_to_terraform_returns_ok_response-1745494490\\\" {\\n\\tname = \\\"Test-Convert_a_rule_from_JSON_to_Terraform_returns_OK_response-1745494490\\\"\\n\\tenabled = true\\n\\tquery {\\n\\t\\tquery = \\\"@test:true\\\"\\n\\t\\tgroup_by_fields = []\\n\\t\\tdistinct_fields = []\\n\\t\\taggregation = \\\"count\\\"\\n\\t\\tname = \\\"\\\"\\n\\t\\tdata_source = \\\"logs\\\"\\n\\t}\\n\\toptions {\\n\\t\\tkeep_alive = 3600\\n\\t\\tmax_signal_duration = 86400\\n\\t\\tdetection_method = \\\"threshold\\\"\\n\\t\\tevaluation_window = 900\\n\\t}\\n\\tcase {\\n\\t\\tname = \\\"\\\"\\n\\t\\tstatus = \\\"info\\\"\\n\\t\\tnotifications = []\\n\\t\\tcondition = \\\"a \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}",
"body": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"_b87eac89722bbff0\\\" {\\n\\tname = \\\"_b87eac89722bbff0\\\"\\n\\tenabled = true\\n\\tquery {\\n\\t\\tquery = \\\"@test:true\\\"\\n\\t\\tgroup_by_fields = []\\n\\t\\tdistinct_fields = []\\n\\t\\taggregation = \\\"count\\\"\\n\\t\\tname = \\\"\\\"\\n\\t\\tdata_source = \\\"logs\\\"\\n\\t}\\n\\toptions {\\n\\t\\tkeep_alive = 3600\\n\\t\\tmax_signal_duration = 86400\\n\\t\\tdetection_method = \\\"threshold\\\"\\n\\t\\tevaluation_window = 900\\n\\t}\\n\\tcase {\\n\\t\\tname = \\\"\\\"\\n\\t\\tstatus = \\\"info\\\"\\n\\t\\tnotifications = []\\n\\t\\tcondition = \\\"a \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -27,6 +27,6 @@
"timeToLive": {
"unlimited": true
},
"id": "cf5cab43-ffe4-7297-9a67-77474c727cac"
"id": "ec4cae32-d40b-fc13-0923-fab39e76bba2"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-04-24T11:34:51.208Z
2025-08-13T20:13:44.611Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metrics\":[],\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
"json": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"_1166a375f2500467\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metrics\":[],\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
},
"headers": {},
"method": "POST",
Expand All @@ -12,7 +12,7 @@
"secure": true
},
"httpResponse": {
"body": "{\"name\":\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\",\"createdAt\":1745494491502,\"isDefault\":false,\"isPartner\":false,\"isEnabled\":true,\"isBeta\":false,\"isDeleted\":false,\"isDeprecated\":false,\"queries\":[{\"query\":\"@test:true\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"cases\":[{\"name\":\"\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 0\"}],\"message\":\"Test rule\",\"tags\":[],\"hasExtendedTitle\":false,\"type\":\"log_detection\",\"filters\":[],\"version\":1,\"id\":\"e60-iv6-d7e\",\"blocking\":false,\"metadata\":{\"entities\":null,\"sources\":null},\"creationAuthorId\":1445416,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"updater\":{\"handle\":\"\",\"name\":\"\"}}",
"body": "{\"name\":\"_1166a375f2500467\",\"createdAt\":1755116024952,\"isDefault\":false,\"isPartner\":false,\"isEnabled\":true,\"isBeta\":false,\"isDeleted\":false,\"isDeprecated\":false,\"queries\":[{\"query\":\"@test:true\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"cases\":[{\"name\":\"\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 0\"}],\"message\":\"Test rule\",\"tags\":[],\"hasExtendedTitle\":false,\"type\":\"log_detection\",\"filters\":[],\"version\":1,\"id\":\"shm-tx8-e8x\",\"blocking\":false,\"metadata\":{\"entities\":null,\"sources\":null},\"creationAuthorId\":1445416,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"updater\":{\"handle\":\"\",\"name\":\"\"}}",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -27,18 +27,18 @@
"timeToLive": {
"unlimited": true
},
"id": "a0052e92-0cc5-1afd-8479-25de6f328de4"
"id": "745201cb-80f6-ba64-8ed7-6d44e0bb9b2e"
},
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v2/security_monitoring/rules/e60-iv6-d7e/convert",
"path": "/api/v2/security_monitoring/rules/shm-tx8-e8x/convert",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"test-convert_an_existing_rule_from_json_to_terraform_returns_ok_response-1745494491\\\" {\\n\\tname = \\\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\\\"\\n\\tenabled = true\\n\\tquery {\\n\\t\\tquery = \\\"@test:true\\\"\\n\\t\\tgroup_by_fields = []\\n\\t\\tdistinct_fields = []\\n\\t\\taggregation = \\\"count\\\"\\n\\t\\tname = \\\"\\\"\\n\\t\\tdata_source = \\\"logs\\\"\\n\\t}\\n\\toptions {\\n\\t\\tkeep_alive = 3600\\n\\t\\tmax_signal_duration = 86400\\n\\t\\tdetection_method = \\\"threshold\\\"\\n\\t\\tevaluation_window = 900\\n\\t}\\n\\tcase {\\n\\t\\tname = \\\"\\\"\\n\\t\\tstatus = \\\"info\\\"\\n\\t\\tnotifications = []\\n\\t\\tcondition = \\\"a \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}",
"body": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"_1166a375f2500467\\\" {\\n\\tname = \\\"_1166a375f2500467\\\"\\n\\tenabled = true\\n\\tquery {\\n\\t\\tquery = \\\"@test:true\\\"\\n\\t\\tgroup_by_fields = []\\n\\t\\tdistinct_fields = []\\n\\t\\taggregation = \\\"count\\\"\\n\\t\\tname = \\\"\\\"\\n\\t\\tdata_source = \\\"logs\\\"\\n\\t}\\n\\toptions {\\n\\t\\tkeep_alive = 3600\\n\\t\\tmax_signal_duration = 86400\\n\\t\\tdetection_method = \\\"threshold\\\"\\n\\t\\tevaluation_window = 900\\n\\t}\\n\\tcase {\\n\\t\\tname = \\\"\\\"\\n\\t\\tstatus = \\\"info\\\"\\n\\t\\tnotifications = []\\n\\t\\tcondition = \\\"a \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -53,13 +53,13 @@
"timeToLive": {
"unlimited": true
},
"id": "d9e5f4a7-8eaa-3589-8987-3efd129df113"
"id": "9d3014a8-ac0f-ab57-30d4-0c2833845480"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v2/security_monitoring/rules/e60-iv6-d7e",
"path": "/api/v2/security_monitoring/rules/shm-tx8-e8x",
"keepAlive": false,
"secure": true
},
Expand All @@ -74,6 +74,6 @@
"timeToLive": {
"unlimited": true
},
"id": "453e930a-3f76-16fa-d5d2-8e2cc982beb0"
"id": "88a9924e-5c70-347c-e9be-b2ff15b95c10"
}
]
12 changes: 12 additions & 0 deletions src/test/resources/com/datadog/api/client/v2/api/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,18 @@
"tag": "Security Monitoring",
"operationId": "CreateSecurityMonitoringRule"
},
{
"parameters": [
{
"name": "body",
"value": "{\n \"name\": \"_{{ unique_hash }}\",\n \"queries\": [{\n \"query\": \"@test:true\",\n \"aggregation\": \"count\",\n \"groupByFields\": [],\n \"distinctFields\": [],\n \"metrics\": []\n }],\n \"filters\": [],\n \"cases\": [{\n \"name\": \"\",\n \"status\": \"info\",\n \"condition\": \"a > 0\",\n \"notifications\": []\n }],\n \"options\": {\n \"evaluationWindow\": 900,\n \"keepAlive\": 3600,\n \"maxSignalDuration\": 86400\n },\n \"message\": \"Test rule\",\n \"tags\": [],\n \"isEnabled\": true,\n \"type\": \"log_detection\"\n}"
}
],
"step": "there is a valid \"security_rule_hash\" in the system",
"key": "security_rule_hash",
"tag": "Security Monitoring",
"operationId": "CreateSecurityMonitoringRule"
},
{
"step": "a valid \"configuration\" in the system",
"key": "configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ Feature: Security Monitoring
@team:DataDog/k9-cloud-security-platform
Scenario: Convert a rule from JSON to Terraform returns "OK" response
Given new "ConvertSecurityMonitoringRuleFromJSONToTerraform" request
And body with value {"name":"{{ unique }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"metric":""}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection"}
And body with value {"name":"_{{ unique_hash }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"metric":""}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection"}
When the request is sent
Then the response status is 200 OK
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"{{ unique_lower }}\" {\n\tname = \"{{ unique }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"

@skip @team:DataDog/k9-cloud-security-platform
Scenario: Convert an existing rule from JSON to Terraform returns "Bad Request" response
Expand All @@ -154,11 +154,11 @@ Feature: Security Monitoring
@team:DataDog/k9-cloud-security-platform
Scenario: Convert an existing rule from JSON to Terraform returns "OK" response
Given new "ConvertExistingSecurityMonitoringRule" request
And there is a valid "security_rule" in the system
And request contains "rule_id" parameter from "security_rule.id"
And there is a valid "security_rule_hash" in the system
And request contains "rule_id" parameter from "security_rule_hash.id"
When the request is sent
Then the response status is 200 OK
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"{{ unique_lower }}\" {\n\tname = \"{{ unique }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"

@skip-validation @team:DataDog/k9-cloud-security-platform
Scenario: Create a cloud_configuration rule returns "OK" response
Expand Down