diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5fefa9009c9..06c5e02c4a1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -37936,6 +37936,13 @@ components: required: - revisions type: object + EntityContextEntityType: + default: siem_entity_identity + description: The type of entity to retrieve. Only `siem_entity_identity` is currently supported. + enum: [siem_entity_identity] + example: siem_entity_identity + type: string + x-enum-varnames: [SIEM_ENTITY_IDENTITY] EntityContextPage: description: Pagination metadata for the entity context response. properties: @@ -38005,6 +38012,15 @@ components: email: user@example.com principal_id: user@example.com type: object + EntityContextRevisionsMode: + default: latest + description: |- + Which revisions to return for each entity: `latest` returns only the latest revision of each entity as of `to`, + and `all` returns every revision in the requested time range. + enum: [latest, all] + example: latest + type: string + x-enum-varnames: [LATEST, ALL] EntityData: description: Entity data. properties: @@ -92891,6 +92907,17 @@ components: x-enum-varnames: - ANY - ALL + RecentlyUpdatedEntitiesResponse: + description: Response from the recently updated entities endpoint, containing the entities with the most recent updates in the requested time range, ordered from most to least recently updated. + properties: + data: + description: The list of entities with the most recent updates, ordered from most to least recently updated. + items: + $ref: "#/components/schemas/EntityContextEntity" + type: array + required: + - data + type: object RecommendationAttributes: description: Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. properties: @@ -212778,6 +212805,15 @@ paths: required: false schema: type: string + - description: |- + The type of entity to retrieve. Only `siem_entity_identity` is currently supported. + Defaults to `siem_entity_identity`. + example: siem_entity_identity + in: query + name: entity_type + required: false + schema: + $ref: "#/components/schemas/EntityContextEntityType" - description: |- The start of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now-7d`). Defaults to `now-7d`. Ignored when `as_of` is set. @@ -212870,6 +212906,113 @@ paths: 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_monitoring/entity_context/recently_updated: + get: + description: |- + Get the entities with the most recent updates in the Cloud SIEM entity context store. Entities are ranked + by the time of their most recent revision in the requested time range, and the top `limit` entities are + returned in that order. This endpoint is not paginated. + operationId: GetEntityContextRecentlyUpdated + parameters: + - description: A free-text query (for example, an email address or principal ID) used to filter the entities returned. + example: user@example.com + in: query + name: query + required: false + schema: + type: string + - description: |- + The type of entity to retrieve. Only `siem_entity_identity` is currently supported. + Defaults to `siem_entity_identity`. + example: siem_entity_identity + in: query + name: entity_type + required: false + schema: + $ref: "#/components/schemas/EntityContextEntityType" + - description: |- + The start of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now-7d`). + Defaults to `now-7d`. + in: query + name: from + required: false + schema: + default: now-7d + example: now-7d + type: string + - description: |- + The end of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now`). + Defaults to `now`. Entities are ranked by their most recent revision within `[from, to]`. + in: query + name: to + required: false + schema: + default: now + example: now + type: string + - description: The number of entities to return. Must be between 1 and 100. + example: 50 + in: query + name: limit + required: false + schema: + default: 50 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: |- + Which revisions to return for each entity: `latest` returns only the latest revision of each entity as of `to`, + and `all` returns every revision in the requested time range. + example: latest + in: query + name: revisions + required: false + schema: + $ref: "#/components/schemas/EntityContextRevisionsMode" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + revisions: + - attributes: + accounts: + - linked-account-123 + display_name: Test User + email: user@example.com + principal_id: user@example.com + first_seen_at: "2026-04-01T00:00:00Z" + last_seen_at: "2026-05-01T00:00:00Z" + id: user@example.com + type: siem_entity_identity + schema: + $ref: "#/components/schemas/RecentlyUpdatedEntitiesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - siem_entities_read + summary: Get recently updated entity context + tags: ["Security Monitoring"] + x-permission: + operator: OR + permissions: + - siem_entities_read + 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_monitoring/entity_context/{id}: get: description: |- @@ -212886,6 +213029,15 @@ paths: schema: example: user@example.com type: string + - description: |- + The type of entity to retrieve. Only `siem_entity_identity` is currently supported. + Defaults to `siem_entity_identity`. + example: siem_entity_identity + in: query + name: entity_type + required: false + schema: + $ref: "#/components/schemas/EntityContextEntityType" - description: |- The start of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now-7d`). Defaults to `now-7d`. Ignored when `as_of` is set. diff --git a/examples/v2/security-monitoring/GetEntityContextRecentlyUpdated.java b/examples/v2/security-monitoring/GetEntityContextRecentlyUpdated.java new file mode 100644 index 00000000000..eb62e2d18aa --- /dev/null +++ b/examples/v2/security-monitoring/GetEntityContextRecentlyUpdated.java @@ -0,0 +1,27 @@ +// Get recently updated entity context 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.RecentlyUpdatedEntitiesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getEntityContextRecentlyUpdated", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + RecentlyUpdatedEntitiesResponse result = apiInstance.getEntityContextRecentlyUpdated(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#getEntityContextRecentlyUpdated"); + 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 31da385557d..1870c7db820 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1053,6 +1053,7 @@ public class ApiClient { put("v2.exportSecurityMonitoringTerraformResource", false); put("v2.getContentPacksStates", false); put("v2.getEntityContext", false); + put("v2.getEntityContextRecentlyUpdated", false); put("v2.getEntraIdAzureAppRegistrations", false); put("v2.getFinding", false); put("v2.getHistoricalJob", 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 e8a29f0ae00..7ac04d157f9 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 @@ -34,7 +34,9 @@ import com.datadog.api.client.v2.model.DueDateRuleResponse; import com.datadog.api.client.v2.model.DueDateRuleUpdateRequest; import com.datadog.api.client.v2.model.DueDateRulesResponse; +import com.datadog.api.client.v2.model.EntityContextEntityType; import com.datadog.api.client.v2.model.EntityContextResponse; +import com.datadog.api.client.v2.model.EntityContextRevisionsMode; import com.datadog.api.client.v2.model.Finding; import com.datadog.api.client.v2.model.FindingCaseResponse; import com.datadog.api.client.v2.model.FindingCaseResponseArray; @@ -83,6 +85,7 @@ import com.datadog.api.client.v2.model.NotificationRuleResponse; import com.datadog.api.client.v2.model.NotificationRulesListResponse; import com.datadog.api.client.v2.model.PatchNotificationRuleParameters; +import com.datadog.api.client.v2.model.RecentlyUpdatedEntitiesResponse; import com.datadog.api.client.v2.model.RunHistoricalJobRequest; import com.datadog.api.client.v2.model.SBOMComponentLicenseType; import com.datadog.api.client.v2.model.SBOMFormat; @@ -11187,6 +11190,7 @@ public ApiResponse getCustomFrameworkWithHttpInfo( /** Manage optional parameters to getEntityContext. */ public static class GetEntityContextOptionalParameters { private String query; + private EntityContextEntityType entityType; private String from; private String to; private String asOf; @@ -11205,6 +11209,19 @@ public GetEntityContextOptionalParameters query(String query) { return this; } + /** + * Set entityType. + * + * @param entityType The type of entity to retrieve. Only siem_entity_identity is + * currently supported. Defaults to siem_entity_identity. (optional, default to + * "siem_entity_identity") + * @return GetEntityContextOptionalParameters + */ + public GetEntityContextOptionalParameters entityType(EntityContextEntityType entityType) { + this.entityType = entityType; + return this; + } + /** * Set from. * @@ -11357,6 +11374,7 @@ public ApiResponse getEntityContextWithHttpInfo( } Object localVarPostBody = null; String query = parameters.query; + EntityContextEntityType entityType = parameters.entityType; String from = parameters.from; String to = parameters.to; String asOf = parameters.asOf; @@ -11369,6 +11387,7 @@ public ApiResponse getEntityContextWithHttpInfo( Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of", asOf)); @@ -11417,6 +11436,7 @@ public CompletableFuture> getEntityContextWit } Object localVarPostBody = null; String query = parameters.query; + EntityContextEntityType entityType = parameters.entityType; String from = parameters.from; String to = parameters.to; String asOf = parameters.asOf; @@ -11429,6 +11449,7 @@ public CompletableFuture> getEntityContextWit Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of", asOf)); @@ -11462,6 +11483,292 @@ public CompletableFuture> getEntityContextWit new GenericType() {}); } + /** Manage optional parameters to getEntityContextRecentlyUpdated. */ + public static class GetEntityContextRecentlyUpdatedOptionalParameters { + private String query; + private EntityContextEntityType entityType; + private String from; + private String to; + private Long limit; + private EntityContextRevisionsMode revisions; + + /** + * Set query. + * + * @param query A free-text query (for example, an email address or principal ID) used to filter + * the entities returned. (optional) + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters query(String query) { + this.query = query; + return this; + } + + /** + * Set entityType. + * + * @param entityType The type of entity to retrieve. Only siem_entity_identity is + * currently supported. Defaults to siem_entity_identity. (optional, default to + * "siem_entity_identity") + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters entityType( + EntityContextEntityType entityType) { + this.entityType = entityType; + return this; + } + + /** + * Set from. + * + * @param from The start of the time range to query, as an RFC3339 timestamp or a relative time + * (for example, now-7d). Defaults to now-7d. (optional, default + * to "now-7d") + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters from(String from) { + this.from = from; + return this; + } + + /** + * Set to. + * + * @param to The end of the time range to query, as an RFC3339 timestamp or a relative time (for + * example, now). Defaults to now. Entities are ranked by their + * most recent revision within [from, to]. (optional, default to "now") + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters to(String to) { + this.to = to; + return this; + } + + /** + * Set limit. + * + * @param limit The number of entities to return. Must be between 1 and 100. (optional, default + * to 50) + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Set revisions. + * + * @param revisions Which revisions to return for each entity: latest returns only + * the latest revision of each entity as of to, and all returns + * every revision in the requested time range. (optional, default to "latest") + * @return GetEntityContextRecentlyUpdatedOptionalParameters + */ + public GetEntityContextRecentlyUpdatedOptionalParameters revisions( + EntityContextRevisionsMode revisions) { + this.revisions = revisions; + return this; + } + } + + /** + * Get recently updated entity context. + * + *

