diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 203a2ac6cdf..2f8c17f5476 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -86174,6 +86174,229 @@ components: example: "report_id" type: string type: object + STIXBundleRequest: + additionalProperties: {} + description: A STIX 2.1 bundle containing threat intelligence indicator objects. + properties: + id: + description: The STIX bundle identifier. + example: bundle--11111111-1111-4111-8111-111111111111 + type: string + objects: + description: The indicator objects included in the bundle. + example: + - created: "2026-07-22T12:00:00Z" + id: indicator--22222222-2222-4222-8222-222222222222 + modified: "2026-07-22T12:00:00Z" + pattern: "[ipv4-addr:value = '198.51.100.42']" + pattern_type: stix + spec_version: "2.1" + type: indicator + valid_from: "2026-07-22T12:00:00Z" + items: + $ref: "#/components/schemas/STIXIndicatorObject" + type: array + spec_version: + $ref: "#/components/schemas/STIXSpecVersion" + type: + $ref: "#/components/schemas/STIXBundleType" + required: + - type + - id + - objects + type: object + STIXBundleType: + description: The STIX object type for a bundle. + enum: + - bundle + example: bundle + type: string + x-enum-varnames: + - BUNDLE + STIXContentEncoding: + description: The content encoding applied to the request body. + enum: + - gzip + example: gzip + type: string + x-enum-varnames: + - GZIP + STIXIndicatorObject: + additionalProperties: {} + description: A STIX 2.1 indicator object. + properties: + confidence: + description: The confidence in the correctness of the indicator, from 0 through 100. + example: 80 + format: int32 + maximum: 100 + minimum: 0 + type: integer + created: + description: The time when the indicator was created. + example: "2026-07-22T12:00:00Z" + format: date-time + type: string + external_references: + description: Optional external reference metadata preserved with the indicator but not interpreted during ingestion. + items: + $ref: "#/components/schemas/STIXMetadataObject" + type: array + id: + description: The STIX indicator identifier. + example: indicator--22222222-2222-4222-8222-222222222222 + type: string + indicator_types: + description: The open vocabulary terms that categorize the indicator. + example: + - malicious-activity + items: + type: string + type: array + kill_chain_phases: + description: Optional kill chain metadata preserved with the indicator but not interpreted during ingestion. + items: + $ref: "#/components/schemas/STIXMetadataObject" + type: array + labels: + description: Labels associated with the indicator. + example: + - synthetic + items: + type: string + type: array + modified: + description: The time when the indicator was last modified. + example: "2026-07-22T12:00:00Z" + format: date-time + type: string + object_marking_refs: + description: References to marking definition objects that apply to the indicator. + example: + - marking-definition--33333333-3333-4333-8333-333333333333 + items: + type: string + type: array + pattern: + description: The STIX pattern that identifies the observable. + example: "[ipv4-addr:value = '198.51.100.42']" + type: string + pattern_type: + $ref: "#/components/schemas/STIXPatternType" + revoked: + description: Whether the indicator has been revoked. + example: false + type: boolean + spec_version: + $ref: "#/components/schemas/STIXSpecVersion" + type: + $ref: "#/components/schemas/STIXIndicatorType" + valid_from: + description: The time from which the indicator is considered valid. + example: "2026-07-22T12:00:00Z" + format: date-time + type: string + valid_until: + description: The time until which the indicator is considered valid. + example: "2027-07-22T12:00:00Z" + format: date-time + type: string + required: + - type + - id + - spec_version + - created + - modified + - pattern + - pattern_type + - valid_from + type: object + STIXIndicatorType: + description: The STIX object type for an indicator. + enum: + - indicator + example: indicator + type: string + x-enum-varnames: + - INDICATOR + STIXIngestResponse: + description: The response from a completed STIX ingestion request. + properties: + data: + $ref: "#/components/schemas/STIXIngestResponseData" + required: + - data + type: object + STIXIngestResponseAttributes: + description: Counters describing the result of the STIX ingestion request. + properties: + added: + description: The number of supported indicators added. + example: 1 + format: int64 + minimum: 0 + type: integer + invalid: + description: The number of indicators with patterns that could not be parsed. + example: 0 + format: int64 + minimum: 0 + type: integer + unsupported: + description: The number of unsupported objects or patterns. + example: 0 + format: int64 + minimum: 0 + type: integer + required: + - added + - unsupported + - invalid + type: object + STIXIngestResponseData: + description: The JSON:API resource describing the completed STIX ingestion request. + properties: + attributes: + $ref: "#/components/schemas/STIXIngestResponseAttributes" + id: + description: The normalized vendor identifier. + example: acme + type: string + type: + $ref: "#/components/schemas/STIXIngestResponseType" + required: + - type + - id + - attributes + type: object + STIXIngestResponseType: + description: The STIX ingestion resource type. + enum: + - threat-intel-stix-ingest + example: threat-intel-stix-ingest + type: string + x-enum-varnames: + - THREAT_INTEL_STIX_INGEST + STIXMetadataObject: + additionalProperties: {} + description: An opaque STIX metadata object. + type: object + STIXPatternType: + description: The supported STIX pattern language. + enum: + - stix + example: stix + type: string + x-enum-varnames: + - STIX + STIXSpecVersion: + description: The supported STIX specification version. + enum: + - "2.1" + example: "2.1" + type: string + x-enum-varnames: + - VERSION_2_1 SalesforceIncidentsOrganizationResponseAttributes: description: Attributes of a Salesforce organization connected to the Datadog Salesforce integration. properties: @@ -181627,6 +181850,114 @@ paths: operator: OR permissions: - security_monitoring_notification_profiles_write + /api/v2/security/threat-intel/stix: + post: + description: |- + Ingest a STIX 2.1 bundle containing threat intelligence indicators. Only indicator objects are supported. Supported indicator patterns contain IPv4 addresses, IPv6 addresses, domain names, or SHA-256 file hashes. + + Unsupported objects and patterns increment the `unsupported` counter. Patterns that cannot be parsed increment the `invalid` counter. Processing is best effort, so valid supported indicators in the same bundle are still added. + + A successful response means ingestion has completed. Reference-table materialization and enrichment happen asynchronously. Requests are limited to 50 MB and 10 requests per second per API key. Gzip-compressed request bodies are supported. + operationId: IngestStixThreatIntel + parameters: + - description: >- + Vendor identifier for the feed. The value must not exceed 10 characters. Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to underscores, and trims leading and trailing underscores. + example: acme + in: header + name: ti_vendor + required: true + schema: + maxLength: 10 + minLength: 1 + type: string + - description: Content encoding for the request body. Use gzip for a compressed STIX bundle. + in: header + name: Content-Encoding + required: false + schema: + $ref: "#/components/schemas/STIXContentEncoding" + requestBody: + content: + application/json: + examples: + default: + value: + id: bundle--11111111-1111-4111-8111-111111111111 + objects: + - created: "2026-07-22T12:00:00Z" + id: indicator--22222222-2222-4222-8222-222222222222 + modified: "2026-07-22T12:00:00Z" + pattern: "[ipv4-addr:value = '198.51.100.42']" + pattern_type: stix + spec_version: "2.1" + type: indicator + valid_from: "2026-07-22T12:00:00Z" + spec_version: "2.1" + type: bundle + schema: + $ref: "#/components/schemas/STIXBundleRequest" + description: >- + A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. When `Content-Encoding: gzip` is used, the limit applies to the compressed bytes received. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + added: 1 + invalid: 0 + unsupported: 0 + id: acme + type: threat-intel-stix-ingest + schema: + $ref: "#/components/schemas/STIXIngestResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "413": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Payload Too Large + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "502": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Gateway + "503": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Service Unavailable + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - reference_tables_write + summary: Ingest STIX threat intelligence + tags: + - Threat Intelligence + x-codegen-request-body-name: body + 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: deprecated: true @@ -204776,6 +205107,8 @@ tags: - description: |- Search and manage flaky tests through Test Optimization. See the [Test Optimization page](https://docs.datadoghq.com/tests/) for more information. name: Test Optimization + - description: Ingest and manage threat intelligence data for security enrichment and investigation. + name: Threat Intelligence - description: |- The usage metering API allows you to get hourly, daily, and monthly usage across multiple facets of Datadog. diff --git a/examples/v2/threat-intelligence/IngestStixThreatIntel.java b/examples/v2/threat-intelligence/IngestStixThreatIntel.java new file mode 100644 index 00000000000..e2caab24d03 --- /dev/null +++ b/examples/v2/threat-intelligence/IngestStixThreatIntel.java @@ -0,0 +1,50 @@ +// Ingest STIX threat intelligence returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ThreatIntelligenceApi; +import com.datadog.api.client.v2.model.STIXBundleRequest; +import com.datadog.api.client.v2.model.STIXBundleType; +import com.datadog.api.client.v2.model.STIXIndicatorObject; +import com.datadog.api.client.v2.model.STIXIndicatorType; +import com.datadog.api.client.v2.model.STIXIngestResponse; +import com.datadog.api.client.v2.model.STIXPatternType; +import com.datadog.api.client.v2.model.STIXSpecVersion; +import java.time.OffsetDateTime; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.ingestStixThreatIntel", true); + ThreatIntelligenceApi apiInstance = new ThreatIntelligenceApi(defaultClient); + + STIXBundleRequest body = + new STIXBundleRequest() + .id("bundle--44444444-4444-4444-8444-444444444444") + .objects( + Collections.singletonList( + new STIXIndicatorObject() + .created(OffsetDateTime.parse("2026-07-22T12:00:00Z")) + .id("indicator--55555555-5555-4555-8555-555555555555") + .modified(OffsetDateTime.parse("2026-07-22T12:00:00Z")) + .pattern("[ipv4-addr:value = '198.51.100.42']") + .patternType(STIXPatternType.STIX) + .specVersion(STIXSpecVersion.VERSION_2_1) + .type(STIXIndicatorType.INDICATOR) + .validFrom(OffsetDateTime.parse("2026-07-22T12:00:00Z")))) + .specVersion(STIXSpecVersion.VERSION_2_1) + .type(STIXBundleType.BUNDLE); + + try { + STIXIngestResponse result = apiInstance.ingestStixThreatIntel("Acme-Inc", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ThreatIntelligenceApi#ingestStixThreatIntel"); + 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 42f44708488..c658629b851 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1218,6 +1218,7 @@ public class ApiClient { put("v2.createScorecardOutcomesBatch", false); put("v2.getEntityRiskScore", false); put("v2.listEntityRiskScores", false); + put("v2.ingestStixThreatIntel", false); put("v2.createSLOReportJob", false); put("v2.getSLOReport", false); put("v2.getSLOReportJobStatus", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ThreatIntelligenceApi.java b/src/main/java/com/datadog/api/client/v2/api/ThreatIntelligenceApi.java new file mode 100644 index 00000000000..913f665151f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ThreatIntelligenceApi.java @@ -0,0 +1,330 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.STIXBundleRequest; +import com.datadog.api.client.v2.model.STIXContentEncoding; +import com.datadog.api.client.v2.model.STIXIngestResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ThreatIntelligenceApi { + private ApiClient apiClient; + + public ThreatIntelligenceApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ThreatIntelligenceApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to ingestStixThreatIntel. */ + public static class IngestStixThreatIntelOptionalParameters { + private STIXContentEncoding contentEncoding; + + /** + * Set contentEncoding. + * + * @param contentEncoding Content encoding for the request body. Use gzip for a compressed STIX + * bundle. (optional) + * @return IngestStixThreatIntelOptionalParameters + */ + public IngestStixThreatIntelOptionalParameters contentEncoding( + STIXContentEncoding contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + } + + /** + * Ingest STIX threat intelligence. + * + *

See {@link #ingestStixThreatIntelWithHttpInfo}. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @return STIXIngestResponse + * @throws ApiException if fails to make API call + */ + public STIXIngestResponse ingestStixThreatIntel(String tiVendor, STIXBundleRequest body) + throws ApiException { + return ingestStixThreatIntelWithHttpInfo( + tiVendor, body, new IngestStixThreatIntelOptionalParameters()) + .getData(); + } + + /** + * Ingest STIX threat intelligence. + * + *

See {@link #ingestStixThreatIntelWithHttpInfoAsync}. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @return CompletableFuture<STIXIngestResponse> + */ + public CompletableFuture ingestStixThreatIntelAsync( + String tiVendor, STIXBundleRequest body) { + return ingestStixThreatIntelWithHttpInfoAsync( + tiVendor, body, new IngestStixThreatIntelOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Ingest STIX threat intelligence. + * + *

See {@link #ingestStixThreatIntelWithHttpInfo}. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @param parameters Optional parameters for the request. + * @return STIXIngestResponse + * @throws ApiException if fails to make API call + */ + public STIXIngestResponse ingestStixThreatIntel( + String tiVendor, STIXBundleRequest body, IngestStixThreatIntelOptionalParameters parameters) + throws ApiException { + return ingestStixThreatIntelWithHttpInfo(tiVendor, body, parameters).getData(); + } + + /** + * Ingest STIX threat intelligence. + * + *

See {@link #ingestStixThreatIntelWithHttpInfoAsync}. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<STIXIngestResponse> + */ + public CompletableFuture ingestStixThreatIntelAsync( + String tiVendor, STIXBundleRequest body, IngestStixThreatIntelOptionalParameters parameters) { + return ingestStixThreatIntelWithHttpInfoAsync(tiVendor, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Ingest a STIX 2.1 bundle containing threat intelligence indicators. Only indicator objects are + * supported. Supported indicator patterns contain IPv4 addresses, IPv6 addresses, domain names, + * or SHA-256 file hashes. + * + *

Unsupported objects and patterns increment the unsupported counter. Patterns + * that cannot be parsed increment the invalid counter. Processing is best effort, so + * valid supported indicators in the same bundle are still added. + * + *

A successful response means ingestion has completed. Reference-table materialization and + * enrichment happen asynchronously. Requests are limited to 50 MB and 10 requests per second per + * API key. Gzip-compressed request bodies are supported. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<STIXIngestResponse> + * @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 -
403 Forbidden -
413 Payload Too Large -
429 Too many requests -
502 Bad Gateway -
503 Service Unavailable -
+ */ + public ApiResponse ingestStixThreatIntelWithHttpInfo( + String tiVendor, STIXBundleRequest body, IngestStixThreatIntelOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "ingestStixThreatIntel"; + 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 ingestStixThreatIntel"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling ingestStixThreatIntel"); + } + STIXContentEncoding contentEncoding = parameters.contentEncoding; + // create path and map variables + String localVarPath = "/api/v2/security/threat-intel/stix"; + + Map localVarHeaderParams = new HashMap(); + + if (tiVendor != null) { + localVarHeaderParams.put("ti_vendor", apiClient.parameterToString(tiVendor)); + } + if (contentEncoding != null) { + localVarHeaderParams.put("Content-Encoding", apiClient.parameterToString(contentEncoding)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ThreatIntelligenceApi.ingestStixThreatIntel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Ingest STIX threat intelligence. + * + *

See {@link #ingestStixThreatIntelWithHttpInfo}. + * + * @param tiVendor Vendor identifier for the feed. The value must not exceed 10 characters. + * Datadog normalizes the accepted value to lowercase, converts non-alphanumeric characters to + * underscores, and trims leading and trailing underscores. (required) + * @param body A STIX 2.1 bundle containing indicator objects. The maximum request size is 50 MB. + * When Content-Encoding: gzip is used, the limit applies to the compressed bytes + * received. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<STIXIngestResponse>> + */ + public CompletableFuture> ingestStixThreatIntelWithHttpInfoAsync( + String tiVendor, STIXBundleRequest body, IngestStixThreatIntelOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "ingestStixThreatIntel"; + 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 ingestStixThreatIntel")); + 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 ingestStixThreatIntel")); + return result; + } + STIXContentEncoding contentEncoding = parameters.contentEncoding; + // create path and map variables + String localVarPath = "/api/v2/security/threat-intel/stix"; + + Map localVarHeaderParams = new HashMap(); + + if (tiVendor != null) { + localVarHeaderParams.put("ti_vendor", apiClient.parameterToString(tiVendor)); + } + if (contentEncoding != null) { + localVarHeaderParams.put("Content-Encoding", apiClient.parameterToString(contentEncoding)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ThreatIntelligenceApi.ingestStixThreatIntel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXBundleRequest.java b/src/main/java/com/datadog/api/client/v2/model/STIXBundleRequest.java new file mode 100644 index 00000000000..f5fb1f47acb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXBundleRequest.java @@ -0,0 +1,257 @@ +/* + * 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 STIX 2.1 bundle containing threat intelligence indicator objects. */ +@JsonPropertyOrder({ + STIXBundleRequest.JSON_PROPERTY_ID, + STIXBundleRequest.JSON_PROPERTY_OBJECTS, + STIXBundleRequest.JSON_PROPERTY_SPEC_VERSION, + STIXBundleRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class STIXBundleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_OBJECTS = "objects"; + private List objects = new ArrayList<>(); + + public static final String JSON_PROPERTY_SPEC_VERSION = "spec_version"; + private STIXSpecVersion specVersion; + + public static final String JSON_PROPERTY_TYPE = "type"; + private STIXBundleType type; + + public STIXBundleRequest() {} + + @JsonCreator + public STIXBundleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_OBJECTS) + List objects, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) STIXBundleType type) { + this.id = id; + this.objects = objects; + for (STIXIndicatorObject item : objects) { + this.unparsed |= item.unparsed; + } + this.type = type; + this.unparsed |= !type.isValid(); + } + + public STIXBundleRequest id(String id) { + this.id = id; + return this; + } + + /** + * The STIX bundle identifier. + * + * @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 STIXBundleRequest objects(List objects) { + this.objects = objects; + for (STIXIndicatorObject item : objects) { + this.unparsed |= item.unparsed; + } + return this; + } + + public STIXBundleRequest addObjectsItem(STIXIndicatorObject objectsItem) { + this.objects.add(objectsItem); + this.unparsed |= objectsItem.unparsed; + return this; + } + + /** + * The indicator objects included in the bundle. + * + * @return objects + */ + @JsonProperty(JSON_PROPERTY_OBJECTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getObjects() { + return objects; + } + + public void setObjects(List objects) { + this.objects = objects; + if (objects != null) { + for (STIXIndicatorObject item : objects) { + this.unparsed |= item.unparsed; + } + } + } + + public STIXBundleRequest specVersion(STIXSpecVersion specVersion) { + this.specVersion = specVersion; + this.unparsed |= !specVersion.isValid(); + return this; + } + + /** + * The supported STIX specification version. + * + * @return specVersion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SPEC_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public STIXSpecVersion getSpecVersion() { + return specVersion; + } + + public void setSpecVersion(STIXSpecVersion specVersion) { + if (!specVersion.isValid()) { + this.unparsed = true; + } + this.specVersion = specVersion; + } + + public STIXBundleRequest type(STIXBundleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The STIX object type for a bundle. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXBundleType getType() { + return type; + } + + public void setType(STIXBundleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return STIXBundleRequest + */ + @JsonAnySetter + public STIXBundleRequest 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 STIXBundleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + STIXBundleRequest stixBundleRequest = (STIXBundleRequest) o; + return Objects.equals(this.id, stixBundleRequest.id) + && Objects.equals(this.objects, stixBundleRequest.objects) + && Objects.equals(this.specVersion, stixBundleRequest.specVersion) + && Objects.equals(this.type, stixBundleRequest.type) + && Objects.equals(this.additionalProperties, stixBundleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, objects, specVersion, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class STIXBundleRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" objects: ").append(toIndentedString(objects)).append("\n"); + sb.append(" specVersion: ").append(toIndentedString(specVersion)).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/STIXBundleType.java b/src/main/java/com/datadog/api/client/v2/model/STIXBundleType.java new file mode 100644 index 00000000000..c178f12cb60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXBundleType.java @@ -0,0 +1,53 @@ +/* + * 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 STIX object type for a bundle. */ +@JsonSerialize(using = STIXBundleType.STIXBundleTypeSerializer.class) +public class STIXBundleType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("bundle")); + + public static final STIXBundleType BUNDLE = new STIXBundleType("bundle"); + + STIXBundleType(String value) { + super(value, allowedValues); + } + + public static class STIXBundleTypeSerializer extends StdSerializer { + public STIXBundleTypeSerializer(Class t) { + super(t); + } + + public STIXBundleTypeSerializer() { + this(null); + } + + @Override + public void serialize(STIXBundleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXBundleType fromValue(String value) { + return new STIXBundleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXContentEncoding.java b/src/main/java/com/datadog/api/client/v2/model/STIXContentEncoding.java new file mode 100644 index 00000000000..7eeda45bb5b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXContentEncoding.java @@ -0,0 +1,54 @@ +/* + * 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 content encoding applied to the request body. */ +@JsonSerialize(using = STIXContentEncoding.STIXContentEncodingSerializer.class) +public class STIXContentEncoding extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("gzip")); + + public static final STIXContentEncoding GZIP = new STIXContentEncoding("gzip"); + + STIXContentEncoding(String value) { + super(value, allowedValues); + } + + public static class STIXContentEncodingSerializer extends StdSerializer { + public STIXContentEncodingSerializer(Class t) { + super(t); + } + + public STIXContentEncodingSerializer() { + this(null); + } + + @Override + public void serialize( + STIXContentEncoding value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXContentEncoding fromValue(String value) { + return new STIXContentEncoding(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXIndicatorObject.java b/src/main/java/com/datadog/api/client/v2/model/STIXIndicatorObject.java new file mode 100644 index 00000000000..eab071ef8ec --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIndicatorObject.java @@ -0,0 +1,635 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A STIX 2.1 indicator object. */ +@JsonPropertyOrder({ + STIXIndicatorObject.JSON_PROPERTY_CONFIDENCE, + STIXIndicatorObject.JSON_PROPERTY_CREATED, + STIXIndicatorObject.JSON_PROPERTY_EXTERNAL_REFERENCES, + STIXIndicatorObject.JSON_PROPERTY_ID, + STIXIndicatorObject.JSON_PROPERTY_INDICATOR_TYPES, + STIXIndicatorObject.JSON_PROPERTY_KILL_CHAIN_PHASES, + STIXIndicatorObject.JSON_PROPERTY_LABELS, + STIXIndicatorObject.JSON_PROPERTY_MODIFIED, + STIXIndicatorObject.JSON_PROPERTY_OBJECT_MARKING_REFS, + STIXIndicatorObject.JSON_PROPERTY_PATTERN, + STIXIndicatorObject.JSON_PROPERTY_PATTERN_TYPE, + STIXIndicatorObject.JSON_PROPERTY_REVOKED, + STIXIndicatorObject.JSON_PROPERTY_SPEC_VERSION, + STIXIndicatorObject.JSON_PROPERTY_TYPE, + STIXIndicatorObject.JSON_PROPERTY_VALID_FROM, + STIXIndicatorObject.JSON_PROPERTY_VALID_UNTIL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class STIXIndicatorObject { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONFIDENCE = "confidence"; + private Integer confidence; + + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_EXTERNAL_REFERENCES = "external_references"; + private List> externalReferences = null; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_INDICATOR_TYPES = "indicator_types"; + private List indicatorTypes = null; + + public static final String JSON_PROPERTY_KILL_CHAIN_PHASES = "kill_chain_phases"; + private List> killChainPhases = null; + + public static final String JSON_PROPERTY_LABELS = "labels"; + private List labels = null; + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_OBJECT_MARKING_REFS = "object_marking_refs"; + private List objectMarkingRefs = null; + + public static final String JSON_PROPERTY_PATTERN = "pattern"; + private String pattern; + + public static final String JSON_PROPERTY_PATTERN_TYPE = "pattern_type"; + private STIXPatternType patternType; + + public static final String JSON_PROPERTY_REVOKED = "revoked"; + private Boolean revoked; + + public static final String JSON_PROPERTY_SPEC_VERSION = "spec_version"; + private STIXSpecVersion specVersion; + + public static final String JSON_PROPERTY_TYPE = "type"; + private STIXIndicatorType type; + + public static final String JSON_PROPERTY_VALID_FROM = "valid_from"; + private OffsetDateTime validFrom; + + public static final String JSON_PROPERTY_VALID_UNTIL = "valid_until"; + private OffsetDateTime validUntil; + + public STIXIndicatorObject() {} + + @JsonCreator + public STIXIndicatorObject( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED) OffsetDateTime created, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED) OffsetDateTime modified, + @JsonProperty(required = true, value = JSON_PROPERTY_PATTERN) String pattern, + @JsonProperty(required = true, value = JSON_PROPERTY_PATTERN_TYPE) + STIXPatternType patternType, + @JsonProperty(required = true, value = JSON_PROPERTY_SPEC_VERSION) + STIXSpecVersion specVersion, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) STIXIndicatorType type, + @JsonProperty(required = true, value = JSON_PROPERTY_VALID_FROM) OffsetDateTime validFrom) { + this.created = created; + this.id = id; + this.modified = modified; + this.pattern = pattern; + this.patternType = patternType; + this.unparsed |= !patternType.isValid(); + this.specVersion = specVersion; + this.unparsed |= !specVersion.isValid(); + this.type = type; + this.unparsed |= !type.isValid(); + this.validFrom = validFrom; + } + + public STIXIndicatorObject confidence(Integer confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence in the correctness of the indicator, from 0 through 100. minimum: 0 maximum: 100 + * + * @return confidence + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getConfidence() { + return confidence; + } + + public void setConfidence(Integer confidence) { + this.confidence = confidence; + } + + public STIXIndicatorObject created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The time when the indicator was created. + * + * @return created + */ + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + + public STIXIndicatorObject externalReferences(List> externalReferences) { + this.externalReferences = externalReferences; + return this; + } + + public STIXIndicatorObject addExternalReferencesItem(Map externalReferencesItem) { + if (this.externalReferences == null) { + this.externalReferences = new ArrayList<>(); + } + this.externalReferences.add(externalReferencesItem); + return this; + } + + /** + * Optional external reference metadata preserved with the indicator but not interpreted during + * ingestion. + * + * @return externalReferences + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXTERNAL_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List> getExternalReferences() { + return externalReferences; + } + + public void setExternalReferences(List> externalReferences) { + this.externalReferences = externalReferences; + } + + public STIXIndicatorObject id(String id) { + this.id = id; + return this; + } + + /** + * The STIX indicator identifier. + * + * @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 STIXIndicatorObject indicatorTypes(List indicatorTypes) { + this.indicatorTypes = indicatorTypes; + return this; + } + + public STIXIndicatorObject addIndicatorTypesItem(String indicatorTypesItem) { + if (this.indicatorTypes == null) { + this.indicatorTypes = new ArrayList<>(); + } + this.indicatorTypes.add(indicatorTypesItem); + return this; + } + + /** + * The open vocabulary terms that categorize the indicator. + * + * @return indicatorTypes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INDICATOR_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIndicatorTypes() { + return indicatorTypes; + } + + public void setIndicatorTypes(List indicatorTypes) { + this.indicatorTypes = indicatorTypes; + } + + public STIXIndicatorObject killChainPhases(List> killChainPhases) { + this.killChainPhases = killChainPhases; + return this; + } + + public STIXIndicatorObject addKillChainPhasesItem(Map killChainPhasesItem) { + if (this.killChainPhases == null) { + this.killChainPhases = new ArrayList<>(); + } + this.killChainPhases.add(killChainPhasesItem); + return this; + } + + /** + * Optional kill chain metadata preserved with the indicator but not interpreted during ingestion. + * + * @return killChainPhases + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KILL_CHAIN_PHASES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List> getKillChainPhases() { + return killChainPhases; + } + + public void setKillChainPhases(List> killChainPhases) { + this.killChainPhases = killChainPhases; + } + + public STIXIndicatorObject labels(List labels) { + this.labels = labels; + return this; + } + + public STIXIndicatorObject addLabelsItem(String labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } + + /** + * Labels associated with the indicator. + * + * @return labels + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LABELS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getLabels() { + return labels; + } + + public void setLabels(List labels) { + this.labels = labels; + } + + public STIXIndicatorObject modified(OffsetDateTime modified) { + this.modified = modified; + return this; + } + + /** + * The time when the indicator was last modified. + * + * @return modified + */ + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModified() { + return modified; + } + + public void setModified(OffsetDateTime modified) { + this.modified = modified; + } + + public STIXIndicatorObject objectMarkingRefs(List objectMarkingRefs) { + this.objectMarkingRefs = objectMarkingRefs; + return this; + } + + public STIXIndicatorObject addObjectMarkingRefsItem(String objectMarkingRefsItem) { + if (this.objectMarkingRefs == null) { + this.objectMarkingRefs = new ArrayList<>(); + } + this.objectMarkingRefs.add(objectMarkingRefsItem); + return this; + } + + /** + * References to marking definition objects that apply to the indicator. + * + * @return objectMarkingRefs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OBJECT_MARKING_REFS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getObjectMarkingRefs() { + return objectMarkingRefs; + } + + public void setObjectMarkingRefs(List objectMarkingRefs) { + this.objectMarkingRefs = objectMarkingRefs; + } + + public STIXIndicatorObject pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * The STIX pattern that identifies the observable. + * + * @return pattern + */ + @JsonProperty(JSON_PROPERTY_PATTERN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPattern() { + return pattern; + } + + public void setPattern(String pattern) { + this.pattern = pattern; + } + + public STIXIndicatorObject patternType(STIXPatternType patternType) { + this.patternType = patternType; + this.unparsed |= !patternType.isValid(); + return this; + } + + /** + * The supported STIX pattern language. + * + * @return patternType + */ + @JsonProperty(JSON_PROPERTY_PATTERN_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXPatternType getPatternType() { + return patternType; + } + + public void setPatternType(STIXPatternType patternType) { + if (!patternType.isValid()) { + this.unparsed = true; + } + this.patternType = patternType; + } + + public STIXIndicatorObject revoked(Boolean revoked) { + this.revoked = revoked; + return this; + } + + /** + * Whether the indicator has been revoked. + * + * @return revoked + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVOKED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getRevoked() { + return revoked; + } + + public void setRevoked(Boolean revoked) { + this.revoked = revoked; + } + + public STIXIndicatorObject specVersion(STIXSpecVersion specVersion) { + this.specVersion = specVersion; + this.unparsed |= !specVersion.isValid(); + return this; + } + + /** + * The supported STIX specification version. + * + * @return specVersion + */ + @JsonProperty(JSON_PROPERTY_SPEC_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXSpecVersion getSpecVersion() { + return specVersion; + } + + public void setSpecVersion(STIXSpecVersion specVersion) { + if (!specVersion.isValid()) { + this.unparsed = true; + } + this.specVersion = specVersion; + } + + public STIXIndicatorObject type(STIXIndicatorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The STIX object type for an indicator. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXIndicatorType getType() { + return type; + } + + public void setType(STIXIndicatorType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public STIXIndicatorObject validFrom(OffsetDateTime validFrom) { + this.validFrom = validFrom; + return this; + } + + /** + * The time from which the indicator is considered valid. + * + * @return validFrom + */ + @JsonProperty(JSON_PROPERTY_VALID_FROM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getValidFrom() { + return validFrom; + } + + public void setValidFrom(OffsetDateTime validFrom) { + this.validFrom = validFrom; + } + + public STIXIndicatorObject validUntil(OffsetDateTime validUntil) { + this.validUntil = validUntil; + return this; + } + + /** + * The time until which the indicator is considered valid. + * + * @return validUntil + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALID_UNTIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getValidUntil() { + return validUntil; + } + + public void setValidUntil(OffsetDateTime validUntil) { + this.validUntil = validUntil; + } + + /** + * 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 STIXIndicatorObject + */ + @JsonAnySetter + public STIXIndicatorObject 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 STIXIndicatorObject object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + STIXIndicatorObject stixIndicatorObject = (STIXIndicatorObject) o; + return Objects.equals(this.confidence, stixIndicatorObject.confidence) + && Objects.equals(this.created, stixIndicatorObject.created) + && Objects.equals(this.externalReferences, stixIndicatorObject.externalReferences) + && Objects.equals(this.id, stixIndicatorObject.id) + && Objects.equals(this.indicatorTypes, stixIndicatorObject.indicatorTypes) + && Objects.equals(this.killChainPhases, stixIndicatorObject.killChainPhases) + && Objects.equals(this.labels, stixIndicatorObject.labels) + && Objects.equals(this.modified, stixIndicatorObject.modified) + && Objects.equals(this.objectMarkingRefs, stixIndicatorObject.objectMarkingRefs) + && Objects.equals(this.pattern, stixIndicatorObject.pattern) + && Objects.equals(this.patternType, stixIndicatorObject.patternType) + && Objects.equals(this.revoked, stixIndicatorObject.revoked) + && Objects.equals(this.specVersion, stixIndicatorObject.specVersion) + && Objects.equals(this.type, stixIndicatorObject.type) + && Objects.equals(this.validFrom, stixIndicatorObject.validFrom) + && Objects.equals(this.validUntil, stixIndicatorObject.validUntil) + && Objects.equals(this.additionalProperties, stixIndicatorObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + confidence, + created, + externalReferences, + id, + indicatorTypes, + killChainPhases, + labels, + modified, + objectMarkingRefs, + pattern, + patternType, + revoked, + specVersion, + type, + validFrom, + validUntil, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class STIXIndicatorObject {\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" externalReferences: ").append(toIndentedString(externalReferences)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" indicatorTypes: ").append(toIndentedString(indicatorTypes)).append("\n"); + sb.append(" killChainPhases: ").append(toIndentedString(killChainPhases)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" objectMarkingRefs: ").append(toIndentedString(objectMarkingRefs)).append("\n"); + sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); + sb.append(" patternType: ").append(toIndentedString(patternType)).append("\n"); + sb.append(" revoked: ").append(toIndentedString(revoked)).append("\n"); + sb.append(" specVersion: ").append(toIndentedString(specVersion)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" validFrom: ").append(toIndentedString(validFrom)).append("\n"); + sb.append(" validUntil: ").append(toIndentedString(validUntil)).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/STIXIndicatorType.java b/src/main/java/com/datadog/api/client/v2/model/STIXIndicatorType.java new file mode 100644 index 00000000000..4633d7f1e54 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIndicatorType.java @@ -0,0 +1,53 @@ +/* + * 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 STIX object type for an indicator. */ +@JsonSerialize(using = STIXIndicatorType.STIXIndicatorTypeSerializer.class) +public class STIXIndicatorType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("indicator")); + + public static final STIXIndicatorType INDICATOR = new STIXIndicatorType("indicator"); + + STIXIndicatorType(String value) { + super(value, allowedValues); + } + + public static class STIXIndicatorTypeSerializer extends StdSerializer { + public STIXIndicatorTypeSerializer(Class t) { + super(t); + } + + public STIXIndicatorTypeSerializer() { + this(null); + } + + @Override + public void serialize(STIXIndicatorType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXIndicatorType fromValue(String value) { + return new STIXIndicatorType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponse.java b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponse.java new file mode 100644 index 00000000000..4eac12e638d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The response from a completed STIX ingestion request. */ +@JsonPropertyOrder({STIXIngestResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class STIXIngestResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private STIXIngestResponseData data; + + public STIXIngestResponse() {} + + @JsonCreator + public STIXIngestResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) STIXIngestResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public STIXIngestResponse data(STIXIngestResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API resource describing the completed STIX ingestion request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXIngestResponseData getData() { + return data; + } + + public void setData(STIXIngestResponseData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 STIXIngestResponse + */ + @JsonAnySetter + public STIXIngestResponse 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 STIXIngestResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + STIXIngestResponse stixIngestResponse = (STIXIngestResponse) o; + return Objects.equals(this.data, stixIngestResponse.data) + && Objects.equals(this.additionalProperties, stixIngestResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class STIXIngestResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseAttributes.java new file mode 100644 index 00000000000..520cb1a1aca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseAttributes.java @@ -0,0 +1,202 @@ +/* + * 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; + +/** Counters describing the result of the STIX ingestion request. */ +@JsonPropertyOrder({ + STIXIngestResponseAttributes.JSON_PROPERTY_ADDED, + STIXIngestResponseAttributes.JSON_PROPERTY_INVALID, + STIXIngestResponseAttributes.JSON_PROPERTY_UNSUPPORTED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class STIXIngestResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADDED = "added"; + private Long added; + + public static final String JSON_PROPERTY_INVALID = "invalid"; + private Long invalid; + + public static final String JSON_PROPERTY_UNSUPPORTED = "unsupported"; + private Long unsupported; + + public STIXIngestResponseAttributes() {} + + @JsonCreator + public STIXIngestResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ADDED) Long added, + @JsonProperty(required = true, value = JSON_PROPERTY_INVALID) Long invalid, + @JsonProperty(required = true, value = JSON_PROPERTY_UNSUPPORTED) Long unsupported) { + this.added = added; + this.invalid = invalid; + this.unsupported = unsupported; + } + + public STIXIngestResponseAttributes added(Long added) { + this.added = added; + return this; + } + + /** + * The number of supported indicators added. minimum: 0 + * + * @return added + */ + @JsonProperty(JSON_PROPERTY_ADDED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getAdded() { + return added; + } + + public void setAdded(Long added) { + this.added = added; + } + + public STIXIngestResponseAttributes invalid(Long invalid) { + this.invalid = invalid; + return this; + } + + /** + * The number of indicators with patterns that could not be parsed. minimum: 0 + * + * @return invalid + */ + @JsonProperty(JSON_PROPERTY_INVALID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getInvalid() { + return invalid; + } + + public void setInvalid(Long invalid) { + this.invalid = invalid; + } + + public STIXIngestResponseAttributes unsupported(Long unsupported) { + this.unsupported = unsupported; + return this; + } + + /** + * The number of unsupported objects or patterns. minimum: 0 + * + * @return unsupported + */ + @JsonProperty(JSON_PROPERTY_UNSUPPORTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUnsupported() { + return unsupported; + } + + public void setUnsupported(Long unsupported) { + this.unsupported = unsupported; + } + + /** + * 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 STIXIngestResponseAttributes + */ + @JsonAnySetter + public STIXIngestResponseAttributes 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 STIXIngestResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + STIXIngestResponseAttributes stixIngestResponseAttributes = (STIXIngestResponseAttributes) o; + return Objects.equals(this.added, stixIngestResponseAttributes.added) + && Objects.equals(this.invalid, stixIngestResponseAttributes.invalid) + && Objects.equals(this.unsupported, stixIngestResponseAttributes.unsupported) + && Objects.equals( + this.additionalProperties, stixIngestResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(added, invalid, unsupported, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class STIXIngestResponseAttributes {\n"); + sb.append(" added: ").append(toIndentedString(added)).append("\n"); + sb.append(" invalid: ").append(toIndentedString(invalid)).append("\n"); + sb.append(" unsupported: ").append(toIndentedString(unsupported)).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/STIXIngestResponseData.java b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseData.java new file mode 100644 index 00000000000..05832e7ca9f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseData.java @@ -0,0 +1,212 @@ +/* + * 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 JSON:API resource describing the completed STIX ingestion request. */ +@JsonPropertyOrder({ + STIXIngestResponseData.JSON_PROPERTY_ATTRIBUTES, + STIXIngestResponseData.JSON_PROPERTY_ID, + STIXIngestResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class STIXIngestResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private STIXIngestResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private STIXIngestResponseType type; + + public STIXIngestResponseData() {} + + @JsonCreator + public STIXIngestResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + STIXIngestResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) STIXIngestResponseType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public STIXIngestResponseData attributes(STIXIngestResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Counters describing the result of the STIX ingestion request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXIngestResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(STIXIngestResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public STIXIngestResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The normalized vendor identifier. + * + * @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 STIXIngestResponseData type(STIXIngestResponseType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The STIX ingestion resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public STIXIngestResponseType getType() { + return type; + } + + public void setType(STIXIngestResponseType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return STIXIngestResponseData + */ + @JsonAnySetter + public STIXIngestResponseData 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 STIXIngestResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + STIXIngestResponseData stixIngestResponseData = (STIXIngestResponseData) o; + return Objects.equals(this.attributes, stixIngestResponseData.attributes) + && Objects.equals(this.id, stixIngestResponseData.id) + && Objects.equals(this.type, stixIngestResponseData.type) + && Objects.equals(this.additionalProperties, stixIngestResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class STIXIngestResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseType.java b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseType.java new file mode 100644 index 00000000000..3ea6e754fa0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXIngestResponseType.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 STIX ingestion resource type. */ +@JsonSerialize(using = STIXIngestResponseType.STIXIngestResponseTypeSerializer.class) +public class STIXIngestResponseType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("threat-intel-stix-ingest")); + + public static final STIXIngestResponseType THREAT_INTEL_STIX_INGEST = + new STIXIngestResponseType("threat-intel-stix-ingest"); + + STIXIngestResponseType(String value) { + super(value, allowedValues); + } + + public static class STIXIngestResponseTypeSerializer + extends StdSerializer { + public STIXIngestResponseTypeSerializer(Class t) { + super(t); + } + + public STIXIngestResponseTypeSerializer() { + this(null); + } + + @Override + public void serialize( + STIXIngestResponseType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXIngestResponseType fromValue(String value) { + return new STIXIngestResponseType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXPatternType.java b/src/main/java/com/datadog/api/client/v2/model/STIXPatternType.java new file mode 100644 index 00000000000..defbaf0d56e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXPatternType.java @@ -0,0 +1,53 @@ +/* + * 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 supported STIX pattern language. */ +@JsonSerialize(using = STIXPatternType.STIXPatternTypeSerializer.class) +public class STIXPatternType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("stix")); + + public static final STIXPatternType STIX = new STIXPatternType("stix"); + + STIXPatternType(String value) { + super(value, allowedValues); + } + + public static class STIXPatternTypeSerializer extends StdSerializer { + public STIXPatternTypeSerializer(Class t) { + super(t); + } + + public STIXPatternTypeSerializer() { + this(null); + } + + @Override + public void serialize(STIXPatternType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXPatternType fromValue(String value) { + return new STIXPatternType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/STIXSpecVersion.java b/src/main/java/com/datadog/api/client/v2/model/STIXSpecVersion.java new file mode 100644 index 00000000000..cd19125b087 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/STIXSpecVersion.java @@ -0,0 +1,53 @@ +/* + * 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 supported STIX specification version. */ +@JsonSerialize(using = STIXSpecVersion.STIXSpecVersionSerializer.class) +public class STIXSpecVersion extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("2.1")); + + public static final STIXSpecVersion VERSION_2_1 = new STIXSpecVersion("2.1"); + + STIXSpecVersion(String value) { + super(value, allowedValues); + } + + public static class STIXSpecVersionSerializer extends StdSerializer { + public STIXSpecVersionSerializer(Class t) { + super(t); + } + + public STIXSpecVersionSerializer() { + this(null); + } + + @Override + public void serialize(STIXSpecVersion value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static STIXSpecVersion fromValue(String value) { + return new STIXSpecVersion(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.freeze new file mode 100644 index 00000000000..62819102ac8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-07-24T13:40:34.989Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.json new file mode 100644 index 00000000000..f4b614b43fa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Ingest_STIX_threat_intelligence_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"id\":\"bundle--44444444-4444-4444-8444-444444444444\",\"objects\":[{\"created\":\"2026-07-22T12:00:00Z\",\"id\":\"indicator--55555555-5555-4555-8555-555555555555\",\"modified\":\"2026-07-22T12:00:00Z\",\"pattern\":\"[ipv4-addr:value = '198.51.100.42']\",\"pattern_type\":\"stix\",\"spec_version\":\"2.1\",\"type\":\"indicator\",\"valid_from\":\"2026-07-22T12:00:00Z\"}],\"spec_version\":\"2.1\",\"type\":\"bundle\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/security/threat-intel/stix", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"acme_inc\",\"type\":\"threat-intel-stix-ingest\",\"attributes\":{\"added\":1,\"invalid\":0,\"unsupported\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "58a1d097-671e-2440-7445-8fc1e14fa3f0" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/threat_intelligence.feature b/src/test/resources/com/datadog/api/client/v2/api/threat_intelligence.feature new file mode 100644 index 00000000000..22385a31f55 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/threat_intelligence.feature @@ -0,0 +1,37 @@ +@endpoint(threat-intelligence) @endpoint(threat-intelligence-v2) +Feature: Threat Intelligence + Ingest and manage threat intelligence data for security enrichment and + investigation. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ThreatIntelligence" API + And operation "IngestStixThreatIntel" enabled + And new "IngestStixThreatIntel" request + + @generated @skip @team:DataDog/cloud-siem + Scenario: Ingest STIX threat intelligence returns "Bad Request" response + Given body with value {"id": "bundle--11111111-1111-4111-8111-111111111111", "objects": [{"created": "2026-07-22T12:00:00Z", "id": "indicator--22222222-2222-4222-8222-222222222222", "modified": "2026-07-22T12:00:00Z", "pattern": "[ipv4-addr:value = '198.51.100.42']", "pattern_type": "stix", "spec_version": "2.1", "type": "indicator", "valid_from": "2026-07-22T12:00:00Z"}], "spec_version": "2.1", "type": "bundle"} + And request contains "ti_vendor" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/cloud-siem + Scenario: Ingest STIX threat intelligence returns "OK" response + Given request contains "ti_vendor" parameter with value "Acme-Inc" + And body with value {"id": "bundle--44444444-4444-4444-8444-444444444444", "objects": [{"created": "2026-07-22T12:00:00Z", "id": "indicator--55555555-5555-4555-8555-555555555555", "modified": "2026-07-22T12:00:00Z", "pattern": "[ipv4-addr:value = '198.51.100.42']", "pattern_type": "stix", "spec_version": "2.1", "type": "indicator", "valid_from": "2026-07-22T12:00:00Z"}], "spec_version": "2.1", "type": "bundle"} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "threat-intel-stix-ingest" + And the response "data.id" is equal to "acme_inc" + And the response "data.attributes.added" is equal to 1 + And the response "data.attributes.unsupported" is equal to 0 + And the response "data.attributes.invalid" is equal to 0 + + @skip @team:DataDog/cloud-siem + Scenario: Ingest STIX threat intelligence returns "Payload Too Large" response + Given request contains "ti_vendor" parameter with value "Acme-Inc" + And body with value {"id": "bundle--66666666-6666-4666-8666-666666666666", "objects": [{"created": "2026-07-22T12:00:00Z", "id": "indicator--77777777-7777-4777-8777-777777777777", "modified": "2026-07-22T12:00:00Z", "pattern": "[ipv4-addr:value = '198.51.100.42']", "pattern_type": "stix", "spec_version": "2.1", "type": "indicator", "valid_from": "2026-07-22T12:00:00Z"}], "spec_version": "2.1", "type": "bundle"} + When the request is sent + Then the response status is 413 Payload Too Large 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 d93991ac7d7..eccfda6021e 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 @@ -7549,6 +7549,12 @@ "type": "idempotent" } }, + "IngestStixThreatIntel": { + "tag": "Threat Intelligence", + "undo": { + "type": "safe" + } + }, "ListVulnerabilities": { "tag": "Security Monitoring", "undo": {