diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 07cf64fab0e..2053789b98d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17581,6 +17581,244 @@ components: required: - data type: object + CycloneDXAdvisory: + description: Advisory reference for a vulnerability. + properties: + url: + description: URL to the advisory. + example: https://example.com/advisory/CVE-2021-1234 + type: string + type: object + CycloneDXAffect: + description: Reference to a component affected by a vulnerability. + properties: + ref: + description: Reference to a component's bom-ref. + example: a3390fca-c315-41ae-ae05-af5e7859cdee + type: string + required: + - ref + type: object + CycloneDXAssetComponent: + description: The asset component represents the system or host being scanned. + properties: + bom-ref: + description: Optional reference to a component in the components list. + example: asset-ref-123 + type: string + name: + description: The name of the asset. + example: i-12345 + type: string + type: + description: The type of the asset component. + example: operating-system + type: string + required: + - name + type: object + CycloneDXBOM: + description: CycloneDX 1.5 Bill of Materials (BOM) for importing vulnerabilities. + properties: + bomFormat: + description: The format of the BOM. Must be "CycloneDX". + example: CycloneDX + type: string + components: + description: List of components (libraries, applications, or operating systems) + that are affected by vulnerabilities. + items: + $ref: '#/components/schemas/CycloneDXComponent' + type: array + metadata: + $ref: '#/components/schemas/CycloneDXMetadata' + specVersion: + description: The version of the CycloneDX specification. Must be "1.5". + example: '1.5' + type: string + version: + description: The version of the BOM. + example: 1 + format: int64 + type: integer + vulnerabilities: + description: List of vulnerabilities to be imported. + items: + $ref: '#/components/schemas/CycloneDXVulnerability' + type: array + required: + - bomFormat + - specVersion + - version + - metadata + - vulnerabilities + - components + type: object + CycloneDXComponent: + description: A component (library, application, or operating system) in the + BOM. + properties: + bom-ref: + description: Unique reference identifier for this component. + example: a3390fca-c315-41ae-ae05-af5e7859cdee + type: string + name: + description: The name of the component. + example: lodash + type: string + purl: + description: Package URL for the component. Required for library components. + 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 component. Supported types are library, application, + and operating-system. + enum: + - library + - application + - operating-system + example: library + type: string + x-enum-varnames: + - LIBRARY + - APPLICATION + - OPERATING_SYSTEM + CycloneDXMetadata: + description: Metadata for the CycloneDX BOM. + properties: + component: + $ref: '#/components/schemas/CycloneDXAssetComponent' + tools: + $ref: '#/components/schemas/CycloneDXTools' + required: + - component + - tools + type: object + CycloneDXRating: + description: Vulnerability rating information. + 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 + CycloneDXReference: + description: External reference for a vulnerability. + properties: + id: + description: Identifier of the reference. + example: GHSA-35m5-8cvj-8783 + type: string + source: + $ref: '#/components/schemas/CycloneDXReferenceSource' + type: object + CycloneDXReferenceSource: + description: Source information for a reference. + properties: + url: + description: URL to the source. + example: https://example.com + type: string + type: object + CycloneDXToolComponent: + description: Tool component that detected the vulnerabilities. + properties: + name: + description: The name of the tool. + example: my-scanner + type: string + type: + description: The type of the tool. + example: application + type: string + required: + - name + type: object + CycloneDXTools: + description: Tools used to generate the BOM. + properties: + components: + description: List of tool components. Only one tool is supported. + items: + $ref: '#/components/schemas/CycloneDXToolComponent' + maxItems: 1 + minItems: 1 + type: array + required: + - components + type: object + CycloneDXVulnerability: + description: A vulnerability in the CycloneDX BOM. + properties: + advisories: + description: List of advisory references. + items: + $ref: '#/components/schemas/CycloneDXAdvisory' + type: array + affects: + description: List of component references affected by this vulnerability. + items: + $ref: '#/components/schemas/CycloneDXAffect' + minItems: 1 + type: array + cwes: + description: List of CWE (Common Weakness Enumeration) identifiers. + example: + - 123 + - 345 + items: + type: integer + type: array + description: + description: 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 unique identifier of the vulnerability (e.g., CVE ID). + example: CVE-2021-1234 + type: string + ratings: + description: List of vulnerability ratings. Must contain exactly one rating. + items: + $ref: '#/components/schemas/CycloneDXRating' + maxItems: 1 + minItems: 1 + type: array + references: + description: List of external references for the vulnerability. + items: + $ref: '#/components/schemas/CycloneDXReference' + type: array + required: + - id + - ratings + - affects + 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. @@ -53101,6 +53339,16 @@ components: meta: $ref: '#/components/schemas/SecurityFilterMeta' type: object + SecurityFindingType: + description: The type of security finding. + enum: + - vulnerability + - configuration_finding + example: vulnerability + type: string + x-enum-varnames: + - VULNERABILITY + - CONFIGURATION_FINDING SecurityFindingsAttributes: description: The JSON object containing all attributes of the security finding. properties: @@ -64143,6 +64391,18 @@ components: type: $ref: '#/components/schemas/ThreatHuntingJobDataType' type: object + ThreatIntelIndicatorType: + description: The type of threat indicator. + enum: + - ip_address + - domain + - sha256 + example: ip_address + type: string + x-enum-varnames: + - IP_ADDRESS + - DOMAIN + - SHA256 TimeAggregation: description: 'Time aggregation period (in seconds) is used to aggregate the results of the notification rule evaluation. @@ -93298,6 +93558,68 @@ paths: permissions: - security_monitoring_findings_read - appsec_vm_read + post: + description: 'Allows external integrations to send security findings to Datadog. + This endpoint accepts finding data in a custom format and returns an empty + response on success. + + + **Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: CreateSecurityFinding + parameters: + - description: The vendor providing the security finding. Must be lowercase. + example: vendor-name + in: header + name: vendor + required: true + schema: + type: string + - description: The type of security finding. + in: header + name: finding_type + required: true + schema: + $ref: '#/components/schemas/SecurityFindingType' + requestBody: + content: + application/json: + schema: + additionalProperties: {} + description: Security finding data in a custom format. + type: object + required: true + responses: + '200': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create security finding + tags: + - Security Monitoring + 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/findings/cases: delete: description: 'Detach security findings from their case. @@ -94050,6 +94372,92 @@ paths: operator: OR permissions: - security_monitoring_notification_profiles_write + /api/v2/security/threat-intel-feed: + post: + description: 'Import threat intelligence feeds with support for IP addresses, + domains, and SHA256 hashes. This endpoint requires specific headers to identify + the vendor and indicator type. + + + **Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: ImportThreatIntel + parameters: + - description: The vendor providing the threat intelligence feed. + example: vendor-name + in: header + name: ti_vendor + required: true + schema: + type: string + - description: The type of threat indicator. Valid values are ip_address, domain, + or sha256. + in: header + name: ti_indicator + required: true + schema: + $ref: '#/components/schemas/ThreatIntelIndicatorType' + - description: Optional integration account identifier. + in: header + name: ti_integration_account + required: false + schema: + type: string + requestBody: + content: + application/json: + schema: + description: Threat intelligence feed data. + type: object + application/octet-stream: + schema: + description: Threat intelligence feed data in binary format. + format: binary + type: string + required: true + responses: + '200': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + '503': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Service Unavailable + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Import threat intelligence feed + tags: + - Security Monitoring + x-permission: + operator: OR + permissions: + - reference_tables_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: get: description: "Get a list of vulnerabilities.\n\n### Pagination\n\nPagination @@ -94463,6 +94871,58 @@ paths: x-unstable: '**Note**: This endpoint is a private preview. If you are interested in accessing this API, [fill out this form](https://forms.gle/kMYC1sDr6WDUBDsx9).' + post: + description: 'Import vulnerabilities in CycloneDX 1.5 format. This endpoint + validates the payload against the CycloneDX 1.5 schema and additional mandatory + field requirements. + + + **Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: ImportSecurityVulnerabilities + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CycloneDXBOM' + required: true + responses: + '200': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Import vulnerabilities + tags: + - Security Monitoring + 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/CreateSecurityFinding.java b/examples/v2/security-monitoring/CreateSecurityFinding.java new file mode 100644 index 00000000000..ae6366e4e12 --- /dev/null +++ b/examples/v2/security-monitoring/CreateSecurityFinding.java @@ -0,0 +1,24 @@ +// Create security finding returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SecurityFindingType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createSecurityFinding", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + apiInstance.createSecurityFinding("vendor-name", SecurityFindingType.VULNERABILITY); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#createSecurityFinding"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java b/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java new file mode 100644 index 00000000000..85456194e9c --- /dev/null +++ b/examples/v2/security-monitoring/ImportSecurityVulnerabilities.java @@ -0,0 +1,94 @@ +// Import vulnerabilities returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.CycloneDXAdvisory; +import com.datadog.api.client.v2.model.CycloneDXAffect; +import com.datadog.api.client.v2.model.CycloneDXAssetComponent; +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.CycloneDXRating; +import com.datadog.api.client.v2.model.CycloneDXReference; +import com.datadog.api.client.v2.model.CycloneDXReferenceSource; +import com.datadog.api.client.v2.model.CycloneDXToolComponent; +import com.datadog.api.client.v2.model.CycloneDXTools; +import com.datadog.api.client.v2.model.CycloneDXVulnerability; +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 CycloneDXAssetComponent() + .bomRef("asset-ref-123") + .name("i-12345") + .type("operating-system")) + .tools( + new CycloneDXTools() + .components( + Collections.singletonList( + new CycloneDXToolComponent() + .name("my-scanner") + .type("application"))))) + .specVersion("1.5") + .version(1L) + .vulnerabilities( + Collections.singletonList( + new CycloneDXVulnerability() + .advisories( + Collections.singletonList( + new CycloneDXAdvisory() + .url("https://example.com/advisory/CVE-2021-1234"))) + .affects( + Collections.singletonList( + new CycloneDXAffect().ref("a3390fca-c315-41ae-ae05-af5e7859cdee"))) + .cwes(Arrays.asList(123, 345)) + .description("Sample vulnerability detected in the application.") + .detail("Details about the vulnerability") + .id("CVE-2021-1234") + .ratings( + Collections.singletonList( + new CycloneDXRating() + .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 CycloneDXReference() + .id("GHSA-35m5-8cvj-8783") + .source( + new CycloneDXReferenceSource() + .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/examples/v2/security-monitoring/ImportThreatIntel.java b/examples/v2/security-monitoring/ImportThreatIntel.java new file mode 100644 index 00000000000..8413699c49f --- /dev/null +++ b/examples/v2/security-monitoring/ImportThreatIntel.java @@ -0,0 +1,24 @@ +// Import threat intelligence feed returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.ThreatIntelIndicatorType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.importThreatIntel", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + apiInstance.importThreatIntel("vendor-name", ThreatIntelIndicatorType.IP_ADDRESS); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#importThreatIntel"); + 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 51e308a256e..6de9443d027 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -785,6 +785,7 @@ public class ApiClient { put("v2.activateContentPack", false); put("v2.cancelThreatHuntingJob", false); put("v2.convertJobResultToSignal", false); + put("v2.createSecurityFinding", false); put("v2.deactivateContentPack", false); put("v2.deleteThreatHuntingJob", false); put("v2.getContentPacksStates", false); @@ -794,6 +795,8 @@ public class ApiClient { put("v2.getSecurityMonitoringHistsignal", false); put("v2.getSecurityMonitoringHistsignalsByJobId", false); put("v2.getThreatHuntingJob", false); + put("v2.importSecurityVulnerabilities", false); + put("v2.importThreatIntel", false); put("v2.listFindings", false); put("v2.listMultipleRulesets", false); put("v2.listScannedAssetsMetadata", 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 810817d80ec..3bdbd990dbc 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 @@ -17,6 +17,7 @@ import com.datadog.api.client.v2.model.CreateCustomFrameworkResponse; import com.datadog.api.client.v2.model.CreateJiraIssueRequestArray; import com.datadog.api.client.v2.model.CreateNotificationRuleParameters; +import com.datadog.api.client.v2.model.CycloneDXBOM; import com.datadog.api.client.v2.model.DeleteCustomFrameworkResponse; import com.datadog.api.client.v2.model.DetachCaseRequest; import com.datadog.api.client.v2.model.Finding; @@ -51,6 +52,7 @@ import com.datadog.api.client.v2.model.SecurityFilterResponse; import com.datadog.api.client.v2.model.SecurityFilterUpdateRequest; import com.datadog.api.client.v2.model.SecurityFiltersResponse; +import com.datadog.api.client.v2.model.SecurityFindingType; import com.datadog.api.client.v2.model.SecurityFindingsData; import com.datadog.api.client.v2.model.SecurityFindingsSearchRequest; import com.datadog.api.client.v2.model.SecurityFindingsSearchRequestData; @@ -89,6 +91,7 @@ import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionUpdateRequest; import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionsResponse; import com.datadog.api.client.v2.model.ThreatHuntingJobResponse; +import com.datadog.api.client.v2.model.ThreatIntelIndicatorType; import com.datadog.api.client.v2.model.UpdateCustomFrameworkRequest; import com.datadog.api.client.v2.model.UpdateCustomFrameworkResponse; import com.datadog.api.client.v2.model.UpdateResourceEvaluationFiltersRequest; @@ -1877,6 +1880,214 @@ public ApiResponse createSecurityFilterWithHttpInfo( new GenericType() {}); } + /** + * Create security finding. + * + *

