diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7acea8a9716..91955c670c9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -118490,6 +118490,193 @@ components: x-enum-varnames: - UP_ONE - DOWN_ONE + SeverityOverrideAttributes: + description: |- + Severity override to apply to the findings. + Set `action` to `set` to apply a manual severity override with the given `value`. + Set `action` to `clear` to remove a manual severity override. + oneOf: + - $ref: "#/components/schemas/SeverityOverrideSet" + - $ref: "#/components/schemas/SeverityOverrideClear" + SeverityOverrideClear: + description: |- + Removes the manual severity override of the findings. + This action does not remove a severity set by an automation rule. + properties: + action: + $ref: "#/components/schemas/SeverityOverrideClearActionType" + description: + description: Additional information about the severity change. This field has a limit of 280 characters. + example: "Severity override no longer needed." + maxLength: 280 + type: string + required: + - action + type: object + SeverityOverrideClearActionType: + default: clear + description: The action that removes a manual severity override. + enum: + - clear + example: clear + type: string + x-enum-varnames: + - CLEAR + SeverityOverrideDataType: + default: severity_override + description: Severity override resource type. + enum: + - severity_override + example: severity_override + type: string + x-enum-varnames: + - SEVERITY_OVERRIDE + SeverityOverrideRequest: + description: Request to set or clear the manual severity override of security findings. + properties: + data: + $ref: "#/components/schemas/SeverityOverrideRequestData" + required: + - data + type: object + SeverityOverrideRequestData: + description: Data of the severity override request. + properties: + attributes: + $ref: "#/components/schemas/SeverityOverrideRequestDataAttributes" + id: + description: Unique identifier of the severity override request. If not provided, an identifier is generated. + example: "00000000-0000-0000-0000-000000000001" + type: string + relationships: + $ref: "#/components/schemas/SeverityOverrideRequestDataRelationships" + type: + $ref: "#/components/schemas/SeverityOverrideDataType" + required: + - attributes + - relationships + - type + type: object + SeverityOverrideRequestDataAttributes: + description: Attributes of the severity override request. + properties: + severity: + $ref: "#/components/schemas/SeverityOverrideAttributes" + required: + - severity + type: object + SeverityOverrideRequestDataRelationships: + description: Relationships of the severity override request. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to override the severity of. + required: + - findings + type: object + SeverityOverrideResponse: + description: Response for the severity override request. + properties: + data: + $ref: "#/components/schemas/SeverityOverrideResponseData" + meta: + $ref: "#/components/schemas/SeverityOverrideResponseMeta" + required: + - data + type: object + SeverityOverrideResponseData: + description: Data of the severity override response. + properties: + id: + description: Unique identifier of the severity override request. + example: "00000000-0000-0000-0000-000000000001" + type: string + type: + $ref: "#/components/schemas/SeverityOverrideDataType" + required: + - id + - type + type: object + SeverityOverrideResponseMeta: + description: Security findings skipped while processing the severity override request. + properties: + warnings: + description: Findings skipped because an automation rule set their severity. + items: + $ref: "#/components/schemas/SeverityOverrideResult" + type: array + type: object + SeverityOverrideResult: + description: Per-finding outcome of a severity override operation. + properties: + detail: + description: Human-readable explanation of why the finding was skipped. + example: >- + cannot set severity on finding because it is overridden by an automation severity modifier rule; disable or update the automation rule first + type: string + finding_id: + description: Unique identifier of the security finding. + example: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: string + status: + description: HTTP-like status code describing the outcome for this finding. + example: 400 + format: int32 + maximum: 599 + type: integer + title: + description: Short label describing the outcome for this finding. + example: "Bad Request" + type: string + required: + - finding_id + - status + - title + - detail + type: object + SeverityOverrideSet: + description: Applies a manual severity override to the findings. + properties: + action: + $ref: "#/components/schemas/SeverityOverrideSetActionType" + description: + description: Additional information about the severity change. This field has a limit of 280 characters. + example: "Database contains sensitive data." + maxLength: 280 + type: string + value: + $ref: "#/components/schemas/SeverityOverrideValue" + required: + - action + - value + type: object + SeverityOverrideSetActionType: + default: set + description: The action that applies a manual severity override. + enum: + - set + example: set + type: string + x-enum-varnames: + - SET + SeverityOverrideValue: + description: |- + Severity to apply to the findings. + `info` sets the lowest severity the finding type allows. + enum: + - critical + - high + - medium + - low + - info + example: high + type: string + x-enum-varnames: + - CRITICAL + - HIGH + - MEDIUM + - LOW + - INFO SharedDashboardGlobalTime: additionalProperties: {} description: Default time range configuration for the shared dashboard. @@ -221300,6 +221487,109 @@ paths: permissions: - security_monitoring_findings_write - appsec_vm_write + /api/v2/security/findings/severity: + patch: + description: |- + Set or clear the manual severity override of security findings. + + You can update up to 100 security findings per request. + Use the `set` action with a `value` to apply a manual severity override. + `value` is required for `set` and must be omitted for `clear`. + The `info` value sets the lowest severity the finding type allows. + Use the `clear` action to remove a manual severity override. + `clear` does not remove a severity set by an automation rule. + The optional `description` is accepted with both actions and has a limit of 280 characters. + + Auto-closed findings are excluded. + Findings whose severity was set by an automation rule are skipped and listed in the response `meta.warnings`. + If every finding is skipped this way, the request fails with a `400` error. + Findings that cannot be found are skipped without a warning. + The request fails with a `404` error only if none of the findings can be found. + operationId: UpdateFindingsSeverity + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + severity: + action: "set" + description: "Database contains sensitive data." + value: "high" + relationships: + findings: + data: + - id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: "findings" + - id: "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=" + type: "findings" + type: "severity_override" + schema: + $ref: "#/components/schemas/SeverityOverrideRequest" + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "severity_override" + meta: + warnings: + - detail: >- + cannot set severity on finding because it is overridden by an automation severity modifier rule; disable or update the automation rule first + finding_id: "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=" + status: 400 + title: "Bad Request" + schema: + $ref: "#/components/schemas/SeverityOverrideResponse" + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: "Unprocessable Entity" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Override the severity of security findings + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + - data_scanner_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security/sboms: get: description: |- diff --git a/examples/v2/security-monitoring/UpdateFindingsSeverity.java b/examples/v2/security-monitoring/UpdateFindingsSeverity.java new file mode 100644 index 00000000000..2364fae8251 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateFindingsSeverity.java @@ -0,0 +1,63 @@ +// Override the severity of security findings returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.FindingData; +import com.datadog.api.client.v2.model.FindingDataType; +import com.datadog.api.client.v2.model.Findings; +import com.datadog.api.client.v2.model.SeverityOverrideAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideDataType; +import com.datadog.api.client.v2.model.SeverityOverrideRequest; +import com.datadog.api.client.v2.model.SeverityOverrideRequestData; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataRelationships; +import com.datadog.api.client.v2.model.SeverityOverrideResponse; +import com.datadog.api.client.v2.model.SeverityOverrideSet; +import com.datadog.api.client.v2.model.SeverityOverrideSetActionType; +import com.datadog.api.client.v2.model.SeverityOverrideValue; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.updateFindingsSeverity", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + SeverityOverrideRequest body = + new SeverityOverrideRequest() + .data( + new SeverityOverrideRequestData() + .attributes( + new SeverityOverrideRequestDataAttributes() + .severity( + new SeverityOverrideAttributes( + new SeverityOverrideSet() + .action(SeverityOverrideSetActionType.SET) + .description("Database contains sensitive data.") + .value(SeverityOverrideValue.HIGH)))) + .id("00000000-0000-0000-0000-000000000001") + .relationships( + new SeverityOverrideRequestDataRelationships() + .findings( + new Findings() + .data( + Collections.singletonList( + new FindingData() + .id("ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==") + .type(FindingDataType.FINDINGS))))) + .type(SeverityOverrideDataType.SEVERITY_OVERRIDE)); + + try { + SeverityOverrideResponse result = apiInstance.updateFindingsSeverity(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#updateFindingsSeverity"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/UpdateFindingsSeverity_1312693410.java b/examples/v2/security-monitoring/UpdateFindingsSeverity_1312693410.java new file mode 100644 index 00000000000..1f3bd3b4358 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateFindingsSeverity_1312693410.java @@ -0,0 +1,60 @@ +// Clear the severity override of security findings returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.FindingData; +import com.datadog.api.client.v2.model.FindingDataType; +import com.datadog.api.client.v2.model.Findings; +import com.datadog.api.client.v2.model.SeverityOverrideAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideClear; +import com.datadog.api.client.v2.model.SeverityOverrideClearActionType; +import com.datadog.api.client.v2.model.SeverityOverrideDataType; +import com.datadog.api.client.v2.model.SeverityOverrideRequest; +import com.datadog.api.client.v2.model.SeverityOverrideRequestData; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataRelationships; +import com.datadog.api.client.v2.model.SeverityOverrideResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.updateFindingsSeverity", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + SeverityOverrideRequest body = + new SeverityOverrideRequest() + .data( + new SeverityOverrideRequestData() + .attributes( + new SeverityOverrideRequestDataAttributes() + .severity( + new SeverityOverrideAttributes( + new SeverityOverrideClear() + .action(SeverityOverrideClearActionType.CLEAR)))) + .relationships( + new SeverityOverrideRequestDataRelationships() + .findings( + new Findings() + .data( + Collections.singletonList( + new FindingData() + .id( + "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=") + .type(FindingDataType.FINDINGS))))) + .type(SeverityOverrideDataType.SEVERITY_OVERRIDE)); + + try { + SeverityOverrideResponse result = apiInstance.updateFindingsSeverity(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#updateFindingsSeverity"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/UpdateFindingsSeverity_412359663.java b/examples/v2/security-monitoring/UpdateFindingsSeverity_412359663.java new file mode 100644 index 00000000000..781bc8af832 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateFindingsSeverity_412359663.java @@ -0,0 +1,63 @@ +// Apply a severity override to security findings returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.FindingData; +import com.datadog.api.client.v2.model.FindingDataType; +import com.datadog.api.client.v2.model.Findings; +import com.datadog.api.client.v2.model.SeverityOverrideAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideDataType; +import com.datadog.api.client.v2.model.SeverityOverrideRequest; +import com.datadog.api.client.v2.model.SeverityOverrideRequestData; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataAttributes; +import com.datadog.api.client.v2.model.SeverityOverrideRequestDataRelationships; +import com.datadog.api.client.v2.model.SeverityOverrideResponse; +import com.datadog.api.client.v2.model.SeverityOverrideSet; +import com.datadog.api.client.v2.model.SeverityOverrideSetActionType; +import com.datadog.api.client.v2.model.SeverityOverrideValue; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.updateFindingsSeverity", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + SeverityOverrideRequest body = + new SeverityOverrideRequest() + .data( + new SeverityOverrideRequestData() + .attributes( + new SeverityOverrideRequestDataAttributes() + .severity( + new SeverityOverrideAttributes( + new SeverityOverrideSet() + .action(SeverityOverrideSetActionType.SET) + .description("Database contains sensitive data.") + .value(SeverityOverrideValue.HIGH)))) + .relationships( + new SeverityOverrideRequestDataRelationships() + .findings( + new Findings() + .data( + Collections.singletonList( + new FindingData() + .id( + "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=") + .type(FindingDataType.FINDINGS))))) + .type(SeverityOverrideDataType.SEVERITY_OVERRIDE)); + + try { + SeverityOverrideResponse result = apiInstance.updateFindingsSeverity(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#updateFindingsSeverity"); + 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 de5d4aea621..6acbb2691aa 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1181,6 +1181,7 @@ public class ApiClient { put("v2.runHistoricalJob", false); put("v2.searchSecurityMonitoringHistsignals", false); put("v2.updateFindingsAssignee", false); + put("v2.updateFindingsSeverity", false); put("v2.updateSecurityFindingsAutomationDueDateRule", false); put("v2.updateSecurityFindingsAutomationInboxRule", false); put("v2.updateSecurityFindingsAutomationMuteRule", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index cf9ee3def5c..630f740cd64 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -179,6 +179,8 @@ import com.datadog.api.client.v2.model.SeverityModifierRuleResponse; import com.datadog.api.client.v2.model.SeverityModifierRuleUpdateRequest; import com.datadog.api.client.v2.model.SeverityModifierRulesResponse; +import com.datadog.api.client.v2.model.SeverityOverrideRequest; +import com.datadog.api.client.v2.model.SeverityOverrideResponse; import com.datadog.api.client.v2.model.SignalEntitiesResponse; import com.datadog.api.client.v2.model.SingleEntityContextResponse; import com.datadog.api.client.v2.model.TicketCreationRuleCreateRequest; @@ -29398,6 +29400,173 @@ public CompletableFuture> updateFindingsAssigneeWi new GenericType() {}); } + /** + * Override the severity of security findings. + * + *

