diff --git a/.apigentools-info b/.apigentools-info index e933497cebf..70326a2a64d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-31 16:41:33.862946", - "spec_repo_commit": "63c441b2" + "regenerated": "2024-11-04 15:58:45.940406", + "spec_repo_commit": "dee0a779" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-31 16:41:33.881242", - "spec_repo_commit": "63c441b2" + "regenerated": "2024-11-04 15:58:45.959562", + "spec_repo_commit": "dee0a779" } } } \ No newline at end of file diff --git a/examples/v2/security-monitoring/ListFindings_1668290866.java b/examples/v2/security-monitoring/ListFindings_1668290866.java new file mode 100644 index 00000000000..e9e62d273a7 --- /dev/null +++ b/examples/v2/security-monitoring/ListFindings_1668290866.java @@ -0,0 +1,34 @@ +// List findings with detection_type query param returns "OK" 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.api.SecurityMonitoringApi.ListFindingsOptionalParameters; +import com.datadog.api.client.v2.model.FindingVulnerabilityType; +import com.datadog.api.client.v2.model.ListFindingsResponse; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listFindings", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + ListFindingsResponse result = + apiInstance.listFindings( + new ListFindingsOptionalParameters() + .filterVulnerabilityType( + Arrays.asList( + FindingVulnerabilityType.MISCONFIGURATION, + FindingVulnerabilityType.ATTACK_PATH))); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#listFindings"); + 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/test/java/com/datadog/api/TestClient.java b/src/test/java/com/datadog/api/TestClient.java index 25b8fea1955..ba643eac1fb 100644 --- a/src/test/java/com/datadog/api/TestClient.java +++ b/src/test/java/com/datadog/api/TestClient.java @@ -423,10 +423,10 @@ public Invocation.Builder request() { expectedQueryParams.put(entry.getKey(), paramValueList.get(0)); } - List actualQueryValue = Arrays.asList(this.queryParams.entrySet().iterator().next().getValue()); + List actualQueryValue = + Arrays.asList(this.queryParams.entrySet().iterator().next().getValue()); Collections.sort(actualQueryValue); assertEquals(expectedQueryParams, this.queryParams); - } return new TestBuilder(this.client); } diff --git a/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.freeze new file mode 100644 index 00000000000..fc4c1120f10 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-21T20:05:58.636Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.json new file mode 100644 index 00000000000..9746c4594b5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_findings_with_detection_type_query_param_returns_OK_response.json @@ -0,0 +1,34 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/posture_management/findings", + "queryStringParameters": { + "filter[vulnerability_type]": [ + "misconfiguration", + "attack_path" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[],\"meta\":{\"page\":{\"total_filtered_count\":0},\"snapshot_timestamp\":1729541158755}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f6fcc70-3704-b046-2fc3-3728fd9b12b2" + } +] \ 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 27e45dd3c2b..515f65f8283 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 @@ -485,6 +485,14 @@ Feature: Security Monitoring When the request with pagination is sent Then the response status is 200 OK + @team:DataDog/cloud-security-posture-management + Scenario: List findings with detection_type query param returns "OK" response + Given operation "ListFindings" enabled + And new "ListFindings" request + And request contains "filter[vulnerability_type]" parameter with value ["misconfiguration", "attack_path"] + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: List rules returns "Bad Request" response Given new "ListSecurityMonitoringRules" request