From 0cdb7d37eb802d2c27b29e156783b372e6beff2d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 20 Jan 2026 11:01:46 +0000 Subject: [PATCH] Regenerate client from commit 2bdc8f1 of spec repo --- .generator/schemas/v2/openapi.yaml | 377 ++++++++++++ .../ListEntityRiskScores.java | 25 + .../com/datadog/api/client/ApiClient.java | 1 + .../client/v2/api/EntityRiskScoresApi.java | 355 +++++++++++ .../v2/model/SecurityEntityConfigRisks.java | 301 ++++++++++ .../v2/model/SecurityEntityMetadata.java | 375 ++++++++++++ .../v2/model/SecurityEntityRiskScore.java | 209 +++++++ .../SecurityEntityRiskScoreAttributes.java | 557 ++++++++++++++++++ ...rityEntityRiskScoreAttributesSeverity.java | 71 +++ .../v2/model/SecurityEntityRiskScoreType.java | 57 ++ .../model/SecurityEntityRiskScoresMeta.java | 230 ++++++++ .../SecurityEntityRiskScoresResponse.java | 189 ++++++ .../client/v2/api/entity_risk_scores.feature | 20 + .../v2/api/security_risk_scores.feature | 20 + .../com/datadog/api/client/v2/api/undo.json | 6 + 15 files changed, 2793 insertions(+) create mode 100644 examples/v2/entity-risk-scores/ListEntityRiskScores.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/EntityRiskScoresApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityConfigRisks.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityMetadata.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScore.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributesSeverity.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresResponse.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/entity_risk_scores.feature create mode 100644 src/test/resources/com/datadog/api/client/v2/api/security_risk_scores.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 128bce58baa..994e7719810 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -48629,6 +48629,263 @@ components: type: string x-enum-varnames: - SECRET_RULE + SecurityEntityConfigRisks: + description: Configuration risks associated with the entity + properties: + hasIdentityRisk: + description: Whether the entity has identity risks + example: false + type: boolean + hasMisconfiguration: + description: Whether the entity has misconfigurations + example: true + type: boolean + hasPrivilegedRole: + description: Whether the entity has privileged roles + example: true + type: boolean + isPrivileged: + description: Whether the entity has privileged access + example: false + type: boolean + isProduction: + description: Whether the entity is in a production environment + example: true + type: boolean + isPubliclyAccessible: + description: Whether the entity is publicly accessible + example: true + type: boolean + required: + - hasMisconfiguration + - hasIdentityRisk + - isPubliclyAccessible + - isProduction + - hasPrivilegedRole + - isPrivileged + type: object + SecurityEntityMetadata: + description: Metadata about the entity from cloud providers + properties: + accountID: + description: Cloud account ID (AWS) + example: '123456789012' + type: string + environments: + description: Environment tags associated with the entity + example: + - production + - us-east-1 + items: + type: string + type: array + mitreTactics: + description: MITRE ATT&CK tactics detected + example: + - Credential Access + - Privilege Escalation + items: + type: string + type: array + mitreTechniques: + description: MITRE ATT&CK techniques detected + example: + - T1078 + - T1098 + items: + type: string + type: array + projectID: + description: Cloud project ID (GCP) + example: my-gcp-project + type: string + services: + description: Services associated with the entity + example: + - api-gateway + - lambda + items: + type: string + type: array + sources: + description: Data sources that detected this entity + example: + - cloudtrail + - cloud-security-posture-management + items: + type: string + type: array + subscriptionID: + description: Cloud subscription ID (Azure) + example: a1b2c3d4-e5f6-7890-abcd-ef1234567890 + type: string + required: + - sources + - environments + - services + - mitreTactics + - mitreTechniques + type: object + SecurityEntityRiskScore: + description: An entity risk score containing security risk assessment information + properties: + attributes: + $ref: '#/components/schemas/SecurityEntityRiskScoreAttributes' + id: + description: Unique identifier for the entity + example: arn:aws:iam::123456789012:user/john.doe + type: string + type: + $ref: '#/components/schemas/SecurityEntityRiskScoreType' + required: + - id + - type + - attributes + type: object + SecurityEntityRiskScoreAttributes: + description: Attributes of an entity risk score + properties: + configRisks: + $ref: '#/components/schemas/SecurityEntityConfigRisks' + entityID: + description: Unique identifier for the entity + example: arn:aws:iam::123456789012:user/john.doe + type: string + entityMetadata: + $ref: '#/components/schemas/SecurityEntityMetadata' + entityName: + description: Human-readable name of the entity + example: john.doe + type: string + entityProviders: + description: Cloud providers associated with the entity + example: + - aws + items: + type: string + type: array + entityRoles: + description: Roles associated with the entity + example: + - Admin + - Developer + items: + type: string + type: array + entityType: + description: Type of the entity (e.g., aws_iam_user, aws_ec2_instance) + example: aws_iam_user + type: string + firstDetected: + description: Timestamp when the entity was first detected (Unix milliseconds) + example: 1704067200000 + format: int64 + type: integer + lastActivityTitle: + description: Title of the most recent signal detected for this entity + example: Suspicious API call detected + type: string + lastDetected: + description: Timestamp when the entity was last detected (Unix milliseconds) + example: 1705276800000 + format: int64 + type: integer + riskScore: + description: Current risk score for the entity + example: 85.5 + format: double + type: number + riskScoreEvolution: + description: Change in risk score compared to previous period + example: 12.3 + format: double + type: number + severity: + $ref: '#/components/schemas/SecurityEntityRiskScoreAttributesSeverity' + signalsDetected: + description: Number of security signals detected for this entity + example: 15 + format: int64 + type: integer + required: + - entityID + - entityType + - entityProviders + - riskScore + - riskScoreEvolution + - severity + - firstDetected + - lastDetected + - lastActivityTitle + - signalsDetected + - configRisks + - entityMetadata + type: object + SecurityEntityRiskScoreAttributesSeverity: + description: Severity level based on risk score + enum: + - critical + - high + - medium + - low + - info + example: critical + type: string + x-enum-varnames: + - CRITICAL + - HIGH + - MEDIUM + - LOW + - INFO + SecurityEntityRiskScoreType: + description: Resource type + enum: + - security_entity_risk_score + example: security_entity_risk_score + type: string + x-enum-varnames: + - SECURITY_ENTITY_RISK_SCORE + SecurityEntityRiskScoresMeta: + description: Metadata for pagination + properties: + pageNumber: + description: Current page number (1-indexed) + example: 1 + format: int64 + type: integer + pageSize: + description: Number of items per page + example: 10 + format: int64 + type: integer + queryId: + description: Query ID for pagination consistency + example: abc123def456 + type: string + totalRowCount: + description: Total number of entities matching the query + example: 150 + format: int64 + type: integer + required: + - queryId + - totalRowCount + - pageSize + - pageNumber + type: object + SecurityEntityRiskScoresResponse: + description: Response containing a list of entity risk scores + properties: + data: + items: + $ref: '#/components/schemas/SecurityEntityRiskScore' + type: array + meta: + $ref: '#/components/schemas/SecurityEntityRiskScoresMeta' + required: + - data + - meta + type: object SecurityFilter: description: The security filter's properties. properties: @@ -83558,6 +83815,124 @@ paths: x-codegen-request-body-name: body x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security-entities/risk-scores: + get: + description: Get a list of entity risk scores for your organization. Entity + risk scores provide security risk assessment for entities like cloud resources, + identities, or services based on detected signals, misconfigurations, and + identity risks. + operationId: ListEntityRiskScores + parameters: + - description: Start time for the query in Unix timestamp (milliseconds). Defaults + to 2 weeks ago. + in: query + name: from + required: false + schema: + example: 1704067200000 + format: int64 + type: integer + - description: End time for the query in Unix timestamp (milliseconds). Defaults + to now. + in: query + name: to + required: false + schema: + example: 1705276800000 + format: int64 + type: integer + - description: Size of the page to return. Maximum is 1000. + in: query + name: page[size] + required: false + schema: + default: 10 + example: 10 + type: integer + - description: Page number to return (1-indexed). + in: query + name: page[number] + required: false + schema: + default: 1 + example: 1 + type: integer + - description: Query ID for pagination consistency. + in: query + name: page[queryId] + required: false + schema: + example: abc123def456 + type: string + - description: 'Sort order for results. Format: `field:direction` where direction + is `asc` or `desc`. + + Supported fields: `riskScore`, `lastDetected`, `firstDetected`, `entityName`, + `signalsDetected`.' + in: query + name: filter[sort] + required: false + schema: + example: riskScore:desc + type: string + - description: 'Supports filtering by entity attributes, risk scores, severity, + and more. + + Example: `severity:critical AND entityType:aws_iam_user`' + in: query + name: filter[query] + required: false + schema: + example: severity:critical + type: string + - description: Filter by entity type(s). Can specify multiple values. + explode: true + in: query + name: entityType + required: false + schema: + example: + - aws_iam_user + - aws_ec2_instance + items: + example: aws_iam_user + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityEntityRiskScoresResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List Entity Risk Scores + tags: + - Entity Risk Scores + x-unstable: '**Note**: This endpoint is in public beta and it''s subject to + change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/security/cloud_workload/policy/download: get: @@ -92576,6 +92951,8 @@ tags: end times, prevent all alerting related to specified Datadog tags.' name: Downtimes +- description: Retrieves security risk scores for entities in your organization. + name: Entity Risk Scores - description: View and manage issues within Error Tracking. See the [Error Tracking page](https://docs.datadoghq.com/error_tracking/) for more information. name: Error Tracking diff --git a/examples/v2/entity-risk-scores/ListEntityRiskScores.java b/examples/v2/entity-risk-scores/ListEntityRiskScores.java new file mode 100644 index 00000000000..1c01083becd --- /dev/null +++ b/examples/v2/entity-risk-scores/ListEntityRiskScores.java @@ -0,0 +1,25 @@ +// List Entity Risk Scores returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.EntityRiskScoresApi; +import com.datadog.api.client.v2.model.SecurityEntityRiskScoresResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listEntityRiskScores", true); + EntityRiskScoresApi apiInstance = new EntityRiskScoresApi(defaultClient); + + try { + SecurityEntityRiskScoresResponse result = apiInstance.listEntityRiskScores(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EntityRiskScoresApi#listEntityRiskScores"); + 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 fef72371100..d9c84c0eebd 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -893,6 +893,7 @@ public class ApiClient { put("v2.listScorecardRules", false); put("v2.updateScorecardOutcomesAsync", false); put("v2.updateScorecardRule", false); + put("v2.listEntityRiskScores", false); put("v2.createIncidentService", false); put("v2.deleteIncidentService", false); put("v2.getIncidentService", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/EntityRiskScoresApi.java b/src/main/java/com/datadog/api/client/v2/api/EntityRiskScoresApi.java new file mode 100644 index 00000000000..8de2b86b173 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/EntityRiskScoresApi.java @@ -0,0 +1,355 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.SecurityEntityRiskScoresResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EntityRiskScoresApi { + private ApiClient apiClient; + + public EntityRiskScoresApi() { + this(ApiClient.getDefaultApiClient()); + } + + public EntityRiskScoresApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to listEntityRiskScores. */ + public static class ListEntityRiskScoresOptionalParameters { + private Long from; + private Long to; + private Integer pageSize; + private Integer pageNumber; + private String pageQueryId; + private String filterSort; + private String filterQuery; + private List entityType; + + /** + * Set from. + * + * @param from Start time for the query in Unix timestamp (milliseconds). Defaults to 2 weeks + * ago. (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters from(Long from) { + this.from = from; + return this; + } + + /** + * Set to. + * + * @param to End time for the query in Unix timestamp (milliseconds). Defaults to now. + * (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters to(Long to) { + this.to = to; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Size of the page to return. Maximum is 1000. (optional, default to 10) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Page number to return (1-indexed). (optional, default to 1) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters pageNumber(Integer pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set pageQueryId. + * + * @param pageQueryId Query ID for pagination consistency. (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters pageQueryId(String pageQueryId) { + this.pageQueryId = pageQueryId; + return this; + } + + /** + * Set filterSort. + * + * @param filterSort Sort order for results. Format: field:direction where + * direction is asc or desc. Supported fields: riskScore + * , lastDetected, firstDetected, entityName, + * signalsDetected. (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters filterSort(String filterSort) { + this.filterSort = filterSort; + return this; + } + + /** + * Set filterQuery. + * + * @param filterQuery Supports filtering by entity attributes, risk scores, severity, and more. + * Example: severity:critical AND entityType:aws_iam_user (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters filterQuery(String filterQuery) { + this.filterQuery = filterQuery; + return this; + } + + /** + * Set entityType. + * + * @param entityType Filter by entity type(s). Can specify multiple values. (optional) + * @return ListEntityRiskScoresOptionalParameters + */ + public ListEntityRiskScoresOptionalParameters entityType(List entityType) { + this.entityType = entityType; + return this; + } + } + + /** + * List Entity Risk Scores. + * + *

