From 041636aed0cac5875c8f11830858b0797f96f0e7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 16 Apr 2026 14:09:11 +0000 Subject: [PATCH] Regenerate client from commit 253ad71 of spec repo --- .generator/schemas/v2/openapi.yaml | 7 ++- ...nerabilityNotificationRule_2417112739.java | 58 +++++++++++++++++++ .../api/client/v2/model/RuleTypesItems.java | 10 +++- ...ated_the_notification_rule_response.freeze | 1 + ...reated_the_notification_rule_response.json | 53 +++++++++++++++++ .../client/v2/api/security_monitoring.feature | 7 +++ 6 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 examples/v2/security-monitoring/CreateVulnerabilityNotificationRule_2417112739.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8a51fd127ec..933b156f639 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -57465,7 +57465,8 @@ components: Signal-based notification rules can filter signals based on rule types application_security, log_detection, workload_security, signal_correlation, cloud_configuration and infrastructure_configuration. Vulnerability-based notification rules can filter vulnerabilities based on rule types application_code_vulnerability, - application_library_vulnerability, attack_path, container_image_vulnerability, identity_risk, misconfiguration, api_security, host_vulnerability and iac_misconfiguration. + application_library_vulnerability, attack_path, container_image_vulnerability, identity_risk, misconfiguration, + api_security, host_vulnerability, iac_misconfiguration, sast_vulnerability and secret_vulnerability. enum: - application_security - log_detection @@ -57482,6 +57483,8 @@ components: - api_security - host_vulnerability - iac_misconfiguration + - sast_vulnerability + - secret_vulnerability type: string x-enum-varnames: - APPLICATION_SECURITY @@ -57499,6 +57502,8 @@ components: - API_SECURITY - HOST_VULNERABILITY - IAC_MISCONFIGURATION + - SAST_VULNERABILITY + - SECRET_VULNERABILITY RuleUser: description: User creating or modifying a rule. properties: diff --git a/examples/v2/security-monitoring/CreateVulnerabilityNotificationRule_2417112739.java b/examples/v2/security-monitoring/CreateVulnerabilityNotificationRule_2417112739.java new file mode 100644 index 00000000000..366b29cc4be --- /dev/null +++ b/examples/v2/security-monitoring/CreateVulnerabilityNotificationRule_2417112739.java @@ -0,0 +1,58 @@ +// Create a new vulnerability-based notification rule with sast and secret rule types returns +// "Successfully created the +// notification rule." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.CreateNotificationRuleParameters; +import com.datadog.api.client.v2.model.CreateNotificationRuleParametersData; +import com.datadog.api.client.v2.model.CreateNotificationRuleParametersDataAttributes; +import com.datadog.api.client.v2.model.NotificationRuleResponse; +import com.datadog.api.client.v2.model.NotificationRulesType; +import com.datadog.api.client.v2.model.RuleSeverity; +import com.datadog.api.client.v2.model.RuleTypesItems; +import com.datadog.api.client.v2.model.Selectors; +import com.datadog.api.client.v2.model.TriggerSource; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + CreateNotificationRuleParameters body = + new CreateNotificationRuleParameters() + .data( + new CreateNotificationRuleParametersData() + .attributes( + new CreateNotificationRuleParametersDataAttributes() + .enabled(true) + .name("Example-Security-Monitoring") + .selectors( + new Selectors() + .query("(source:production_service OR env:prod)") + .ruleTypes( + Arrays.asList( + RuleTypesItems.SAST_VULNERABILITY, + RuleTypesItems.SECRET_VULNERABILITY)) + .severities(Collections.singletonList(RuleSeverity.CRITICAL)) + .triggerSource(TriggerSource.SECURITY_FINDINGS)) + .targets(Collections.singletonList("@john.doe@email.com")) + .timeAggregation(86400L)) + .type(NotificationRulesType.NOTIFICATION_RULES)); + + try { + NotificationRuleResponse result = apiInstance.createVulnerabilityNotificationRule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#createVulnerabilityNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RuleTypesItems.java b/src/main/java/com/datadog/api/client/v2/model/RuleTypesItems.java index 6fd4f24ef2b..31fd9ddbf18 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RuleTypesItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/RuleTypesItems.java @@ -24,7 +24,8 @@ * signal_correlation, cloud_configuration and infrastructure_configuration. Vulnerability-based * notification rules can filter vulnerabilities based on rule types application_code_vulnerability, * application_library_vulnerability, attack_path, container_image_vulnerability, identity_risk, - * misconfiguration, api_security, host_vulnerability and iac_misconfiguration. + * misconfiguration, api_security, host_vulnerability, iac_misconfiguration, sast_vulnerability and + * secret_vulnerability. */ @JsonSerialize(using = RuleTypesItems.RuleTypesItemsSerializer.class) public class RuleTypesItems extends ModelEnum { @@ -46,7 +47,9 @@ public class RuleTypesItems extends ModelEnum { "misconfiguration", "api_security", "host_vulnerability", - "iac_misconfiguration")); + "iac_misconfiguration", + "sast_vulnerability", + "secret_vulnerability")); public static final RuleTypesItems APPLICATION_SECURITY = new RuleTypesItems("application_security"); @@ -70,6 +73,9 @@ public class RuleTypesItems extends ModelEnum { public static final RuleTypesItems HOST_VULNERABILITY = new RuleTypesItems("host_vulnerability"); public static final RuleTypesItems IAC_MISCONFIGURATION = new RuleTypesItems("iac_misconfiguration"); + public static final RuleTypesItems SAST_VULNERABILITY = new RuleTypesItems("sast_vulnerability"); + public static final RuleTypesItems SECRET_VULNERABILITY = + new RuleTypesItems("secret_vulnerability"); RuleTypesItems(String value) { super(value, allowedValues); diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.freeze new file mode 100644 index 00000000000..0a015a705ff --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.freeze @@ -0,0 +1 @@ +2026-04-16T13:47:18.057Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.json b/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.json new file mode 100644 index 00000000000..d483c30ec0d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfully_created_the_notification_rule_response.json @@ -0,0 +1,53 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"enabled\":true,\"name\":\"Test-Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfu-1776347238\",\"selectors\":{\"query\":\"(source:production_service OR env:prod)\",\"rule_types\":[\"sast_vulnerability\",\"secret_vulnerability\"],\"severities\":[\"critical\"],\"trigger_source\":\"security_findings\"},\"targets\":[\"@john.doe@email.com\"],\"time_aggregation\":86400},\"type\":\"notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/security/vulnerabilities/notification_rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"exz-ipg-n1m\",\"type\":\"notification_rules\",\"attributes\":{\"created_at\":1776347239287,\"created_by\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"enabled\":true,\"modified_at\":1776347239287,\"modified_by\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"name\":\"Test-Create_a_new_vulnerability_based_notification_rule_with_sast_and_secret_rule_types_returns_Successfu-1776347238\",\"selectors\":{\"severities\":[\"critical\"],\"rule_types\":[\"sast_vulnerability\",\"secret_vulnerability\"],\"query\":\"(source:production_service OR env:prod)\",\"trigger_source\":\"security_findings\"},\"targets\":[\"@john.doe@email.com\"],\"time_aggregation\":86400,\"version\":1}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c063ba47-07a3-14ad-0932-fc744f457fd5" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security/vulnerabilities/notification_rules/exz-ipg-n1m", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9dbd8db3-f734-efcb-f0da-5e234a383dd7" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 1fdee4f141b..245f2378408 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -591,6 +591,13 @@ Feature: Security Monitoring When the request is sent Then the response status is 201 Successfully created the notification rule. + @team:DataDog/cloud-security-posture-management + Scenario: Create a new vulnerability-based notification rule with sast and secret rule types returns "Successfully created the notification rule." response + Given new "CreateVulnerabilityNotificationRule" request + And body with value {"data": {"attributes": {"enabled": true, "name": "{{ unique }}", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["sast_vulnerability", "secret_vulnerability"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} + When the request is sent + Then the response status is 201 Successfully created the notification rule. + @team:DataDog/k9-cloud-siem Scenario: Create a scheduled detection rule returns "OK" response Given new "CreateSecurityMonitoringRule" request