See {@link #createSecurityFindingWithHttpInfo}. + * + * @param vendor The vendor providing the security finding. Must be lowercase. (required) + * @param findingType The type of security finding. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void createSecurityFinding( + String vendor, SecurityFindingType findingType, Map body) + throws ApiException { + createSecurityFindingWithHttpInfo(vendor, findingType, body); + } + + /** + * Create security finding. + * + *

See {@link #createSecurityFindingWithHttpInfoAsync}. + * + * @param vendor The vendor providing the security finding. Must be lowercase. (required) + * @param findingType The type of security finding. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture createSecurityFindingAsync( + String vendor, SecurityFindingType findingType, Map body) { + return createSecurityFindingWithHttpInfoAsync(vendor, findingType, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Allows external integrations to send security findings to Datadog. This endpoint accepts + * finding data in a custom format and returns an empty response on success. + * + *

Note: This endpoint is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + * + * @param vendor The vendor providing the security finding. Must be lowercase. (required) + * @param findingType The type of security finding. (required) + * @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 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createSecurityFindingWithHttpInfo( + String vendor, SecurityFindingType findingType, Map body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createSecurityFinding"; + 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 'vendor' is set + if (vendor == null) { + throw new ApiException( + 400, "Missing the required parameter 'vendor' when calling createSecurityFinding"); + } + + // verify the required parameter 'findingType' is set + if (findingType == null) { + throw new ApiException( + 400, "Missing the required parameter 'findingType' when calling createSecurityFinding"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createSecurityFinding"); + } + // create path and map variables + String localVarPath = "/api/v2/security/findings"; + + Map localVarHeaderParams = new HashMap(); + + if (vendor != null) { + localVarHeaderParams.put("vendor", apiClient.parameterToString(vendor)); + } + if (findingType != null) { + localVarHeaderParams.put("finding_type", apiClient.parameterToString(findingType)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createSecurityFinding", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Create security finding. + * + *

See {@link #createSecurityFindingWithHttpInfo}. + * + * @param vendor The vendor providing the security finding. Must be lowercase. (required) + * @param findingType The type of security finding. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> createSecurityFindingWithHttpInfoAsync( + String vendor, SecurityFindingType findingType, Map body) { + // Check if unstable operation is enabled + String operationId = "createSecurityFinding"; + 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 'vendor' is set + if (vendor == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'vendor' when calling createSecurityFinding")); + return result; + } + + // verify the required parameter 'findingType' is set + if (findingType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'findingType' when calling createSecurityFinding")); + return result; + } + + // 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 createSecurityFinding")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/security/findings"; + + Map localVarHeaderParams = new HashMap(); + + if (vendor != null) { + localVarHeaderParams.put("vendor", apiClient.parameterToString(vendor)); + } + if (findingType != null) { + localVarHeaderParams.put("finding_type", apiClient.parameterToString(findingType)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.createSecurityFinding", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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); + } + /** * Create a critical asset. * @@ -8339,6 +8550,452 @@ public ApiResponse getVulnerabilityNotificationRulesWithHttpInfo() throw new GenericType() {}); } + /** + * Import 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 vulnerabilities. + * + *

See {@link #importSecurityVulnerabilitiesWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture importSecurityVulnerabilitiesAsync(CycloneDXBOM body) { + return importSecurityVulnerabilitiesWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Import vulnerabilities in CycloneDX 1.5 format. This endpoint validates the payload against the + * CycloneDX 1.5 schema and additional mandatory field requirements. + * + *

Note: This endpoint is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + * + * @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 OK -
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"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Import 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"}); + } 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 importThreatIntel. */ + public static class ImportThreatIntelOptionalParameters { + private String tiIntegrationAccount; + + /** + * Set tiIntegrationAccount. + * + * @param tiIntegrationAccount Optional integration account identifier. (optional) + * @return ImportThreatIntelOptionalParameters + */ + public ImportThreatIntelOptionalParameters tiIntegrationAccount(String tiIntegrationAccount) { + this.tiIntegrationAccount = tiIntegrationAccount; + return this; + } + } + + /** + * Import threat intelligence feed. + * + *

See {@link #importThreatIntelWithHttpInfo}. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void importThreatIntel(String tiVendor, ThreatIntelIndicatorType tiIndicator, Object body) + throws ApiException { + importThreatIntelWithHttpInfo( + tiVendor, tiIndicator, body, new ImportThreatIntelOptionalParameters()); + } + + /** + * Import threat intelligence feed. + * + *

See {@link #importThreatIntelWithHttpInfoAsync}. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture importThreatIntelAsync( + String tiVendor, ThreatIntelIndicatorType tiIndicator, Object body) { + return importThreatIntelWithHttpInfoAsync( + tiVendor, tiIndicator, body, new ImportThreatIntelOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Import threat intelligence feed. + * + *

See {@link #importThreatIntelWithHttpInfo}. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @throws ApiException if fails to make API call + */ + public void importThreatIntel( + String tiVendor, + ThreatIntelIndicatorType tiIndicator, + Object body, + ImportThreatIntelOptionalParameters parameters) + throws ApiException { + importThreatIntelWithHttpInfo(tiVendor, tiIndicator, body, parameters); + } + + /** + * Import threat intelligence feed. + * + *

See {@link #importThreatIntelWithHttpInfoAsync}. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture + */ + public CompletableFuture importThreatIntelAsync( + String tiVendor, + ThreatIntelIndicatorType tiIndicator, + Object body, + ImportThreatIntelOptionalParameters parameters) { + return importThreatIntelWithHttpInfoAsync(tiVendor, tiIndicator, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Import threat intelligence feeds with support for IP addresses, domains, and SHA256 hashes. + * This endpoint requires specific headers to identify the vendor and indicator type. + * + *

Note: This endpoint is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse importThreatIntelWithHttpInfo( + String tiVendor, + ThreatIntelIndicatorType tiIndicator, + Object body, + ImportThreatIntelOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "importThreatIntel"; + 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 'tiVendor' is set + if (tiVendor == null) { + throw new ApiException( + 400, "Missing the required parameter 'tiVendor' when calling importThreatIntel"); + } + + // verify the required parameter 'tiIndicator' is set + if (tiIndicator == null) { + throw new ApiException( + 400, "Missing the required parameter 'tiIndicator' when calling importThreatIntel"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling importThreatIntel"); + } + String tiIntegrationAccount = parameters.tiIntegrationAccount; + // create path and map variables + String localVarPath = "/api/v2/security/threat-intel-feed"; + + Map localVarHeaderParams = new HashMap(); + + if (tiVendor != null) { + localVarHeaderParams.put("ti_vendor", apiClient.parameterToString(tiVendor)); + } + if (tiIndicator != null) { + localVarHeaderParams.put("ti_indicator", apiClient.parameterToString(tiIndicator)); + } + if (tiIntegrationAccount != null) { + localVarHeaderParams.put( + "ti_integration_account", apiClient.parameterToString(tiIntegrationAccount)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.importThreatIntel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json", "application/octet-stream"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Import threat intelligence feed. + * + *

See {@link #importThreatIntelWithHttpInfo}. + * + * @param tiVendor The vendor providing the threat intelligence feed. (required) + * @param tiIndicator The type of threat indicator. Valid values are ip_address, domain, or + * sha256. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> importThreatIntelWithHttpInfoAsync( + String tiVendor, + ThreatIntelIndicatorType tiIndicator, + Object body, + ImportThreatIntelOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "importThreatIntel"; + 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 'tiVendor' is set + if (tiVendor == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'tiVendor' when calling importThreatIntel")); + return result; + } + + // verify the required parameter 'tiIndicator' is set + if (tiIndicator == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'tiIndicator' when calling importThreatIntel")); + return result; + } + + // 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 importThreatIntel")); + return result; + } + String tiIntegrationAccount = parameters.tiIntegrationAccount; + // create path and map variables + String localVarPath = "/api/v2/security/threat-intel-feed"; + + Map localVarHeaderParams = new HashMap(); + + if (tiVendor != null) { + localVarHeaderParams.put("ti_vendor", apiClient.parameterToString(tiVendor)); + } + if (tiIndicator != null) { + localVarHeaderParams.put("ti_indicator", apiClient.parameterToString(tiIndicator)); + } + if (tiIntegrationAccount != null) { + localVarHeaderParams.put( + "ti_integration_account", apiClient.parameterToString(tiIntegrationAccount)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.importThreatIntel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json", "application/octet-stream"}, + 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/CycloneDXAdvisory.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAdvisory.java new file mode 100644 index 00000000000..8494b0661d6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAdvisory.java @@ -0,0 +1,135 @@ +/* + * 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; + +/** Advisory reference for a vulnerability. */ +@JsonPropertyOrder({CycloneDXAdvisory.JSON_PROPERTY_URL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXAdvisory { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CycloneDXAdvisory url(String url) { + this.url = url; + return this; + } + + /** + * URL to 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 CycloneDXAdvisory + */ + @JsonAnySetter + public CycloneDXAdvisory 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 CycloneDXAdvisory object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXAdvisory cycloneDxAdvisory = (CycloneDXAdvisory) o; + return Objects.equals(this.url, cycloneDxAdvisory.url) + && Objects.equals(this.additionalProperties, cycloneDxAdvisory.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXAdvisory {\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/CycloneDXAffect.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAffect.java new file mode 100644 index 00000000000..29c09befe18 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAffect.java @@ -0,0 +1,142 @@ +/* + * 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; + +/** Reference to a component affected by a vulnerability. */ +@JsonPropertyOrder({CycloneDXAffect.JSON_PROPERTY_REF}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXAffect { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_REF = "ref"; + private String ref; + + public CycloneDXAffect() {} + + @JsonCreator + public CycloneDXAffect(@JsonProperty(required = true, value = JSON_PROPERTY_REF) String ref) { + this.ref = ref; + } + + public CycloneDXAffect ref(String ref) { + this.ref = ref; + return this; + } + + /** + * Reference to a component's bom-ref. + * + * @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 CycloneDXAffect + */ + @JsonAnySetter + public CycloneDXAffect 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 CycloneDXAffect object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXAffect cycloneDxAffect = (CycloneDXAffect) o; + return Objects.equals(this.ref, cycloneDxAffect.ref) + && Objects.equals(this.additionalProperties, cycloneDxAffect.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ref, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXAffect {\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/CycloneDXAssetComponent.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAssetComponent.java new file mode 100644 index 00000000000..944bfef67d0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXAssetComponent.java @@ -0,0 +1,199 @@ +/* + * 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 component represents the system or host being scanned. */ +@JsonPropertyOrder({ + CycloneDXAssetComponent.JSON_PROPERTY_BOM_REF, + CycloneDXAssetComponent.JSON_PROPERTY_NAME, + CycloneDXAssetComponent.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXAssetComponent { + @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 CycloneDXAssetComponent() {} + + @JsonCreator + public CycloneDXAssetComponent( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public CycloneDXAssetComponent bomRef(String bomRef) { + this.bomRef = bomRef; + return this; + } + + /** + * Optional reference to a component in the components list. + * + * @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 CycloneDXAssetComponent name(String name) { + this.name = name; + return this; + } + + /** + * The name of the asset. + * + * @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 CycloneDXAssetComponent type(String type) { + this.type = type; + return this; + } + + /** + * The type of the asset 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 CycloneDXAssetComponent + */ + @JsonAnySetter + public CycloneDXAssetComponent 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 CycloneDXAssetComponent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXAssetComponent cycloneDxAssetComponent = (CycloneDXAssetComponent) o; + return Objects.equals(this.bomRef, cycloneDxAssetComponent.bomRef) + && Objects.equals(this.name, cycloneDxAssetComponent.name) + && Objects.equals(this.type, cycloneDxAssetComponent.type) + && Objects.equals(this.additionalProperties, cycloneDxAssetComponent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bomRef, name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXAssetComponent {\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/CycloneDXBOM.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXBOM.java new file mode 100644 index 00000000000..fa96038b05b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXBOM.java @@ -0,0 +1,317 @@ +/* + * 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; + +/** CycloneDX 1.5 Bill of Materials (BOM) for importing vulnerabilities. */ +@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_VERSION) Long version, + @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.version = version; + this.vulnerabilities = vulnerabilities; + } + + public CycloneDXBOM bomFormat(String bomFormat) { + this.bomFormat = bomFormat; + return this; + } + + /** + * The format of the BOM. 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; + } + + /** + * List of components (libraries, applications, or operating systems) that are affected by + * vulnerabilities. + * + * @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 for the CycloneDX BOM. + * + * @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 version of the CycloneDX specification. 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 of the BOM. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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; + } + + /** + * List of vulnerabilities to be imported. + * + * @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..387f6b74825 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXComponent.java @@ -0,0 +1,261 @@ +/* + * 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 component (library, application, or operating system) in the BOM. */ +@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; + } + + /** + * Unique reference identifier for 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; + } + + /** + * Package URL for the component. Required for library components. + * + * @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 component. Supported types are library, application, and operating-system. + * + * @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..fc0213061cc --- /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 component. Supported types are library, application, and operating-system. */ +@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..806343ef165 --- /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 for the CycloneDX BOM. */ +@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 CycloneDXAssetComponent component; + + public static final String JSON_PROPERTY_TOOLS = "tools"; + private CycloneDXTools tools; + + public CycloneDXMetadata() {} + + @JsonCreator + public CycloneDXMetadata( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPONENT) + CycloneDXAssetComponent component, + @JsonProperty(required = true, value = JSON_PROPERTY_TOOLS) CycloneDXTools tools) { + this.component = component; + this.unparsed |= component.unparsed; + this.tools = tools; + this.unparsed |= tools.unparsed; + } + + public CycloneDXMetadata component(CycloneDXAssetComponent component) { + this.component = component; + this.unparsed |= component.unparsed; + return this; + } + + /** + * The asset component represents the system or host being scanned. + * + * @return component + */ + @JsonProperty(JSON_PROPERTY_COMPONENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXAssetComponent getComponent() { + return component; + } + + public void setComponent(CycloneDXAssetComponent component) { + this.component = component; + } + + public CycloneDXMetadata tools(CycloneDXTools tools) { + this.tools = tools; + this.unparsed |= tools.unparsed; + return this; + } + + /** + * Tools used to generate the BOM. + * + * @return tools + */ + @JsonProperty(JSON_PROPERTY_TOOLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CycloneDXTools getTools() { + return tools; + } + + public void setTools(CycloneDXTools 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/CycloneDXRating.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXRating.java new file mode 100644 index 00000000000..c2c0f6eece7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXRating.java @@ -0,0 +1,191 @@ +/* + * 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; + +/** Vulnerability rating information. */ +@JsonPropertyOrder({ + CycloneDXRating.JSON_PROPERTY_SCORE, + CycloneDXRating.JSON_PROPERTY_SEVERITY, + CycloneDXRating.JSON_PROPERTY_VECTOR +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXRating { + @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 CycloneDXRating 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 CycloneDXRating 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 CycloneDXRating 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 CycloneDXRating + */ + @JsonAnySetter + public CycloneDXRating 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 CycloneDXRating object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXRating cycloneDxRating = (CycloneDXRating) o; + return Objects.equals(this.score, cycloneDxRating.score) + && Objects.equals(this.severity, cycloneDxRating.severity) + && Objects.equals(this.vector, cycloneDxRating.vector) + && Objects.equals(this.additionalProperties, cycloneDxRating.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(score, severity, vector, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXRating {\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/CycloneDXReference.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXReference.java new file mode 100644 index 00000000000..e41ed519716 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXReference.java @@ -0,0 +1,162 @@ +/* + * 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; + +/** External reference for a vulnerability. */ +@JsonPropertyOrder({CycloneDXReference.JSON_PROPERTY_ID, CycloneDXReference.JSON_PROPERTY_SOURCE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXReference { + @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 CycloneDXReferenceSource source; + + public CycloneDXReference id(String id) { + this.id = id; + return this; + } + + /** + * Identifier of the reference. + * + * @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 CycloneDXReference source(CycloneDXReferenceSource source) { + this.source = source; + this.unparsed |= source.unparsed; + return this; + } + + /** + * Source information for a reference. + * + * @return source + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CycloneDXReferenceSource getSource() { + return source; + } + + public void setSource(CycloneDXReferenceSource 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 CycloneDXReference + */ + @JsonAnySetter + public CycloneDXReference 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 CycloneDXReference object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXReference cycloneDxReference = (CycloneDXReference) o; + return Objects.equals(this.id, cycloneDxReference.id) + && Objects.equals(this.source, cycloneDxReference.source) + && Objects.equals(this.additionalProperties, cycloneDxReference.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXReference {\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/CycloneDXReferenceSource.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXReferenceSource.java new file mode 100644 index 00000000000..d343fbb167a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXReferenceSource.java @@ -0,0 +1,135 @@ +/* + * 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; + +/** Source information for a reference. */ +@JsonPropertyOrder({CycloneDXReferenceSource.JSON_PROPERTY_URL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXReferenceSource { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CycloneDXReferenceSource url(String url) { + this.url = url; + return this; + } + + /** + * URL to the 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 CycloneDXReferenceSource + */ + @JsonAnySetter + public CycloneDXReferenceSource 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 CycloneDXReferenceSource object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXReferenceSource cycloneDxReferenceSource = (CycloneDXReferenceSource) o; + return Objects.equals(this.url, cycloneDxReferenceSource.url) + && Objects.equals(this.additionalProperties, cycloneDxReferenceSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXReferenceSource {\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/CycloneDXToolComponent.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXToolComponent.java new file mode 100644 index 00000000000..7a1fafa8366 --- /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; + +/** Tool component that detected the vulnerabilities. */ +@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 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. + * + * @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/CycloneDXTools.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXTools.java new file mode 100644 index 00000000000..484f4b9719b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXTools.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; + +/** Tools used to generate the BOM. */ +@JsonPropertyOrder({CycloneDXTools.JSON_PROPERTY_COMPONENTS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CycloneDXTools { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMPONENTS = "components"; + private List components = new ArrayList<>(); + + public CycloneDXTools() {} + + @JsonCreator + public CycloneDXTools( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPONENTS) + List components) { + this.components = components; + } + + public CycloneDXTools components(List components) { + this.components = components; + for (CycloneDXToolComponent item : components) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXTools addComponentsItem(CycloneDXToolComponent componentsItem) { + this.components.add(componentsItem); + this.unparsed |= componentsItem.unparsed; + return this; + } + + /** + * List of tool components. Only one tool is supported. + * + * @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 CycloneDXTools + */ + @JsonAnySetter + public CycloneDXTools 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 CycloneDXTools object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CycloneDXTools cycloneDxTools = (CycloneDXTools) o; + return Objects.equals(this.components, cycloneDxTools.components) + && Objects.equals(this.additionalProperties, cycloneDxTools.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(components, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CycloneDXTools {\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/CycloneDXVulnerability.java b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerability.java new file mode 100644 index 00000000000..5ec933e2e8b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CycloneDXVulnerability.java @@ -0,0 +1,397 @@ +/* + * 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 vulnerability in the CycloneDX BOM. */ +@JsonPropertyOrder({ + CycloneDXVulnerability.JSON_PROPERTY_ADVISORIES, + CycloneDXVulnerability.JSON_PROPERTY_AFFECTS, + 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_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 (CycloneDXAdvisory item : advisories) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addAdvisoriesItem(CycloneDXAdvisory advisoriesItem) { + if (this.advisories == null) { + this.advisories = new ArrayList<>(); + } + this.advisories.add(advisoriesItem); + this.unparsed |= advisoriesItem.unparsed; + return this; + } + + /** + * List of advisory references. + * + * @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 (CycloneDXAffect item : affects) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addAffectsItem(CycloneDXAffect affectsItem) { + this.affects.add(affectsItem); + this.unparsed |= affectsItem.unparsed; + return this; + } + + /** + * List of component references affected by this vulnerability. + * + * @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 cwes(List cwes) { + this.cwes = cwes; + return this; + } + + public CycloneDXVulnerability addCwesItem(Integer cwesItem) { + if (this.cwes == null) { + this.cwes = new ArrayList<>(); + } + this.cwes.add(cwesItem); + return this; + } + + /** + * List of CWE (Common Weakness Enumeration) identifiers. + * + * @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; + } + + /** + * 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 unique identifier of the vulnerability (e.g., 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 (CycloneDXRating item : ratings) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addRatingsItem(CycloneDXRating ratingsItem) { + this.ratings.add(ratingsItem); + this.unparsed |= ratingsItem.unparsed; + return this; + } + + /** + * List of vulnerability ratings. Must contain exactly one rating. + * + * @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 (CycloneDXReference item : references) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CycloneDXVulnerability addReferencesItem(CycloneDXReference referencesItem) { + if (this.references == null) { + this.references = new ArrayList<>(); + } + this.references.add(referencesItem); + this.unparsed |= referencesItem.unparsed; + return this; + } + + /** + * List of external references 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.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, + 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(" 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/SecurityFindingType.java b/src/main/java/com/datadog/api/client/v2/model/SecurityFindingType.java new file mode 100644 index 00000000000..5710c45959f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityFindingType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of security finding. */ +@JsonSerialize(using = SecurityFindingType.SecurityFindingTypeSerializer.class) +public class SecurityFindingType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("vulnerability", "configuration_finding")); + + public static final SecurityFindingType VULNERABILITY = new SecurityFindingType("vulnerability"); + public static final SecurityFindingType CONFIGURATION_FINDING = + new SecurityFindingType("configuration_finding"); + + SecurityFindingType(String value) { + super(value, allowedValues); + } + + public static class SecurityFindingTypeSerializer extends StdSerializer { + public SecurityFindingTypeSerializer(Class t) { + super(t); + } + + public SecurityFindingTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityFindingType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityFindingType fromValue(String value) { + return new SecurityFindingType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ThreatIntelIndicatorType.java b/src/main/java/com/datadog/api/client/v2/model/ThreatIntelIndicatorType.java new file mode 100644 index 00000000000..f0b40513820 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ThreatIntelIndicatorType.java @@ -0,0 +1,59 @@ +/* + * 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 threat indicator. */ +@JsonSerialize(using = ThreatIntelIndicatorType.ThreatIntelIndicatorTypeSerializer.class) +public class ThreatIntelIndicatorType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ip_address", "domain", "sha256")); + + public static final ThreatIntelIndicatorType IP_ADDRESS = + new ThreatIntelIndicatorType("ip_address"); + public static final ThreatIntelIndicatorType DOMAIN = new ThreatIntelIndicatorType("domain"); + public static final ThreatIntelIndicatorType SHA256 = new ThreatIntelIndicatorType("sha256"); + + ThreatIntelIndicatorType(String value) { + super(value, allowedValues); + } + + public static class ThreatIntelIndicatorTypeSerializer + extends StdSerializer { + public ThreatIntelIndicatorTypeSerializer(Class t) { + super(t); + } + + public ThreatIntelIndicatorTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ThreatIntelIndicatorType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ThreatIntelIndicatorType fromValue(String value) { + return new ThreatIntelIndicatorType(value); + } +} 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 5695a7ea4a5..3ad8d5c9636 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 @@ -708,6 +708,24 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/asm-vm + Scenario: Create security finding returns "Bad Request" response + Given operation "CreateSecurityFinding" enabled + And new "CreateSecurityFinding" request + And request contains "vendor" parameter from "REPLACE.ME" + And request contains "finding_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/asm-vm + Scenario: Create security finding returns "OK" response + Given operation "CreateSecurityFinding" enabled + And new "CreateSecurityFinding" request + And request contains "vendor" parameter from "REPLACE.ME" + And request contains "finding_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Deactivate content pack returns "Accepted" response Given operation "DeactivateContentPack" enabled @@ -1397,6 +1415,40 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 The list of notification rules. + @generated @skip @team:DataDog/asm-vm + Scenario: Import threat intelligence feed returns "Bad Request" response + Given operation "ImportThreatIntel" enabled + And new "ImportThreatIntel" request + And request contains "ti_vendor" parameter from "REPLACE.ME" + And request contains "ti_indicator" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/asm-vm + Scenario: Import threat intelligence feed returns "OK" response + Given operation "ImportThreatIntel" enabled + And new "ImportThreatIntel" request + And request contains "ti_vendor" parameter from "REPLACE.ME" + And request contains "ti_indicator" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/asm-vm + Scenario: Import 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": "asset-ref-123", "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"}], "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/asm-vm + Scenario: Import vulnerabilities returns "OK" 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": "asset-ref-123", "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"}], "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 OK + @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 75d0d7f71ed..110c6b94f87 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 @@ -4304,6 +4304,12 @@ "type": "safe" } }, + "CreateSecurityFinding": { + "tag": "Security Monitoring", + "undo": { + "type": "unsafe" + } + }, "DetachCase": { "tag": "Security Monitoring", "undo": { @@ -4409,12 +4415,24 @@ "type": "idempotent" } }, + "ImportThreatIntel": { + "tag": "Security Monitoring", + "undo": { + "type": "unsafe" + } + }, "ListVulnerabilities": { "tag": "Security Monitoring", "undo": { "type": "safe" } }, + "ImportSecurityVulnerabilities": { + "tag": "Security Monitoring", + "undo": { + "type": "unsafe" + } + }, "GetVulnerabilityNotificationRules": { "tag": "Security Monitoring", "undo": {