See {@link #listEntityRiskScoresWithHttpInfo}. + * + * @return SecurityEntityRiskScoresResponse + * @throws ApiException if fails to make API call + */ + public SecurityEntityRiskScoresResponse listEntityRiskScores() throws ApiException { + return listEntityRiskScoresWithHttpInfo(new ListEntityRiskScoresOptionalParameters()).getData(); + } + + /** + * List Entity Risk Scores. + * + *

See {@link #listEntityRiskScoresWithHttpInfoAsync}. + * + * @return CompletableFuture<SecurityEntityRiskScoresResponse> + */ + public CompletableFuture listEntityRiskScoresAsync() { + return listEntityRiskScoresWithHttpInfoAsync(new ListEntityRiskScoresOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Entity Risk Scores. + * + *

See {@link #listEntityRiskScoresWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return SecurityEntityRiskScoresResponse + * @throws ApiException if fails to make API call + */ + public SecurityEntityRiskScoresResponse listEntityRiskScores( + ListEntityRiskScoresOptionalParameters parameters) throws ApiException { + return listEntityRiskScoresWithHttpInfo(parameters).getData(); + } + + /** + * List Entity Risk Scores. + * + *

See {@link #listEntityRiskScoresWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<SecurityEntityRiskScoresResponse> + */ + public CompletableFuture listEntityRiskScoresAsync( + ListEntityRiskScoresOptionalParameters parameters) { + return listEntityRiskScoresWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of entity risk scores for your organization. Entity risk scores provide security + * risk assessment for entities like cloud resources, identities, or services based on detected + * signals, misconfigurations, and identity risks. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<SecurityEntityRiskScoresResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listEntityRiskScoresWithHttpInfo( + ListEntityRiskScoresOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listEntityRiskScores"; + 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; + Long from = parameters.from; + Long to = parameters.to; + Integer pageSize = parameters.pageSize; + Integer pageNumber = parameters.pageNumber; + String pageQueryId = parameters.pageQueryId; + String filterSort = parameters.filterSort; + String filterQuery = parameters.filterQuery; + List entityType = parameters.entityType; + // create path and map variables + String localVarPath = "/api/v2/security-entities/risk-scores"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[queryId]", pageQueryId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[sort]", filterSort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "entityType", entityType)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.EntityRiskScoresApi.listEntityRiskScores", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List Entity Risk Scores. + * + *

See {@link #listEntityRiskScoresWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<SecurityEntityRiskScoresResponse>> + */ + public CompletableFuture> + listEntityRiskScoresWithHttpInfoAsync(ListEntityRiskScoresOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listEntityRiskScores"; + 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; + Long from = parameters.from; + Long to = parameters.to; + Integer pageSize = parameters.pageSize; + Integer pageNumber = parameters.pageNumber; + String pageQueryId = parameters.pageQueryId; + String filterSort = parameters.filterSort; + String filterQuery = parameters.filterQuery; + List entityType = parameters.entityType; + // create path and map variables + String localVarPath = "/api/v2/security-entities/risk-scores"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[queryId]", pageQueryId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[sort]", filterSort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "entityType", entityType)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.EntityRiskScoresApi.listEntityRiskScores", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityConfigRisks.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityConfigRisks.java new file mode 100644 index 00000000000..b1414545a44 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityConfigRisks.java @@ -0,0 +1,301 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Configuration risks associated with the entity */ +@JsonPropertyOrder({ + SecurityEntityConfigRisks.JSON_PROPERTY_HAS_IDENTITY_RISK, + SecurityEntityConfigRisks.JSON_PROPERTY_HAS_MISCONFIGURATION, + SecurityEntityConfigRisks.JSON_PROPERTY_HAS_PRIVILEGED_ROLE, + SecurityEntityConfigRisks.JSON_PROPERTY_IS_PRIVILEGED, + SecurityEntityConfigRisks.JSON_PROPERTY_IS_PRODUCTION, + SecurityEntityConfigRisks.JSON_PROPERTY_IS_PUBLICLY_ACCESSIBLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityConfigRisks { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HAS_IDENTITY_RISK = "hasIdentityRisk"; + private Boolean hasIdentityRisk; + + public static final String JSON_PROPERTY_HAS_MISCONFIGURATION = "hasMisconfiguration"; + private Boolean hasMisconfiguration; + + public static final String JSON_PROPERTY_HAS_PRIVILEGED_ROLE = "hasPrivilegedRole"; + private Boolean hasPrivilegedRole; + + public static final String JSON_PROPERTY_IS_PRIVILEGED = "isPrivileged"; + private Boolean isPrivileged; + + public static final String JSON_PROPERTY_IS_PRODUCTION = "isProduction"; + private Boolean isProduction; + + public static final String JSON_PROPERTY_IS_PUBLICLY_ACCESSIBLE = "isPubliclyAccessible"; + private Boolean isPubliclyAccessible; + + public SecurityEntityConfigRisks() {} + + @JsonCreator + public SecurityEntityConfigRisks( + @JsonProperty(required = true, value = JSON_PROPERTY_HAS_IDENTITY_RISK) + Boolean hasIdentityRisk, + @JsonProperty(required = true, value = JSON_PROPERTY_HAS_MISCONFIGURATION) + Boolean hasMisconfiguration, + @JsonProperty(required = true, value = JSON_PROPERTY_HAS_PRIVILEGED_ROLE) + Boolean hasPrivilegedRole, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PRIVILEGED) Boolean isPrivileged, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PRODUCTION) Boolean isProduction, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PUBLICLY_ACCESSIBLE) + Boolean isPubliclyAccessible) { + this.hasIdentityRisk = hasIdentityRisk; + this.hasMisconfiguration = hasMisconfiguration; + this.hasPrivilegedRole = hasPrivilegedRole; + this.isPrivileged = isPrivileged; + this.isProduction = isProduction; + this.isPubliclyAccessible = isPubliclyAccessible; + } + + public SecurityEntityConfigRisks hasIdentityRisk(Boolean hasIdentityRisk) { + this.hasIdentityRisk = hasIdentityRisk; + return this; + } + + /** + * Whether the entity has identity risks + * + * @return hasIdentityRisk + */ + @JsonProperty(JSON_PROPERTY_HAS_IDENTITY_RISK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasIdentityRisk() { + return hasIdentityRisk; + } + + public void setHasIdentityRisk(Boolean hasIdentityRisk) { + this.hasIdentityRisk = hasIdentityRisk; + } + + public SecurityEntityConfigRisks hasMisconfiguration(Boolean hasMisconfiguration) { + this.hasMisconfiguration = hasMisconfiguration; + return this; + } + + /** + * Whether the entity has misconfigurations + * + * @return hasMisconfiguration + */ + @JsonProperty(JSON_PROPERTY_HAS_MISCONFIGURATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasMisconfiguration() { + return hasMisconfiguration; + } + + public void setHasMisconfiguration(Boolean hasMisconfiguration) { + this.hasMisconfiguration = hasMisconfiguration; + } + + public SecurityEntityConfigRisks hasPrivilegedRole(Boolean hasPrivilegedRole) { + this.hasPrivilegedRole = hasPrivilegedRole; + return this; + } + + /** + * Whether the entity has privileged roles + * + * @return hasPrivilegedRole + */ + @JsonProperty(JSON_PROPERTY_HAS_PRIVILEGED_ROLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasPrivilegedRole() { + return hasPrivilegedRole; + } + + public void setHasPrivilegedRole(Boolean hasPrivilegedRole) { + this.hasPrivilegedRole = hasPrivilegedRole; + } + + public SecurityEntityConfigRisks isPrivileged(Boolean isPrivileged) { + this.isPrivileged = isPrivileged; + return this; + } + + /** + * Whether the entity has privileged access + * + * @return isPrivileged + */ + @JsonProperty(JSON_PROPERTY_IS_PRIVILEGED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPrivileged() { + return isPrivileged; + } + + public void setIsPrivileged(Boolean isPrivileged) { + this.isPrivileged = isPrivileged; + } + + public SecurityEntityConfigRisks isProduction(Boolean isProduction) { + this.isProduction = isProduction; + return this; + } + + /** + * Whether the entity is in a production environment + * + * @return isProduction + */ + @JsonProperty(JSON_PROPERTY_IS_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsProduction() { + return isProduction; + } + + public void setIsProduction(Boolean isProduction) { + this.isProduction = isProduction; + } + + public SecurityEntityConfigRisks isPubliclyAccessible(Boolean isPubliclyAccessible) { + this.isPubliclyAccessible = isPubliclyAccessible; + return this; + } + + /** + * Whether the entity is publicly accessible + * + * @return isPubliclyAccessible + */ + @JsonProperty(JSON_PROPERTY_IS_PUBLICLY_ACCESSIBLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPubliclyAccessible() { + return isPubliclyAccessible; + } + + public void setIsPubliclyAccessible(Boolean isPubliclyAccessible) { + this.isPubliclyAccessible = isPubliclyAccessible; + } + + /** + * 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 SecurityEntityConfigRisks + */ + @JsonAnySetter + public SecurityEntityConfigRisks 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 SecurityEntityConfigRisks object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityConfigRisks securityEntityConfigRisks = (SecurityEntityConfigRisks) o; + return Objects.equals(this.hasIdentityRisk, securityEntityConfigRisks.hasIdentityRisk) + && Objects.equals(this.hasMisconfiguration, securityEntityConfigRisks.hasMisconfiguration) + && Objects.equals(this.hasPrivilegedRole, securityEntityConfigRisks.hasPrivilegedRole) + && Objects.equals(this.isPrivileged, securityEntityConfigRisks.isPrivileged) + && Objects.equals(this.isProduction, securityEntityConfigRisks.isProduction) + && Objects.equals(this.isPubliclyAccessible, securityEntityConfigRisks.isPubliclyAccessible) + && Objects.equals( + this.additionalProperties, securityEntityConfigRisks.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + hasIdentityRisk, + hasMisconfiguration, + hasPrivilegedRole, + isPrivileged, + isProduction, + isPubliclyAccessible, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityConfigRisks {\n"); + sb.append(" hasIdentityRisk: ").append(toIndentedString(hasIdentityRisk)).append("\n"); + sb.append(" hasMisconfiguration: ") + .append(toIndentedString(hasMisconfiguration)) + .append("\n"); + sb.append(" hasPrivilegedRole: ").append(toIndentedString(hasPrivilegedRole)).append("\n"); + sb.append(" isPrivileged: ").append(toIndentedString(isPrivileged)).append("\n"); + sb.append(" isProduction: ").append(toIndentedString(isProduction)).append("\n"); + sb.append(" isPubliclyAccessible: ") + .append(toIndentedString(isPubliclyAccessible)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityMetadata.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityMetadata.java new file mode 100644 index 00000000000..988c5975290 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityMetadata.java @@ -0,0 +1,375 @@ +/* + * 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; + +/** Metadata about the entity from cloud providers */ +@JsonPropertyOrder({ + SecurityEntityMetadata.JSON_PROPERTY_ACCOUNT_ID, + SecurityEntityMetadata.JSON_PROPERTY_ENVIRONMENTS, + SecurityEntityMetadata.JSON_PROPERTY_MITRE_TACTICS, + SecurityEntityMetadata.JSON_PROPERTY_MITRE_TECHNIQUES, + SecurityEntityMetadata.JSON_PROPERTY_PROJECT_ID, + SecurityEntityMetadata.JSON_PROPERTY_SERVICES, + SecurityEntityMetadata.JSON_PROPERTY_SOURCES, + SecurityEntityMetadata.JSON_PROPERTY_SUBSCRIPTION_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountID"; + private String accountId; + + public static final String JSON_PROPERTY_ENVIRONMENTS = "environments"; + private List environments = new ArrayList<>(); + + public static final String JSON_PROPERTY_MITRE_TACTICS = "mitreTactics"; + private List mitreTactics = new ArrayList<>(); + + public static final String JSON_PROPERTY_MITRE_TECHNIQUES = "mitreTechniques"; + private List mitreTechniques = new ArrayList<>(); + + public static final String JSON_PROPERTY_PROJECT_ID = "projectID"; + private String projectId; + + public static final String JSON_PROPERTY_SERVICES = "services"; + private List services = new ArrayList<>(); + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_SUBSCRIPTION_ID = "subscriptionID"; + private String subscriptionId; + + public SecurityEntityMetadata() {} + + @JsonCreator + public SecurityEntityMetadata( + @JsonProperty(required = true, value = JSON_PROPERTY_ENVIRONMENTS) List environments, + @JsonProperty(required = true, value = JSON_PROPERTY_MITRE_TACTICS) List mitreTactics, + @JsonProperty(required = true, value = JSON_PROPERTY_MITRE_TECHNIQUES) + List mitreTechniques, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICES) List services, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) List sources) { + this.environments = environments; + this.mitreTactics = mitreTactics; + this.mitreTechniques = mitreTechniques; + this.services = services; + this.sources = sources; + } + + public SecurityEntityMetadata accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Cloud account ID (AWS) + * + * @return accountId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public SecurityEntityMetadata environments(List environments) { + this.environments = environments; + return this; + } + + public SecurityEntityMetadata addEnvironmentsItem(String environmentsItem) { + this.environments.add(environmentsItem); + return this; + } + + /** + * Environment tags associated with the entity + * + * @return environments + */ + @JsonProperty(JSON_PROPERTY_ENVIRONMENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEnvironments() { + return environments; + } + + public void setEnvironments(List environments) { + this.environments = environments; + } + + public SecurityEntityMetadata mitreTactics(List mitreTactics) { + this.mitreTactics = mitreTactics; + return this; + } + + public SecurityEntityMetadata addMitreTacticsItem(String mitreTacticsItem) { + this.mitreTactics.add(mitreTacticsItem); + return this; + } + + /** + * MITRE ATT&CK tactics detected + * + * @return mitreTactics + */ + @JsonProperty(JSON_PROPERTY_MITRE_TACTICS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getMitreTactics() { + return mitreTactics; + } + + public void setMitreTactics(List mitreTactics) { + this.mitreTactics = mitreTactics; + } + + public SecurityEntityMetadata mitreTechniques(List mitreTechniques) { + this.mitreTechniques = mitreTechniques; + return this; + } + + public SecurityEntityMetadata addMitreTechniquesItem(String mitreTechniquesItem) { + this.mitreTechniques.add(mitreTechniquesItem); + return this; + } + + /** + * MITRE ATT&CK techniques detected + * + * @return mitreTechniques + */ + @JsonProperty(JSON_PROPERTY_MITRE_TECHNIQUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getMitreTechniques() { + return mitreTechniques; + } + + public void setMitreTechniques(List mitreTechniques) { + this.mitreTechniques = mitreTechniques; + } + + public SecurityEntityMetadata projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Cloud project ID (GCP) + * + * @return projectId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROJECT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public SecurityEntityMetadata services(List services) { + this.services = services; + return this; + } + + public SecurityEntityMetadata addServicesItem(String servicesItem) { + this.services.add(servicesItem); + return this; + } + + /** + * Services associated with the entity + * + * @return services + */ + @JsonProperty(JSON_PROPERTY_SERVICES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getServices() { + return services; + } + + public void setServices(List services) { + this.services = services; + } + + public SecurityEntityMetadata sources(List sources) { + this.sources = sources; + return this; + } + + public SecurityEntityMetadata addSourcesItem(String sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * Data sources that detected this entity + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSources() { + return sources; + } + + public void setSources(List sources) { + this.sources = sources; + } + + public SecurityEntityMetadata subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Cloud subscription ID (Azure) + * + * @return subscriptionId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUBSCRIPTION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSubscriptionId() { + return subscriptionId; + } + + public void setSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + } + + /** + * 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 SecurityEntityMetadata + */ + @JsonAnySetter + public SecurityEntityMetadata 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 SecurityEntityMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityMetadata securityEntityMetadata = (SecurityEntityMetadata) o; + return Objects.equals(this.accountId, securityEntityMetadata.accountId) + && Objects.equals(this.environments, securityEntityMetadata.environments) + && Objects.equals(this.mitreTactics, securityEntityMetadata.mitreTactics) + && Objects.equals(this.mitreTechniques, securityEntityMetadata.mitreTechniques) + && Objects.equals(this.projectId, securityEntityMetadata.projectId) + && Objects.equals(this.services, securityEntityMetadata.services) + && Objects.equals(this.sources, securityEntityMetadata.sources) + && Objects.equals(this.subscriptionId, securityEntityMetadata.subscriptionId) + && Objects.equals(this.additionalProperties, securityEntityMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accountId, + environments, + mitreTactics, + mitreTechniques, + projectId, + services, + sources, + subscriptionId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityMetadata {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" environments: ").append(toIndentedString(environments)).append("\n"); + sb.append(" mitreTactics: ").append(toIndentedString(mitreTactics)).append("\n"); + sb.append(" mitreTechniques: ").append(toIndentedString(mitreTechniques)).append("\n"); + sb.append(" projectId: ").append(toIndentedString(projectId)).append("\n"); + sb.append(" services: ").append(toIndentedString(services)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScore.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScore.java new file mode 100644 index 00000000000..ff56bb87435 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScore.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An entity risk score containing security risk assessment information */ +@JsonPropertyOrder({ + SecurityEntityRiskScore.JSON_PROPERTY_ATTRIBUTES, + SecurityEntityRiskScore.JSON_PROPERTY_ID, + SecurityEntityRiskScore.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityRiskScore { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SecurityEntityRiskScoreAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SecurityEntityRiskScoreType type; + + public SecurityEntityRiskScore() {} + + @JsonCreator + public SecurityEntityRiskScore( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SecurityEntityRiskScoreAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SecurityEntityRiskScoreType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SecurityEntityRiskScore attributes(SecurityEntityRiskScoreAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an entity risk score + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityRiskScoreAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SecurityEntityRiskScoreAttributes attributes) { + this.attributes = attributes; + } + + public SecurityEntityRiskScore id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the entity + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public SecurityEntityRiskScore type(SecurityEntityRiskScoreType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityRiskScoreType getType() { + return type; + } + + public void setType(SecurityEntityRiskScoreType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SecurityEntityRiskScore + */ + @JsonAnySetter + public SecurityEntityRiskScore 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 SecurityEntityRiskScore object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityRiskScore securityEntityRiskScore = (SecurityEntityRiskScore) o; + return Objects.equals(this.attributes, securityEntityRiskScore.attributes) + && Objects.equals(this.id, securityEntityRiskScore.id) + && Objects.equals(this.type, securityEntityRiskScore.type) + && Objects.equals(this.additionalProperties, securityEntityRiskScore.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityRiskScore {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributes.java new file mode 100644 index 00000000000..b9f561005df --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributes.java @@ -0,0 +1,557 @@ +/* + * 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; + +/** Attributes of an entity risk score */ +@JsonPropertyOrder({ + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_CONFIG_RISKS, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_ID, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_METADATA, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_NAME, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_PROVIDERS, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_ROLES, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_ENTITY_TYPE, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_FIRST_DETECTED, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_LAST_ACTIVITY_TITLE, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_LAST_DETECTED, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_RISK_SCORE, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_RISK_SCORE_EVOLUTION, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_SEVERITY, + SecurityEntityRiskScoreAttributes.JSON_PROPERTY_SIGNALS_DETECTED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityRiskScoreAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONFIG_RISKS = "configRisks"; + private SecurityEntityConfigRisks configRisks; + + public static final String JSON_PROPERTY_ENTITY_ID = "entityID"; + private String entityId; + + public static final String JSON_PROPERTY_ENTITY_METADATA = "entityMetadata"; + private SecurityEntityMetadata entityMetadata; + + public static final String JSON_PROPERTY_ENTITY_NAME = "entityName"; + private String entityName; + + public static final String JSON_PROPERTY_ENTITY_PROVIDERS = "entityProviders"; + private List entityProviders = new ArrayList<>(); + + public static final String JSON_PROPERTY_ENTITY_ROLES = "entityRoles"; + private List entityRoles = null; + + public static final String JSON_PROPERTY_ENTITY_TYPE = "entityType"; + private String entityType; + + public static final String JSON_PROPERTY_FIRST_DETECTED = "firstDetected"; + private Long firstDetected; + + public static final String JSON_PROPERTY_LAST_ACTIVITY_TITLE = "lastActivityTitle"; + private String lastActivityTitle; + + public static final String JSON_PROPERTY_LAST_DETECTED = "lastDetected"; + private Long lastDetected; + + public static final String JSON_PROPERTY_RISK_SCORE = "riskScore"; + private Double riskScore; + + public static final String JSON_PROPERTY_RISK_SCORE_EVOLUTION = "riskScoreEvolution"; + private Double riskScoreEvolution; + + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private SecurityEntityRiskScoreAttributesSeverity severity; + + public static final String JSON_PROPERTY_SIGNALS_DETECTED = "signalsDetected"; + private Long signalsDetected; + + public SecurityEntityRiskScoreAttributes() {} + + @JsonCreator + public SecurityEntityRiskScoreAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIG_RISKS) + SecurityEntityConfigRisks configRisks, + @JsonProperty(required = true, value = JSON_PROPERTY_ENTITY_ID) String entityId, + @JsonProperty(required = true, value = JSON_PROPERTY_ENTITY_METADATA) + SecurityEntityMetadata entityMetadata, + @JsonProperty(required = true, value = JSON_PROPERTY_ENTITY_PROVIDERS) + List entityProviders, + @JsonProperty(required = true, value = JSON_PROPERTY_ENTITY_TYPE) String entityType, + @JsonProperty(required = true, value = JSON_PROPERTY_FIRST_DETECTED) Long firstDetected, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_ACTIVITY_TITLE) + String lastActivityTitle, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_DETECTED) Long lastDetected, + @JsonProperty(required = true, value = JSON_PROPERTY_RISK_SCORE) Double riskScore, + @JsonProperty(required = true, value = JSON_PROPERTY_RISK_SCORE_EVOLUTION) + Double riskScoreEvolution, + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + SecurityEntityRiskScoreAttributesSeverity severity, + @JsonProperty(required = true, value = JSON_PROPERTY_SIGNALS_DETECTED) Long signalsDetected) { + this.configRisks = configRisks; + this.unparsed |= configRisks.unparsed; + this.entityId = entityId; + this.entityMetadata = entityMetadata; + this.unparsed |= entityMetadata.unparsed; + this.entityProviders = entityProviders; + this.entityType = entityType; + this.firstDetected = firstDetected; + this.lastActivityTitle = lastActivityTitle; + this.lastDetected = lastDetected; + this.riskScore = riskScore; + this.riskScoreEvolution = riskScoreEvolution; + this.severity = severity; + this.unparsed |= !severity.isValid(); + this.signalsDetected = signalsDetected; + } + + public SecurityEntityRiskScoreAttributes configRisks(SecurityEntityConfigRisks configRisks) { + this.configRisks = configRisks; + this.unparsed |= configRisks.unparsed; + return this; + } + + /** + * Configuration risks associated with the entity + * + * @return configRisks + */ + @JsonProperty(JSON_PROPERTY_CONFIG_RISKS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityConfigRisks getConfigRisks() { + return configRisks; + } + + public void setConfigRisks(SecurityEntityConfigRisks configRisks) { + this.configRisks = configRisks; + } + + public SecurityEntityRiskScoreAttributes entityId(String entityId) { + this.entityId = entityId; + return this; + } + + /** + * Unique identifier for the entity + * + * @return entityId + */ + @JsonProperty(JSON_PROPERTY_ENTITY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEntityId() { + return entityId; + } + + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + public SecurityEntityRiskScoreAttributes entityMetadata(SecurityEntityMetadata entityMetadata) { + this.entityMetadata = entityMetadata; + this.unparsed |= entityMetadata.unparsed; + return this; + } + + /** + * Metadata about the entity from cloud providers + * + * @return entityMetadata + */ + @JsonProperty(JSON_PROPERTY_ENTITY_METADATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityMetadata getEntityMetadata() { + return entityMetadata; + } + + public void setEntityMetadata(SecurityEntityMetadata entityMetadata) { + this.entityMetadata = entityMetadata; + } + + public SecurityEntityRiskScoreAttributes entityName(String entityName) { + this.entityName = entityName; + return this; + } + + /** + * Human-readable name of the entity + * + * @return entityName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEntityName() { + return entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public SecurityEntityRiskScoreAttributes entityProviders(List entityProviders) { + this.entityProviders = entityProviders; + return this; + } + + public SecurityEntityRiskScoreAttributes addEntityProvidersItem(String entityProvidersItem) { + this.entityProviders.add(entityProvidersItem); + return this; + } + + /** + * Cloud providers associated with the entity + * + * @return entityProviders + */ + @JsonProperty(JSON_PROPERTY_ENTITY_PROVIDERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEntityProviders() { + return entityProviders; + } + + public void setEntityProviders(List entityProviders) { + this.entityProviders = entityProviders; + } + + public SecurityEntityRiskScoreAttributes entityRoles(List entityRoles) { + this.entityRoles = entityRoles; + return this; + } + + public SecurityEntityRiskScoreAttributes addEntityRolesItem(String entityRolesItem) { + if (this.entityRoles == null) { + this.entityRoles = new ArrayList<>(); + } + this.entityRoles.add(entityRolesItem); + return this; + } + + /** + * Roles associated with the entity + * + * @return entityRoles + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEntityRoles() { + return entityRoles; + } + + public void setEntityRoles(List entityRoles) { + this.entityRoles = entityRoles; + } + + public SecurityEntityRiskScoreAttributes entityType(String entityType) { + this.entityType = entityType; + return this; + } + + /** + * Type of the entity (e.g., aws_iam_user, aws_ec2_instance) + * + * @return entityType + */ + @JsonProperty(JSON_PROPERTY_ENTITY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEntityType() { + return entityType; + } + + public void setEntityType(String entityType) { + this.entityType = entityType; + } + + public SecurityEntityRiskScoreAttributes firstDetected(Long firstDetected) { + this.firstDetected = firstDetected; + return this; + } + + /** + * Timestamp when the entity was first detected (Unix milliseconds) + * + * @return firstDetected + */ + @JsonProperty(JSON_PROPERTY_FIRST_DETECTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFirstDetected() { + return firstDetected; + } + + public void setFirstDetected(Long firstDetected) { + this.firstDetected = firstDetected; + } + + public SecurityEntityRiskScoreAttributes lastActivityTitle(String lastActivityTitle) { + this.lastActivityTitle = lastActivityTitle; + return this; + } + + /** + * Title of the most recent signal detected for this entity + * + * @return lastActivityTitle + */ + @JsonProperty(JSON_PROPERTY_LAST_ACTIVITY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLastActivityTitle() { + return lastActivityTitle; + } + + public void setLastActivityTitle(String lastActivityTitle) { + this.lastActivityTitle = lastActivityTitle; + } + + public SecurityEntityRiskScoreAttributes lastDetected(Long lastDetected) { + this.lastDetected = lastDetected; + return this; + } + + /** + * Timestamp when the entity was last detected (Unix milliseconds) + * + * @return lastDetected + */ + @JsonProperty(JSON_PROPERTY_LAST_DETECTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLastDetected() { + return lastDetected; + } + + public void setLastDetected(Long lastDetected) { + this.lastDetected = lastDetected; + } + + public SecurityEntityRiskScoreAttributes riskScore(Double riskScore) { + this.riskScore = riskScore; + return this; + } + + /** + * Current risk score for the entity + * + * @return riskScore + */ + @JsonProperty(JSON_PROPERTY_RISK_SCORE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getRiskScore() { + return riskScore; + } + + public void setRiskScore(Double riskScore) { + this.riskScore = riskScore; + } + + public SecurityEntityRiskScoreAttributes riskScoreEvolution(Double riskScoreEvolution) { + this.riskScoreEvolution = riskScoreEvolution; + return this; + } + + /** + * Change in risk score compared to previous period + * + * @return riskScoreEvolution + */ + @JsonProperty(JSON_PROPERTY_RISK_SCORE_EVOLUTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getRiskScoreEvolution() { + return riskScoreEvolution; + } + + public void setRiskScoreEvolution(Double riskScoreEvolution) { + this.riskScoreEvolution = riskScoreEvolution; + } + + public SecurityEntityRiskScoreAttributes severity( + SecurityEntityRiskScoreAttributesSeverity severity) { + this.severity = severity; + this.unparsed |= !severity.isValid(); + return this; + } + + /** + * Severity level based on risk score + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityRiskScoreAttributesSeverity getSeverity() { + return severity; + } + + public void setSeverity(SecurityEntityRiskScoreAttributesSeverity severity) { + if (!severity.isValid()) { + this.unparsed = true; + } + this.severity = severity; + } + + public SecurityEntityRiskScoreAttributes signalsDetected(Long signalsDetected) { + this.signalsDetected = signalsDetected; + return this; + } + + /** + * Number of security signals detected for this entity + * + * @return signalsDetected + */ + @JsonProperty(JSON_PROPERTY_SIGNALS_DETECTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSignalsDetected() { + return signalsDetected; + } + + public void setSignalsDetected(Long signalsDetected) { + this.signalsDetected = signalsDetected; + } + + /** + * 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 SecurityEntityRiskScoreAttributes + */ + @JsonAnySetter + public SecurityEntityRiskScoreAttributes 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 SecurityEntityRiskScoreAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityRiskScoreAttributes securityEntityRiskScoreAttributes = + (SecurityEntityRiskScoreAttributes) o; + return Objects.equals(this.configRisks, securityEntityRiskScoreAttributes.configRisks) + && Objects.equals(this.entityId, securityEntityRiskScoreAttributes.entityId) + && Objects.equals(this.entityMetadata, securityEntityRiskScoreAttributes.entityMetadata) + && Objects.equals(this.entityName, securityEntityRiskScoreAttributes.entityName) + && Objects.equals(this.entityProviders, securityEntityRiskScoreAttributes.entityProviders) + && Objects.equals(this.entityRoles, securityEntityRiskScoreAttributes.entityRoles) + && Objects.equals(this.entityType, securityEntityRiskScoreAttributes.entityType) + && Objects.equals(this.firstDetected, securityEntityRiskScoreAttributes.firstDetected) + && Objects.equals( + this.lastActivityTitle, securityEntityRiskScoreAttributes.lastActivityTitle) + && Objects.equals(this.lastDetected, securityEntityRiskScoreAttributes.lastDetected) + && Objects.equals(this.riskScore, securityEntityRiskScoreAttributes.riskScore) + && Objects.equals( + this.riskScoreEvolution, securityEntityRiskScoreAttributes.riskScoreEvolution) + && Objects.equals(this.severity, securityEntityRiskScoreAttributes.severity) + && Objects.equals(this.signalsDetected, securityEntityRiskScoreAttributes.signalsDetected) + && Objects.equals( + this.additionalProperties, securityEntityRiskScoreAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + configRisks, + entityId, + entityMetadata, + entityName, + entityProviders, + entityRoles, + entityType, + firstDetected, + lastActivityTitle, + lastDetected, + riskScore, + riskScoreEvolution, + severity, + signalsDetected, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityRiskScoreAttributes {\n"); + sb.append(" configRisks: ").append(toIndentedString(configRisks)).append("\n"); + sb.append(" entityId: ").append(toIndentedString(entityId)).append("\n"); + sb.append(" entityMetadata: ").append(toIndentedString(entityMetadata)).append("\n"); + sb.append(" entityName: ").append(toIndentedString(entityName)).append("\n"); + sb.append(" entityProviders: ").append(toIndentedString(entityProviders)).append("\n"); + sb.append(" entityRoles: ").append(toIndentedString(entityRoles)).append("\n"); + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); + sb.append(" firstDetected: ").append(toIndentedString(firstDetected)).append("\n"); + sb.append(" lastActivityTitle: ").append(toIndentedString(lastActivityTitle)).append("\n"); + sb.append(" lastDetected: ").append(toIndentedString(lastDetected)).append("\n"); + sb.append(" riskScore: ").append(toIndentedString(riskScore)).append("\n"); + sb.append(" riskScoreEvolution: ").append(toIndentedString(riskScoreEvolution)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" signalsDetected: ").append(toIndentedString(signalsDetected)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributesSeverity.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributesSeverity.java new file mode 100644 index 00000000000..5bb3f1b9638 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreAttributesSeverity.java @@ -0,0 +1,71 @@ +/* + * 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; + +/** Severity level based on risk score */ +@JsonSerialize( + using = + SecurityEntityRiskScoreAttributesSeverity + .SecurityEntityRiskScoreAttributesSeveritySerializer.class) +public class SecurityEntityRiskScoreAttributesSeverity extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("critical", "high", "medium", "low", "info")); + + public static final SecurityEntityRiskScoreAttributesSeverity CRITICAL = + new SecurityEntityRiskScoreAttributesSeverity("critical"); + public static final SecurityEntityRiskScoreAttributesSeverity HIGH = + new SecurityEntityRiskScoreAttributesSeverity("high"); + public static final SecurityEntityRiskScoreAttributesSeverity MEDIUM = + new SecurityEntityRiskScoreAttributesSeverity("medium"); + public static final SecurityEntityRiskScoreAttributesSeverity LOW = + new SecurityEntityRiskScoreAttributesSeverity("low"); + public static final SecurityEntityRiskScoreAttributesSeverity INFO = + new SecurityEntityRiskScoreAttributesSeverity("info"); + + SecurityEntityRiskScoreAttributesSeverity(String value) { + super(value, allowedValues); + } + + public static class SecurityEntityRiskScoreAttributesSeveritySerializer + extends StdSerializer { + public SecurityEntityRiskScoreAttributesSeveritySerializer( + Class t) { + super(t); + } + + public SecurityEntityRiskScoreAttributesSeveritySerializer() { + this(null); + } + + @Override + public void serialize( + SecurityEntityRiskScoreAttributesSeverity value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityEntityRiskScoreAttributesSeverity fromValue(String value) { + return new SecurityEntityRiskScoreAttributesSeverity(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreType.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreType.java new file mode 100644 index 00000000000..17ecfeb69d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoreType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Resource type */ +@JsonSerialize(using = SecurityEntityRiskScoreType.SecurityEntityRiskScoreTypeSerializer.class) +public class SecurityEntityRiskScoreType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("security_entity_risk_score")); + + public static final SecurityEntityRiskScoreType SECURITY_ENTITY_RISK_SCORE = + new SecurityEntityRiskScoreType("security_entity_risk_score"); + + SecurityEntityRiskScoreType(String value) { + super(value, allowedValues); + } + + public static class SecurityEntityRiskScoreTypeSerializer + extends StdSerializer { + public SecurityEntityRiskScoreTypeSerializer(Class t) { + super(t); + } + + public SecurityEntityRiskScoreTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityEntityRiskScoreType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityEntityRiskScoreType fromValue(String value) { + return new SecurityEntityRiskScoreType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresMeta.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresMeta.java new file mode 100644 index 00000000000..e5badde0af0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresMeta.java @@ -0,0 +1,230 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metadata for pagination */ +@JsonPropertyOrder({ + SecurityEntityRiskScoresMeta.JSON_PROPERTY_PAGE_NUMBER, + SecurityEntityRiskScoresMeta.JSON_PROPERTY_PAGE_SIZE, + SecurityEntityRiskScoresMeta.JSON_PROPERTY_QUERY_ID, + SecurityEntityRiskScoresMeta.JSON_PROPERTY_TOTAL_ROW_COUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityRiskScoresMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE_NUMBER = "pageNumber"; + private Long pageNumber; + + public static final String JSON_PROPERTY_PAGE_SIZE = "pageSize"; + private Long pageSize; + + public static final String JSON_PROPERTY_QUERY_ID = "queryId"; + private String queryId; + + public static final String JSON_PROPERTY_TOTAL_ROW_COUNT = "totalRowCount"; + private Long totalRowCount; + + public SecurityEntityRiskScoresMeta() {} + + @JsonCreator + public SecurityEntityRiskScoresMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_PAGE_NUMBER) Long pageNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_PAGE_SIZE) Long pageSize, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY_ID) String queryId, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL_ROW_COUNT) Long totalRowCount) { + this.pageNumber = pageNumber; + this.pageSize = pageSize; + this.queryId = queryId; + this.totalRowCount = totalRowCount; + } + + public SecurityEntityRiskScoresMeta pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Current page number (1-indexed) + * + * @return pageNumber + */ + @JsonProperty(JSON_PROPERTY_PAGE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPageNumber() { + return pageNumber; + } + + public void setPageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + } + + public SecurityEntityRiskScoresMeta pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Number of items per page + * + * @return pageSize + */ + @JsonProperty(JSON_PROPERTY_PAGE_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(Long pageSize) { + this.pageSize = pageSize; + } + + public SecurityEntityRiskScoresMeta queryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Query ID for pagination consistency + * + * @return queryId + */ + @JsonProperty(JSON_PROPERTY_QUERY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQueryId() { + return queryId; + } + + public void setQueryId(String queryId) { + this.queryId = queryId; + } + + public SecurityEntityRiskScoresMeta totalRowCount(Long totalRowCount) { + this.totalRowCount = totalRowCount; + return this; + } + + /** + * Total number of entities matching the query + * + * @return totalRowCount + */ + @JsonProperty(JSON_PROPERTY_TOTAL_ROW_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotalRowCount() { + return totalRowCount; + } + + public void setTotalRowCount(Long totalRowCount) { + this.totalRowCount = totalRowCount; + } + + /** + * 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 SecurityEntityRiskScoresMeta + */ + @JsonAnySetter + public SecurityEntityRiskScoresMeta 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 SecurityEntityRiskScoresMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityRiskScoresMeta securityEntityRiskScoresMeta = (SecurityEntityRiskScoresMeta) o; + return Objects.equals(this.pageNumber, securityEntityRiskScoresMeta.pageNumber) + && Objects.equals(this.pageSize, securityEntityRiskScoresMeta.pageSize) + && Objects.equals(this.queryId, securityEntityRiskScoresMeta.queryId) + && Objects.equals(this.totalRowCount, securityEntityRiskScoresMeta.totalRowCount) + && Objects.equals( + this.additionalProperties, securityEntityRiskScoresMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(pageNumber, pageSize, queryId, totalRowCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityRiskScoresMeta {\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" queryId: ").append(toIndentedString(queryId)).append("\n"); + sb.append(" totalRowCount: ").append(toIndentedString(totalRowCount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresResponse.java b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresResponse.java new file mode 100644 index 00000000000..d0e4a9b9588 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityEntityRiskScoresResponse.java @@ -0,0 +1,189 @@ +/* + * 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 containing a list of entity risk scores */ +@JsonPropertyOrder({ + SecurityEntityRiskScoresResponse.JSON_PROPERTY_DATA, + SecurityEntityRiskScoresResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityEntityRiskScoresResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_META = "meta"; + private SecurityEntityRiskScoresMeta meta; + + public SecurityEntityRiskScoresResponse() {} + + @JsonCreator + public SecurityEntityRiskScoresResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data, + @JsonProperty(required = true, value = JSON_PROPERTY_META) + SecurityEntityRiskScoresMeta meta) { + this.data = data; + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public SecurityEntityRiskScoresResponse data(List data) { + this.data = data; + for (SecurityEntityRiskScore item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SecurityEntityRiskScoresResponse addDataItem(SecurityEntityRiskScore dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public SecurityEntityRiskScoresResponse meta(SecurityEntityRiskScoresMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata for pagination + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityEntityRiskScoresMeta getMeta() { + return meta; + } + + public void setMeta(SecurityEntityRiskScoresMeta meta) { + this.meta = meta; + } + + /** + * 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 SecurityEntityRiskScoresResponse + */ + @JsonAnySetter + public SecurityEntityRiskScoresResponse 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 SecurityEntityRiskScoresResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityEntityRiskScoresResponse securityEntityRiskScoresResponse = + (SecurityEntityRiskScoresResponse) o; + return Objects.equals(this.data, securityEntityRiskScoresResponse.data) + && Objects.equals(this.meta, securityEntityRiskScoresResponse.meta) + && Objects.equals( + this.additionalProperties, securityEntityRiskScoresResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityEntityRiskScoresResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/entity_risk_scores.feature b/src/test/resources/com/datadog/api/client/v2/api/entity_risk_scores.feature new file mode 100644 index 00000000000..f6e28ae7405 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/entity_risk_scores.feature @@ -0,0 +1,20 @@ +@endpoint(entity-risk-scores) @endpoint(entity-risk-scores-v2) +Feature: Entity Risk Scores + Retrieves security risk scores for entities in your organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "EntityRiskScores" API + And operation "ListEntityRiskScores" enabled + And new "ListEntityRiskScores" request + + @generated @skip @team:DataDog/cloud-siem + Scenario: List Entity Risk Scores returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-siem + Scenario: List Entity Risk Scores returns "OK" response + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_risk_scores.feature b/src/test/resources/com/datadog/api/client/v2/api/security_risk_scores.feature new file mode 100644 index 00000000000..8b91662d06a --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/security_risk_scores.feature @@ -0,0 +1,20 @@ +@endpoint(security-risk-scores) @endpoint(security-risk-scores-v2) +Feature: Entity Risk Scores + Retrieves security risk scores for entities in your organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "EntityRiskScores" API + And operation "ListEntityRiskScores" enabled + And new "ListEntityRiskScores" request + + @generated @skip @team:DataDog/cloud-siem + Scenario: List Entity Risk Scores returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-siem + Scenario: List Entity Risk Scores returns "OK" response + When the request is sent + Then the response status is 200 OK 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 59046d30f0b..9933fbbfa3f 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 @@ -3793,6 +3793,12 @@ "type": "idempotent" } }, + "ListEntityRiskScores": { + "tag": "Entity Risk Scores", + "undo": { + "type": "safe" + } + }, "DownloadCloudWorkloadPolicyFile": { "tag": "CSM Threats", "undo": {