diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c1ed2925666..07bda16a906 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -48002,6 +48002,72 @@ components: required: - name type: object + LicensesListResponse: + description: The top-level response object returned by the licenses list endpoint, containing the array of supported SPDX licenses. + properties: + data: + $ref: "#/components/schemas/LicensesListResponseData" + required: + - data + type: object + LicensesListResponseData: + description: The data object in a licenses list response, containing the list of SPDX licenses. + properties: + attributes: + $ref: "#/components/schemas/LicensesListResponseDataAttributes" + id: + description: The unique identifier for this licenses list response. + example: 0190a3d4-1234-7000-8000-000000000000 + type: string + type: + $ref: "#/components/schemas/LicensesListResponseDataType" + required: + - id + - type + - attributes + type: object + LicensesListResponseDataAttributes: + description: The attributes of the licenses list response, containing the array of SPDX licenses. + properties: + licenses: + $ref: "#/components/schemas/LicensesListResponseDataAttributesLicenses" + required: + - licenses + type: object + LicensesListResponseDataAttributesLicenses: + description: The list of SPDX licenses returned by the API. + items: + $ref: "#/components/schemas/LicensesListResponseDataAttributesLicensesItems" + type: array + LicensesListResponseDataAttributesLicensesItems: + description: An SPDX license entry returned by the licenses list endpoint. + properties: + display_name: + description: The human-readable name of the license. + example: MIT License + type: string + identifier: + description: The SPDX identifier of the license. + example: MIT + type: string + short_name: + description: The short name of the license, typically matching the SPDX identifier. + example: MIT + type: string + required: + - display_name + - identifier + - short_name + type: object + LicensesListResponseDataType: + default: licenserequest + description: The type identifier for license list responses. + enum: + - licenserequest + example: licenserequest + type: string + x-enum-varnames: + - LICENSEREQUEST Links: description: The JSON:API links related to pagination. properties: @@ -50672,6 +50738,144 @@ components: type: string x-enum-varnames: - MANAGED_ORGS + McpScanRequest: + description: The top-level request object for submitting an MCP SCA dependency scan. + properties: + data: + $ref: "#/components/schemas/McpScanRequestData" + required: + - data + type: object + McpScanRequestData: + description: The data object in an MCP SCA scan request, containing the scan attributes and request type. + properties: + attributes: + $ref: "#/components/schemas/McpScanRequestDataAttributes" + id: + description: An optional identifier for this scan request. + type: string + type: + $ref: "#/components/schemas/McpScanRequestDataType" + required: + - type + - attributes + type: object + McpScanRequestDataAttributes: + description: The attributes of an MCP SCA scan request, describing the libraries to scan and their context. + properties: + commit_hash: + description: The commit hash of the source code being scanned. + example: 0e9fc8de83eaabecd722e1cd0ed44fb489fe15fc + type: string + libraries: + $ref: "#/components/schemas/McpScanRequestDataAttributesLibraries" + resource_name: + description: The name of the resource (typically the repository or project name) being scanned. + example: my-org/my-repo + type: string + required: + - resource_name + - commit_hash + - libraries + type: object + McpScanRequestDataAttributesLibraries: + description: The list of libraries to scan for vulnerabilities. + items: + $ref: "#/components/schemas/McpScanRequestDataAttributesLibrariesItems" + type: array + McpScanRequestDataAttributesLibrariesItems: + description: A library declaration to include in the dependency scan. + properties: + exclusions: + $ref: "#/components/schemas/McpScanRequestDataAttributesLibrariesItemsExclusions" + is_dev: + description: Whether this library is a development-only dependency. + example: false + type: boolean + is_direct: + description: Whether this library is a direct (rather than transitive) dependency. + example: true + type: boolean + package_manager: + description: The package manager that produced this library entry (for example, `npm`, `pip`, `nuget`). + example: nuget + type: string + purl: + description: The Package URL (PURL) uniquely identifying the library and its version. + example: pkg:nuget/Newtonsoft.Json@13.0.1 + type: string + target_frameworks: + $ref: "#/components/schemas/McpScanRequestDataAttributesLibrariesItemsTargetFrameworks" + required: + - purl + - is_dev + - is_direct + - package_manager + type: object + McpScanRequestDataAttributesLibrariesItemsExclusions: + description: The list of dependency PURLs to exclude when resolving transitive dependencies for this library. + items: + description: A dependency PURL to exclude. + type: string + type: array + McpScanRequestDataAttributesLibrariesItemsTargetFrameworks: + description: The list of target framework identifiers associated with the library. + items: + description: A target framework identifier (for example, `net8.0`). + type: string + type: array + McpScanRequestDataType: + default: mcpscanrequest + description: The type identifier for MCP SCA scan requests. + enum: + - mcpscanrequest + example: mcpscanrequest + type: string + x-enum-varnames: + - MCPSCANREQUEST + McpScanRequestResponse: + description: The top-level response object returned when an MCP SCA dependency scan request has been accepted. + properties: + data: + $ref: "#/components/schemas/McpScanRequestResponseData" + required: + - data + type: object + McpScanRequestResponseData: + description: The data object returned when a scan request has been accepted. + properties: + attributes: + $ref: "#/components/schemas/McpScanRequestResponseDataAttributes" + id: + description: The job identifier assigned to the scan. + example: 0190a3d4-1234-7000-8000-000000000000 + type: string + type: + $ref: "#/components/schemas/McpScanRequestResponseDataType" + required: + - id + - type + - attributes + type: object + McpScanRequestResponseDataAttributes: + description: The attributes returned when a scan request has been accepted, containing the job identifier used to poll for results. + properties: + job_id: + description: The job identifier assigned to the scan, used to retrieve the scan result. + example: 0190a3d4-1234-7000-8000-000000000000 + type: string + required: + - job_id + type: object + McpScanRequestResponseDataType: + default: mcpscanrequestresponse + description: The type identifier for MCP SCA scan request responses. + enum: + - mcpscanrequestresponse + example: mcpscanrequestresponse + type: string + x-enum-varnames: + - MCPSCANREQUESTRESPONSE MemberTeam: description: A member team properties: @@ -67651,7 +67855,7 @@ components: type: object ResolveVulnerableSymbolsResponseDataType: default: resolve-vulnerable-symbols-response - description: The type identifier for responses containing resolved vulnerable symbols. + description: The type identifier for responses containing resolved vulnerable symbols enum: - resolve-vulnerable-symbols-response example: resolve-vulnerable-symbols-response @@ -71369,6 +71573,9 @@ components: type: $ref: "#/components/schemas/ScalarFormulaResponseType" type: object + ScanResultResponse: + description: The raw scan result document produced by the SCA processor. The contents reflect the vulnerabilities and metadata produced for the libraries submitted in the original scan request. + type: object ScannedAssetMetadata: description: The metadata of a scanned asset. properties: @@ -155905,6 +156112,138 @@ paths: tags: - Static Analysis x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/static-analysis-sca/dependencies/scan: + post: + operationId: CreateSCAScan + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + commit_hash: 0e9fc8de83eaabecd722e1cd0ed44fb489fe15fc + libraries: + - exclusions: [] + is_dev: false + is_direct: true + package_manager: nuget + purl: pkg:nuget/Newtonsoft.Json@13.0.1 + target_frameworks: + - net8.0 + resource_name: my-org/my-repo + type: mcpscanrequest + schema: + $ref: "#/components/schemas/McpScanRequest" + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: + data: + attributes: + job_id: 0190a3d4-1234-7000-8000-000000000000 + id: 0190a3d4-1234-7000-8000-000000000000 + type: mcpscanrequestresponse + schema: + $ref: "#/components/schemas/McpScanRequestResponse" + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Submit libraries for vulnerability scanning + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis-sca/dependencies/scan/{job_id}: + get: + operationId: GetSCAScan + parameters: + - description: The job identifier returned when the scan was submitted. + in: path + name: job_id + required: true + schema: + example: 0190a3d4-1234-7000-8000-000000000000 + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + vulnerabilities: [] + schema: + $ref: "#/components/schemas/ScanResultResponse" + description: OK + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Retrieve a dependency scan result + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/static-analysis-sca/licenses/list: + get: + operationId: ListSCALicenses + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + licenses: + - display_name: MIT License + identifier: MIT + short_name: MIT + id: 0190a3d4-1234-7000-8000-000000000000 + type: licenserequest + schema: + $ref: "#/components/schemas/LicensesListResponse" + description: OK + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get the list of SPDX licenses + tags: + - Static Analysis + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols: post: operationId: CreateSCAResolveVulnerableSymbols diff --git a/examples/v2/static-analysis/CreateSCAScan.java b/examples/v2/static-analysis/CreateSCAScan.java new file mode 100644 index 00000000000..22e68ef06b3 --- /dev/null +++ b/examples/v2/static-analysis/CreateSCAScan.java @@ -0,0 +1,48 @@ +// Submit libraries for vulnerability scanning returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.McpScanRequest; +import com.datadog.api.client.v2.model.McpScanRequestData; +import com.datadog.api.client.v2.model.McpScanRequestDataAttributes; +import com.datadog.api.client.v2.model.McpScanRequestDataAttributesLibrariesItems; +import com.datadog.api.client.v2.model.McpScanRequestDataType; +import com.datadog.api.client.v2.model.McpScanRequestResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createSCAScan", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + McpScanRequest body = + new McpScanRequest() + .data( + new McpScanRequestData() + .attributes( + new McpScanRequestDataAttributes() + .commitHash("0e9fc8de83eaabecd722e1cd0ed44fb489fe15fc") + .libraries( + Collections.singletonList( + new McpScanRequestDataAttributesLibrariesItems() + .isDev(false) + .isDirect(true) + .packageManager("nuget") + .purl("pkg:nuget/Newtonsoft.Json@13.0.1"))) + .resourceName("my-org/my-repo")) + .type(McpScanRequestDataType.MCPSCANREQUEST)); + + try { + McpScanRequestResponse result = apiInstance.createSCAScan(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#createSCAScan"); + 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/examples/v2/static-analysis/GetSCAScan.java b/examples/v2/static-analysis/GetSCAScan.java new file mode 100644 index 00000000000..50e6149ec1e --- /dev/null +++ b/examples/v2/static-analysis/GetSCAScan.java @@ -0,0 +1,25 @@ +// Retrieve a dependency scan result returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.ScanResultResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getSCAScan", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + ScanResultResponse result = apiInstance.getSCAScan("0190a3d4-1234-7000-8000-000000000000"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#getSCAScan"); + 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/examples/v2/static-analysis/ListSCALicenses.java b/examples/v2/static-analysis/ListSCALicenses.java new file mode 100644 index 00000000000..8748e228d56 --- /dev/null +++ b/examples/v2/static-analysis/ListSCALicenses.java @@ -0,0 +1,25 @@ +// Get the list of SPDX licenses returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StaticAnalysisApi; +import com.datadog.api.client.v2.model.LicensesListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listSCALicenses", true); + StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient); + + try { + LicensesListResponse result = apiInstance.listSCALicenses(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StaticAnalysisApi#listSCALicenses"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 68d8583171e..63d8b992cff 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1139,6 +1139,7 @@ public class ApiClient { put("v2.createCustomRuleset", false); put("v2.createSCAResolveVulnerableSymbols", false); put("v2.createSCAResult", false); + put("v2.createSCAScan", false); put("v2.deleteAiCustomRule", false); put("v2.deleteAiCustomRuleset", false); put("v2.deleteAiMemoryViolationResult", false); @@ -1150,12 +1151,14 @@ public class ApiClient { put("v2.getCustomRule", false); put("v2.getCustomRuleRevision", false); put("v2.getCustomRuleset", false); + put("v2.getSCAScan", false); put("v2.listAiCustomRuleRevisions", false); put("v2.listAiCustomRulesets", false); put("v2.listAiMemoryViolationResults", false); put("v2.listAiPrompts", false); put("v2.listCustomRuleRevisions", false); put("v2.listCustomRulesets", false); + put("v2.listSCALicenses", false); put("v2.revertCustomRuleRevision", false); put("v2.updateAiCustomRuleset", false); put("v2.updateCustomRuleset", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java b/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java index 6eab587186d..41b7e611ba8 100644 --- a/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java @@ -27,10 +27,14 @@ import com.datadog.api.client.v2.model.CustomRulesetListResponse; import com.datadog.api.client.v2.model.CustomRulesetRequest; import com.datadog.api.client.v2.model.CustomRulesetResponse; +import com.datadog.api.client.v2.model.LicensesListResponse; +import com.datadog.api.client.v2.model.McpScanRequest; +import com.datadog.api.client.v2.model.McpScanRequestResponse; import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsRequest; import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsResponse; import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequest; import com.datadog.api.client.v2.model.ScaRequest; +import com.datadog.api.client.v2.model.ScanResultResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -1578,6 +1582,151 @@ public CompletableFuture> createSCAResultWithHttpInfoAsync(Sca null); } + /** + * Submit libraries for vulnerability scanning. + * + *

