diff --git a/.apigentools-info b/.apigentools-info index 5b1753d7633..c627fbbc09c 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-05 14:46:44.023128", - "spec_repo_commit": "060dc917" + "regenerated": "2023-06-05 15:09:03.292240", + "spec_repo_commit": "2638a894" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-05 14:46:44.038351", - "spec_repo_commit": "060dc917" + "regenerated": "2023-06-05 15:09:03.311292", + "spec_repo_commit": "2638a894" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 30105fc7788..ca4e366cbb7 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3674,7 +3674,7 @@ components: type: array type: object Finding: - description: A single finding without message and resource configuration. + description: A single finding without the message and resource configuration. properties: attributes: $ref: '#/components/schemas/FindingAttributes' @@ -3732,16 +3732,16 @@ components: properties: description: description: Additional information about the reason why this finding is - muted. + muted or unmuted. example: To be resolved later type: string expiration_date: - description: The end of the mute period. + description: The expiration date of the mute or unmute action (Unix ms). example: 1778721573794 format: int64 type: integer muted: - description: Whether this finding is muted. + description: Whether this finding is muted or unmuted. example: true type: boolean reason: @@ -3752,23 +3752,29 @@ components: format: int64 type: integer uuid: - description: The ID of the user who muted this finding. + description: The ID of the user who muted or unmuted this finding. example: e51c9744-d158-11ec-ad23-da7ad0900002 type: string type: object FindingMuteReason: - description: The reason why this finding is muted. + description: The reason why this finding is muted or unmuted. enum: - - ACCEPTED_RISK - PENDING_FIX - FALSE_POSITIVE + - ACCEPTED_RISK + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK - OTHER example: ACCEPTED_RISK type: string x-enum-varnames: - - ACCEPTED_RISK - PENDING_FIX - FALSE_POSITIVE + - ACCEPTED_RISK + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK - OTHER FindingResource: description: The resource name of this finding. @@ -3831,6 +3837,34 @@ components: type: string x-enum-varnames: - FINDING + FindingsErrorItem: + description: API error response body + properties: + detail: + description: A human-readable explanation specific to this occurrence of + the error. + example: attribute "muted" is required + type: string + status: + description: Status code of the response. + example: '400' + type: string + title: + description: Short human-readable summary of the error. + example: Bad Request + type: string + type: object + FindingsErrorResponse: + description: API error response. + properties: + errors: + description: A list of errors. + items: + $ref: '#/components/schemas/FindingsErrorItem' + type: array + required: + - errors + type: object FormulaLimit: description: Message for specifying limits to the number of values returned by a query. @@ -8471,6 +8505,139 @@ components: description: The monitor type. type: string type: object + MuteFindingRequest: + description: The new mute finding request. + properties: + data: + $ref: '#/components/schemas/MuteFindingRequestData' + required: + - data + type: object + MuteFindingRequestAttributes: + additionalProperties: false + description: The mute properties to be updated. + properties: + mute: + $ref: '#/components/schemas/MuteFindingRequestProperties' + required: + - mute + type: object + MuteFindingRequestData: + description: Data object containing the new mute properties of the finding. + properties: + attributes: + $ref: '#/components/schemas/MuteFindingRequestAttributes' + id: + $ref: '#/components/schemas/FindingID' + type: + $ref: '#/components/schemas/FindingType' + required: + - id + - type + - attributes + type: object + MuteFindingRequestProperties: + additionalProperties: false + description: Object containing the new mute properties of the finding. + properties: + description: + description: Additional information about the reason why this finding is + muted or unmuted. This field has a maximum limit of 280 characters. + example: To be resolved later + type: string + expiration_date: + description: 'The expiration date of the mute or unmute action (Unix ms). + It must be set to a value greater than the current timestamp. + + If this field is not provided, the finding will be muted or unmuted indefinitely, + which is equivalent to setting the expiration date to 9999999999999. + + ' + example: 1778721573794 + format: int64 + type: integer + muted: + description: Whether this finding is muted or unmuted. + example: true + type: boolean + reason: + $ref: '#/components/schemas/FindingMuteReason' + required: + - muted + - reason + type: object + MuteFindingResponse: + description: The expected response schema. + properties: + data: + $ref: '#/components/schemas/MuteFindingResponseData' + required: + - data + type: object + MuteFindingResponseAttributes: + description: The JSON:API attributes of the finding. + properties: + evaluation: + $ref: '#/components/schemas/FindingEvaluation' + evaluation_changed_at: + $ref: '#/components/schemas/FindingEvaluationChangedAt' + mute: + $ref: '#/components/schemas/MuteFindingResponseProperties' + resource: + $ref: '#/components/schemas/FindingResource' + resource_discovery_date: + $ref: '#/components/schemas/FindingResourceDiscoveryDate' + resource_type: + $ref: '#/components/schemas/FindingResourceType' + rule: + $ref: '#/components/schemas/FindingRule' + status: + $ref: '#/components/schemas/FindingStatus' + tags: + $ref: '#/components/schemas/FindingTags' + type: object + MuteFindingResponseData: + description: Data object containing the updated finding. + properties: + attributes: + $ref: '#/components/schemas/MuteFindingResponseAttributes' + id: + $ref: '#/components/schemas/FindingID' + type: + $ref: '#/components/schemas/FindingType' + type: object + MuteFindingResponseProperties: + additionalProperties: false + description: Information about the mute status of this finding. + properties: + description: + description: 'Additional information about the reason why this finding is + muted or unmuted. + + This attribute will not be included in the response if the description + is not provided in the request body. + + ' + example: To be resolved later + type: string + expiration_date: + description: 'The expiration date of the mute or unmute action. + + If the expiration date is not provided in the request body, this attribute + will not be included in the response and the finding will be muted or + unmuted indefinitely. + + ' + example: 1778721573794 + format: int64 + type: integer + muted: + description: Whether this finding is muted or unmuted. + example: true + type: boolean + reason: + $ref: '#/components/schemas/FindingMuteReason' + type: object NullableRelationshipToUser: description: Relationship to user. properties: @@ -19954,6 +20121,87 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: 'Mute or unmute a specific finding. + + The API returns the updated finding object when the request is successful.' + operationId: UpdateFinding + parameters: + - description: The ID of the finding. + in: path + name: finding_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MuteFindingRequest' + description: 'To mute or unmute a finding, the request body should include + at least two attributes: `muted` and `reason`. The allowed reasons depend + on whether the finding is being muted or unmuted: + + - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `ACCEPTED_RISK`, `OTHER`. + + - To unmute a finding : `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, + `OTHER`. + + ' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MuteFindingResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingsErrorResponse' + description: 'Bad Request: The server cannot process the request due to + invalid syntax in the request.' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingsErrorResponse' + description: 'Not Found: The requested finding cannot be found.' + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingsErrorResponse' + description: 'Resource Conflict: The finding has already been muted or unmuted + within the last 60 seconds.' + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingsErrorResponse' + description: 'Invalid Request: The server understands the request syntax + but cannot process it due to invalid data.' + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingsErrorResponse' + description: 'Too many requests: The rate limit set by the API has been + exceeded.' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_findings_write + summary: Mute or unmute a finding + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/processes: get: description: Get all processes for your organization. diff --git a/examples/v2/security-monitoring/UpdateFinding.java b/examples/v2/security-monitoring/UpdateFinding.java new file mode 100644 index 00000000000..b03ba6c7c22 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateFinding.java @@ -0,0 +1,48 @@ +// Mute or unmute a finding returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.FindingMuteReason; +import com.datadog.api.client.v2.model.FindingType; +import com.datadog.api.client.v2.model.MuteFindingRequest; +import com.datadog.api.client.v2.model.MuteFindingRequestAttributes; +import com.datadog.api.client.v2.model.MuteFindingRequestData; +import com.datadog.api.client.v2.model.MuteFindingRequestProperties; +import com.datadog.api.client.v2.model.MuteFindingResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateFinding", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + MuteFindingRequest body = + new MuteFindingRequest() + .data( + new MuteFindingRequestData() + .attributes( + new MuteFindingRequestAttributes() + .mute( + new MuteFindingRequestProperties() + .description("To be resolved later") + .expirationDate(1778721573794L) + .muted(true) + .reason(FindingMuteReason.ACCEPTED_RISK))) + .id("AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE") + .type(FindingType.FINDING)); + + try { + MuteFindingResponse result = + apiInstance.updateFinding( + "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#updateFinding"); + 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 3af4db6d1d6..3280de58857 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -457,6 +457,7 @@ public class ApiClient { put("v2.queryTimeseriesData", false); put("v2.getFinding", false); put("v2.listFindings", false); + put("v2.updateFinding", false); put("v2.createIncidentService", false); put("v2.deleteIncidentService", false); put("v2.getIncidentService", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 5ef2756d44d..c6b4d711110 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 @@ -10,6 +10,8 @@ import com.datadog.api.client.v2.model.FindingStatus; import com.datadog.api.client.v2.model.GetFindingResponse; import com.datadog.api.client.v2.model.ListFindingsResponse; +import com.datadog.api.client.v2.model.MuteFindingRequest; +import com.datadog.api.client.v2.model.MuteFindingResponse; import com.datadog.api.client.v2.model.SecurityFilterCreateRequest; import com.datadog.api.client.v2.model.SecurityFilterResponse; import com.datadog.api.client.v2.model.SecurityFilterUpdateRequest; @@ -3094,6 +3096,202 @@ public PaginationIterable searchSecurityMonitoringSign new GenericType() {}); } + /** + * Mute or unmute a finding. + * + *

See {@link #updateFindingWithHttpInfo}. + * + * @param findingId The ID of the finding. (required) + * @param body To mute or unmute a finding, the request body should include at least two + * attributes: muted and reason. The allowed reasons depend on + * whether the finding is being muted or unmuted: - To mute a finding: PENDING_FIX + * , FALSE_POSITIVE, ACCEPTED_RISK, OTHER. - To + * unmute a finding : NO_PENDING_FIX, HUMAN_ERROR, + * NO_LONGER_ACCEPTED_RISK, OTHER. (required) + * @return MuteFindingResponse + * @throws ApiException if fails to make API call + */ + public MuteFindingResponse updateFinding(String findingId, MuteFindingRequest body) + throws ApiException { + return updateFindingWithHttpInfo(findingId, body).getData(); + } + + /** + * Mute or unmute a finding. + * + *

See {@link #updateFindingWithHttpInfoAsync}. + * + * @param findingId The ID of the finding. (required) + * @param body To mute or unmute a finding, the request body should include at least two + * attributes: muted and reason. The allowed reasons depend on + * whether the finding is being muted or unmuted: - To mute a finding: PENDING_FIX + * , FALSE_POSITIVE, ACCEPTED_RISK, OTHER. - To + * unmute a finding : NO_PENDING_FIX, HUMAN_ERROR, + * NO_LONGER_ACCEPTED_RISK, OTHER. (required) + * @return CompletableFuture<MuteFindingResponse> + */ + public CompletableFuture updateFindingAsync( + String findingId, MuteFindingRequest body) { + return updateFindingWithHttpInfoAsync(findingId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Mute or unmute a specific finding. The API returns the updated finding object when the request + * is successful. + * + * @param findingId The ID of the finding. (required) + * @param body To mute or unmute a finding, the request body should include at least two + * attributes: muted and reason. The allowed reasons depend on + * whether the finding is being muted or unmuted: - To mute a finding: PENDING_FIX + * , FALSE_POSITIVE, ACCEPTED_RISK, OTHER. - To + * unmute a finding : NO_PENDING_FIX, HUMAN_ERROR, + * NO_LONGER_ACCEPTED_RISK, OTHER. (required) + * @return ApiResponse<MuteFindingResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request: The server cannot process the request due to invalid syntax in the request. -
404 Not Found: The requested finding cannot be found. -
409 Resource Conflict: The finding has already been muted or unmuted within the last 60 seconds. -
422 Invalid Request: The server understands the request syntax but cannot process it due to invalid data. -
429 Too many requests: The rate limit set by the API has been exceeded. -
+ */ + public ApiResponse updateFindingWithHttpInfo( + String findingId, MuteFindingRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateFinding"; + 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 'findingId' is set + if (findingId == null) { + throw new ApiException( + 400, "Missing the required parameter 'findingId' when calling updateFinding"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateFinding"); + } + // create path and map variables + String localVarPath = + "/api/v2/posture_management/findings/{finding_id}" + .replaceAll("\\{" + "finding_id" + "\\}", apiClient.escapeString(findingId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.updateFinding", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Mute or unmute a finding. + * + *

See {@link #updateFindingWithHttpInfo}. + * + * @param findingId The ID of the finding. (required) + * @param body To mute or unmute a finding, the request body should include at least two + * attributes: muted and reason. The allowed reasons depend on + * whether the finding is being muted or unmuted: - To mute a finding: PENDING_FIX + * , FALSE_POSITIVE, ACCEPTED_RISK, OTHER. - To + * unmute a finding : NO_PENDING_FIX, HUMAN_ERROR, + * NO_LONGER_ACCEPTED_RISK, OTHER. (required) + * @return CompletableFuture<ApiResponse<MuteFindingResponse>> + */ + public CompletableFuture> updateFindingWithHttpInfoAsync( + String findingId, MuteFindingRequest body) { + // Check if unstable operation is enabled + String operationId = "updateFinding"; + 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 'findingId' is set + if (findingId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'findingId' when calling updateFinding")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateFinding")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/posture_management/findings/{finding_id}" + .replaceAll("\\{" + "finding_id" + "\\}", apiClient.escapeString(findingId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.updateFinding", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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 a security filter. * diff --git a/src/main/java/com/datadog/api/client/v2/model/Finding.java b/src/main/java/com/datadog/api/client/v2/model/Finding.java index e4900213377..8bd28fd76d6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/Finding.java +++ b/src/main/java/com/datadog/api/client/v2/model/Finding.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.Objects; -/** A single finding without message and resource configuration. */ +/** A single finding without the message and resource configuration. */ @JsonPropertyOrder({ Finding.JSON_PROPERTY_ATTRIBUTES, Finding.JSON_PROPERTY_ID, diff --git a/src/main/java/com/datadog/api/client/v2/model/FindingMute.java b/src/main/java/com/datadog/api/client/v2/model/FindingMute.java index 04685785c22..7342289febe 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FindingMute.java +++ b/src/main/java/com/datadog/api/client/v2/model/FindingMute.java @@ -49,7 +49,7 @@ public FindingMute description(String description) { } /** - * Additional information about the reason why this finding is muted. + * Additional information about the reason why this finding is muted or unmuted. * * @return description */ @@ -70,7 +70,7 @@ public FindingMute expirationDate(Long expirationDate) { } /** - * The end of the mute period. + * The expiration date of the mute or unmute action (Unix ms). * * @return expirationDate */ @@ -91,7 +91,7 @@ public FindingMute muted(Boolean muted) { } /** - * Whether this finding is muted. + * Whether this finding is muted or unmuted. * * @return muted */ @@ -113,7 +113,7 @@ public FindingMute reason(FindingMuteReason reason) { } /** - * The reason why this finding is muted. + * The reason why this finding is muted or unmuted. * * @return reason */ @@ -158,7 +158,7 @@ public FindingMute uuid(String uuid) { } /** - * The ID of the user who muted this finding. + * The ID of the user who muted or unmuted this finding. * * @return uuid */ diff --git a/src/main/java/com/datadog/api/client/v2/model/FindingMuteReason.java b/src/main/java/com/datadog/api/client/v2/model/FindingMuteReason.java index f5300508368..d028dcc55b4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FindingMuteReason.java +++ b/src/main/java/com/datadog/api/client/v2/model/FindingMuteReason.java @@ -19,17 +19,29 @@ import java.util.Objects; import java.util.Set; -/** The reason why this finding is muted. */ +/** The reason why this finding is muted or unmuted. */ @JsonSerialize(using = FindingMuteReason.FindingMuteReasonSerializer.class) public class FindingMuteReason { - public static final FindingMuteReason ACCEPTED_RISK = new FindingMuteReason("ACCEPTED_RISK"); public static final FindingMuteReason PENDING_FIX = new FindingMuteReason("PENDING_FIX"); public static final FindingMuteReason FALSE_POSITIVE = new FindingMuteReason("FALSE_POSITIVE"); + public static final FindingMuteReason ACCEPTED_RISK = new FindingMuteReason("ACCEPTED_RISK"); + public static final FindingMuteReason NO_PENDING_FIX = new FindingMuteReason("NO_PENDING_FIX"); + public static final FindingMuteReason HUMAN_ERROR = new FindingMuteReason("HUMAN_ERROR"); + public static final FindingMuteReason NO_LONGER_ACCEPTED_RISK = + new FindingMuteReason("NO_LONGER_ACCEPTED_RISK"); public static final FindingMuteReason OTHER = new FindingMuteReason("OTHER"); private static final Set allowedValues = - new HashSet(Arrays.asList("ACCEPTED_RISK", "PENDING_FIX", "FALSE_POSITIVE", "OTHER")); + new HashSet( + Arrays.asList( + "PENDING_FIX", + "FALSE_POSITIVE", + "ACCEPTED_RISK", + "NO_PENDING_FIX", + "HUMAN_ERROR", + "NO_LONGER_ACCEPTED_RISK", + "OTHER")); private String value; diff --git a/src/main/java/com/datadog/api/client/v2/model/FindingsErrorItem.java b/src/main/java/com/datadog/api/client/v2/model/FindingsErrorItem.java new file mode 100644 index 00000000000..9cac7b62d7a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FindingsErrorItem.java @@ -0,0 +1,137 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** API error response body */ +@JsonPropertyOrder({ + FindingsErrorItem.JSON_PROPERTY_DETAIL, + FindingsErrorItem.JSON_PROPERTY_STATUS, + FindingsErrorItem.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FindingsErrorItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public FindingsErrorItem detail(String detail) { + this.detail = detail; + return this; + } + + /** + * A human-readable explanation specific to this occurrence of the error. + * + * @return detail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public FindingsErrorItem status(String status) { + this.status = status; + return this; + } + + /** + * Status code of the response. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public FindingsErrorItem title(String title) { + this.title = title; + return this; + } + + /** + * Short human-readable summary of the error. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** Return true if this FindingsErrorItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FindingsErrorItem findingsErrorItem = (FindingsErrorItem) o; + return Objects.equals(this.detail, findingsErrorItem.detail) + && Objects.equals(this.status, findingsErrorItem.status) + && Objects.equals(this.title, findingsErrorItem.title); + } + + @Override + public int hashCode() { + return Objects.hash(detail, status, title); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FindingsErrorItem {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).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/FindingsErrorResponse.java b/src/main/java/com/datadog/api/client/v2/model/FindingsErrorResponse.java new file mode 100644 index 00000000000..5ef7868dd77 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FindingsErrorResponse.java @@ -0,0 +1,100 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** API error response. */ +@JsonPropertyOrder({FindingsErrorResponse.JSON_PROPERTY_ERRORS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FindingsErrorResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = new ArrayList<>(); + + public FindingsErrorResponse() {} + + @JsonCreator + public FindingsErrorResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ERRORS) List errors) { + this.errors = errors; + } + + public FindingsErrorResponse errors(List errors) { + this.errors = errors; + for (FindingsErrorItem item : errors) { + this.unparsed |= item.unparsed; + } + return this; + } + + public FindingsErrorResponse addErrorsItem(FindingsErrorItem errorsItem) { + this.errors.add(errorsItem); + this.unparsed |= errorsItem.unparsed; + return this; + } + + /** + * A list of errors. + * + * @return errors + */ + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + /** Return true if this FindingsErrorResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FindingsErrorResponse findingsErrorResponse = (FindingsErrorResponse) o; + return Objects.equals(this.errors, findingsErrorResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FindingsErrorResponse {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).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/MuteFindingRequest.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequest.java new file mode 100644 index 00000000000..d3c19a75ad8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequest.java @@ -0,0 +1,91 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** The new mute finding request. */ +@JsonPropertyOrder({MuteFindingRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MuteFindingRequestData data; + + public MuteFindingRequest() {} + + @JsonCreator + public MuteFindingRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) MuteFindingRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public MuteFindingRequest data(MuteFindingRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object containing the new mute properties of the finding. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MuteFindingRequestData getData() { + return data; + } + + public void setData(MuteFindingRequestData data) { + this.data = data; + } + + /** Return true if this MuteFindingRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingRequest muteFindingRequest = (MuteFindingRequest) o; + return Objects.equals(this.data, muteFindingRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/MuteFindingRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestAttributes.java new file mode 100644 index 00000000000..4d1ef2d8ab0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestAttributes.java @@ -0,0 +1,92 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** The mute properties to be updated. */ +@JsonPropertyOrder({MuteFindingRequestAttributes.JSON_PROPERTY_MUTE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MUTE = "mute"; + private MuteFindingRequestProperties mute = new MuteFindingRequestProperties(); + + public MuteFindingRequestAttributes() {} + + @JsonCreator + public MuteFindingRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_MUTE) + MuteFindingRequestProperties mute) { + this.mute = mute; + this.unparsed |= mute.unparsed; + } + + public MuteFindingRequestAttributes mute(MuteFindingRequestProperties mute) { + this.mute = mute; + this.unparsed |= mute.unparsed; + return this; + } + + /** + * Object containing the new mute properties of the finding. + * + * @return mute + */ + @JsonProperty(JSON_PROPERTY_MUTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MuteFindingRequestProperties getMute() { + return mute; + } + + public void setMute(MuteFindingRequestProperties mute) { + this.mute = mute; + } + + /** Return true if this MuteFindingRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingRequestAttributes muteFindingRequestAttributes = (MuteFindingRequestAttributes) o; + return Objects.equals(this.mute, muteFindingRequestAttributes.mute); + } + + @Override + public int hashCode() { + return Objects.hash(mute); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingRequestAttributes {\n"); + sb.append(" mute: ").append(toIndentedString(mute)).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/MuteFindingRequestData.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestData.java new file mode 100644 index 00000000000..5643d8d06f2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestData.java @@ -0,0 +1,155 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Data object containing the new mute properties of the finding. */ +@JsonPropertyOrder({ + MuteFindingRequestData.JSON_PROPERTY_ATTRIBUTES, + MuteFindingRequestData.JSON_PROPERTY_ID, + MuteFindingRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MuteFindingRequestAttributes attributes = new MuteFindingRequestAttributes(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FindingType type = FindingType.FINDING; + + public MuteFindingRequestData() {} + + @JsonCreator + public MuteFindingRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + MuteFindingRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FindingType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public MuteFindingRequestData attributes(MuteFindingRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The mute properties to be updated. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MuteFindingRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MuteFindingRequestAttributes attributes) { + this.attributes = attributes; + } + + public MuteFindingRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The unique ID for this finding. + * + * @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 MuteFindingRequestData type(FindingType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for findings. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FindingType getType() { + return type; + } + + public void setType(FindingType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this MuteFindingRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingRequestData muteFindingRequestData = (MuteFindingRequestData) o; + return Objects.equals(this.attributes, muteFindingRequestData.attributes) + && Objects.equals(this.id, muteFindingRequestData.id) + && Objects.equals(this.type, muteFindingRequestData.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + 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/MuteFindingRequestProperties.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestProperties.java new file mode 100644 index 00000000000..25728627523 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingRequestProperties.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.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Object containing the new mute properties of the finding. */ +@JsonPropertyOrder({ + MuteFindingRequestProperties.JSON_PROPERTY_DESCRIPTION, + MuteFindingRequestProperties.JSON_PROPERTY_EXPIRATION_DATE, + MuteFindingRequestProperties.JSON_PROPERTY_MUTED, + MuteFindingRequestProperties.JSON_PROPERTY_REASON +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingRequestProperties { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_EXPIRATION_DATE = "expiration_date"; + private Long expirationDate; + + public static final String JSON_PROPERTY_MUTED = "muted"; + private Boolean muted; + + public static final String JSON_PROPERTY_REASON = "reason"; + private FindingMuteReason reason; + + public MuteFindingRequestProperties() {} + + @JsonCreator + public MuteFindingRequestProperties( + @JsonProperty(required = true, value = JSON_PROPERTY_MUTED) Boolean muted, + @JsonProperty(required = true, value = JSON_PROPERTY_REASON) FindingMuteReason reason) { + this.muted = muted; + this.reason = reason; + this.unparsed |= !reason.isValid(); + } + + public MuteFindingRequestProperties description(String description) { + this.description = description; + return this; + } + + /** + * Additional information about the reason why this finding is muted or unmuted. This field has a + * maximum 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 MuteFindingRequestProperties expirationDate(Long expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * The expiration date of the mute or unmute action (Unix ms). It must be set to a value greater + * than the current timestamp. If this field is not provided, the finding will be muted or unmuted + * indefinitely, which is equivalent to setting the expiration date to 9999999999999. + * + * @return expirationDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPIRATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getExpirationDate() { + return expirationDate; + } + + public void setExpirationDate(Long expirationDate) { + this.expirationDate = expirationDate; + } + + public MuteFindingRequestProperties muted(Boolean muted) { + this.muted = muted; + return this; + } + + /** + * Whether this finding is muted or unmuted. + * + * @return muted + */ + @JsonProperty(JSON_PROPERTY_MUTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getMuted() { + return muted; + } + + public void setMuted(Boolean muted) { + this.muted = muted; + } + + public MuteFindingRequestProperties reason(FindingMuteReason reason) { + this.reason = reason; + this.unparsed |= !reason.isValid(); + return this; + } + + /** + * The reason why this finding is muted or unmuted. + * + * @return reason + */ + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FindingMuteReason getReason() { + return reason; + } + + public void setReason(FindingMuteReason reason) { + if (!reason.isValid()) { + this.unparsed = true; + } + this.reason = reason; + } + + /** Return true if this MuteFindingRequestProperties object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingRequestProperties muteFindingRequestProperties = (MuteFindingRequestProperties) o; + return Objects.equals(this.description, muteFindingRequestProperties.description) + && Objects.equals(this.expirationDate, muteFindingRequestProperties.expirationDate) + && Objects.equals(this.muted, muteFindingRequestProperties.muted) + && Objects.equals(this.reason, muteFindingRequestProperties.reason); + } + + @Override + public int hashCode() { + return Objects.hash(description, expirationDate, muted, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingRequestProperties {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" muted: ").append(toIndentedString(muted)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).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/MuteFindingResponse.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponse.java new file mode 100644 index 00000000000..eef9d06bf28 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponse.java @@ -0,0 +1,91 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** The expected response schema. */ +@JsonPropertyOrder({MuteFindingResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MuteFindingResponseData data; + + public MuteFindingResponse() {} + + @JsonCreator + public MuteFindingResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) MuteFindingResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public MuteFindingResponse data(MuteFindingResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object containing the updated finding. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MuteFindingResponseData getData() { + return data; + } + + public void setData(MuteFindingResponseData data) { + this.data = data; + } + + /** Return true if this MuteFindingResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingResponse muteFindingResponse = (MuteFindingResponse) o; + return Objects.equals(this.data, muteFindingResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/MuteFindingResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseAttributes.java new file mode 100644 index 00000000000..6ad296fda9a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseAttributes.java @@ -0,0 +1,334 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** The JSON:API attributes of the finding. */ +@JsonPropertyOrder({ + MuteFindingResponseAttributes.JSON_PROPERTY_EVALUATION, + MuteFindingResponseAttributes.JSON_PROPERTY_EVALUATION_CHANGED_AT, + MuteFindingResponseAttributes.JSON_PROPERTY_MUTE, + MuteFindingResponseAttributes.JSON_PROPERTY_RESOURCE, + MuteFindingResponseAttributes.JSON_PROPERTY_RESOURCE_DISCOVERY_DATE, + MuteFindingResponseAttributes.JSON_PROPERTY_RESOURCE_TYPE, + MuteFindingResponseAttributes.JSON_PROPERTY_RULE, + MuteFindingResponseAttributes.JSON_PROPERTY_STATUS, + MuteFindingResponseAttributes.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVALUATION = "evaluation"; + private FindingEvaluation evaluation; + + public static final String JSON_PROPERTY_EVALUATION_CHANGED_AT = "evaluation_changed_at"; + private Long evaluationChangedAt; + + public static final String JSON_PROPERTY_MUTE = "mute"; + private MuteFindingResponseProperties mute = null; + + public static final String JSON_PROPERTY_RESOURCE = "resource"; + private String resource; + + public static final String JSON_PROPERTY_RESOURCE_DISCOVERY_DATE = "resource_discovery_date"; + private Long resourceDiscoveryDate; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; + private String resourceType; + + public static final String JSON_PROPERTY_RULE = "rule"; + private FindingRule rule = null; + + public static final String JSON_PROPERTY_STATUS = "status"; + private FindingStatus status; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public MuteFindingResponseAttributes evaluation(FindingEvaluation evaluation) { + this.evaluation = evaluation; + this.unparsed |= !evaluation.isValid(); + return this; + } + + /** + * The evaluation of the finding. + * + * @return evaluation + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FindingEvaluation getEvaluation() { + return evaluation; + } + + public void setEvaluation(FindingEvaluation evaluation) { + if (!evaluation.isValid()) { + this.unparsed = true; + } + this.evaluation = evaluation; + } + + public MuteFindingResponseAttributes evaluationChangedAt(Long evaluationChangedAt) { + this.evaluationChangedAt = evaluationChangedAt; + return this; + } + + /** + * The date on which the evaluation for this finding changed (Unix ms). minimum: 1 + * + * @return evaluationChangedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVALUATION_CHANGED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEvaluationChangedAt() { + return evaluationChangedAt; + } + + public void setEvaluationChangedAt(Long evaluationChangedAt) { + this.evaluationChangedAt = evaluationChangedAt; + } + + public MuteFindingResponseAttributes mute(MuteFindingResponseProperties mute) { + this.mute = mute; + this.unparsed |= mute.unparsed; + return this; + } + + /** + * Information about the mute status of this finding. + * + * @return mute + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MUTE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MuteFindingResponseProperties getMute() { + return mute; + } + + public void setMute(MuteFindingResponseProperties mute) { + this.mute = mute; + } + + public MuteFindingResponseAttributes resource(String resource) { + this.resource = resource; + return this; + } + + /** + * The resource name of this finding. + * + * @return resource + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public MuteFindingResponseAttributes resourceDiscoveryDate(Long resourceDiscoveryDate) { + this.resourceDiscoveryDate = resourceDiscoveryDate; + return this; + } + + /** + * The date on which the resource was discovered (Unix ms). minimum: 1 + * + * @return resourceDiscoveryDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_DISCOVERY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getResourceDiscoveryDate() { + return resourceDiscoveryDate; + } + + public void setResourceDiscoveryDate(Long resourceDiscoveryDate) { + this.resourceDiscoveryDate = resourceDiscoveryDate; + } + + public MuteFindingResponseAttributes resourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * The resource type of this finding. + * + * @return resourceType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public MuteFindingResponseAttributes rule(FindingRule rule) { + this.rule = rule; + this.unparsed |= rule.unparsed; + return this; + } + + /** + * The rule that triggered this finding. + * + * @return rule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FindingRule getRule() { + return rule; + } + + public void setRule(FindingRule rule) { + this.rule = rule; + } + + public MuteFindingResponseAttributes status(FindingStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The status of the finding. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FindingStatus getStatus() { + return status; + } + + public void setStatus(FindingStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public MuteFindingResponseAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public MuteFindingResponseAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The tags associated with this finding. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + /** Return true if this MuteFindingResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingResponseAttributes muteFindingResponseAttributes = (MuteFindingResponseAttributes) o; + return Objects.equals(this.evaluation, muteFindingResponseAttributes.evaluation) + && Objects.equals( + this.evaluationChangedAt, muteFindingResponseAttributes.evaluationChangedAt) + && Objects.equals(this.mute, muteFindingResponseAttributes.mute) + && Objects.equals(this.resource, muteFindingResponseAttributes.resource) + && Objects.equals( + this.resourceDiscoveryDate, muteFindingResponseAttributes.resourceDiscoveryDate) + && Objects.equals(this.resourceType, muteFindingResponseAttributes.resourceType) + && Objects.equals(this.rule, muteFindingResponseAttributes.rule) + && Objects.equals(this.status, muteFindingResponseAttributes.status) + && Objects.equals(this.tags, muteFindingResponseAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash( + evaluation, + evaluationChangedAt, + mute, + resource, + resourceDiscoveryDate, + resourceType, + rule, + status, + tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingResponseAttributes {\n"); + sb.append(" evaluation: ").append(toIndentedString(evaluation)).append("\n"); + sb.append(" evaluationChangedAt: ") + .append(toIndentedString(evaluationChangedAt)) + .append("\n"); + sb.append(" mute: ").append(toIndentedString(mute)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" resourceDiscoveryDate: ") + .append(toIndentedString(resourceDiscoveryDate)) + .append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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/MuteFindingResponseData.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseData.java new file mode 100644 index 00000000000..373057864a4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseData.java @@ -0,0 +1,142 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Data object containing the updated finding. */ +@JsonPropertyOrder({ + MuteFindingResponseData.JSON_PROPERTY_ATTRIBUTES, + MuteFindingResponseData.JSON_PROPERTY_ID, + MuteFindingResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MuteFindingResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FindingType type = FindingType.FINDING; + + public MuteFindingResponseData attributes(MuteFindingResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The JSON:API attributes of the finding. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MuteFindingResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MuteFindingResponseAttributes attributes) { + this.attributes = attributes; + } + + public MuteFindingResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique ID for this finding. + * + * @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 MuteFindingResponseData type(FindingType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for findings. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FindingType getType() { + return type; + } + + public void setType(FindingType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this MuteFindingResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingResponseData muteFindingResponseData = (MuteFindingResponseData) o; + return Objects.equals(this.attributes, muteFindingResponseData.attributes) + && Objects.equals(this.id, muteFindingResponseData.id) + && Objects.equals(this.type, muteFindingResponseData.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + 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/MuteFindingResponseProperties.java b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseProperties.java new file mode 100644 index 00000000000..5c80f5f6abc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MuteFindingResponseProperties.java @@ -0,0 +1,171 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Information about the mute status of this finding. */ +@JsonPropertyOrder({ + MuteFindingResponseProperties.JSON_PROPERTY_DESCRIPTION, + MuteFindingResponseProperties.JSON_PROPERTY_EXPIRATION_DATE, + MuteFindingResponseProperties.JSON_PROPERTY_MUTED, + MuteFindingResponseProperties.JSON_PROPERTY_REASON +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MuteFindingResponseProperties { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_EXPIRATION_DATE = "expiration_date"; + private Long expirationDate; + + public static final String JSON_PROPERTY_MUTED = "muted"; + private Boolean muted; + + public static final String JSON_PROPERTY_REASON = "reason"; + private FindingMuteReason reason; + + public MuteFindingResponseProperties description(String description) { + this.description = description; + return this; + } + + /** + * Additional information about the reason why this finding is muted or unmuted. This attribute + * will not be included in the response if the description is not provided in the request body. + * + * @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 MuteFindingResponseProperties expirationDate(Long expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * The expiration date of the mute or unmute action. If the expiration date is not provided in the + * request body, this attribute will not be included in the response and the finding will be muted + * or unmuted indefinitely. + * + * @return expirationDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPIRATION_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getExpirationDate() { + return expirationDate; + } + + public void setExpirationDate(Long expirationDate) { + this.expirationDate = expirationDate; + } + + public MuteFindingResponseProperties muted(Boolean muted) { + this.muted = muted; + return this; + } + + /** + * Whether this finding is muted or unmuted. + * + * @return muted + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getMuted() { + return muted; + } + + public void setMuted(Boolean muted) { + this.muted = muted; + } + + public MuteFindingResponseProperties reason(FindingMuteReason reason) { + this.reason = reason; + this.unparsed |= !reason.isValid(); + return this; + } + + /** + * The reason why this finding is muted or unmuted. + * + * @return reason + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FindingMuteReason getReason() { + return reason; + } + + public void setReason(FindingMuteReason reason) { + if (!reason.isValid()) { + this.unparsed = true; + } + this.reason = reason; + } + + /** Return true if this MuteFindingResponseProperties object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MuteFindingResponseProperties muteFindingResponseProperties = (MuteFindingResponseProperties) o; + return Objects.equals(this.description, muteFindingResponseProperties.description) + && Objects.equals(this.expirationDate, muteFindingResponseProperties.expirationDate) + && Objects.equals(this.muted, muteFindingResponseProperties.muted) + && Objects.equals(this.reason, muteFindingResponseProperties.reason); + } + + @Override + public int hashCode() { + return Objects.hash(description, expirationDate, muted, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MuteFindingResponseProperties {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" muted: ").append(toIndentedString(muted)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.freeze new file mode 100644 index 00000000000..0bbac631553 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-05-30T22:58:28.319Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.json new file mode 100644 index 00000000000..3c40b1e6d13 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Mute_or_unmute_a_finding_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"mute\":{\"description\":\"To be resolved later\",\"expiration_date\":1778721573794,\"muted\":true,\"reason\":\"ACCEPTED_RISK\"}},\"id\":\"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE\",\"type\":\"finding\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/posture_management/findings/AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE\",\"type\":\"finding\",\"attributes\":{\"evaluation\":\"pass\",\"evaluation_changed_at\":1681220975000,\"mute\":{\"description\":\"To be resolved later\",\"expiration_date\":1778721573794,\"muted\":true,\"reason\":\"ACCEPTED_RISK\"},\"resource\":\"dd-chaos-cloud-xuxu-eu-north-1\",\"resource_discovery_date\":1681220975000,\"resource_type\":\"aws_s3_bucket\",\"rule\":{\"name\":\"S3 bucket ACL does not grant full bucket control to everyone\",\"id\":\"gkb-eoz-lut\"},\"status\":\"critical\",\"tags\":[\"requirement:AWS\",\"scored:true\",\"aws_account:013910733512\",\"framework:gdpr\",\"control:164.308-a-3-i\",\"requirement:Compliance\",\"framework:iso-27001\",\"framework:hipaa\",\"requirement:Access-Control\",\"source:s3\",\"requirement:Information-Access-Management\",\"region:eu-north-1\",\"control:164.308-a-4-ii-B\",\"framework:pci\",\"control:164.308-a-4-ii-C\",\"control:25.2\",\"requirement:Workforce-Security\",\"control:1.1\",\"security:compliance\",\"requirement:Least-Privileged-Access\",\"cloud_provider:aws\",\"requirement:Data-Protection\",\"control:7.2.1\",\"control:7.2.2\",\"requirement:Security-of-Processing\",\"control:A.18.1.3\",\"framework:soc-2\",\"scope:s3\",\"control:A.9.2.3\",\"control:32.1a\",\"requirement:Logical-and-Physical-Access-Control\",\"control:CC6.3\",\"framework:security-labs\",\"control:CC6.1\"]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "11a9fbe6-b524-667a-9d6a-8816a1676a13" + } +] \ No newline at end of file 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 6c66b15860c..cdbcb18dffc 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 @@ -389,6 +389,52 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a finding returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response + Given operation "UpdateFinding" enabled + And new "UpdateFinding" request + And request contains "finding_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + When the request is sent + Then the response status is 400 Bad Request: The server cannot process the request due to invalid syntax in the request. + + @generated @skip @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a finding returns "Invalid Request: The server understands the request syntax but cannot process it due to invalid data." response + Given operation "UpdateFinding" enabled + And new "UpdateFinding" request + And request contains "finding_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + When the request is sent + Then the response status is 422 Invalid Request: The server understands the request syntax but cannot process it due to invalid data. + + @generated @skip @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a finding returns "Not Found: The requested finding cannot be found." response + Given operation "UpdateFinding" enabled + And new "UpdateFinding" request + And request contains "finding_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + When the request is sent + Then the response status is 404 Not Found: The requested finding cannot be found. + + @replay-only @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a finding returns "OK" response + Given operation "UpdateFinding" enabled + And new "UpdateFinding" request + And request contains "finding_id" parameter with value "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE" + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.mute.muted" is equal to true + + @generated @skip @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a finding returns "Resource Conflict: The finding has already been muted or unmuted within the last 60 seconds." response + Given operation "UpdateFinding" enabled + And new "UpdateFinding" request + And request contains "finding_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + When the request is sent + Then the response status is 409 Resource Conflict: The finding has already been muted or unmuted within the last 60 seconds. + @team:DataDog/k9-cloud-security-platform Scenario: Update a cloud configuration rule's details returns "OK" response Given new "UpdateSecurityMonitoringRule" 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 6a3bd0e0492..8958efda758 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 @@ -925,6 +925,12 @@ "type": "safe" } }, + "UpdateFinding": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListProcesses": { "tag": "Processes", "undo": {