See {@link #updateFindingsSeverityWithHttpInfo}. + * + * @param body (required) + * @return SeverityOverrideResponse + * @throws ApiException if fails to make API call + */ + public SeverityOverrideResponse updateFindingsSeverity(SeverityOverrideRequest body) + throws ApiException { + return updateFindingsSeverityWithHttpInfo(body).getData(); + } + + /** + * Override the severity of security findings. + * + *

See {@link #updateFindingsSeverityWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<SeverityOverrideResponse> + */ + public CompletableFuture updateFindingsSeverityAsync( + SeverityOverrideRequest body) { + return updateFindingsSeverityWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Set or clear the manual severity override of security findings. + * + *

You can update up to 100 security findings per request. Use the set action with + * a value to apply a manual severity override. value is required for + * set and must be omitted for clear. The info value sets + * the lowest severity the finding type allows. Use the clear action to remove a + * manual severity override. clear does not remove a severity set by an automation + * rule. The optional description is accepted with both actions and has a limit of + * 280 characters. + * + *

Auto-closed findings are excluded. Findings whose severity was set by an automation rule are + * skipped and listed in the response meta.warnings. If every finding is skipped this + * way, the request fails with a 400 error. Findings that cannot be found are skipped + * without a warning. The request fails with a 404 error only if none of the findings + * can be found. + * + * @param body (required) + * @return ApiResponse<SeverityOverrideResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
429 Too many requests -
+ */ + public ApiResponse updateFindingsSeverityWithHttpInfo( + SeverityOverrideRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateFindingsSeverity"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateFindingsSeverity"); + } + // create path and map variables + String localVarPath = "/api/v2/security/findings/severity"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.updateFindingsSeverity", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Override the severity of security findings. + * + *

See {@link #updateFindingsSeverityWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<SeverityOverrideResponse>> + */ + public CompletableFuture> + updateFindingsSeverityWithHttpInfoAsync(SeverityOverrideRequest body) { + // Check if unstable operation is enabled + String operationId = "updateFindingsSeverity"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateFindingsSeverity")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/security/findings/severity"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.updateFindingsSeverity", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Update resource filters. * diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideAttributes.java new file mode 100644 index 00000000000..759223d85c3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideAttributes.java @@ -0,0 +1,280 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = SeverityOverrideAttributes.SeverityOverrideAttributesDeserializer.class) +@JsonSerialize(using = SeverityOverrideAttributes.SeverityOverrideAttributesSerializer.class) +public class SeverityOverrideAttributes extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SeverityOverrideAttributes.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class SeverityOverrideAttributesSerializer + extends StdSerializer { + public SeverityOverrideAttributesSerializer(Class t) { + super(t); + } + + public SeverityOverrideAttributesSerializer() { + this(null); + } + + @Override + public void serialize( + SeverityOverrideAttributes value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class SeverityOverrideAttributesDeserializer + extends StdDeserializer { + public SeverityOverrideAttributesDeserializer() { + this(SeverityOverrideAttributes.class); + } + + public SeverityOverrideAttributesDeserializer(Class vc) { + super(vc); + } + + @Override + public SeverityOverrideAttributes deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize SeverityOverrideSet + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SeverityOverrideSet.class.equals(Integer.class) + || SeverityOverrideSet.class.equals(Long.class) + || SeverityOverrideSet.class.equals(Float.class) + || SeverityOverrideSet.class.equals(Double.class) + || SeverityOverrideSet.class.equals(Boolean.class) + || SeverityOverrideSet.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SeverityOverrideSet.class.equals(Integer.class) + || SeverityOverrideSet.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SeverityOverrideSet.class.equals(Float.class) + || SeverityOverrideSet.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SeverityOverrideSet.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SeverityOverrideSet.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SeverityOverrideSet.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SeverityOverrideSet) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SeverityOverrideSet'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SeverityOverrideSet'", e); + } + + // deserialize SeverityOverrideClear + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SeverityOverrideClear.class.equals(Integer.class) + || SeverityOverrideClear.class.equals(Long.class) + || SeverityOverrideClear.class.equals(Float.class) + || SeverityOverrideClear.class.equals(Double.class) + || SeverityOverrideClear.class.equals(Boolean.class) + || SeverityOverrideClear.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SeverityOverrideClear.class.equals(Integer.class) + || SeverityOverrideClear.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SeverityOverrideClear.class.equals(Float.class) + || SeverityOverrideClear.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SeverityOverrideClear.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SeverityOverrideClear.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SeverityOverrideClear.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SeverityOverrideClear) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SeverityOverrideClear'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SeverityOverrideClear'", e); + } + + SeverityOverrideAttributes ret = new SeverityOverrideAttributes(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SeverityOverrideAttributes getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SeverityOverrideAttributes cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public SeverityOverrideAttributes() { + super("oneOf", Boolean.FALSE); + } + + public SeverityOverrideAttributes(SeverityOverrideSet o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SeverityOverrideAttributes(SeverityOverrideClear o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SeverityOverrideSet", new GenericType() {}); + schemas.put("SeverityOverrideClear", new GenericType() {}); + JSON.registerDescendants( + SeverityOverrideAttributes.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return SeverityOverrideAttributes.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SeverityOverrideSet, SeverityOverrideClear + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(SeverityOverrideSet.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SeverityOverrideClear.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be SeverityOverrideSet, SeverityOverrideClear"); + } + + /** + * Get the actual instance, which can be the following: SeverityOverrideSet, SeverityOverrideClear + * + * @return The actual instance (SeverityOverrideSet, SeverityOverrideClear) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SeverityOverrideSet`. If the actual instance is not + * `SeverityOverrideSet`, the ClassCastException will be thrown. + * + * @return The actual instance of `SeverityOverrideSet` + * @throws ClassCastException if the instance is not `SeverityOverrideSet` + */ + public SeverityOverrideSet getSeverityOverrideSet() throws ClassCastException { + return (SeverityOverrideSet) super.getActualInstance(); + } + + /** + * Get the actual instance of `SeverityOverrideClear`. If the actual instance is not + * `SeverityOverrideClear`, the ClassCastException will be thrown. + * + * @return The actual instance of `SeverityOverrideClear` + * @throws ClassCastException if the instance is not `SeverityOverrideClear` + */ + public SeverityOverrideClear getSeverityOverrideClear() throws ClassCastException { + return (SeverityOverrideClear) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideClear.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideClear.java new file mode 100644 index 00000000000..22214d87c91 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideClear.java @@ -0,0 +1,181 @@ +/* + * 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; + +/** + * Removes the manual severity override of the findings. This action does not remove a severity set + * by an automation rule. + */ +@JsonPropertyOrder({ + SeverityOverrideClear.JSON_PROPERTY_ACTION, + SeverityOverrideClear.JSON_PROPERTY_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideClear { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private SeverityOverrideClearActionType action = SeverityOverrideClearActionType.CLEAR; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public SeverityOverrideClear() {} + + @JsonCreator + public SeverityOverrideClear( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) + SeverityOverrideClearActionType action) { + this.action = action; + this.unparsed |= !action.isValid(); + } + + public SeverityOverrideClear action(SeverityOverrideClearActionType action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The action that removes a manual severity override. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideClearActionType getAction() { + return action; + } + + public void setAction(SeverityOverrideClearActionType action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public SeverityOverrideClear description(String description) { + this.description = description; + return this; + } + + /** + * Additional information about the severity change. This field has a limit of 280 characters. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * 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 SeverityOverrideClear + */ + @JsonAnySetter + public SeverityOverrideClear 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 SeverityOverrideClear object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideClear severityOverrideClear = (SeverityOverrideClear) o; + return Objects.equals(this.action, severityOverrideClear.action) + && Objects.equals(this.description, severityOverrideClear.description) + && Objects.equals(this.additionalProperties, severityOverrideClear.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, description, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideClear {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).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/SeverityOverrideClearActionType.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideClearActionType.java new file mode 100644 index 00000000000..7d1d29f2f5b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideClearActionType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The action that removes a manual severity override. */ +@JsonSerialize( + using = SeverityOverrideClearActionType.SeverityOverrideClearActionTypeSerializer.class) +public class SeverityOverrideClearActionType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("clear")); + + public static final SeverityOverrideClearActionType CLEAR = + new SeverityOverrideClearActionType("clear"); + + SeverityOverrideClearActionType(String value) { + super(value, allowedValues); + } + + public static class SeverityOverrideClearActionTypeSerializer + extends StdSerializer { + public SeverityOverrideClearActionTypeSerializer(Class t) { + super(t); + } + + public SeverityOverrideClearActionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SeverityOverrideClearActionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SeverityOverrideClearActionType fromValue(String value) { + return new SeverityOverrideClearActionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideDataType.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideDataType.java new file mode 100644 index 00000000000..0fe963d0dd4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideDataType.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; + +/** Severity override resource type. */ +@JsonSerialize(using = SeverityOverrideDataType.SeverityOverrideDataTypeSerializer.class) +public class SeverityOverrideDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("severity_override")); + + public static final SeverityOverrideDataType SEVERITY_OVERRIDE = + new SeverityOverrideDataType("severity_override"); + + SeverityOverrideDataType(String value) { + super(value, allowedValues); + } + + public static class SeverityOverrideDataTypeSerializer + extends StdSerializer { + public SeverityOverrideDataTypeSerializer(Class t) { + super(t); + } + + public SeverityOverrideDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SeverityOverrideDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SeverityOverrideDataType fromValue(String value) { + return new SeverityOverrideDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequest.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequest.java new file mode 100644 index 00000000000..68aaf1c820a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to set or clear the manual severity override of security findings. */ +@JsonPropertyOrder({SeverityOverrideRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SeverityOverrideRequestData data; + + public SeverityOverrideRequest() {} + + @JsonCreator + public SeverityOverrideRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) SeverityOverrideRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SeverityOverrideRequest data(SeverityOverrideRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data of the severity override request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideRequestData getData() { + return data; + } + + public void setData(SeverityOverrideRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SeverityOverrideRequest + */ + @JsonAnySetter + public SeverityOverrideRequest 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 SeverityOverrideRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideRequest severityOverrideRequest = (SeverityOverrideRequest) o; + return Objects.equals(this.data, severityOverrideRequest.data) + && Objects.equals(this.additionalProperties, severityOverrideRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestData.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestData.java new file mode 100644 index 00000000000..915b23a4fd7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestData.java @@ -0,0 +1,248 @@ +/* + * 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; + +/** Data of the severity override request. */ +@JsonPropertyOrder({ + SeverityOverrideRequestData.JSON_PROPERTY_ATTRIBUTES, + SeverityOverrideRequestData.JSON_PROPERTY_ID, + SeverityOverrideRequestData.JSON_PROPERTY_RELATIONSHIPS, + SeverityOverrideRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SeverityOverrideRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private SeverityOverrideRequestDataRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SeverityOverrideDataType type = SeverityOverrideDataType.SEVERITY_OVERRIDE; + + public SeverityOverrideRequestData() {} + + @JsonCreator + public SeverityOverrideRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SeverityOverrideRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_RELATIONSHIPS) + SeverityOverrideRequestDataRelationships relationships, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SeverityOverrideDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SeverityOverrideRequestData attributes(SeverityOverrideRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the severity override request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SeverityOverrideRequestDataAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public SeverityOverrideRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the severity override request. If not provided, an identifier is + * generated. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public SeverityOverrideRequestData relationships( + SeverityOverrideRequestDataRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of the severity override request. + * + * @return relationships + */ + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideRequestDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(SeverityOverrideRequestDataRelationships relationships) { + this.relationships = relationships; + if (relationships != null) { + this.unparsed |= relationships.unparsed; + } + } + + public SeverityOverrideRequestData type(SeverityOverrideDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Severity override resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideDataType getType() { + return type; + } + + public void setType(SeverityOverrideDataType 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 SeverityOverrideRequestData + */ + @JsonAnySetter + public SeverityOverrideRequestData 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 SeverityOverrideRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideRequestData severityOverrideRequestData = (SeverityOverrideRequestData) o; + return Objects.equals(this.attributes, severityOverrideRequestData.attributes) + && Objects.equals(this.id, severityOverrideRequestData.id) + && Objects.equals(this.relationships, severityOverrideRequestData.relationships) + && Objects.equals(this.type, severityOverrideRequestData.type) + && Objects.equals( + this.additionalProperties, severityOverrideRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/SeverityOverrideRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestDataAttributes.java new file mode 100644 index 00000000000..1237ebdced0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestDataAttributes.java @@ -0,0 +1,153 @@ +/* + * 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; + +/** Attributes of the severity override request. */ +@JsonPropertyOrder({SeverityOverrideRequestDataAttributes.JSON_PROPERTY_SEVERITY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SEVERITY = "severity"; + private SeverityOverrideAttributes severity; + + public SeverityOverrideRequestDataAttributes() {} + + @JsonCreator + public SeverityOverrideRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_SEVERITY) + SeverityOverrideAttributes severity) { + this.severity = severity; + this.unparsed |= severity.unparsed; + } + + public SeverityOverrideRequestDataAttributes severity(SeverityOverrideAttributes severity) { + this.severity = severity; + this.unparsed |= severity.unparsed; + return this; + } + + /** + * Severity override to apply to the findings. Set action to set to + * apply a manual severity override with the given value. Set action to + * clear to remove a manual severity override. + * + * @return severity + */ + @JsonProperty(JSON_PROPERTY_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideAttributes getSeverity() { + return severity; + } + + public void setSeverity(SeverityOverrideAttributes severity) { + this.severity = severity; + if (severity != null) { + this.unparsed |= severity.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SeverityOverrideRequestDataAttributes + */ + @JsonAnySetter + public SeverityOverrideRequestDataAttributes 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 SeverityOverrideRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideRequestDataAttributes severityOverrideRequestDataAttributes = + (SeverityOverrideRequestDataAttributes) o; + return Objects.equals(this.severity, severityOverrideRequestDataAttributes.severity) + && Objects.equals( + this.additionalProperties, severityOverrideRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(severity, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideRequestDataAttributes {\n"); + sb.append(" severity: ").append(toIndentedString(severity)).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/SeverityOverrideRequestDataRelationships.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestDataRelationships.java new file mode 100644 index 00000000000..3ce685b7fd9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideRequestDataRelationships.java @@ -0,0 +1,151 @@ +/* + * 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; + +/** Relationships of the severity override request. */ +@JsonPropertyOrder({SeverityOverrideRequestDataRelationships.JSON_PROPERTY_FINDINGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideRequestDataRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FINDINGS = "findings"; + private Findings findings; + + public SeverityOverrideRequestDataRelationships() {} + + @JsonCreator + public SeverityOverrideRequestDataRelationships( + @JsonProperty(required = true, value = JSON_PROPERTY_FINDINGS) Findings findings) { + this.findings = findings; + this.unparsed |= findings.unparsed; + } + + public SeverityOverrideRequestDataRelationships findings(Findings findings) { + this.findings = findings; + this.unparsed |= findings.unparsed; + return this; + } + + /** + * A list of security findings. + * + * @return findings + */ + @JsonProperty(JSON_PROPERTY_FINDINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Findings getFindings() { + return findings; + } + + public void setFindings(Findings findings) { + this.findings = findings; + if (findings != null) { + this.unparsed |= findings.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SeverityOverrideRequestDataRelationships + */ + @JsonAnySetter + public SeverityOverrideRequestDataRelationships 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 SeverityOverrideRequestDataRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideRequestDataRelationships severityOverrideRequestDataRelationships = + (SeverityOverrideRequestDataRelationships) o; + return Objects.equals(this.findings, severityOverrideRequestDataRelationships.findings) + && Objects.equals( + this.additionalProperties, + severityOverrideRequestDataRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(findings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideRequestDataRelationships {\n"); + sb.append(" findings: ").append(toIndentedString(findings)).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/SeverityOverrideResponse.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponse.java new file mode 100644 index 00000000000..23f3c6dfaf9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponse.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** Response for the severity override request. */ +@JsonPropertyOrder({ + SeverityOverrideResponse.JSON_PROPERTY_DATA, + SeverityOverrideResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SeverityOverrideResponseData data; + + public static final String JSON_PROPERTY_META = "meta"; + private SeverityOverrideResponseMeta meta; + + public SeverityOverrideResponse() {} + + @JsonCreator + public SeverityOverrideResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + SeverityOverrideResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SeverityOverrideResponse data(SeverityOverrideResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data of the severity override response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideResponseData getData() { + return data; + } + + public void setData(SeverityOverrideResponseData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + public SeverityOverrideResponse meta(SeverityOverrideResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Security findings skipped while processing the severity override request. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SeverityOverrideResponseMeta getMeta() { + return meta; + } + + public void setMeta(SeverityOverrideResponseMeta meta) { + this.meta = meta; + if (meta != null) { + this.unparsed |= meta.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SeverityOverrideResponse + */ + @JsonAnySetter + public SeverityOverrideResponse 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 SeverityOverrideResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideResponse severityOverrideResponse = (SeverityOverrideResponse) o; + return Objects.equals(this.data, severityOverrideResponse.data) + && Objects.equals(this.meta, severityOverrideResponse.meta) + && Objects.equals(this.additionalProperties, severityOverrideResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideResponse {\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/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponseData.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponseData.java new file mode 100644 index 00000000000..63576f495c5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponseData.java @@ -0,0 +1,179 @@ +/* + * 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; + +/** Data of the severity override response. */ +@JsonPropertyOrder({ + SeverityOverrideResponseData.JSON_PROPERTY_ID, + SeverityOverrideResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SeverityOverrideDataType type = SeverityOverrideDataType.SEVERITY_OVERRIDE; + + public SeverityOverrideResponseData() {} + + @JsonCreator + public SeverityOverrideResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SeverityOverrideDataType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SeverityOverrideResponseData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the severity override request. + * + * @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 SeverityOverrideResponseData type(SeverityOverrideDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Severity override resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideDataType getType() { + return type; + } + + public void setType(SeverityOverrideDataType 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 SeverityOverrideResponseData + */ + @JsonAnySetter + public SeverityOverrideResponseData 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 SeverityOverrideResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideResponseData severityOverrideResponseData = (SeverityOverrideResponseData) o; + return Objects.equals(this.id, severityOverrideResponseData.id) + && Objects.equals(this.type, severityOverrideResponseData.type) + && Objects.equals( + this.additionalProperties, severityOverrideResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideResponseData {\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/SeverityOverrideResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponseMeta.java new file mode 100644 index 00000000000..122557cd01b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResponseMeta.java @@ -0,0 +1,157 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Security findings skipped while processing the severity override request. */ +@JsonPropertyOrder({SeverityOverrideResponseMeta.JSON_PROPERTY_WARNINGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_WARNINGS = "warnings"; + private List warnings = null; + + public SeverityOverrideResponseMeta warnings(List warnings) { + this.warnings = warnings; + if (warnings != null) { + for (SeverityOverrideResult item : warnings) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public SeverityOverrideResponseMeta addWarningsItem(SeverityOverrideResult warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + this.unparsed |= warningsItem.unparsed; + return this; + } + + /** + * Findings skipped because an automation rule set their severity. + * + * @return warnings + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WARNINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getWarnings() { + return warnings; + } + + public void setWarnings(List warnings) { + this.warnings = warnings; + if (warnings != null) { + for (SeverityOverrideResult item : warnings) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SeverityOverrideResponseMeta + */ + @JsonAnySetter + public SeverityOverrideResponseMeta 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 SeverityOverrideResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideResponseMeta severityOverrideResponseMeta = (SeverityOverrideResponseMeta) o; + return Objects.equals(this.warnings, severityOverrideResponseMeta.warnings) + && Objects.equals( + this.additionalProperties, severityOverrideResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(warnings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideResponseMeta {\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).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/SeverityOverrideResult.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResult.java new file mode 100644 index 00000000000..f486688d2f6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideResult.java @@ -0,0 +1,229 @@ +/* + * 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; + +/** Per-finding outcome of a severity override operation. */ +@JsonPropertyOrder({ + SeverityOverrideResult.JSON_PROPERTY_DETAIL, + SeverityOverrideResult.JSON_PROPERTY_FINDING_ID, + SeverityOverrideResult.JSON_PROPERTY_STATUS, + SeverityOverrideResult.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideResult { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + public static final String JSON_PROPERTY_FINDING_ID = "finding_id"; + private String findingId; + + public static final String JSON_PROPERTY_STATUS = "status"; + private Integer status; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public SeverityOverrideResult() {} + + @JsonCreator + public SeverityOverrideResult( + @JsonProperty(required = true, value = JSON_PROPERTY_DETAIL) String detail, + @JsonProperty(required = true, value = JSON_PROPERTY_FINDING_ID) String findingId, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) Integer status, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.detail = detail; + this.findingId = findingId; + this.status = status; + this.title = title; + } + + public SeverityOverrideResult detail(String detail) { + this.detail = detail; + return this; + } + + /** + * Human-readable explanation of why the finding was skipped. + * + * @return detail + */ + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public SeverityOverrideResult findingId(String findingId) { + this.findingId = findingId; + return this; + } + + /** + * Unique identifier of the security finding. + * + * @return findingId + */ + @JsonProperty(JSON_PROPERTY_FINDING_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFindingId() { + return findingId; + } + + public void setFindingId(String findingId) { + this.findingId = findingId; + } + + public SeverityOverrideResult status(Integer status) { + this.status = status; + return this; + } + + /** + * HTTP-like status code describing the outcome for this finding. maximum: 599 + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public SeverityOverrideResult title(String title) { + this.title = title; + return this; + } + + /** + * Short label describing the outcome for this finding. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * 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 SeverityOverrideResult + */ + @JsonAnySetter + public SeverityOverrideResult 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 SeverityOverrideResult object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideResult severityOverrideResult = (SeverityOverrideResult) o; + return Objects.equals(this.detail, severityOverrideResult.detail) + && Objects.equals(this.findingId, severityOverrideResult.findingId) + && Objects.equals(this.status, severityOverrideResult.status) + && Objects.equals(this.title, severityOverrideResult.title) + && Objects.equals(this.additionalProperties, severityOverrideResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, findingId, status, title, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideResult {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" findingId: ").append(toIndentedString(findingId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).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/SeverityOverrideSet.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideSet.java new file mode 100644 index 00000000000..75eac7e0d9b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideSet.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Applies a manual severity override to the findings. */ +@JsonPropertyOrder({ + SeverityOverrideSet.JSON_PROPERTY_ACTION, + SeverityOverrideSet.JSON_PROPERTY_DESCRIPTION, + SeverityOverrideSet.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SeverityOverrideSet { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private SeverityOverrideSetActionType action = SeverityOverrideSetActionType.SET; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_VALUE = "value"; + private SeverityOverrideValue value; + + public SeverityOverrideSet() {} + + @JsonCreator + public SeverityOverrideSet( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) + SeverityOverrideSetActionType action, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) SeverityOverrideValue value) { + this.action = action; + this.unparsed |= !action.isValid(); + this.value = value; + this.unparsed |= !value.isValid(); + } + + public SeverityOverrideSet action(SeverityOverrideSetActionType action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The action that applies a manual severity override. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideSetActionType getAction() { + return action; + } + + public void setAction(SeverityOverrideSetActionType action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public SeverityOverrideSet description(String description) { + this.description = description; + return this; + } + + /** + * Additional information about the severity change. This field has a limit of 280 characters. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public SeverityOverrideSet value(SeverityOverrideValue value) { + this.value = value; + this.unparsed |= !value.isValid(); + return this; + } + + /** + * Severity to apply to the findings. info sets the lowest severity the finding type + * allows. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SeverityOverrideValue getValue() { + return value; + } + + public void setValue(SeverityOverrideValue value) { + if (!value.isValid()) { + this.unparsed = true; + } + this.value = value; + } + + /** + * 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 SeverityOverrideSet + */ + @JsonAnySetter + public SeverityOverrideSet 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 SeverityOverrideSet object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SeverityOverrideSet severityOverrideSet = (SeverityOverrideSet) o; + return Objects.equals(this.action, severityOverrideSet.action) + && Objects.equals(this.description, severityOverrideSet.description) + && Objects.equals(this.value, severityOverrideSet.value) + && Objects.equals(this.additionalProperties, severityOverrideSet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, description, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SeverityOverrideSet {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/SeverityOverrideSetActionType.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideSetActionType.java new file mode 100644 index 00000000000..878e281dde3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideSetActionType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The action that applies a manual severity override. */ +@JsonSerialize(using = SeverityOverrideSetActionType.SeverityOverrideSetActionTypeSerializer.class) +public class SeverityOverrideSetActionType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("set")); + + public static final SeverityOverrideSetActionType SET = new SeverityOverrideSetActionType("set"); + + SeverityOverrideSetActionType(String value) { + super(value, allowedValues); + } + + public static class SeverityOverrideSetActionTypeSerializer + extends StdSerializer { + public SeverityOverrideSetActionTypeSerializer(Class t) { + super(t); + } + + public SeverityOverrideSetActionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SeverityOverrideSetActionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SeverityOverrideSetActionType fromValue(String value) { + return new SeverityOverrideSetActionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideValue.java b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideValue.java new file mode 100644 index 00000000000..0c3090d833d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SeverityOverrideValue.java @@ -0,0 +1,62 @@ +/* + * 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 to apply to the findings. info sets the lowest severity the finding type + * allows. + */ +@JsonSerialize(using = SeverityOverrideValue.SeverityOverrideValueSerializer.class) +public class SeverityOverrideValue extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("critical", "high", "medium", "low", "info")); + + public static final SeverityOverrideValue CRITICAL = new SeverityOverrideValue("critical"); + public static final SeverityOverrideValue HIGH = new SeverityOverrideValue("high"); + public static final SeverityOverrideValue MEDIUM = new SeverityOverrideValue("medium"); + public static final SeverityOverrideValue LOW = new SeverityOverrideValue("low"); + public static final SeverityOverrideValue INFO = new SeverityOverrideValue("info"); + + SeverityOverrideValue(String value) { + super(value, allowedValues); + } + + public static class SeverityOverrideValueSerializer extends StdSerializer { + public SeverityOverrideValueSerializer(Class t) { + super(t); + } + + public SeverityOverrideValueSerializer() { + this(null); + } + + @Override + public void serialize( + SeverityOverrideValue value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SeverityOverrideValue fromValue(String value) { + return new SeverityOverrideValue(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 58e774ce389..3a2ac120f41 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -68,6 +68,31 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:ddoghq/k9-investigation + Scenario: Apply a severity override to security findings returns "Accepted" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "description": "Database contains sensitive data.", "value": "high"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 202 Accepted + And the response "data.type" is equal to "severity_override" + + @team:ddoghq/k9-investigation + Scenario: Apply a severity override to security findings returns "Not Found" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "value": "high"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 404 Not Found + + @skip-validation @team:ddoghq/k9-investigation + Scenario: Apply a severity override to security findings returns "Unprocessable Entity" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:ddoghq/k9-investigation Scenario: Assign or unassign security findings returns "Accepted" response Given operation "UpdateFindingsAssignee" enabled @@ -414,6 +439,15 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:ddoghq/k9-investigation + Scenario: Clear the severity override of security findings returns "Accepted" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "clear"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 202 Accepted + And the response "data.type" is equal to "severity_override" + @team:ddoghq/cloud-siem Scenario: Convert a job result to a signal returns "Bad Request" response Given operation "ConvertJobResultToSignal" enabled @@ -3079,6 +3113,38 @@ Feature: Security Monitoring When the request is sent Then the response status is 422 Unprocessable Entity + @generated @skip @team:ddoghq/k9-investigation + Scenario: Override the severity of security findings returns "Accepted" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "description": "Database contains sensitive data.", "value": "high"}}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:ddoghq/k9-investigation + Scenario: Override the severity of security findings returns "Bad Request" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "description": "Database contains sensitive data.", "value": "high"}}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/k9-investigation + Scenario: Override the severity of security findings returns "Not Found" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "description": "Database contains sensitive data.", "value": "high"}}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/k9-investigation + Scenario: Override the severity of security findings returns "Unprocessable Entity" response + Given operation "UpdateFindingsSeverity" enabled + And new "UpdateFindingsSeverity" request + And body with value {"data": {"attributes": {"severity": {"action": "set", "description": "Database contains sensitive data.", "value": "high"}}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "severity_override"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @team:ddoghq/cloud-security-posture-management Scenario: Patch a signal-based notification rule returns "Bad Request" response Given new "PatchSignalNotificationRule" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 3c60ae2cd5e..8c110cf9e5f 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 @@ -8748,6 +8748,12 @@ "type": "unsafe" } }, + "UpdateFindingsSeverity": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "ListAssetsSBOMs": { "tag": "Security Monitoring", "undo": { diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 33c1d061053..e054ee8b488 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -9513,6 +9513,27 @@ "scenario": "Unassign seats from users returns \"Unprocessable Entity\" response when user_uuids is empty", "version": "v2" }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-accepted-response.json", + "scenario": "Apply a severity override to security findings returns \"Accepted\" response", + "version": "v2" + }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-not-found-response.json", + "scenario": "Apply a severity override to security findings returns \"Not Found\" response", + "version": "v2" + }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-unprocessable-entity-response.json", + "scenario": "Apply a severity override to security findings returns \"Unprocessable Entity\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", @@ -9611,6 +9632,13 @@ "scenario": "Change the triage state of a security signal returns \"OK\" response", "version": "v2" }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/clear-the-severity-override-of-security-findings-returns-accepted-response.json", + "scenario": "Clear the severity override of security findings returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-accepted-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-accepted-response.json new file mode 100644 index 00000000000..15e7f6b6596 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-accepted-response.json @@ -0,0 +1,47 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 202, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Apply a severity override to security findings returns \"Accepted\" response", + "operation_id": "UpdateFindingsSeverity", + "request": { + "body": { + "schema": { + "format": null, + "ref": "SeverityOverrideRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set", + "description": "Database contains sensitive data.", + "value": "high" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [], + "path": "/api/v2/security/findings/severity" + }, + "scenario": "Apply a severity override to security findings returns \"Accepted\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-not-found-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-not-found-response.json new file mode 100644 index 00000000000..006a1972a7e --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-not-found-response.json @@ -0,0 +1,46 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 404, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Apply a severity override to security findings returns \"Not Found\" response", + "operation_id": "UpdateFindingsSeverity", + "request": { + "body": { + "schema": { + "format": null, + "ref": "SeverityOverrideRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set", + "value": "high" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [], + "path": "/api/v2/security/findings/severity" + }, + "scenario": "Apply a severity override to security findings returns \"Not Found\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-unprocessable-entity-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-unprocessable-entity-response.json new file mode 100644 index 00000000000..4a7f61feb91 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/apply-a-severity-override-to-security-findings-returns-unprocessable-entity-response.json @@ -0,0 +1,45 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 422, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Apply a severity override to security findings returns \"Unprocessable Entity\" response", + "operation_id": "UpdateFindingsSeverity", + "request": { + "body": { + "schema": { + "format": null, + "ref": "SeverityOverrideRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [], + "path": "/api/v2/security/findings/severity" + }, + "scenario": "Apply a severity override to security findings returns \"Unprocessable Entity\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/clear-the-severity-override-of-security-findings-returns-accepted-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/clear-the-severity-override-of-security-findings-returns-accepted-response.json new file mode 100644 index 00000000000..3eee9e30546 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/clear-the-severity-override-of-security-findings-returns-accepted-response.json @@ -0,0 +1,45 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 202, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Clear the severity override of security findings returns \"Accepted\" response", + "operation_id": "UpdateFindingsSeverity", + "request": { + "body": { + "schema": { + "format": null, + "ref": "SeverityOverrideRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "severity": { + "action": "clear" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [], + "path": "/api/v2/security/findings/severity" + }, + "scenario": "Clear the severity override of security findings returns \"Accepted\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json b/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json index 4aaa1af1cf5..43e65f4bef5 100644 --- a/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json +++ b/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json @@ -1,6 +1,159 @@ { "feature": "Security Monitoring", "recordings": [ + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-08T12:23:32.869Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set", + "description": "Database contains sensitive data.", + "value": "high" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/security/findings/severity", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"ac66db29-c96f-45f2-bd4b-69f753400a9d\",\"type\":\"severity_override\"}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + } + ], + "scenario": "Apply a severity override to security findings returns \"Accepted\" response", + "version": "v2" + }, + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-08T12:23:35.263Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set", + "value": "high" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/security/findings/severity", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"finding not found\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Not Found", + "status": 404 + } + } + ], + "scenario": "Apply a severity override to security findings returns \"Not Found\" response", + "version": "v2" + }, + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-08T12:23:35.347Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "severity": { + "action": "set" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/security/findings/severity", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid severity value \\\"\\\" for action \\\"set\\\": must be one of info, low, medium, high, critical\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Unprocessable Entity", + "status": 422 + } + } + ], + "scenario": "Apply a severity override to security findings returns \"Unprocessable Entity\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "frozen_at": "2025-11-20T15:49:48.969Z", @@ -739,6 +892,56 @@ "scenario": "Change the triage state of a security signal returns \"OK\" response", "version": "v2" }, + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-08T12:23:35.440Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "severity": { + "action": "clear" + } + }, + "relationships": { + "findings": { + "data": [ + { + "id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + "type": "findings" + } + ] + } + }, + "type": "severity_override" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/security/findings/severity", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a1cea0d7-e53b-4e44-a914-c90343617a70\",\"type\":\"severity_override\"}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + } + ], + "scenario": "Clear the severity override of security findings returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "frozen_at": "2026-05-26T20:46:00.730Z",