diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fd30acae59e..cee9ad50485 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28134,6 +28134,249 @@ components: type: string x-enum-varnames: - CUSTOMER_ORG_DISABLE + CycloneDXBom: + description: A CycloneDX 1.5 Bill of Materials (BOM) document containing vulnerability data. + properties: + bomFormat: + description: The BOM format identifier. Must be `CycloneDX`. + example: CycloneDX + type: string + components: + description: The list of scanned software components. Cannot be empty. + items: + $ref: "#/components/schemas/CycloneDXComponent" + type: array + metadata: + $ref: "#/components/schemas/CycloneDXMetadata" + specVersion: + description: The CycloneDX specification version. Must be `1.5`. + example: "1.5" + type: string + version: + description: The version number of the BOM document. + example: 1 + format: int64 + type: integer + vulnerabilities: + description: The list of detected vulnerabilities. Cannot be empty. + items: + $ref: "#/components/schemas/CycloneDXVulnerability" + type: array + required: + - bomFormat + - specVersion + - metadata + - components + - vulnerabilities + type: object + CycloneDXComponent: + description: A software component identified during scanning. + properties: + bom-ref: + description: A unique reference identifier used to link vulnerabilities to this component. + example: a3390fca-c315-41ae-ae05-af5e7859cdee + type: string + name: + description: The name of the component. + example: lodash + type: string + purl: + description: The Package URL (PURL) of the component. Required when `type` is `library`. + example: "pkg:npm/lodash@4.17.21" + type: string + type: + $ref: "#/components/schemas/CycloneDXComponentType" + version: + description: The version of the component. + example: 4.17.21 + type: string + required: + - bom-ref + - type + - name + - version + type: object + CycloneDXComponentType: + description: The type of the scanned component. + enum: + - library + - application + - operating-system + example: library + type: string + x-enum-varnames: + - LIBRARY + - APPLICATION + - OPERATING_SYSTEM + CycloneDXMetadata: + description: Metadata about the BOM, including the scanned asset and the scanner tool. + properties: + component: + $ref: "#/components/schemas/CycloneDXMetadataComponent" + tools: + $ref: "#/components/schemas/CycloneDXMetadataTools" + required: + - component + - tools + type: object + CycloneDXMetadataComponent: + description: The asset that was scanned (for example, a host or container image). + properties: + bom-ref: + description: >- + A unique reference identifier for this metadata component. If set, must match a `bom-ref` in `components`. + example: host-ref-abc123 + type: string + name: + description: The name or identifier of the scanned asset (for example, an instance ID or hostname). + example: i-12345 + type: string + type: + description: The type of the scanned asset. + example: operating-system + type: string + required: + - name + type: object + CycloneDXMetadataTools: + description: Information about the scanner tool that produced this BOM. + properties: + components: + description: The scanner tool components. Must contain exactly one element. + items: + $ref: "#/components/schemas/CycloneDXToolComponent" + type: array + required: + - components + type: object + CycloneDXToolComponent: + description: A scanner tool component. + properties: + name: + description: The name of the scanner tool. + example: my-scanner + type: string + type: + description: The type of the tool component. + example: application + type: string + required: + - name + type: object + CycloneDXVulnerability: + description: A security vulnerability affecting one or more components. + properties: + advisories: + description: External advisory references for the vulnerability. + items: + $ref: "#/components/schemas/CycloneDXVulnerabilityAdvisory" + type: array + affects: + description: >- + The components affected by this vulnerability. Must be non-empty. Each `ref` must match a `bom-ref` in `components`. + items: + $ref: "#/components/schemas/CycloneDXVulnerabilityAffects" + type: array + analysis: + $ref: "#/components/schemas/CycloneDXVulnerabilityAnalysis" + cwes: + description: CWE identifiers associated with the vulnerability. + example: [123, 345] + items: + format: int64 + type: integer + type: array + description: + description: A short description of the vulnerability. + example: "Sample vulnerability detected in the application." + type: string + detail: + description: Detailed information about the vulnerability. + example: "Details about the vulnerability." + type: string + id: + description: The vulnerability identifier (for example, a CVE ID). + example: CVE-2021-1234 + type: string + ratings: + description: The severity ratings for the vulnerability. Must contain exactly one element. + items: + $ref: "#/components/schemas/CycloneDXVulnerabilityRating" + type: array + references: + description: External reference identifiers for the vulnerability. + items: + $ref: "#/components/schemas/CycloneDXVulnerabilityReference" + type: array + required: + - id + - ratings + - affects + type: object + CycloneDXVulnerabilityAdvisory: + description: An external advisory reference for a vulnerability. + properties: + url: + description: The URL of the advisory. + example: "https://example.com/advisory/CVE-2021-1234" + type: string + type: object + CycloneDXVulnerabilityAffects: + description: A reference to a component affected by a vulnerability. + properties: + ref: + description: The `bom-ref` of the affected component. + example: a3390fca-c315-41ae-ae05-af5e7859cdee + type: string + required: + - ref + type: object + CycloneDXVulnerabilityAnalysis: + description: |- + The exploitability analysis for the vulnerability. When `state` is set to `resolved` + or `resolved_with_pedigree`, the vulnerability is closed in Datadog. + Other state values are accepted but have no effect on the vulnerability status. + properties: + state: + description: The vulnerability analysis state. + example: resolved + type: string + type: object + CycloneDXVulnerabilityRating: + description: A severity rating for a vulnerability. + properties: + score: + description: The CVSS score. + example: 9.0 + format: double + type: number + severity: + description: The severity level. + example: high + type: string + vector: + description: The CVSS vector string. + example: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N" + type: string + type: object + CycloneDXVulnerabilityReference: + description: An external reference identifier for a vulnerability. + properties: + id: + description: The identifier of the external reference (for example, a GHSA ID). + example: GHSA-35m5-8cvj-8783 + type: string + source: + $ref: "#/components/schemas/CycloneDXVulnerabilityReferenceSource" + type: object + CycloneDXVulnerabilityReferenceSource: + description: The source of an external vulnerability reference. + properties: + url: + description: The URL of the reference source. + example: "https://example.com" + type: string + type: object DORACustomTags: description: A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event. example: @@ -174464,6 +174707,91 @@ paths: x-sunset: "2027-01-01" x-unstable: |- **Note**: This endpoint is deprecated. See the [List Security Findings endpoint](https://docs.datadoghq.com/api/latest/security-monitoring/#list-security-findings). + post: + description: |- + Import security vulnerabilities from an external scanner in CycloneDX 1.5 format. + + The payload is validated against the CycloneDX 1.5 JSON schema and the following + additional constraints: + + - `metadata`, `metadata.component`, and `metadata.component.name` are required. + - `metadata.tools.components` must contain exactly one element with a `name` field. + - `components` cannot be empty. Each component requires `bom-ref`, `type`, `name`, and `version`. + - When `type` is `library`, `purl` is required and must be a valid PURL. + - When `type` is `operating-system`, `name` must be one of the supported OS values: + `alma`, `alpine`, `amazon`, `azurelinux`, `bottlerocket`, `cbl-mariner`, `chainguard`, + `centos`, `debian`, `fedora`, `opensuse`, `opensuse-leap`, `opensuse-tumbleweed`, + `oracle`, `photon`, `redhat`, `rocky`, `slem`, `sles`, `ubuntu`, `wolfi`, `windows`, `macos`. + - `vulnerabilities` cannot be empty. Each vulnerability requires `id`, exactly one `ratings` entry, + and at least one `affects` entry. + - Each `affects[].ref` must match a `bom-ref` value in `components`. + operationId: ImportSecurityVulnerabilities + requestBody: + content: + application/json: + examples: + default: + value: + bomFormat: CycloneDX + components: + - bom-ref: a3390fca-c315-41ae-ae05-af5e7859cdee + name: lodash + purl: "pkg:npm/lodash@4.17.21" + type: library + version: 4.17.21 + metadata: + component: + name: i-12345 + type: operating-system + tools: + components: + - name: my-scanner + type: application + specVersion: "1.5" + version: 1 + vulnerabilities: + - affects: + - ref: a3390fca-c315-41ae-ae05-af5e7859cdee + description: "Sample vulnerability detected in the application." + id: CVE-2021-1234 + ratings: + - score: 9.0 + severity: high + vector: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N" + schema: + $ref: "#/components/schemas/CycloneDXBom" + required: true + responses: + "200": + description: Vulnerabilities accepted successfully. + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_findings_write + summary: Import security vulnerabilities + tags: + - Security Monitoring + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + 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/security/vulnerabilities/notification_rules: get: description: Returns the list of notification rules for security vulnerabilities. diff --git a/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java b/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java new file mode 100644 index 00000000000..381348455f0 --- /dev/null +++ b/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java @@ -0,0 +1,97 @@ +// Import security vulnerabilities returns "Vulnerabilities accepted successfully." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.CycloneDXBom; +import com.datadog.api.client.v2.model.CycloneDXComponent; +import com.datadog.api.client.v2.model.CycloneDXComponentType; +import com.datadog.api.client.v2.model.CycloneDXMetadata; +import com.datadog.api.client.v2.model.CycloneDXMetadataComponent; +import com.datadog.api.client.v2.model.CycloneDXMetadataTools; +import com.datadog.api.client.v2.model.CycloneDXToolComponent; +import com.datadog.api.client.v2.model.CycloneDXVulnerability; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityAdvisory; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityAffects; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityAnalysis; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityRating; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityReference; +import com.datadog.api.client.v2.model.CycloneDXVulnerabilityReferenceSource; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.importSecurityVulnerabilities", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + CycloneDXBom body = + new CycloneDXBom() + .bomFormat("CycloneDX") + .components( + Collections.singletonList( + new CycloneDXComponent() + .bomRef("a3390fca-c315-41ae-ae05-af5e7859cdee") + .name("lodash") + .purl("pkg:npm/lodash@4.17.21") + .type(CycloneDXComponentType.LIBRARY) + .version("4.17.21"))) + .metadata( + new CycloneDXMetadata() + .component( + new CycloneDXMetadataComponent() + .bomRef("host-ref-abc123") + .name("i-12345") + .type("operating-system")) + .tools( + new CycloneDXMetadataTools() + .components( + Collections.singletonList( + new CycloneDXToolComponent() + .name("my-scanner") + .type("application"))))) + .specVersion("1.5") + .version(1L) + .vulnerabilities( + Collections.singletonList( + new CycloneDXVulnerability() + .advisories( + Collections.singletonList( + new CycloneDXVulnerabilityAdvisory() + .url("https://example.com/advisory/CVE-2021-1234"))) + .affects( + Collections.singletonList( + new CycloneDXVulnerabilityAffects() + .ref("a3390fca-c315-41ae-ae05-af5e7859cdee"))) + .analysis(new CycloneDXVulnerabilityAnalysis().state("resolved")) + .cwes(Arrays.asList(123L, 345L)) + .description("Sample vulnerability detected in the application.") + .detail("Details about the vulnerability.") + .id("CVE-2021-1234") + .ratings( + Collections.singletonList( + new CycloneDXVulnerabilityRating() + .score(9.0) + .severity("high") + .vector("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"))) + .references( + Collections.singletonList( + new CycloneDXVulnerabilityReference() + .id("GHSA-35m5-8cvj-8783") + .source( + new CycloneDXVulnerabilityReferenceSource() + .url("https://example.com")))))); + + try { + apiInstance.importSecurityVulnerabilities(body); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#importSecurityVulnerabilities"); + 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 bd9e92793d5..cbfecb94041 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -951,6 +951,7 @@ public class ApiClient { put("v2.getStaticAnalysisNodeTypes", false); put("v2.getStaticAnalysisRuleset", false); put("v2.getStaticAnalysisTreeSitterWasm", false); + put("v2.importSecurityVulnerabilities", false); put("v2.listFindings", false); put("v2.listHistoricalJobs", false); put("v2.listIndicatorsOfCompromise", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 8464f5331f5..d2aa9fbad52 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -21,6 +21,7 @@ import com.datadog.api.client.v2.model.CreateJiraIssueRequestArray; import com.datadog.api.client.v2.model.CreateNotificationRuleParameters; import com.datadog.api.client.v2.model.CreateServiceNowTicketRequestArray; +import com.datadog.api.client.v2.model.CycloneDXBom; import com.datadog.api.client.v2.model.DefaultRulesetsPerLanguageResponse; import com.datadog.api.client.v2.model.DeleteCustomFrameworkResponse; import com.datadog.api.client.v2.model.DetachCaseRequest; @@ -16190,6 +16191,181 @@ public ApiResponse getVulnerabilityNotificationRu new GenericType() {}); } + /** + * Import security vulnerabilities. + * + *

See {@link #importSecurityVulnerabilitiesWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void importSecurityVulnerabilities(CycloneDXBom body) throws ApiException { + importSecurityVulnerabilitiesWithHttpInfo(body); + } + + /** + * Import security vulnerabilities. + * + *

See {@link #importSecurityVulnerabilitiesWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture importSecurityVulnerabilitiesAsync(CycloneDXBom body) { + return importSecurityVulnerabilitiesWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Import security vulnerabilities from an external scanner in CycloneDX 1.5 format. + * + *

The payload is validated against the CycloneDX 1.5 JSON schema and the following additional + * constraints: + * + *

+ * + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Vulnerabilities accepted successfully. -
400 Bad Request -
403 Forbidden -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse importSecurityVulnerabilitiesWithHttpInfo(CycloneDXBom body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "importSecurityVulnerabilities"; + 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 importSecurityVulnerabilities"); + } + // create path and map variables + String localVarPath = "/api/v2/security/vulnerabilities"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.importSecurityVulnerabilities", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Import security vulnerabilities. + * + *

See {@link #importSecurityVulnerabilitiesWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> importSecurityVulnerabilitiesWithHttpInfoAsync( + CycloneDXBom body) { + // Check if unstable operation is enabled + String operationId = "importSecurityVulnerabilities"; + 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 importSecurityVulnerabilities")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/security/vulnerabilities"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.importSecurityVulnerabilities", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + 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, + null); + } + /** Manage optional parameters to listAssetsSBOMs. */ public static class ListAssetsSBOMsOptionalParameters { private String pageToken; diff --git a/src/main/java/com/datadog/api/client/v2/model/CycloneDXBom.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXBom.java new file mode 100644 index 00000000000..64194ba1e67 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXBom.java @@ -0,0 +1,315 @@ +/* + * 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 CycloneDX 1.5 Bill of Materials (BOM) document containing vulnerability data. */ +@JsonPropertyOrder({ + CycloneDXBom.JSON_PROPERTY_BOM_FORMAT, + CycloneDXBom.JSON_PROPERTY_COMPONENTS, + CycloneDXBom.JSON_PROPERTY_METADATA, + CycloneDXBom.JSON_PROPERTY_SPEC_VERSION, + CycloneDXBom.JSON_PROPERTY_VERSION, + CycloneDXBom.JSON_PROPERTY_VULNERABILITIES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXBom { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BOM_FORMAT = "bomFormat"; + private String bomFormat; + + public static final String JSON_PROPERTY_COMPONENTS = "components"; + private List components = new ArrayList<>(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private CycloneDXMetadata metadata; + + public static final String JSON_PROPERTY_SPEC_VERSION = "specVersion"; + private String specVersion; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public static final String JSON_PROPERTY_VULNERABILITIES = "vulnerabilities"; + private List vulnerabilities = new ArrayList<>(); + + public CycloneDXBom() {} + + @JsonCreator + public CycloneDXBom( + @JsonProperty(required = true, value = JSON_PROPERTY_BOM_FORMAT) String bomFormat, + @JsonProperty(required = true, value = JSON_PROPERTY_COMPONENTS) + List components, + @JsonProperty(required = true, value = JSON_PROPERTY_METADATA) CycloneDXMetadata metadata, + @JsonProperty(required = true, value = JSON_PROPERTY_SPEC_VERSION) String specVersion, + @JsonProperty(required = true, value = JSON_PROPERTY_VULNERABILITIES) + List vulnerabilities) { + this.bomFormat = bomFormat; + this.components = components; + this.metadata = metadata; + this.unparsed |= metadata.unparsed; + this.specVersion = specVersion; + this.vulnerabilities = vulnerabilities; + } + + public CycloneDXBom bomFormat(String bomFormat) { + this.bomFormat = bomFormat; + return this; + } + + /** + * The BOM format identifier. Must be CycloneDX. + * + * @return bomFormat + */ + @JsonProperty(JSON_PROPERTY_BOM_FORMAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBomFormat() { + return bomFormat; + } + + public void setBomFormat(String bomFormat) { + this.bomFormat = bomFormat; + } + + public CycloneDXBom components(List components) { + this.components = components; + for (CycloneDXComponent item : components) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXBom addComponentsItem(CycloneDXComponent componentsItem) { + this.components.add(componentsItem); + this.unparsed |= componentsItem.unparsed; + return this; + } + + /** + * The list of scanned software components. Cannot be empty. + * + * @return components + */ + @JsonProperty(JSON_PROPERTY_COMPONENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getComponents() { + return components; + } + + public void setComponents(List components) { + this.components = components; + } + + public CycloneDXBom metadata(CycloneDXMetadata metadata) { + this.metadata = metadata; + this.unparsed |= metadata.unparsed; + return this; + } + + /** + * Metadata about the BOM, including the scanned asset and the scanner tool. + * + * @return metadata + */ + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXMetadata getMetadata() { + return metadata; + } + + public void setMetadata(CycloneDXMetadata metadata) { + this.metadata = metadata; + } + + public CycloneDXBom specVersion(String specVersion) { + this.specVersion = specVersion; + return this; + } + + /** + * The CycloneDX specification version. Must be 1.5. + * + * @return specVersion + */ + @JsonProperty(JSON_PROPERTY_SPEC_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSpecVersion() { + return specVersion; + } + + public void setSpecVersion(String specVersion) { + this.specVersion = specVersion; + } + + public CycloneDXBom version(Long version) { + this.version = version; + return this; + } + + /** + * The version number of the BOM document. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + public CycloneDXBom vulnerabilities(List vulnerabilities) { + this.vulnerabilities = vulnerabilities; + for (CycloneDXVulnerability item : vulnerabilities) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXBom addVulnerabilitiesItem(CycloneDXVulnerability vulnerabilitiesItem) { + this.vulnerabilities.add(vulnerabilitiesItem); + this.unparsed |= vulnerabilitiesItem.unparsed; + return this; + } + + /** + * The list of detected vulnerabilities. Cannot be empty. + * + * @return vulnerabilities + */ + @JsonProperty(JSON_PROPERTY_VULNERABILITIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getVulnerabilities() { + return vulnerabilities; + } + + public void setVulnerabilities(List vulnerabilities) { + this.vulnerabilities = vulnerabilities; + } + + /** + * 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 CycloneDXBom + */ + @JsonAnySetter + public CycloneDXBom 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 CycloneDXBom object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXBom cycloneDxBom = (CycloneDXBom) o; + return Objects.equals(this.bomFormat, cycloneDxBom.bomFormat) + && Objects.equals(this.components, cycloneDxBom.components) + && Objects.equals(this.metadata, cycloneDxBom.metadata) + && Objects.equals(this.specVersion, cycloneDxBom.specVersion) + && Objects.equals(this.version, cycloneDxBom.version) + && Objects.equals(this.vulnerabilities, cycloneDxBom.vulnerabilities) + && Objects.equals(this.additionalProperties, cycloneDxBom.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + bomFormat, + components, + metadata, + specVersion, + version, + vulnerabilities, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXBom {\n"); + sb.append(" bomFormat: ").append(toIndentedString(bomFormat)).append("\n"); + sb.append(" components: ").append(toIndentedString(components)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" specVersion: ").append(toIndentedString(specVersion)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" vulnerabilities: ").append(toIndentedString(vulnerabilities)).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/CycloneDXComponent.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXComponent.java new file mode 100644 index 00000000000..6924ded0357 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXComponent.java @@ -0,0 +1,262 @@ +/* + * 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; + +/** A software component identified during scanning. */ +@JsonPropertyOrder({ + CycloneDXComponent.JSON_PROPERTY_BOM_REF, + CycloneDXComponent.JSON_PROPERTY_NAME, + CycloneDXComponent.JSON_PROPERTY_PURL, + CycloneDXComponent.JSON_PROPERTY_TYPE, + CycloneDXComponent.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXComponent { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BOM_REF = "bom-ref"; + private String bomRef; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PURL = "purl"; + private String purl; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CycloneDXComponentType type; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public CycloneDXComponent() {} + + @JsonCreator + public CycloneDXComponent( + @JsonProperty(required = true, value = JSON_PROPERTY_BOM_REF) String bomRef, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CycloneDXComponentType type, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) String version) { + this.bomRef = bomRef; + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + this.version = version; + } + + public CycloneDXComponent bomRef(String bomRef) { + this.bomRef = bomRef; + return this; + } + + /** + * A unique reference identifier used to link vulnerabilities to this component. + * + * @return bomRef + */ + @JsonProperty(JSON_PROPERTY_BOM_REF) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBomRef() { + return bomRef; + } + + public void setBomRef(String bomRef) { + this.bomRef = bomRef; + } + + public CycloneDXComponent name(String name) { + this.name = name; + return this; + } + + /** + * The name of the component. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CycloneDXComponent purl(String purl) { + this.purl = purl; + return this; + } + + /** + * The Package URL (PURL) of the component. Required when type is library + * . + * + * @return purl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PURL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPurl() { + return purl; + } + + public void setPurl(String purl) { + this.purl = purl; + } + + public CycloneDXComponent type(CycloneDXComponentType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the scanned component. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXComponentType getType() { + return type; + } + + public void setType(CycloneDXComponentType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public CycloneDXComponent version(String version) { + this.version = version; + return this; + } + + /** + * The version of the component. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * 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 CycloneDXComponent + */ + @JsonAnySetter + public CycloneDXComponent 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 CycloneDXComponent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXComponent cycloneDxComponent = (CycloneDXComponent) o; + return Objects.equals(this.bomRef, cycloneDxComponent.bomRef) + && Objects.equals(this.name, cycloneDxComponent.name) + && Objects.equals(this.purl, cycloneDxComponent.purl) + && Objects.equals(this.type, cycloneDxComponent.type) + && Objects.equals(this.version, cycloneDxComponent.version) + && Objects.equals(this.additionalProperties, cycloneDxComponent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bomRef, name, purl, type, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXComponent {\n"); + sb.append(" bomRef: ").append(toIndentedString(bomRef)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" purl: ").append(toIndentedString(purl)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/CycloneDXComponentType.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXComponentType.java new file mode 100644 index 00000000000..bf4d4ed45d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXComponentType.java @@ -0,0 +1,60 @@ +/* + * 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 of the scanned component. */ +@JsonSerialize(using = CycloneDXComponentType.CycloneDXComponentTypeSerializer.class) +public class CycloneDXComponentType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("library", "application", "operating-system")); + + public static final CycloneDXComponentType LIBRARY = new CycloneDXComponentType("library"); + public static final CycloneDXComponentType APPLICATION = + new CycloneDXComponentType("application"); + public static final CycloneDXComponentType OPERATING_SYSTEM = + new CycloneDXComponentType("operating-system"); + + CycloneDXComponentType(String value) { + super(value, allowedValues); + } + + public static class CycloneDXComponentTypeSerializer + extends StdSerializer { + public CycloneDXComponentTypeSerializer(Class t) { + super(t); + } + + public CycloneDXComponentTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CycloneDXComponentType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CycloneDXComponentType fromValue(String value) { + return new CycloneDXComponentType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadata.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadata.java new file mode 100644 index 00000000000..99c01b02e65 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadata.java @@ -0,0 +1,178 @@ +/* + * 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; + +/** Metadata about the BOM, including the scanned asset and the scanner tool. */ +@JsonPropertyOrder({ + CycloneDXMetadata.JSON_PROPERTY_COMPONENT, + CycloneDXMetadata.JSON_PROPERTY_TOOLS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMPONENT = "component"; + private CycloneDXMetadataComponent component; + + public static final String JSON_PROPERTY_TOOLS = "tools"; + private CycloneDXMetadataTools tools; + + public CycloneDXMetadata() {} + + @JsonCreator + public CycloneDXMetadata( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPONENT) + CycloneDXMetadataComponent component, + @JsonProperty(required = true, value = JSON_PROPERTY_TOOLS) CycloneDXMetadataTools tools) { + this.component = component; + this.unparsed |= component.unparsed; + this.tools = tools; + this.unparsed |= tools.unparsed; + } + + public CycloneDXMetadata component(CycloneDXMetadataComponent component) { + this.component = component; + this.unparsed |= component.unparsed; + return this; + } + + /** + * The asset that was scanned (for example, a host or container image). + * + * @return component + */ + @JsonProperty(JSON_PROPERTY_COMPONENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXMetadataComponent getComponent() { + return component; + } + + public void setComponent(CycloneDXMetadataComponent component) { + this.component = component; + } + + public CycloneDXMetadata tools(CycloneDXMetadataTools tools) { + this.tools = tools; + this.unparsed |= tools.unparsed; + return this; + } + + /** + * Information about the scanner tool that produced this BOM. + * + * @return tools + */ + @JsonProperty(JSON_PROPERTY_TOOLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXMetadataTools getTools() { + return tools; + } + + public void setTools(CycloneDXMetadataTools tools) { + this.tools = tools; + } + + /** + * 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 CycloneDXMetadata + */ + @JsonAnySetter + public CycloneDXMetadata 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 CycloneDXMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXMetadata cycloneDxMetadata = (CycloneDXMetadata) o; + return Objects.equals(this.component, cycloneDxMetadata.component) + && Objects.equals(this.tools, cycloneDxMetadata.tools) + && Objects.equals(this.additionalProperties, cycloneDxMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(component, tools, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXMetadata {\n"); + sb.append(" component: ").append(toIndentedString(component)).append("\n"); + sb.append(" tools: ").append(toIndentedString(tools)).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/CycloneDXMetadataComponent.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadataComponent.java new file mode 100644 index 00000000000..0ffa5ee5e25 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadataComponent.java @@ -0,0 +1,201 @@ +/* + * 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 asset that was scanned (for example, a host or container image). */ +@JsonPropertyOrder({ + CycloneDXMetadataComponent.JSON_PROPERTY_BOM_REF, + CycloneDXMetadataComponent.JSON_PROPERTY_NAME, + CycloneDXMetadataComponent.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXMetadataComponent { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BOM_REF = "bom-ref"; + private String bomRef; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public CycloneDXMetadataComponent() {} + + @JsonCreator + public CycloneDXMetadataComponent( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public CycloneDXMetadataComponent bomRef(String bomRef) { + this.bomRef = bomRef; + return this; + } + + /** + * A unique reference identifier for this metadata component. If set, must match a bom-ref + * in components. + * + * @return bomRef + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BOM_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBomRef() { + return bomRef; + } + + public void setBomRef(String bomRef) { + this.bomRef = bomRef; + } + + public CycloneDXMetadataComponent name(String name) { + this.name = name; + return this; + } + + /** + * The name or identifier of the scanned asset (for example, an instance ID or hostname). + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CycloneDXMetadataComponent type(String type) { + this.type = type; + return this; + } + + /** + * The type of the scanned asset. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 CycloneDXMetadataComponent + */ + @JsonAnySetter + public CycloneDXMetadataComponent 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 CycloneDXMetadataComponent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXMetadataComponent cycloneDxMetadataComponent = (CycloneDXMetadataComponent) o; + return Objects.equals(this.bomRef, cycloneDxMetadataComponent.bomRef) + && Objects.equals(this.name, cycloneDxMetadataComponent.name) + && Objects.equals(this.type, cycloneDxMetadataComponent.type) + && Objects.equals( + this.additionalProperties, cycloneDxMetadataComponent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bomRef, name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXMetadataComponent {\n"); + sb.append(" bomRef: ").append(toIndentedString(bomRef)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/CycloneDXMetadataTools.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadataTools.java new file mode 100644 index 00000000000..09279f95d24 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXMetadataTools.java @@ -0,0 +1,155 @@ +/* + * 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; + +/** Information about the scanner tool that produced this BOM. */ +@JsonPropertyOrder({CycloneDXMetadataTools.JSON_PROPERTY_COMPONENTS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXMetadataTools { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMPONENTS = "components"; + private List components = new ArrayList<>(); + + public CycloneDXMetadataTools() {} + + @JsonCreator + public CycloneDXMetadataTools( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPONENTS) + List components) { + this.components = components; + } + + public CycloneDXMetadataTools components(List components) { + this.components = components; + for (CycloneDXToolComponent item : components) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXMetadataTools addComponentsItem(CycloneDXToolComponent componentsItem) { + this.components.add(componentsItem); + this.unparsed |= componentsItem.unparsed; + return this; + } + + /** + * The scanner tool components. Must contain exactly one element. + * + * @return components + */ + @JsonProperty(JSON_PROPERTY_COMPONENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getComponents() { + return components; + } + + public void setComponents(List components) { + this.components = components; + } + + /** + * 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 CycloneDXMetadataTools + */ + @JsonAnySetter + public CycloneDXMetadataTools 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 CycloneDXMetadataTools object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXMetadataTools cycloneDxMetadataTools = (CycloneDXMetadataTools) o; + return Objects.equals(this.components, cycloneDxMetadataTools.components) + && Objects.equals(this.additionalProperties, cycloneDxMetadataTools.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(components, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXMetadataTools {\n"); + sb.append(" components: ").append(toIndentedString(components)).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/CycloneDXToolComponent.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXToolComponent.java new file mode 100644 index 00000000000..f13e659c213 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXToolComponent.java @@ -0,0 +1,172 @@ +/* + * 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; + +/** A scanner tool component. */ +@JsonPropertyOrder({ + CycloneDXToolComponent.JSON_PROPERTY_NAME, + CycloneDXToolComponent.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXToolComponent { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public CycloneDXToolComponent() {} + + @JsonCreator + public CycloneDXToolComponent( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public CycloneDXToolComponent name(String name) { + this.name = name; + return this; + } + + /** + * The name of the scanner tool. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CycloneDXToolComponent type(String type) { + this.type = type; + return this; + } + + /** + * The type of the tool component. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 CycloneDXToolComponent + */ + @JsonAnySetter + public CycloneDXToolComponent 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 CycloneDXToolComponent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXToolComponent cycloneDxToolComponent = (CycloneDXToolComponent) o; + return Objects.equals(this.name, cycloneDxToolComponent.name) + && Objects.equals(this.type, cycloneDxToolComponent.type) + && Objects.equals(this.additionalProperties, cycloneDxToolComponent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXToolComponent {\n"); + sb.append(" name: ").append(toIndentedString(name)).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/CycloneDXVulnerability.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerability.java new file mode 100644 index 00000000000..06d751e29da --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerability.java @@ -0,0 +1,431 @@ +/* + * 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 security vulnerability affecting one or more components. */ +@JsonPropertyOrder({ + CycloneDXVulnerability.JSON_PROPERTY_ADVISORIES, + CycloneDXVulnerability.JSON_PROPERTY_AFFECTS, + CycloneDXVulnerability.JSON_PROPERTY_ANALYSIS, + CycloneDXVulnerability.JSON_PROPERTY_CWES, + CycloneDXVulnerability.JSON_PROPERTY_DESCRIPTION, + CycloneDXVulnerability.JSON_PROPERTY_DETAIL, + CycloneDXVulnerability.JSON_PROPERTY_ID, + CycloneDXVulnerability.JSON_PROPERTY_RATINGS, + CycloneDXVulnerability.JSON_PROPERTY_REFERENCES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerability { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADVISORIES = "advisories"; + private List advisories = null; + + public static final String JSON_PROPERTY_AFFECTS = "affects"; + private List affects = new ArrayList<>(); + + public static final String JSON_PROPERTY_ANALYSIS = "analysis"; + private CycloneDXVulnerabilityAnalysis analysis; + + public static final String JSON_PROPERTY_CWES = "cwes"; + private List cwes = null; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RATINGS = "ratings"; + private List ratings = new ArrayList<>(); + + public static final String JSON_PROPERTY_REFERENCES = "references"; + private List references = null; + + public CycloneDXVulnerability() {} + + @JsonCreator + public CycloneDXVulnerability( + @JsonProperty(required = true, value = JSON_PROPERTY_AFFECTS) + List affects, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_RATINGS) + List ratings) { + this.affects = affects; + this.id = id; + this.ratings = ratings; + } + + public CycloneDXVulnerability advisories(List advisories) { + this.advisories = advisories; + for (CycloneDXVulnerabilityAdvisory item : advisories) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addAdvisoriesItem(CycloneDXVulnerabilityAdvisory advisoriesItem) { + if (this.advisories == null) { + this.advisories = new ArrayList<>(); + } + this.advisories.add(advisoriesItem); + this.unparsed |= advisoriesItem.unparsed; + return this; + } + + /** + * External advisory references for the vulnerability. + * + * @return advisories + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADVISORIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAdvisories() { + return advisories; + } + + public void setAdvisories(List advisories) { + this.advisories = advisories; + } + + public CycloneDXVulnerability affects(List affects) { + this.affects = affects; + for (CycloneDXVulnerabilityAffects item : affects) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addAffectsItem(CycloneDXVulnerabilityAffects affectsItem) { + this.affects.add(affectsItem); + this.unparsed |= affectsItem.unparsed; + return this; + } + + /** + * The components affected by this vulnerability. Must be non-empty. Each ref must + * match a bom-ref in components. + * + * @return affects + */ + @JsonProperty(JSON_PROPERTY_AFFECTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAffects() { + return affects; + } + + public void setAffects(List affects) { + this.affects = affects; + } + + public CycloneDXVulnerability analysis(CycloneDXVulnerabilityAnalysis analysis) { + this.analysis = analysis; + this.unparsed |= analysis.unparsed; + return this; + } + + /** + * The exploitability analysis for the vulnerability. When state is set to + * resolved or resolved_with_pedigree, the vulnerability is closed in Datadog. + * Other state values are accepted but have no effect on the vulnerability status. + * + * @return analysis + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ANALYSIS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CycloneDXVulnerabilityAnalysis getAnalysis() { + return analysis; + } + + public void setAnalysis(CycloneDXVulnerabilityAnalysis analysis) { + this.analysis = analysis; + } + + public CycloneDXVulnerability cwes(List cwes) { + this.cwes = cwes; + return this; + } + + public CycloneDXVulnerability addCwesItem(Long cwesItem) { + if (this.cwes == null) { + this.cwes = new ArrayList<>(); + } + this.cwes.add(cwesItem); + return this; + } + + /** + * CWE identifiers associated with the vulnerability. + * + * @return cwes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CWES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCwes() { + return cwes; + } + + public void setCwes(List cwes) { + this.cwes = cwes; + } + + public CycloneDXVulnerability description(String description) { + this.description = description; + return this; + } + + /** + * A short description of the vulnerability. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CycloneDXVulnerability detail(String detail) { + this.detail = detail; + return this; + } + + /** + * Detailed information about the vulnerability. + * + * @return detail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public CycloneDXVulnerability id(String id) { + this.id = id; + return this; + } + + /** + * The vulnerability identifier (for example, a CVE ID). + * + * @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 CycloneDXVulnerability ratings(List ratings) { + this.ratings = ratings; + for (CycloneDXVulnerabilityRating item : ratings) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addRatingsItem(CycloneDXVulnerabilityRating ratingsItem) { + this.ratings.add(ratingsItem); + this.unparsed |= ratingsItem.unparsed; + return this; + } + + /** + * The severity ratings for the vulnerability. Must contain exactly one element. + * + * @return ratings + */ + @JsonProperty(JSON_PROPERTY_RATINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRatings() { + return ratings; + } + + public void setRatings(List ratings) { + this.ratings = ratings; + } + + public CycloneDXVulnerability references(List references) { + this.references = references; + for (CycloneDXVulnerabilityReference item : references) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addReferencesItem(CycloneDXVulnerabilityReference referencesItem) { + if (this.references == null) { + this.references = new ArrayList<>(); + } + this.references.add(referencesItem); + this.unparsed |= referencesItem.unparsed; + return this; + } + + /** + * External reference identifiers for the vulnerability. + * + * @return references + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getReferences() { + return references; + } + + public void setReferences(List references) { + this.references = references; + } + + /** + * 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 CycloneDXVulnerability + */ + @JsonAnySetter + public CycloneDXVulnerability 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 CycloneDXVulnerability object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerability cycloneDxVulnerability = (CycloneDXVulnerability) o; + return Objects.equals(this.advisories, cycloneDxVulnerability.advisories) + && Objects.equals(this.affects, cycloneDxVulnerability.affects) + && Objects.equals(this.analysis, cycloneDxVulnerability.analysis) + && Objects.equals(this.cwes, cycloneDxVulnerability.cwes) + && Objects.equals(this.description, cycloneDxVulnerability.description) + && Objects.equals(this.detail, cycloneDxVulnerability.detail) + && Objects.equals(this.id, cycloneDxVulnerability.id) + && Objects.equals(this.ratings, cycloneDxVulnerability.ratings) + && Objects.equals(this.references, cycloneDxVulnerability.references) + && Objects.equals(this.additionalProperties, cycloneDxVulnerability.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + advisories, + affects, + analysis, + cwes, + description, + detail, + id, + ratings, + references, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerability {\n"); + sb.append(" advisories: ").append(toIndentedString(advisories)).append("\n"); + sb.append(" affects: ").append(toIndentedString(affects)).append("\n"); + sb.append(" analysis: ").append(toIndentedString(analysis)).append("\n"); + sb.append(" cwes: ").append(toIndentedString(cwes)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ratings: ").append(toIndentedString(ratings)).append("\n"); + sb.append(" references: ").append(toIndentedString(references)).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/CycloneDXVulnerabilityAdvisory.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAdvisory.java new file mode 100644 index 00000000000..52c2630e2d0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAdvisory.java @@ -0,0 +1,137 @@ +/* + * 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.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 external advisory reference for a vulnerability. */ +@JsonPropertyOrder({CycloneDXVulnerabilityAdvisory.JSON_PROPERTY_URL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityAdvisory { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CycloneDXVulnerabilityAdvisory url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the advisory. + * + * @return url + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * 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 CycloneDXVulnerabilityAdvisory + */ + @JsonAnySetter + public CycloneDXVulnerabilityAdvisory 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 CycloneDXVulnerabilityAdvisory object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityAdvisory cycloneDxVulnerabilityAdvisory = + (CycloneDXVulnerabilityAdvisory) o; + return Objects.equals(this.url, cycloneDxVulnerabilityAdvisory.url) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityAdvisory.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityAdvisory {\n"); + sb.append(" url: ").append(toIndentedString(url)).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/CycloneDXVulnerabilityAffects.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAffects.java new file mode 100644 index 00000000000..740b2fb6af1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAffects.java @@ -0,0 +1,144 @@ +/* + * 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; + +/** A reference to a component affected by a vulnerability. */ +@JsonPropertyOrder({CycloneDXVulnerabilityAffects.JSON_PROPERTY_REF}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityAffects { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_REF = "ref"; + private String ref; + + public CycloneDXVulnerabilityAffects() {} + + @JsonCreator + public CycloneDXVulnerabilityAffects( + @JsonProperty(required = true, value = JSON_PROPERTY_REF) String ref) { + this.ref = ref; + } + + public CycloneDXVulnerabilityAffects ref(String ref) { + this.ref = ref; + return this; + } + + /** + * The bom-ref of the affected component. + * + * @return ref + */ + @JsonProperty(JSON_PROPERTY_REF) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRef() { + return ref; + } + + public void setRef(String ref) { + this.ref = ref; + } + + /** + * 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 CycloneDXVulnerabilityAffects + */ + @JsonAnySetter + public CycloneDXVulnerabilityAffects 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 CycloneDXVulnerabilityAffects object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityAffects cycloneDxVulnerabilityAffects = (CycloneDXVulnerabilityAffects) o; + return Objects.equals(this.ref, cycloneDxVulnerabilityAffects.ref) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityAffects.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ref, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityAffects {\n"); + sb.append(" ref: ").append(toIndentedString(ref)).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/CycloneDXVulnerabilityAnalysis.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAnalysis.java new file mode 100644 index 00000000000..5fb2110d4e7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityAnalysis.java @@ -0,0 +1,141 @@ +/* + * 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.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 exploitability analysis for the vulnerability. When state is set to + * resolved or resolved_with_pedigree, the vulnerability is closed in Datadog. + * Other state values are accepted but have no effect on the vulnerability status. + */ +@JsonPropertyOrder({CycloneDXVulnerabilityAnalysis.JSON_PROPERTY_STATE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityAnalysis { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_STATE = "state"; + private String state; + + public CycloneDXVulnerabilityAnalysis state(String state) { + this.state = state; + return this; + } + + /** + * The vulnerability analysis state. + * + * @return state + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + /** + * 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 CycloneDXVulnerabilityAnalysis + */ + @JsonAnySetter + public CycloneDXVulnerabilityAnalysis 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 CycloneDXVulnerabilityAnalysis object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityAnalysis cycloneDxVulnerabilityAnalysis = + (CycloneDXVulnerabilityAnalysis) o; + return Objects.equals(this.state, cycloneDxVulnerabilityAnalysis.state) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityAnalysis.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(state, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityAnalysis {\n"); + sb.append(" state: ").append(toIndentedString(state)).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/CycloneDXVulnerabilityRating.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityRating.java new file mode 100644 index 00000000000..3846660ab92 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityRating.java @@ -0,0 +1,192 @@ +/* + * 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.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; + +/** A severity rating for a vulnerability. */ +@JsonPropertyOrder({ + CycloneDXVulnerabilityRating.JSON_PROPERTY_SCORE, + CycloneDXVulnerabilityRating.JSON_PROPERTY_SEVERITY, + CycloneDXVulnerabilityRating.JSON_PROPERTY_VECTOR +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityRating { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SCORE = "score"; + private Double score; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private String severity; + + public static final String JSON_PROPERTY_VECTOR = "vector"; + private String vector; + + public CycloneDXVulnerabilityRating score(Double score) { + this.score = score; + return this; + } + + /** + * The CVSS score. + * + * @return score + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public CycloneDXVulnerabilityRating severity(String severity) { + this.severity = severity; + return this; + } + + /** + * The severity level. + * + * @return severity + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public CycloneDXVulnerabilityRating vector(String vector) { + this.vector = vector; + return this; + } + + /** + * The CVSS vector string. + * + * @return vector + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VECTOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVector() { + return vector; + } + + public void setVector(String vector) { + this.vector = vector; + } + + /** + * 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 CycloneDXVulnerabilityRating + */ + @JsonAnySetter + public CycloneDXVulnerabilityRating 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 CycloneDXVulnerabilityRating object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityRating cycloneDxVulnerabilityRating = (CycloneDXVulnerabilityRating) o; + return Objects.equals(this.score, cycloneDxVulnerabilityRating.score) + && Objects.equals(this.severity, cycloneDxVulnerabilityRating.severity) + && Objects.equals(this.vector, cycloneDxVulnerabilityRating.vector) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityRating.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(score, severity, vector, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityRating {\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" vector: ").append(toIndentedString(vector)).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/CycloneDXVulnerabilityReference.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityReference.java new file mode 100644 index 00000000000..b690e32b684 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityReference.java @@ -0,0 +1,167 @@ +/* + * 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.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 external reference identifier for a vulnerability. */ +@JsonPropertyOrder({ + CycloneDXVulnerabilityReference.JSON_PROPERTY_ID, + CycloneDXVulnerabilityReference.JSON_PROPERTY_SOURCE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityReference { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private CycloneDXVulnerabilityReferenceSource source; + + public CycloneDXVulnerabilityReference id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the external reference (for example, a GHSA ID). + * + * @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 CycloneDXVulnerabilityReference source(CycloneDXVulnerabilityReferenceSource source) { + this.source = source; + this.unparsed |= source.unparsed; + return this; + } + + /** + * The source of an external vulnerability reference. + * + * @return source + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CycloneDXVulnerabilityReferenceSource getSource() { + return source; + } + + public void setSource(CycloneDXVulnerabilityReferenceSource source) { + this.source = source; + } + + /** + * 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 CycloneDXVulnerabilityReference + */ + @JsonAnySetter + public CycloneDXVulnerabilityReference 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 CycloneDXVulnerabilityReference object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityReference cycloneDxVulnerabilityReference = + (CycloneDXVulnerabilityReference) o; + return Objects.equals(this.id, cycloneDxVulnerabilityReference.id) + && Objects.equals(this.source, cycloneDxVulnerabilityReference.source) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityReference.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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/CycloneDXVulnerabilityReferenceSource.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityReferenceSource.java new file mode 100644 index 00000000000..be3887b9f38 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerabilityReferenceSource.java @@ -0,0 +1,137 @@ +/* + * 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.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 source of an external vulnerability reference. */ +@JsonPropertyOrder({CycloneDXVulnerabilityReferenceSource.JSON_PROPERTY_URL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXVulnerabilityReferenceSource { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CycloneDXVulnerabilityReferenceSource url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the reference source. + * + * @return url + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * 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 CycloneDXVulnerabilityReferenceSource + */ + @JsonAnySetter + public CycloneDXVulnerabilityReferenceSource 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 CycloneDXVulnerabilityReferenceSource object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXVulnerabilityReferenceSource cycloneDxVulnerabilityReferenceSource = + (CycloneDXVulnerabilityReferenceSource) o; + return Objects.equals(this.url, cycloneDxVulnerabilityReferenceSource.url) + && Objects.equals( + this.additionalProperties, cycloneDxVulnerabilityReferenceSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXVulnerabilityReferenceSource {\n"); + sb.append(" url: ").append(toIndentedString(url)).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/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 0c14124aaec..3ec8e88ce32 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -2308,6 +2308,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:DataDog/k9-cloud-vm + Scenario: Import security vulnerabilities returns "Bad Request" response + Given operation "ImportSecurityVulnerabilities" enabled + And new "ImportSecurityVulnerabilities" request + And body with value {"bomFormat": "CycloneDX", "components": [{"bom-ref": "a3390fca-c315-41ae-ae05-af5e7859cdee", "name": "lodash", "purl": "pkg:npm/lodash@4.17.21", "type": "library", "version": "4.17.21"}], "metadata": {"component": {"bom-ref": "host-ref-abc123", "name": "i-12345", "type": "operating-system"}, "tools": {"components": [{"name": "my-scanner", "type": "application"}]}}, "specVersion": "1.5", "version": 1, "vulnerabilities": [{"advisories": [{"url": "https://example.com/advisory/CVE-2021-1234"}], "affects": [{"ref": "a3390fca-c315-41ae-ae05-af5e7859cdee"}], "analysis": {"state": "resolved"}, "cwes": [123, 345], "description": "Sample vulnerability detected in the application.", "detail": "Details about the vulnerability.", "id": "CVE-2021-1234", "ratings": [{"score": 9.0, "severity": "high", "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"}], "references": [{"id": "GHSA-35m5-8cvj-8783", "source": {"url": "https://example.com"}}]}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-vm + Scenario: Import security vulnerabilities returns "Vulnerabilities accepted successfully." response + Given operation "ImportSecurityVulnerabilities" enabled + And new "ImportSecurityVulnerabilities" request + And body with value {"bomFormat": "CycloneDX", "components": [{"bom-ref": "a3390fca-c315-41ae-ae05-af5e7859cdee", "name": "lodash", "purl": "pkg:npm/lodash@4.17.21", "type": "library", "version": "4.17.21"}], "metadata": {"component": {"bom-ref": "host-ref-abc123", "name": "i-12345", "type": "operating-system"}, "tools": {"components": [{"name": "my-scanner", "type": "application"}]}}, "specVersion": "1.5", "version": 1, "vulnerabilities": [{"advisories": [{"url": "https://example.com/advisory/CVE-2021-1234"}], "affects": [{"ref": "a3390fca-c315-41ae-ae05-af5e7859cdee"}], "analysis": {"state": "resolved"}, "cwes": [123, 345], "description": "Sample vulnerability detected in the application.", "detail": "Details about the vulnerability.", "id": "CVE-2021-1234", "ratings": [{"score": 9.0, "severity": "high", "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"}], "references": [{"id": "GHSA-35m5-8cvj-8783", "source": {"url": "https://example.com"}}]}]} + When the request is sent + Then the response status is 200 Vulnerabilities accepted successfully. + @generated @skip @team:DataDog/k9-cloud-vm Scenario: List assets SBOMs returns "Bad request: The server cannot process the request due to invalid syntax in the request." response Given new "ListAssetsSBOMs" request 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 c07e3792ac5..486933f758d 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 @@ -7294,6 +7294,12 @@ "type": "safe" } }, + "ImportSecurityVulnerabilities": { + "tag": "Security Monitoring", + "undo": { + "type": "unsafe" + } + }, "GetVulnerabilityNotificationRules": { "tag": "Security Monitoring", "undo": {