See {@link #getEntityContextRecentlyUpdatedWithHttpInfo}. + * + * @return RecentlyUpdatedEntitiesResponse + * @throws ApiException if fails to make API call + */ + public RecentlyUpdatedEntitiesResponse getEntityContextRecentlyUpdated() throws ApiException { + return getEntityContextRecentlyUpdatedWithHttpInfo( + new GetEntityContextRecentlyUpdatedOptionalParameters()) + .getData(); + } + + /** + * Get recently updated entity context. + * + *

See {@link #getEntityContextRecentlyUpdatedWithHttpInfoAsync}. + * + * @return CompletableFuture<RecentlyUpdatedEntitiesResponse> + */ + public CompletableFuture getEntityContextRecentlyUpdatedAsync() { + return getEntityContextRecentlyUpdatedWithHttpInfoAsync( + new GetEntityContextRecentlyUpdatedOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get recently updated entity context. + * + *

See {@link #getEntityContextRecentlyUpdatedWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return RecentlyUpdatedEntitiesResponse + * @throws ApiException if fails to make API call + */ + public RecentlyUpdatedEntitiesResponse getEntityContextRecentlyUpdated( + GetEntityContextRecentlyUpdatedOptionalParameters parameters) throws ApiException { + return getEntityContextRecentlyUpdatedWithHttpInfo(parameters).getData(); + } + + /** + * Get recently updated entity context. + * + *

See {@link #getEntityContextRecentlyUpdatedWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<RecentlyUpdatedEntitiesResponse> + */ + public CompletableFuture getEntityContextRecentlyUpdatedAsync( + GetEntityContextRecentlyUpdatedOptionalParameters parameters) { + return getEntityContextRecentlyUpdatedWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the entities with the most recent updates in the Cloud SIEM entity context store. Entities + * are ranked by the time of their most recent revision in the requested time range, and the top + * limit entities are returned in that order. This endpoint is not paginated. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<RecentlyUpdatedEntitiesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse getEntityContextRecentlyUpdatedWithHttpInfo( + GetEntityContextRecentlyUpdatedOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getEntityContextRecentlyUpdated"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + String query = parameters.query; + EntityContextEntityType entityType = parameters.entityType; + String from = parameters.from; + String to = parameters.to; + Long limit = parameters.limit; + EntityContextRevisionsMode revisions = parameters.revisions; + // create path and map variables + String localVarPath = "/api/v2/security_monitoring/entity_context/recently_updated"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "revisions", revisions)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getEntityContextRecentlyUpdated", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get recently updated entity context. + * + *

See {@link #getEntityContextRecentlyUpdatedWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<RecentlyUpdatedEntitiesResponse>> + */ + public CompletableFuture> + getEntityContextRecentlyUpdatedWithHttpInfoAsync( + GetEntityContextRecentlyUpdatedOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getEntityContextRecentlyUpdated"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + String query = parameters.query; + EntityContextEntityType entityType = parameters.entityType; + String from = parameters.from; + String to = parameters.to; + Long limit = parameters.limit; + EntityContextRevisionsMode revisions = parameters.revisions; + // create path and map variables + String localVarPath = "/api/v2/security_monitoring/entity_context/recently_updated"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "revisions", revisions)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getEntityContextRecentlyUpdated", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get Entra ID Azure App Registration prerequisites. * @@ -16788,10 +17095,24 @@ public ApiResponse getSignalNotificationRulesWith /** Manage optional parameters to getSingleEntityContext. */ public static class GetSingleEntityContextOptionalParameters { + private EntityContextEntityType entityType; private String from; private String to; private String asOf; + /** + * Set entityType. + * + * @param entityType The type of entity to retrieve. Only siem_entity_identity is + * currently supported. Defaults to siem_entity_identity. (optional, default to + * "siem_entity_identity") + * @return GetSingleEntityContextOptionalParameters + */ + public GetSingleEntityContextOptionalParameters entityType(EntityContextEntityType entityType) { + this.entityType = entityType; + return this; + } + /** * Set from. * @@ -16934,6 +17255,7 @@ public ApiResponse getSingleEntityContextWithHttpIn throw new ApiException( 400, "Missing the required parameter 'id' when calling getSingleEntityContext"); } + EntityContextEntityType entityType = parameters.entityType; String from = parameters.from; String to = parameters.to; String asOf = parameters.asOf; @@ -16945,6 +17267,7 @@ public ApiResponse getSingleEntityContextWithHttpIn List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of", asOf)); @@ -17003,6 +17326,7 @@ public ApiResponse getSingleEntityContextWithHttpIn 400, "Missing the required parameter 'id' when calling getSingleEntityContext")); return result; } + EntityContextEntityType entityType = parameters.entityType; String from = parameters.from; String to = parameters.to; String asOf = parameters.asOf; @@ -17014,6 +17338,7 @@ public ApiResponse getSingleEntityContextWithHttpIn List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "entity_type", entityType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of", asOf)); diff --git a/src/main/java/com/datadog/api/client/v2/model/EntityContextEntityType.java b/src/main/java/com/datadog/api/client/v2/model/EntityContextEntityType.java new file mode 100644 index 00000000000..b2d5da62e06 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EntityContextEntityType.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 entity to retrieve. Only siem_entity_identity is currently supported. + */ +@JsonSerialize(using = EntityContextEntityType.EntityContextEntityTypeSerializer.class) +public class EntityContextEntityType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("siem_entity_identity")); + + public static final EntityContextEntityType SIEM_ENTITY_IDENTITY = + new EntityContextEntityType("siem_entity_identity"); + + EntityContextEntityType(String value) { + super(value, allowedValues); + } + + public static class EntityContextEntityTypeSerializer + extends StdSerializer { + public EntityContextEntityTypeSerializer(Class t) { + super(t); + } + + public EntityContextEntityTypeSerializer() { + this(null); + } + + @Override + public void serialize( + EntityContextEntityType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EntityContextEntityType fromValue(String value) { + return new EntityContextEntityType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EntityContextRevisionsMode.java b/src/main/java/com/datadog/api/client/v2/model/EntityContextRevisionsMode.java new file mode 100644 index 00000000000..f728825d84d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EntityContextRevisionsMode.java @@ -0,0 +1,61 @@ +/* + * 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; + +/** + * Which revisions to return for each entity: latest returns only the latest revision + * of each entity as of to, and all returns every revision in the + * requested time range. + */ +@JsonSerialize(using = EntityContextRevisionsMode.EntityContextRevisionsModeSerializer.class) +public class EntityContextRevisionsMode extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("latest", "all")); + + public static final EntityContextRevisionsMode LATEST = new EntityContextRevisionsMode("latest"); + public static final EntityContextRevisionsMode ALL = new EntityContextRevisionsMode("all"); + + EntityContextRevisionsMode(String value) { + super(value, allowedValues); + } + + public static class EntityContextRevisionsModeSerializer + extends StdSerializer { + public EntityContextRevisionsModeSerializer(Class t) { + super(t); + } + + public EntityContextRevisionsModeSerializer() { + this(null); + } + + @Override + public void serialize( + EntityContextRevisionsMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EntityContextRevisionsMode fromValue(String value) { + return new EntityContextRevisionsMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RecentlyUpdatedEntitiesResponse.java b/src/main/java/com/datadog/api/client/v2/model/RecentlyUpdatedEntitiesResponse.java new file mode 100644 index 00000000000..11f9c66eecf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RecentlyUpdatedEntitiesResponse.java @@ -0,0 +1,167 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.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; + +/** + * Response from the recently updated entities endpoint, containing the entities with the most + * recent updates in the requested time range, ordered from most to least recently updated. + */ +@JsonPropertyOrder({RecentlyUpdatedEntitiesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RecentlyUpdatedEntitiesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public RecentlyUpdatedEntitiesResponse() {} + + @JsonCreator + public RecentlyUpdatedEntitiesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + for (EntityContextEntity item : data) { + this.unparsed |= item.unparsed; + } + } + + public RecentlyUpdatedEntitiesResponse data(List data) { + this.data = data; + for (EntityContextEntity item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RecentlyUpdatedEntitiesResponse addDataItem(EntityContextEntity dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of entities with the most recent updates, ordered from most to least recently updated. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (EntityContextEntity item : data) { + this.unparsed |= item.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 RecentlyUpdatedEntitiesResponse + */ + @JsonAnySetter + public RecentlyUpdatedEntitiesResponse 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 RecentlyUpdatedEntitiesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecentlyUpdatedEntitiesResponse recentlyUpdatedEntitiesResponse = + (RecentlyUpdatedEntitiesResponse) o; + return Objects.equals(this.data, recentlyUpdatedEntitiesResponse.data) + && Objects.equals( + this.additionalProperties, recentlyUpdatedEntitiesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecentlyUpdatedEntitiesResponse {\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/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 a1781b2257a..cf9a335e221 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 @@ -2505,6 +2505,20 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-siem + Scenario: Get recently updated entity context returns "Bad Request" response + Given operation "GetEntityContextRecentlyUpdated" enabled + And new "GetEntityContextRecentlyUpdated" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-siem + Scenario: Get recently updated entity context returns "OK" response + Given operation "GetEntityContextRecentlyUpdated" enabled + And new "GetEntityContextRecentlyUpdated" request + When the request is sent + Then the response status is 200 OK + @skip-go @skip-java @skip-ruby @team:DataDog/cloud-siem Scenario: Get rule version history returns "OK" response Given operation "GetRuleVersionHistory" enabled diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index cbecf69cfc2..a3ee9d72c99 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 @@ -8776,6 +8776,12 @@ "type": "safe" } }, + "GetEntityContextRecentlyUpdated": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "GetSingleEntityContext": { "tag": "Security Monitoring", "undo": {