From 46456f907ae4aae0aca9e02b8e0ca4aa88a329c6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 30 Sep 2026 16:29:51 +0000 Subject: [PATCH] Regenerate client from commit d5c2179 of spec repo --- .generator/schemas/v2/openapi.yaml | 203 ++++++++++- .../GetEntityContextRecentlyUpdated.java | 27 ++ .../com/datadog/api/client/ApiClient.java | 1 + .../client/v2/api/SecurityMonitoringApi.java | 325 ++++++++++++++++++ .../v2/model/EntityContextEntityType.java | 59 ++++ .../v2/model/EntityContextRevisionsMode.java | 61 ++++ .../LLMObsCreatePromptDataAttributes.java | 14 +- ...MObsCreatePromptVersionDataAttributes.java | 14 +- .../v2/model/LLMObsPromptChatTemplate.java | 11 +- .../model/LLMObsPromptChatTemplateItem.java | 288 ++++++++++++++++ .../model/LLMObsPromptMessagePlaceholder.java | 131 +++++++ .../LLMObsPromptMessagePlaceholderType.java | 59 ++++ .../model/LLMObsPromptSDKDataAttributes.java | 21 +- .../LLMObsPromptVersionDataAttributes.java | 28 +- .../RecentlyUpdatedEntitiesResponse.java | 167 +++++++++ .../client/v2/api/security_monitoring.feature | 14 + .../com/datadog/api/client/v2/api/undo.json | 6 + 17 files changed, 1388 insertions(+), 41 deletions(-) create mode 100644 examples/v2/security-monitoring/GetEntityContextRecentlyUpdated.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/EntityContextEntityType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/EntityContextRevisionsMode.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplateItem.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholder.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholderType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RecentlyUpdatedEntitiesResponse.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5fefa9009c9..fbaf9995c56 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: @@ -64945,12 +64961,20 @@ components: - content type: object LLMObsPromptChatTemplate: - description: A chat prompt template. + description: >- + A chat prompt template containing messages and optional named message placeholders. + + **Preview:** Message placeholders are available in Preview. To request access, contact [Datadog Support](https://www.datadoghq.com/support/) or your Customer Success Manager. items: - $ref: "#/components/schemas/LLMObsPromptChatMessage" + $ref: "#/components/schemas/LLMObsPromptChatTemplateItem" minItems: 1 type: array x-generate-alias-as-model: true + LLMObsPromptChatTemplateItem: + description: A chat message or a named message placeholder in a prompt template. + oneOf: + - $ref: "#/components/schemas/LLMObsPromptChatMessage" + - $ref: "#/components/schemas/LLMObsPromptMessagePlaceholder" LLMObsPromptConfig: additionalProperties: {} description: >- @@ -65103,6 +65127,33 @@ components: required: - include type: object + LLMObsPromptMessagePlaceholder: + additionalProperties: false + description: >- + A named placeholder that inserts a list of messages when a compatible SDK formats the prompt. + + **Preview:** Message placeholders are available in Preview. To request access, contact [Datadog Support](https://www.datadoghq.com/support/) or your Customer Success Manager. + properties: + name: + description: Name used to supply the message list when formatting the prompt. + example: "history" + minLength: 1 + pattern: "^[A-Za-z0-9_]+$" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptMessagePlaceholderType" + required: + - type + - name + type: object + LLMObsPromptMessagePlaceholderType: + description: Type of chat-template item. + enum: + - placeholder + example: "placeholder" + type: string + x-enum-varnames: + - PLACEHOLDER LLMObsPromptResponse: description: Response containing a single Agent Observability prompt. example: @@ -65158,9 +65209,11 @@ components: properties: chat_template: description: >- - Chat template for this prompt version, as a list of role and content messages. Omitted for text templates. + Chat template for this prompt version, as a list of messages and named message placeholders. Omitted for text templates. + + **Preview:** Message placeholders are available in Preview. To request access, contact [Datadog Support](https://www.datadoghq.com/support/) or your Customer Success Manager. items: - $ref: "#/components/schemas/LLMObsPromptChatMessage" + $ref: "#/components/schemas/LLMObsPromptChatTemplateItem" type: array config: $ref: "#/components/schemas/LLMObsPromptConfig" @@ -65195,6 +65248,8 @@ components: chat_template: - content: "You are a helpful customer support assistant for {{company_name}}." role: "system" + - name: "history" + type: "placeholder" - content: "Help {{customer_name}} with this question: {{question}}" role: "user" config: @@ -65213,11 +65268,13 @@ components: type: object LLMObsPromptTemplate: description: >- - A text template, a list of chat messages, or an authored chat object. Text can include an exact prompt version with `{{>prompt-id version=N}}`; other text, including `{{>...}}` sequences without a version, remains literal. Use an authored chat object when including prompts as chat messages. + A text template, a list of chat messages and named message placeholders, or an authored chat object. Text can include an exact prompt version with `{{>prompt-id version=N}}`; other text, including `{{>...}}` sequences without a version, remains literal. Use an authored chat object when including prompts as chat messages. **Preview**: Prompt composition is available in Preview. To request access, contact [Datadog Support](https://docs.datadoghq.com/help/) or your Customer Success Manager. Without access, inline references remain literal text and structured includes are unsupported. Previously compiled prompt versions remain available for execution. + + **Preview:** Message placeholders are available in Preview. To request access, contact [Datadog Support](https://www.datadoghq.com/support/) or your Customer Success Manager. example: "You are a helpful assistant for {{audience}}." oneOf: - $ref: "#/components/schemas/LLMObsPromptTextTemplate" @@ -92891,6 +92948,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 +212846,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 +212947,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 +213070,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/LLMObsCreatePromptDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptDataAttributes.java index a090cb998e6..0041dd3720f 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptDataAttributes.java @@ -220,14 +220,16 @@ public LLMObsCreatePromptDataAttributes template(LLMObsPromptTemplate template) } /** - * A text template, a list of chat messages, or an authored chat object. Text can include an exact - * prompt version with {{>prompt-id version=N}}; other text, including - * {{>...}} sequences without a version, remains literal. Use an authored chat object - * when including prompts as chat messages. Preview: Prompt composition is - * available in Preview. To request access, contact {{>prompt-id version=N}}; + * other text, including {{>...}} sequences without a version, remains literal. + * Use an authored chat object when including prompts as chat messages. Preview: + * Prompt composition is available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * Without access, inline references remain literal text and structured includes are unsupported. - * Previously compiled prompt versions remain available for execution. + * Previously compiled prompt versions remain available for execution. Preview: + * Message placeholders are available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * * @return template */ diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptVersionDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptVersionDataAttributes.java index a706cad9e99..43dd006af8c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptVersionDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsCreatePromptVersionDataAttributes.java @@ -192,14 +192,16 @@ public LLMObsCreatePromptVersionDataAttributes template(LLMObsPromptTemplate tem } /** - * A text template, a list of chat messages, or an authored chat object. Text can include an exact - * prompt version with {{>prompt-id version=N}}; other text, including - * {{>...}} sequences without a version, remains literal. Use an authored chat object - * when including prompts as chat messages. Preview: Prompt composition is - * available in Preview. To request access, contact {{>prompt-id version=N}}; + * other text, including {{>...}} sequences without a version, remains literal. + * Use an authored chat object when including prompts as chat messages. Preview: + * Prompt composition is available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * Without access, inline references remain literal text and structured includes are unsupported. - * Previously compiled prompt versions remain available for execution. + * Previously compiled prompt versions remain available for execution. Preview: + * Message placeholders are available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * * @return template */ diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplate.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplate.java index 53d603e186e..2b2b0294b57 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplate.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplate.java @@ -16,16 +16,21 @@ import java.util.Map; import java.util.Objects; -/** A chat prompt template. */ +/** + * A chat prompt template containing messages and optional named message placeholders. + * Preview: Message placeholders are available in Preview. To request access, + * contact Datadog Support or your Customer Success + * Manager. + */ @JsonPropertyOrder({}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class LLMObsPromptChatTemplate extends ArrayList { +public class LLMObsPromptChatTemplate extends ArrayList { @JsonIgnore public boolean unparsed = false; public LLMObsPromptChatTemplate() {} - public LLMObsPromptChatTemplate(List items) { + public LLMObsPromptChatTemplate(List items) { super(items); } diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplateItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplateItem.java new file mode 100644 index 00000000000..c553be3b074 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptChatTemplateItem.java @@ -0,0 +1,288 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = LLMObsPromptChatTemplateItem.LLMObsPromptChatTemplateItemDeserializer.class) +@JsonSerialize(using = LLMObsPromptChatTemplateItem.LLMObsPromptChatTemplateItemSerializer.class) +public class LLMObsPromptChatTemplateItem extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(LLMObsPromptChatTemplateItem.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class LLMObsPromptChatTemplateItemSerializer + extends StdSerializer { + public LLMObsPromptChatTemplateItemSerializer(Class t) { + super(t); + } + + public LLMObsPromptChatTemplateItemSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsPromptChatTemplateItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class LLMObsPromptChatTemplateItemDeserializer + extends StdDeserializer { + public LLMObsPromptChatTemplateItemDeserializer() { + this(LLMObsPromptChatTemplateItem.class); + } + + public LLMObsPromptChatTemplateItemDeserializer(Class vc) { + super(vc); + } + + @Override + public LLMObsPromptChatTemplateItem deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LLMObsPromptChatMessage + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsPromptChatMessage.class.equals(Integer.class) + || LLMObsPromptChatMessage.class.equals(Long.class) + || LLMObsPromptChatMessage.class.equals(Float.class) + || LLMObsPromptChatMessage.class.equals(Double.class) + || LLMObsPromptChatMessage.class.equals(Boolean.class) + || LLMObsPromptChatMessage.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsPromptChatMessage.class.equals(Integer.class) + || LLMObsPromptChatMessage.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsPromptChatMessage.class.equals(Float.class) + || LLMObsPromptChatMessage.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsPromptChatMessage.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsPromptChatMessage.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsPromptChatMessage.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsPromptChatMessage) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsPromptChatMessage'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LLMObsPromptChatMessage'", e); + } + + // deserialize LLMObsPromptMessagePlaceholder + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsPromptMessagePlaceholder.class.equals(Integer.class) + || LLMObsPromptMessagePlaceholder.class.equals(Long.class) + || LLMObsPromptMessagePlaceholder.class.equals(Float.class) + || LLMObsPromptMessagePlaceholder.class.equals(Double.class) + || LLMObsPromptMessagePlaceholder.class.equals(Boolean.class) + || LLMObsPromptMessagePlaceholder.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsPromptMessagePlaceholder.class.equals(Integer.class) + || LLMObsPromptMessagePlaceholder.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsPromptMessagePlaceholder.class.equals(Float.class) + || LLMObsPromptMessagePlaceholder.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsPromptMessagePlaceholder.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsPromptMessagePlaceholder.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsPromptMessagePlaceholder.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsPromptMessagePlaceholder) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsPromptMessagePlaceholder'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'LLMObsPromptMessagePlaceholder'", e); + } + + LLMObsPromptChatTemplateItem ret = new LLMObsPromptChatTemplateItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LLMObsPromptChatTemplateItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "LLMObsPromptChatTemplateItem cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LLMObsPromptChatTemplateItem() { + super("oneOf", Boolean.FALSE); + } + + public LLMObsPromptChatTemplateItem(LLMObsPromptChatMessage o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LLMObsPromptChatTemplateItem(LLMObsPromptMessagePlaceholder o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("LLMObsPromptChatMessage", new GenericType() {}); + schemas.put( + "LLMObsPromptMessagePlaceholder", new GenericType() {}); + JSON.registerDescendants( + LLMObsPromptChatTemplateItem.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return LLMObsPromptChatTemplateItem.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LLMObsPromptChatMessage, LLMObsPromptMessagePlaceholder + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(LLMObsPromptChatMessage.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LLMObsPromptMessagePlaceholder.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be LLMObsPromptChatMessage, LLMObsPromptMessagePlaceholder"); + } + + /** + * Get the actual instance, which can be the following: LLMObsPromptChatMessage, + * LLMObsPromptMessagePlaceholder + * + * @return The actual instance (LLMObsPromptChatMessage, LLMObsPromptMessagePlaceholder) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `LLMObsPromptChatMessage`. If the actual instance is not + * `LLMObsPromptChatMessage`, the ClassCastException will be thrown. + * + * @return The actual instance of `LLMObsPromptChatMessage` + * @throws ClassCastException if the instance is not `LLMObsPromptChatMessage` + */ + public LLMObsPromptChatMessage getLLMObsPromptChatMessage() throws ClassCastException { + return (LLMObsPromptChatMessage) super.getActualInstance(); + } + + /** + * Get the actual instance of `LLMObsPromptMessagePlaceholder`. If the actual instance is not + * `LLMObsPromptMessagePlaceholder`, the ClassCastException will be thrown. + * + * @return The actual instance of `LLMObsPromptMessagePlaceholder` + * @throws ClassCastException if the instance is not `LLMObsPromptMessagePlaceholder` + */ + public LLMObsPromptMessagePlaceholder getLLMObsPromptMessagePlaceholder() + throws ClassCastException { + return (LLMObsPromptMessagePlaceholder) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholder.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholder.java new file mode 100644 index 00000000000..b32ae25fe70 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholder.java @@ -0,0 +1,131 @@ +/* + * 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.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.Objects; + +/** + * A named placeholder that inserts a list of messages when a compatible SDK formats the prompt. + * Preview: Message placeholders are available in Preview. To request access, + * contact Datadog Support or your Customer Success + * Manager. + */ +@JsonPropertyOrder({ + LLMObsPromptMessagePlaceholder.JSON_PROPERTY_NAME, + LLMObsPromptMessagePlaceholder.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsPromptMessagePlaceholder { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsPromptMessagePlaceholderType type; + + public LLMObsPromptMessagePlaceholder() {} + + @JsonCreator + public LLMObsPromptMessagePlaceholder( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LLMObsPromptMessagePlaceholderType type) { + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsPromptMessagePlaceholder name(String name) { + this.name = name; + return this; + } + + /** + * Name used to supply the message list when formatting the prompt. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LLMObsPromptMessagePlaceholder type(LLMObsPromptMessagePlaceholderType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of chat-template item. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsPromptMessagePlaceholderType getType() { + return type; + } + + public void setType(LLMObsPromptMessagePlaceholderType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this LLMObsPromptMessagePlaceholder object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsPromptMessagePlaceholder llmObsPromptMessagePlaceholder = + (LLMObsPromptMessagePlaceholder) o; + return Objects.equals(this.name, llmObsPromptMessagePlaceholder.name) + && Objects.equals(this.type, llmObsPromptMessagePlaceholder.type); + } + + @Override + public int hashCode() { + return Objects.hash(name, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsPromptMessagePlaceholder {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/LLMObsPromptMessagePlaceholderType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholderType.java new file mode 100644 index 00000000000..1ffc8e5c8f8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptMessagePlaceholderType.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; + +/** Type of chat-template item. */ +@JsonSerialize( + using = LLMObsPromptMessagePlaceholderType.LLMObsPromptMessagePlaceholderTypeSerializer.class) +public class LLMObsPromptMessagePlaceholderType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("placeholder")); + + public static final LLMObsPromptMessagePlaceholderType PLACEHOLDER = + new LLMObsPromptMessagePlaceholderType("placeholder"); + + LLMObsPromptMessagePlaceholderType(String value) { + super(value, allowedValues); + } + + public static class LLMObsPromptMessagePlaceholderTypeSerializer + extends StdSerializer { + public LLMObsPromptMessagePlaceholderTypeSerializer( + Class t) { + super(t); + } + + public LLMObsPromptMessagePlaceholderTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsPromptMessagePlaceholderType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsPromptMessagePlaceholderType fromValue(String value) { + return new LLMObsPromptMessagePlaceholderType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptSDKDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptSDKDataAttributes.java index 52e16f9cea2..f9093926685 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptSDKDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptSDKDataAttributes.java @@ -38,7 +38,7 @@ public class LLMObsPromptSDKDataAttributes { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CHAT_TEMPLATE = "chat_template"; - private List chatTemplate = null; + private List chatTemplate = null; public static final String JSON_PROPERTY_CONFIG = "config"; private Map config = null; @@ -58,10 +58,11 @@ public class LLMObsPromptSDKDataAttributes { public static final String JSON_PROPERTY_VERSION = "version"; private String version; - public LLMObsPromptSDKDataAttributes chatTemplate(List chatTemplate) { + public LLMObsPromptSDKDataAttributes chatTemplate( + List chatTemplate) { this.chatTemplate = chatTemplate; if (chatTemplate != null) { - for (LLMObsPromptChatMessage item : chatTemplate) { + for (LLMObsPromptChatTemplateItem item : chatTemplate) { this.unparsed |= item.unparsed; } } @@ -69,7 +70,7 @@ public LLMObsPromptSDKDataAttributes chatTemplate(List } public LLMObsPromptSDKDataAttributes addChatTemplateItem( - LLMObsPromptChatMessage chatTemplateItem) { + LLMObsPromptChatTemplateItem chatTemplateItem) { if (this.chatTemplate == null) { this.chatTemplate = new ArrayList<>(); } @@ -79,22 +80,24 @@ public LLMObsPromptSDKDataAttributes addChatTemplateItem( } /** - * Chat template for this prompt version, as a list of role and content messages. Omitted for text - * templates. + * Chat template for this prompt version, as a list of messages and named message placeholders. + * Omitted for text templates. Preview: Message placeholders are available in + * Preview. To request access, contact Datadog + * Support or your Customer Success Manager. * * @return chatTemplate */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CHAT_TEMPLATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getChatTemplate() { + public List getChatTemplate() { return chatTemplate; } - public void setChatTemplate(List chatTemplate) { + public void setChatTemplate(List chatTemplate) { this.chatTemplate = chatTemplate; if (chatTemplate != null) { - for (LLMObsPromptChatMessage item : chatTemplate) { + for (LLMObsPromptChatTemplateItem item : chatTemplate) { this.unparsed |= item.unparsed; } } diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptVersionDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptVersionDataAttributes.java index 38eb360db34..c14492b0b89 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptVersionDataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsPromptVersionDataAttributes.java @@ -144,14 +144,16 @@ public LLMObsPromptVersionDataAttributes authoringTemplate( } /** - * A text template, a list of chat messages, or an authored chat object. Text can include an exact - * prompt version with {{>prompt-id version=N}}; other text, including - * {{>...}} sequences without a version, remains literal. Use an authored chat object - * when including prompts as chat messages. Preview: Prompt composition is - * available in Preview. To request access, contact {{>prompt-id version=N}}; + * other text, including {{>...}} sequences without a version, remains literal. + * Use an authored chat object when including prompts as chat messages. Preview: + * Prompt composition is available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * Without access, inline references remain literal text and structured includes are unsupported. - * Previously compiled prompt versions remain available for execution. + * Previously compiled prompt versions remain available for execution. Preview: + * Message placeholders are available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * * @return authoringTemplate */ @@ -464,14 +466,16 @@ public LLMObsPromptVersionDataAttributes template(LLMObsPromptTemplate template) } /** - * A text template, a list of chat messages, or an authored chat object. Text can include an exact - * prompt version with {{>prompt-id version=N}}; other text, including - * {{>...}} sequences without a version, remains literal. Use an authored chat object - * when including prompts as chat messages. Preview: Prompt composition is - * available in Preview. To request access, contact {{>prompt-id version=N}}; + * other text, including {{>...}} sequences without a version, remains literal. + * Use an authored chat object when including prompts as chat messages. Preview: + * Prompt composition is available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * Without access, inline references remain literal text and structured includes are unsupported. - * Previously compiled prompt versions remain available for execution. + * Previously compiled prompt versions remain available for execution. Preview: + * Message placeholders are available in Preview. To request access, contact Datadog Support or your Customer Success Manager. * * @return template */ 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": {