See {@link #createSCAScanWithHttpInfo}. + * + * @param body (required) + * @return McpScanRequestResponse + * @throws ApiException if fails to make API call + */ + public McpScanRequestResponse createSCAScan(McpScanRequest body) throws ApiException { + return createSCAScanWithHttpInfo(body).getData(); + } + + /** + * Submit libraries for vulnerability scanning. + * + *

See {@link #createSCAScanWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<McpScanRequestResponse> + */ + public CompletableFuture createSCAScanAsync(McpScanRequest body) { + return createSCAScanWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param body (required) + * @return ApiResponse<McpScanRequestResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse createSCAScanWithHttpInfo(McpScanRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createSCAScan"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createSCAScan"); + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/dependencies/scan"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAScan", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Submit libraries for vulnerability scanning. + * + *

See {@link #createSCAScanWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<McpScanRequestResponse>> + */ + public CompletableFuture> createSCAScanWithHttpInfoAsync( + McpScanRequest body) { + // Check if unstable operation is enabled + String operationId = "createSCAScan"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createSCAScan")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/dependencies/scan"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.createSCAScan", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete an AI custom rule. * @@ -3467,6 +3616,152 @@ public CompletableFuture> getCustomRulesetWit new GenericType() {}); } + /** + * Retrieve a dependency scan result. + * + *

See {@link #getSCAScanWithHttpInfo}. + * + * @param jobId The job identifier returned when the scan was submitted. (required) + * @return ScanResultResponse + * @throws ApiException if fails to make API call + */ + public ScanResultResponse getSCAScan(String jobId) throws ApiException { + return getSCAScanWithHttpInfo(jobId).getData(); + } + + /** + * Retrieve a dependency scan result. + * + *

See {@link #getSCAScanWithHttpInfoAsync}. + * + * @param jobId The job identifier returned when the scan was submitted. (required) + * @return CompletableFuture<ScanResultResponse> + */ + public CompletableFuture getSCAScanAsync(String jobId) { + return getSCAScanWithHttpInfoAsync(jobId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param jobId The job identifier returned when the scan was submitted. (required) + * @return ApiResponse<ScanResultResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getSCAScanWithHttpInfo(String jobId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getSCAScan"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + throw new ApiException(400, "Missing the required parameter 'jobId' when calling getSCAScan"); + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis-sca/dependencies/scan/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.getSCAScan", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Retrieve a dependency scan result. + * + *

See {@link #getSCAScanWithHttpInfo}. + * + * @param jobId The job identifier returned when the scan was submitted. (required) + * @return CompletableFuture<ApiResponse<ScanResultResponse>> + */ + public CompletableFuture> getSCAScanWithHttpInfoAsync( + String jobId) { + // Check if unstable operation is enabled + String operationId = "getSCAScan"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'jobId' when calling getSCAScan")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/static-analysis-sca/dependencies/scan/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.getSCAScan", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listAiCustomRuleRevisions. */ public static class ListAiCustomRuleRevisionsOptionalParameters { private Long pageOffset; @@ -4728,6 +5023,129 @@ public ApiResponse listCustomRulesetsWithHttpInfo() new GenericType() {}); } + /** + * Get the list of SPDX licenses. + * + *

See {@link #listSCALicensesWithHttpInfo}. + * + * @return LicensesListResponse + * @throws ApiException if fails to make API call + */ + public LicensesListResponse listSCALicenses() throws ApiException { + return listSCALicensesWithHttpInfo().getData(); + } + + /** + * Get the list of SPDX licenses. + * + *

See {@link #listSCALicensesWithHttpInfoAsync}. + * + * @return CompletableFuture<LicensesListResponse> + */ + public CompletableFuture listSCALicensesAsync() { + return listSCALicensesWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @return ApiResponse<LicensesListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse listSCALicensesWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "listSCALicenses"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/licenses/list"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listSCALicenses", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get the list of SPDX licenses. + * + *

See {@link #listSCALicensesWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<LicensesListResponse>> + */ + public CompletableFuture> listSCALicensesWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listSCALicenses"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/static-analysis-sca/licenses/list"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StaticAnalysisApi.listSCALicenses", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Revert Custom Rule Revision. * diff --git a/src/main/java/com/datadog/api/client/v2/model/LicensesListResponse.java b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponse.java new file mode 100644 index 00000000000..3b61cc3ea92 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The top-level response object returned by the licenses list endpoint, containing the array of + * supported SPDX licenses. + */ +@JsonPropertyOrder({LicensesListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LicensesListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private LicensesListResponseData data; + + public LicensesListResponse() {} + + @JsonCreator + public LicensesListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) LicensesListResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public LicensesListResponse data(LicensesListResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object in a licenses list response, containing the list of SPDX licenses. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LicensesListResponseData getData() { + return data; + } + + public void setData(LicensesListResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LicensesListResponse + */ + @JsonAnySetter + public LicensesListResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LicensesListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LicensesListResponse licensesListResponse = (LicensesListResponse) o; + return Objects.equals(this.data, licensesListResponse.data) + && Objects.equals(this.additionalProperties, licensesListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LicensesListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseData.java b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseData.java new file mode 100644 index 00000000000..d401e877cca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseData.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data object in a licenses list response, containing the list of SPDX licenses. */ +@JsonPropertyOrder({ + LicensesListResponseData.JSON_PROPERTY_ATTRIBUTES, + LicensesListResponseData.JSON_PROPERTY_ID, + LicensesListResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LicensesListResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private LicensesListResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LicensesListResponseDataType type = LicensesListResponseDataType.LICENSEREQUEST; + + public LicensesListResponseData() {} + + @JsonCreator + public LicensesListResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + LicensesListResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LicensesListResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LicensesListResponseData attributes(LicensesListResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the licenses list response, containing the array of SPDX licenses. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LicensesListResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(LicensesListResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public LicensesListResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier for this licenses list response. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public LicensesListResponseData type(LicensesListResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type identifier for license list responses. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LicensesListResponseDataType getType() { + return type; + } + + public void setType(LicensesListResponseDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LicensesListResponseData + */ + @JsonAnySetter + public LicensesListResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LicensesListResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LicensesListResponseData licensesListResponseData = (LicensesListResponseData) o; + return Objects.equals(this.attributes, licensesListResponseData.attributes) + && Objects.equals(this.id, licensesListResponseData.id) + && Objects.equals(this.type, licensesListResponseData.type) + && Objects.equals(this.additionalProperties, licensesListResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LicensesListResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributes.java new file mode 100644 index 00000000000..d8f70f8d4e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributes.java @@ -0,0 +1,159 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of the licenses list response, containing the array of SPDX licenses. */ +@JsonPropertyOrder({LicensesListResponseDataAttributes.JSON_PROPERTY_LICENSES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LicensesListResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LICENSES = "licenses"; + private List licenses = new ArrayList<>(); + + public LicensesListResponseDataAttributes() {} + + @JsonCreator + public LicensesListResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_LICENSES) + List licenses) { + this.licenses = licenses; + } + + public LicensesListResponseDataAttributes licenses( + List licenses) { + this.licenses = licenses; + for (LicensesListResponseDataAttributesLicensesItems item : licenses) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LicensesListResponseDataAttributes addLicensesItem( + LicensesListResponseDataAttributesLicensesItems licensesItem) { + this.licenses.add(licensesItem); + this.unparsed |= licensesItem.unparsed; + return this; + } + + /** + * The list of SPDX licenses returned by the API. + * + * @return licenses + */ + @JsonProperty(JSON_PROPERTY_LICENSES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getLicenses() { + return licenses; + } + + public void setLicenses(List licenses) { + this.licenses = licenses; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LicensesListResponseDataAttributes + */ + @JsonAnySetter + public LicensesListResponseDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LicensesListResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LicensesListResponseDataAttributes licensesListResponseDataAttributes = + (LicensesListResponseDataAttributes) o; + return Objects.equals(this.licenses, licensesListResponseDataAttributes.licenses) + && Objects.equals( + this.additionalProperties, licensesListResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(licenses, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LicensesListResponseDataAttributes {\n"); + sb.append(" licenses: ").append(toIndentedString(licenses)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributesLicensesItems.java b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributesLicensesItems.java new file mode 100644 index 00000000000..4ca362c0f99 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataAttributesLicensesItems.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An SPDX license entry returned by the licenses list endpoint. */ +@JsonPropertyOrder({ + LicensesListResponseDataAttributesLicensesItems.JSON_PROPERTY_DISPLAY_NAME, + LicensesListResponseDataAttributesLicensesItems.JSON_PROPERTY_IDENTIFIER, + LicensesListResponseDataAttributesLicensesItems.JSON_PROPERTY_SHORT_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LicensesListResponseDataAttributesLicensesItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; + private String displayName; + + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + private String identifier; + + public static final String JSON_PROPERTY_SHORT_NAME = "short_name"; + private String shortName; + + public LicensesListResponseDataAttributesLicensesItems() {} + + @JsonCreator + public LicensesListResponseDataAttributesLicensesItems( + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, + @JsonProperty(required = true, value = JSON_PROPERTY_IDENTIFIER) String identifier, + @JsonProperty(required = true, value = JSON_PROPERTY_SHORT_NAME) String shortName) { + this.displayName = displayName; + this.identifier = identifier; + this.shortName = shortName; + } + + public LicensesListResponseDataAttributesLicensesItems displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The human-readable name of the license. + * + * @return displayName + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public LicensesListResponseDataAttributesLicensesItems identifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * The SPDX identifier of the license. + * + * @return identifier + */ + @JsonProperty(JSON_PROPERTY_IDENTIFIER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public LicensesListResponseDataAttributesLicensesItems shortName(String shortName) { + this.shortName = shortName; + return this; + } + + /** + * The short name of the license, typically matching the SPDX identifier. + * + * @return shortName + */ + @JsonProperty(JSON_PROPERTY_SHORT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getShortName() { + return shortName; + } + + public void setShortName(String shortName) { + this.shortName = shortName; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LicensesListResponseDataAttributesLicensesItems + */ + @JsonAnySetter + public LicensesListResponseDataAttributesLicensesItems putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LicensesListResponseDataAttributesLicensesItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LicensesListResponseDataAttributesLicensesItems + licensesListResponseDataAttributesLicensesItems = + (LicensesListResponseDataAttributesLicensesItems) o; + return Objects.equals( + this.displayName, licensesListResponseDataAttributesLicensesItems.displayName) + && Objects.equals( + this.identifier, licensesListResponseDataAttributesLicensesItems.identifier) + && Objects.equals(this.shortName, licensesListResponseDataAttributesLicensesItems.shortName) + && Objects.equals( + this.additionalProperties, + licensesListResponseDataAttributesLicensesItems.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, identifier, shortName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LicensesListResponseDataAttributesLicensesItems {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" shortName: ").append(toIndentedString(shortName)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataType.java new file mode 100644 index 00000000000..5b3355e2bdb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LicensesListResponseDataType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type identifier for license list responses. */ +@JsonSerialize(using = LicensesListResponseDataType.LicensesListResponseDataTypeSerializer.class) +public class LicensesListResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("licenserequest")); + + public static final LicensesListResponseDataType LICENSEREQUEST = + new LicensesListResponseDataType("licenserequest"); + + LicensesListResponseDataType(String value) { + super(value, allowedValues); + } + + public static class LicensesListResponseDataTypeSerializer + extends StdSerializer { + public LicensesListResponseDataTypeSerializer(Class t) { + super(t); + } + + public LicensesListResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LicensesListResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LicensesListResponseDataType fromValue(String value) { + return new LicensesListResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequest.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequest.java new file mode 100644 index 00000000000..93cef7b3dd9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The top-level request object for submitting an MCP SCA dependency scan. */ +@JsonPropertyOrder({McpScanRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private McpScanRequestData data; + + public McpScanRequest() {} + + @JsonCreator + public McpScanRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) McpScanRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public McpScanRequest data(McpScanRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object in an MCP SCA scan request, containing the scan attributes and request type. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestData getData() { + return data; + } + + public void setData(McpScanRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequest + */ + @JsonAnySetter + public McpScanRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequest mcpScanRequest = (McpScanRequest) o; + return Objects.equals(this.data, mcpScanRequest.data) + && Objects.equals(this.additionalProperties, mcpScanRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestData.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestData.java new file mode 100644 index 00000000000..62092afcc3e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestData.java @@ -0,0 +1,208 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data object in an MCP SCA scan request, containing the scan attributes and request type. */ +@JsonPropertyOrder({ + McpScanRequestData.JSON_PROPERTY_ATTRIBUTES, + McpScanRequestData.JSON_PROPERTY_ID, + McpScanRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private McpScanRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private McpScanRequestDataType type = McpScanRequestDataType.MCPSCANREQUEST; + + public McpScanRequestData() {} + + @JsonCreator + public McpScanRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + McpScanRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) McpScanRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public McpScanRequestData attributes(McpScanRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an MCP SCA scan request, describing the libraries to scan and their context. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(McpScanRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public McpScanRequestData id(String id) { + this.id = id; + return this; + } + + /** + * An optional identifier for this scan request. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public McpScanRequestData type(McpScanRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type identifier for MCP SCA scan requests. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestDataType getType() { + return type; + } + + public void setType(McpScanRequestDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestData + */ + @JsonAnySetter + public McpScanRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestData mcpScanRequestData = (McpScanRequestData) o; + return Objects.equals(this.attributes, mcpScanRequestData.attributes) + && Objects.equals(this.id, mcpScanRequestData.id) + && Objects.equals(this.type, mcpScanRequestData.type) + && Objects.equals(this.additionalProperties, mcpScanRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributes.java new file mode 100644 index 00000000000..7cb1bf854a0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributes.java @@ -0,0 +1,218 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The attributes of an MCP SCA scan request, describing the libraries to scan and their context. + */ +@JsonPropertyOrder({ + McpScanRequestDataAttributes.JSON_PROPERTY_COMMIT_HASH, + McpScanRequestDataAttributes.JSON_PROPERTY_LIBRARIES, + McpScanRequestDataAttributes.JSON_PROPERTY_RESOURCE_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMMIT_HASH = "commit_hash"; + private String commitHash; + + public static final String JSON_PROPERTY_LIBRARIES = "libraries"; + private List libraries = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESOURCE_NAME = "resource_name"; + private String resourceName; + + public McpScanRequestDataAttributes() {} + + @JsonCreator + public McpScanRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_COMMIT_HASH) String commitHash, + @JsonProperty(required = true, value = JSON_PROPERTY_LIBRARIES) + List libraries, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_NAME) String resourceName) { + this.commitHash = commitHash; + this.libraries = libraries; + this.resourceName = resourceName; + } + + public McpScanRequestDataAttributes commitHash(String commitHash) { + this.commitHash = commitHash; + return this; + } + + /** + * The commit hash of the source code being scanned. + * + * @return commitHash + */ + @JsonProperty(JSON_PROPERTY_COMMIT_HASH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCommitHash() { + return commitHash; + } + + public void setCommitHash(String commitHash) { + this.commitHash = commitHash; + } + + public McpScanRequestDataAttributes libraries( + List libraries) { + this.libraries = libraries; + for (McpScanRequestDataAttributesLibrariesItems item : libraries) { + this.unparsed |= item.unparsed; + } + return this; + } + + public McpScanRequestDataAttributes addLibrariesItem( + McpScanRequestDataAttributesLibrariesItems librariesItem) { + this.libraries.add(librariesItem); + this.unparsed |= librariesItem.unparsed; + return this; + } + + /** + * The list of libraries to scan for vulnerabilities. + * + * @return libraries + */ + @JsonProperty(JSON_PROPERTY_LIBRARIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getLibraries() { + return libraries; + } + + public void setLibraries(List libraries) { + this.libraries = libraries; + } + + public McpScanRequestDataAttributes resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * The name of the resource (typically the repository or project name) being scanned. + * + * @return resourceName + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestDataAttributes + */ + @JsonAnySetter + public McpScanRequestDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestDataAttributes mcpScanRequestDataAttributes = (McpScanRequestDataAttributes) o; + return Objects.equals(this.commitHash, mcpScanRequestDataAttributes.commitHash) + && Objects.equals(this.libraries, mcpScanRequestDataAttributes.libraries) + && Objects.equals(this.resourceName, mcpScanRequestDataAttributes.resourceName) + && Objects.equals( + this.additionalProperties, mcpScanRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(commitHash, libraries, resourceName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestDataAttributes {\n"); + sb.append(" commitHash: ").append(toIndentedString(commitHash)).append("\n"); + sb.append(" libraries: ").append(toIndentedString(libraries)).append("\n"); + sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributesLibrariesItems.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributesLibrariesItems.java new file mode 100644 index 00000000000..f46ebef9bf8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataAttributesLibrariesItems.java @@ -0,0 +1,312 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A library declaration to include in the dependency scan. */ +@JsonPropertyOrder({ + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_EXCLUSIONS, + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_IS_DEV, + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_IS_DIRECT, + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_PACKAGE_MANAGER, + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_PURL, + McpScanRequestDataAttributesLibrariesItems.JSON_PROPERTY_TARGET_FRAMEWORKS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestDataAttributesLibrariesItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXCLUSIONS = "exclusions"; + private List exclusions = null; + + public static final String JSON_PROPERTY_IS_DEV = "is_dev"; + private Boolean isDev; + + public static final String JSON_PROPERTY_IS_DIRECT = "is_direct"; + private Boolean isDirect; + + public static final String JSON_PROPERTY_PACKAGE_MANAGER = "package_manager"; + private String packageManager; + + public static final String JSON_PROPERTY_PURL = "purl"; + private String purl; + + public static final String JSON_PROPERTY_TARGET_FRAMEWORKS = "target_frameworks"; + private List targetFrameworks = null; + + public McpScanRequestDataAttributesLibrariesItems() {} + + @JsonCreator + public McpScanRequestDataAttributesLibrariesItems( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_DEV) Boolean isDev, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_DIRECT) Boolean isDirect, + @JsonProperty(required = true, value = JSON_PROPERTY_PACKAGE_MANAGER) String packageManager, + @JsonProperty(required = true, value = JSON_PROPERTY_PURL) String purl) { + this.isDev = isDev; + this.isDirect = isDirect; + this.packageManager = packageManager; + this.purl = purl; + } + + public McpScanRequestDataAttributesLibrariesItems exclusions(List exclusions) { + this.exclusions = exclusions; + return this; + } + + public McpScanRequestDataAttributesLibrariesItems addExclusionsItem(String exclusionsItem) { + if (this.exclusions == null) { + this.exclusions = new ArrayList<>(); + } + this.exclusions.add(exclusionsItem); + return this; + } + + /** + * The list of dependency PURLs to exclude when resolving transitive dependencies for this + * library. + * + * @return exclusions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXCLUSIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getExclusions() { + return exclusions; + } + + public void setExclusions(List exclusions) { + this.exclusions = exclusions; + } + + public McpScanRequestDataAttributesLibrariesItems isDev(Boolean isDev) { + this.isDev = isDev; + return this; + } + + /** + * Whether this library is a development-only dependency. + * + * @return isDev + */ + @JsonProperty(JSON_PROPERTY_IS_DEV) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsDev() { + return isDev; + } + + public void setIsDev(Boolean isDev) { + this.isDev = isDev; + } + + public McpScanRequestDataAttributesLibrariesItems isDirect(Boolean isDirect) { + this.isDirect = isDirect; + return this; + } + + /** + * Whether this library is a direct (rather than transitive) dependency. + * + * @return isDirect + */ + @JsonProperty(JSON_PROPERTY_IS_DIRECT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsDirect() { + return isDirect; + } + + public void setIsDirect(Boolean isDirect) { + this.isDirect = isDirect; + } + + public McpScanRequestDataAttributesLibrariesItems packageManager(String packageManager) { + this.packageManager = packageManager; + return this; + } + + /** + * The package manager that produced this library entry (for example, npm, pip + * , nuget). + * + * @return packageManager + */ + @JsonProperty(JSON_PROPERTY_PACKAGE_MANAGER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPackageManager() { + return packageManager; + } + + public void setPackageManager(String packageManager) { + this.packageManager = packageManager; + } + + public McpScanRequestDataAttributesLibrariesItems purl(String purl) { + this.purl = purl; + return this; + } + + /** + * The Package URL (PURL) uniquely identifying the library and its version. + * + * @return purl + */ + @JsonProperty(JSON_PROPERTY_PURL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPurl() { + return purl; + } + + public void setPurl(String purl) { + this.purl = purl; + } + + public McpScanRequestDataAttributesLibrariesItems targetFrameworks( + List targetFrameworks) { + this.targetFrameworks = targetFrameworks; + return this; + } + + public McpScanRequestDataAttributesLibrariesItems addTargetFrameworksItem( + String targetFrameworksItem) { + if (this.targetFrameworks == null) { + this.targetFrameworks = new ArrayList<>(); + } + this.targetFrameworks.add(targetFrameworksItem); + return this; + } + + /** + * The list of target framework identifiers associated with the library. + * + * @return targetFrameworks + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TARGET_FRAMEWORKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTargetFrameworks() { + return targetFrameworks; + } + + public void setTargetFrameworks(List targetFrameworks) { + this.targetFrameworks = targetFrameworks; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestDataAttributesLibrariesItems + */ + @JsonAnySetter + public McpScanRequestDataAttributesLibrariesItems putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestDataAttributesLibrariesItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestDataAttributesLibrariesItems mcpScanRequestDataAttributesLibrariesItems = + (McpScanRequestDataAttributesLibrariesItems) o; + return Objects.equals(this.exclusions, mcpScanRequestDataAttributesLibrariesItems.exclusions) + && Objects.equals(this.isDev, mcpScanRequestDataAttributesLibrariesItems.isDev) + && Objects.equals(this.isDirect, mcpScanRequestDataAttributesLibrariesItems.isDirect) + && Objects.equals( + this.packageManager, mcpScanRequestDataAttributesLibrariesItems.packageManager) + && Objects.equals(this.purl, mcpScanRequestDataAttributesLibrariesItems.purl) + && Objects.equals( + this.targetFrameworks, mcpScanRequestDataAttributesLibrariesItems.targetFrameworks) + && Objects.equals( + this.additionalProperties, + mcpScanRequestDataAttributesLibrariesItems.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + exclusions, isDev, isDirect, packageManager, purl, targetFrameworks, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestDataAttributesLibrariesItems {\n"); + sb.append(" exclusions: ").append(toIndentedString(exclusions)).append("\n"); + sb.append(" isDev: ").append(toIndentedString(isDev)).append("\n"); + sb.append(" isDirect: ").append(toIndentedString(isDirect)).append("\n"); + sb.append(" packageManager: ").append(toIndentedString(packageManager)).append("\n"); + sb.append(" purl: ").append(toIndentedString(purl)).append("\n"); + sb.append(" targetFrameworks: ").append(toIndentedString(targetFrameworks)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataType.java new file mode 100644 index 00000000000..2ea0bc08b76 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestDataType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type identifier for MCP SCA scan requests. */ +@JsonSerialize(using = McpScanRequestDataType.McpScanRequestDataTypeSerializer.class) +public class McpScanRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("mcpscanrequest")); + + public static final McpScanRequestDataType MCPSCANREQUEST = + new McpScanRequestDataType("mcpscanrequest"); + + McpScanRequestDataType(String value) { + super(value, allowedValues); + } + + public static class McpScanRequestDataTypeSerializer + extends StdSerializer { + public McpScanRequestDataTypeSerializer(Class t) { + super(t); + } + + public McpScanRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + McpScanRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static McpScanRequestDataType fromValue(String value) { + return new McpScanRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponse.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponse.java new file mode 100644 index 00000000000..f3d5473694d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponse.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The top-level response object returned when an MCP SCA dependency scan request has been accepted. + */ +@JsonPropertyOrder({McpScanRequestResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private McpScanRequestResponseData data; + + public McpScanRequestResponse() {} + + @JsonCreator + public McpScanRequestResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) McpScanRequestResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public McpScanRequestResponse data(McpScanRequestResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object returned when a scan request has been accepted. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestResponseData getData() { + return data; + } + + public void setData(McpScanRequestResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestResponse + */ + @JsonAnySetter + public McpScanRequestResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestResponse mcpScanRequestResponse = (McpScanRequestResponse) o; + return Objects.equals(this.data, mcpScanRequestResponse.data) + && Objects.equals(this.additionalProperties, mcpScanRequestResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseData.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseData.java new file mode 100644 index 00000000000..ed5acd87acd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseData.java @@ -0,0 +1,213 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data object returned when a scan request has been accepted. */ +@JsonPropertyOrder({ + McpScanRequestResponseData.JSON_PROPERTY_ATTRIBUTES, + McpScanRequestResponseData.JSON_PROPERTY_ID, + McpScanRequestResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private McpScanRequestResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private McpScanRequestResponseDataType type = + McpScanRequestResponseDataType.MCPSCANREQUESTRESPONSE; + + public McpScanRequestResponseData() {} + + @JsonCreator + public McpScanRequestResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + McpScanRequestResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + McpScanRequestResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public McpScanRequestResponseData attributes(McpScanRequestResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes returned when a scan request has been accepted, containing the job identifier + * used to poll for results. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(McpScanRequestResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public McpScanRequestResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The job identifier assigned to the scan. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public McpScanRequestResponseData type(McpScanRequestResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type identifier for MCP SCA scan request responses. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public McpScanRequestResponseDataType getType() { + return type; + } + + public void setType(McpScanRequestResponseDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestResponseData + */ + @JsonAnySetter + public McpScanRequestResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestResponseData mcpScanRequestResponseData = (McpScanRequestResponseData) o; + return Objects.equals(this.attributes, mcpScanRequestResponseData.attributes) + && Objects.equals(this.id, mcpScanRequestResponseData.id) + && Objects.equals(this.type, mcpScanRequestResponseData.type) + && Objects.equals( + this.additionalProperties, mcpScanRequestResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataAttributes.java new file mode 100644 index 00000000000..878cd3d0359 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataAttributes.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The attributes returned when a scan request has been accepted, containing the job identifier used + * to poll for results. + */ +@JsonPropertyOrder({McpScanRequestResponseDataAttributes.JSON_PROPERTY_JOB_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class McpScanRequestResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_JOB_ID = "job_id"; + private String jobId; + + public McpScanRequestResponseDataAttributes() {} + + @JsonCreator + public McpScanRequestResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_JOB_ID) String jobId) { + this.jobId = jobId; + } + + public McpScanRequestResponseDataAttributes jobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * The job identifier assigned to the scan, used to retrieve the scan result. + * + * @return jobId + */ + @JsonProperty(JSON_PROPERTY_JOB_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return McpScanRequestResponseDataAttributes + */ + @JsonAnySetter + public McpScanRequestResponseDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this McpScanRequestResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + McpScanRequestResponseDataAttributes mcpScanRequestResponseDataAttributes = + (McpScanRequestResponseDataAttributes) o; + return Objects.equals(this.jobId, mcpScanRequestResponseDataAttributes.jobId) + && Objects.equals( + this.additionalProperties, mcpScanRequestResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(jobId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class McpScanRequestResponseDataAttributes {\n"); + sb.append(" jobId: ").append(toIndentedString(jobId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataType.java new file mode 100644 index 00000000000..19cb54bde5d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/McpScanRequestResponseDataType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type identifier for MCP SCA scan request responses. */ +@JsonSerialize( + using = McpScanRequestResponseDataType.McpScanRequestResponseDataTypeSerializer.class) +public class McpScanRequestResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("mcpscanrequestresponse")); + + public static final McpScanRequestResponseDataType MCPSCANREQUESTRESPONSE = + new McpScanRequestResponseDataType("mcpscanrequestresponse"); + + McpScanRequestResponseDataType(String value) { + super(value, allowedValues); + } + + public static class McpScanRequestResponseDataTypeSerializer + extends StdSerializer { + public McpScanRequestResponseDataTypeSerializer(Class t) { + super(t); + } + + public McpScanRequestResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + McpScanRequestResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static McpScanRequestResponseDataType fromValue(String value) { + return new McpScanRequestResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseData.java index aaffa79601b..0827115cbdd 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseData.java +++ b/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseData.java @@ -101,7 +101,7 @@ public ResolveVulnerableSymbolsResponseData type(ResolveVulnerableSymbolsRespons } /** - * The type identifier for responses containing resolved vulnerable symbols. + * The type identifier for responses containing resolved vulnerable symbols * * @return type */ diff --git a/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseDataType.java index 638fa8576f6..65f45d4520b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseDataType.java +++ b/src/main/java/com/datadog/api/client/v2/model/ResolveVulnerableSymbolsResponseDataType.java @@ -18,7 +18,7 @@ import java.util.HashSet; import java.util.Set; -/** The type identifier for responses containing resolved vulnerable symbols. */ +/** The type identifier for responses containing resolved vulnerable symbols */ @JsonSerialize( using = ResolveVulnerableSymbolsResponseDataType.ResolveVulnerableSymbolsResponseDataTypeSerializer diff --git a/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature b/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature index 3d690035c18..5a662bc9c32 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/static_analysis.feature @@ -434,6 +434,13 @@ Feature: Static Analysis When the request is sent Then the response status is 200 Successful response + @generated @skip @team:DataDog/k9-vm-sca + Scenario: Get the list of SPDX licenses returns "OK" response + Given operation "ListSCALicenses" enabled + And new "ListSCALicenses" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast Scenario: List AI custom rule revisions returns "Bad Request" response Given operation "ListAiCustomRuleRevisions" enabled @@ -578,6 +585,22 @@ Feature: Static Analysis When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-sca + Scenario: Retrieve a dependency scan result returns "Not Found" response + Given operation "GetSCAScan" enabled + And new "GetSCAScan" request + And request contains "job_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-vm-sca + Scenario: Retrieve a dependency scan result returns "OK" response + Given operation "GetSCAScan" enabled + And new "GetSCAScan" request + And request contains "job_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-vm-ast Scenario: Revert Custom Rule Revision returns "Bad request" response Given operation "RevertCustomRuleRevision" enabled @@ -679,6 +702,22 @@ Feature: Static Analysis When the request is sent Then the response status is 200 Successful response + @generated @skip @team:DataDog/k9-vm-sca + Scenario: Submit libraries for vulnerability scanning returns "Accepted" response + Given operation "CreateSCAScan" enabled + And new "CreateSCAScan" request + And body with value {"data": {"attributes": {"commit_hash": "0e9fc8de83eaabecd722e1cd0ed44fb489fe15fc", "libraries": [{"exclusions": [], "is_dev": false, "is_direct": true, "package_manager": "nuget", "purl": "pkg:nuget/Newtonsoft.Json@13.0.1", "target_frameworks": []}], "resource_name": "my-org/my-repo"}, "type": "mcpscanrequest"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-vm-sca + Scenario: Submit libraries for vulnerability scanning returns "Bad Request" response + Given operation "CreateSCAScan" enabled + And new "CreateSCAScan" request + And body with value {"data": {"attributes": {"commit_hash": "0e9fc8de83eaabecd722e1cd0ed44fb489fe15fc", "libraries": [{"exclusions": [], "is_dev": false, "is_direct": true, "package_manager": "nuget", "purl": "pkg:nuget/Newtonsoft.Json@13.0.1", "target_frameworks": []}], "resource_name": "my-org/my-repo"}, "type": "mcpscanrequest"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/k9-vm-ast Scenario: Update Custom Ruleset returns "Bad request" response Given operation "UpdateCustomRuleset" enabled diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index d86d61c2288..ed3317d68ce 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -7126,6 +7126,24 @@ "type": "safe" } }, + "CreateSCAScan": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "GetSCAScan": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, + "ListSCALicenses": { + "tag": "Static Analysis", + "undo": { + "type": "safe" + } + }, "CreateSCAResolveVulnerableSymbols": { "tag": "Static Analysis", "undo": {