diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496..526df34c713 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23526,6 +23526,30 @@ components: required: - data type: object + GetSuppressionVersionHistoryData: + description: Data for the suppression version history. + properties: + attributes: + $ref: '#/components/schemas/SuppressionVersionHistory' + id: + description: ID of the suppression. + type: string + type: + $ref: '#/components/schemas/GetSuppressionVersionHistoryDataType' + type: object + GetSuppressionVersionHistoryDataType: + description: Type of data. + enum: + - suppression_version_history + type: string + x-enum-varnames: + - SUPPRESSIONVERSIONHISTORY + GetSuppressionVersionHistoryResponse: + description: Response for getting the suppression version history. + properties: + data: + $ref: '#/components/schemas/GetSuppressionVersionHistoryData' + type: object GetTeamMembershipsSort: description: Specifies the order of returned team memberships enum: @@ -42745,38 +42769,13 @@ components: description: The `RuleVersionHistory` `data`. type: object type: object - RuleVersionUpdate: - description: A change in a rule version. - properties: - change: - description: The new value of the field. - example: cloud_provider:aws - type: string - field: - description: The field that was changed. - example: Tags - type: string - type: - $ref: '#/components/schemas/RuleVersionUpdateType' - type: object - RuleVersionUpdateType: - description: The type of change. - enum: - - create - - update - - delete - type: string - x-enum-varnames: - - CREATE - - UPDATE - - DELETE RuleVersions: description: A rule version with a list of updates. properties: changes: description: A list of changes. items: - $ref: '#/components/schemas/RuleVersionUpdate' + $ref: '#/components/schemas/VersionHistoryUpdate' type: array rule: $ref: '#/components/schemas/SecurityMonitoringRuleResponse' @@ -51322,6 +51321,32 @@ components: format: double type: number type: object + SuppressionVersionHistory: + description: Response object containing the version history of a suppression. + properties: + count: + description: The number of suppression versions. + format: int32 + maximum: 2147483647 + type: integer + data: + additionalProperties: + $ref: '#/components/schemas/SuppressionVersions' + description: A suppression version with a list of updates. + description: The version history of a suppression. + type: object + type: object + SuppressionVersions: + description: A suppression version with a list of updates. + properties: + changes: + description: A list of changes. + items: + $ref: '#/components/schemas/VersionHistoryUpdate' + type: array + suppression: + $ref: '#/components/schemas/SecurityMonitoringSuppressionAttributes' + type: object TableResultV2: description: A reference table resource containing its full configuration and state. @@ -55372,6 +55397,31 @@ components: example: 1 format: int64 type: integer + VersionHistoryUpdate: + description: A change in a rule version. + properties: + change: + description: The new value of the field. + example: cloud_provider:aws + type: string + field: + description: The field that was changed. + example: Tags + type: string + type: + $ref: '#/components/schemas/VersionHistoryUpdateType' + type: object + VersionHistoryUpdateType: + description: The type of change. + enum: + - create + - update + - delete + type: string + x-enum-varnames: + - CREATE + - UPDATE + - DELETE VirusTotalAPIKey: description: The definition of the `VirusTotalAPIKey` object. properties: @@ -79065,6 +79115,35 @@ paths: summary: Update a suppression rule tags: - Security Monitoring + /api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history: + get: + description: Get a suppression's version history. + operationId: GetSuppressionVersionHistory + parameters: + - $ref: '#/components/parameters/SecurityMonitoringSuppressionID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetSuppressionVersionHistoryResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_suppressions_read + summary: Get a suppression's version history + tags: + - Security Monitoring /api/v2/security_monitoring/rules: get: description: List rules. diff --git a/examples/v2/security-monitoring/GetSuppressionVersionHistory.java b/examples/v2/security-monitoring/GetSuppressionVersionHistory.java new file mode 100644 index 00000000000..0100cb85da9 --- /dev/null +++ b/examples/v2/security-monitoring/GetSuppressionVersionHistory.java @@ -0,0 +1,29 @@ +// Get a suppression's version history 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.GetSuppressionVersionHistoryResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + // there is a valid "suppression" in the system + String SUPPRESSION_DATA_ID = System.getenv("SUPPRESSION_DATA_ID"); + + try { + GetSuppressionVersionHistoryResponse result = + apiInstance.getSuppressionVersionHistory(SUPPRESSION_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#getSuppressionVersionHistory"); + 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/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index a6b569264c1..6c5fcc2fda7 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 @@ -25,6 +25,7 @@ import com.datadog.api.client.v2.model.GetResourceEvaluationFiltersResponse; import com.datadog.api.client.v2.model.GetRuleVersionHistoryResponse; import com.datadog.api.client.v2.model.GetSBOMResponse; +import com.datadog.api.client.v2.model.GetSuppressionVersionHistoryResponse; import com.datadog.api.client.v2.model.JobCreateResponse; import com.datadog.api.client.v2.model.ListAssetsSBOMsResponse; import com.datadog.api.client.v2.model.ListFindingsResponse; @@ -5849,6 +5850,233 @@ public SecurityMonitoringSuppressionsResponse getSuppressionsAffectingRule(Strin new GenericType() {}); } + /** Manage optional parameters to getSuppressionVersionHistory. */ + public static class GetSuppressionVersionHistoryOptionalParameters { + private Long pageSize; + private Long pageNumber; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return GetSuppressionVersionHistoryOptionalParameters + */ + public GetSuppressionVersionHistoryOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return GetSuppressionVersionHistoryOptionalParameters + */ + public GetSuppressionVersionHistoryOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + } + + /** + * Get a suppression's version history. + * + *

See {@link #getSuppressionVersionHistoryWithHttpInfo}. + * + * @param suppressionId The ID of the suppression rule (required) + * @return GetSuppressionVersionHistoryResponse + * @throws ApiException if fails to make API call + */ + public GetSuppressionVersionHistoryResponse getSuppressionVersionHistory(String suppressionId) + throws ApiException { + return getSuppressionVersionHistoryWithHttpInfo( + suppressionId, new GetSuppressionVersionHistoryOptionalParameters()) + .getData(); + } + + /** + * Get a suppression's version history. + * + *

See {@link #getSuppressionVersionHistoryWithHttpInfoAsync}. + * + * @param suppressionId The ID of the suppression rule (required) + * @return CompletableFuture<GetSuppressionVersionHistoryResponse> + */ + public CompletableFuture getSuppressionVersionHistoryAsync( + String suppressionId) { + return getSuppressionVersionHistoryWithHttpInfoAsync( + suppressionId, new GetSuppressionVersionHistoryOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a suppression's version history. + * + *

See {@link #getSuppressionVersionHistoryWithHttpInfo}. + * + * @param suppressionId The ID of the suppression rule (required) + * @param parameters Optional parameters for the request. + * @return GetSuppressionVersionHistoryResponse + * @throws ApiException if fails to make API call + */ + public GetSuppressionVersionHistoryResponse getSuppressionVersionHistory( + String suppressionId, GetSuppressionVersionHistoryOptionalParameters parameters) + throws ApiException { + return getSuppressionVersionHistoryWithHttpInfo(suppressionId, parameters).getData(); + } + + /** + * Get a suppression's version history. + * + *

See {@link #getSuppressionVersionHistoryWithHttpInfoAsync}. + * + * @param suppressionId The ID of the suppression rule (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<GetSuppressionVersionHistoryResponse> + */ + public CompletableFuture getSuppressionVersionHistoryAsync( + String suppressionId, GetSuppressionVersionHistoryOptionalParameters parameters) { + return getSuppressionVersionHistoryWithHttpInfoAsync(suppressionId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a suppression's version history. + * + * @param suppressionId The ID of the suppression rule (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<GetSuppressionVersionHistoryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getSuppressionVersionHistoryWithHttpInfo( + String suppressionId, GetSuppressionVersionHistoryOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'suppressionId' is set + if (suppressionId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'suppressionId' when calling" + + " getSuppressionVersionHistory"); + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history" + .replaceAll( + "\\{" + "suppression_id" + "\\}", apiClient.escapeString(suppressionId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getSuppressionVersionHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a suppression's version history. + * + *

See {@link #getSuppressionVersionHistoryWithHttpInfo}. + * + * @param suppressionId The ID of the suppression rule (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<GetSuppressionVersionHistoryResponse>> + */ + public CompletableFuture> + getSuppressionVersionHistoryWithHttpInfoAsync( + String suppressionId, GetSuppressionVersionHistoryOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'suppressionId' is set + if (suppressionId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'suppressionId' when calling" + + " getSuppressionVersionHistory")); + return result; + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history" + .replaceAll( + "\\{" + "suppression_id" + "\\}", apiClient.escapeString(suppressionId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getSuppressionVersionHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get a job's details. * diff --git a/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryData.java b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryData.java new file mode 100644 index 00000000000..f0f56e04db9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryData.java @@ -0,0 +1,198 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for the suppression version history. */ +@JsonPropertyOrder({ + GetSuppressionVersionHistoryData.JSON_PROPERTY_ATTRIBUTES, + GetSuppressionVersionHistoryData.JSON_PROPERTY_ID, + GetSuppressionVersionHistoryData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetSuppressionVersionHistoryData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SuppressionVersionHistory attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GetSuppressionVersionHistoryDataType type; + + public GetSuppressionVersionHistoryData attributes(SuppressionVersionHistory attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Response object containing the version history of a suppression. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SuppressionVersionHistory getAttributes() { + return attributes; + } + + public void setAttributes(SuppressionVersionHistory attributes) { + this.attributes = attributes; + } + + public GetSuppressionVersionHistoryData id(String id) { + this.id = id; + return this; + } + + /** + * ID of the suppression. + * + * @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 GetSuppressionVersionHistoryData type(GetSuppressionVersionHistoryDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of data. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GetSuppressionVersionHistoryDataType getType() { + return type; + } + + public void setType(GetSuppressionVersionHistoryDataType 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 GetSuppressionVersionHistoryData + */ + @JsonAnySetter + public GetSuppressionVersionHistoryData 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 GetSuppressionVersionHistoryData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSuppressionVersionHistoryData getSuppressionVersionHistoryData = + (GetSuppressionVersionHistoryData) o; + return Objects.equals(this.attributes, getSuppressionVersionHistoryData.attributes) + && Objects.equals(this.id, getSuppressionVersionHistoryData.id) + && Objects.equals(this.type, getSuppressionVersionHistoryData.type) + && Objects.equals( + this.additionalProperties, getSuppressionVersionHistoryData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSuppressionVersionHistoryData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryDataType.java b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryDataType.java new file mode 100644 index 00000000000..8cd0fe65e78 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryDataType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of data. */ +@JsonSerialize( + using = + GetSuppressionVersionHistoryDataType.GetSuppressionVersionHistoryDataTypeSerializer.class) +public class GetSuppressionVersionHistoryDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("suppression_version_history")); + + public static final GetSuppressionVersionHistoryDataType SUPPRESSIONVERSIONHISTORY = + new GetSuppressionVersionHistoryDataType("suppression_version_history"); + + GetSuppressionVersionHistoryDataType(String value) { + super(value, allowedValues); + } + + public static class GetSuppressionVersionHistoryDataTypeSerializer + extends StdSerializer { + public GetSuppressionVersionHistoryDataTypeSerializer( + Class t) { + super(t); + } + + public GetSuppressionVersionHistoryDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GetSuppressionVersionHistoryDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GetSuppressionVersionHistoryDataType fromValue(String value) { + return new GetSuppressionVersionHistoryDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryResponse.java b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryResponse.java new file mode 100644 index 00000000000..215d200c3e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetSuppressionVersionHistoryResponse.java @@ -0,0 +1,138 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response for getting the suppression version history. */ +@JsonPropertyOrder({GetSuppressionVersionHistoryResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetSuppressionVersionHistoryResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GetSuppressionVersionHistoryData data; + + public GetSuppressionVersionHistoryResponse data(GetSuppressionVersionHistoryData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for the suppression version history. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GetSuppressionVersionHistoryData getData() { + return data; + } + + public void setData(GetSuppressionVersionHistoryData data) { + this.data = data; + } + + /** + * 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 GetSuppressionVersionHistoryResponse + */ + @JsonAnySetter + public GetSuppressionVersionHistoryResponse 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 GetSuppressionVersionHistoryResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSuppressionVersionHistoryResponse getSuppressionVersionHistoryResponse = + (GetSuppressionVersionHistoryResponse) o; + return Objects.equals(this.data, getSuppressionVersionHistoryResponse.data) + && Objects.equals( + this.additionalProperties, getSuppressionVersionHistoryResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSuppressionVersionHistoryResponse {\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/RuleVersions.java b/src/main/java/com/datadog/api/client/v2/model/RuleVersions.java index b220bdd9700..626dd27f729 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RuleVersions.java +++ b/src/main/java/com/datadog/api/client/v2/model/RuleVersions.java @@ -25,20 +25,20 @@ public class RuleVersions { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CHANGES = "changes"; - private List changes = null; + private List changes = null; public static final String JSON_PROPERTY_RULE = "rule"; private SecurityMonitoringRuleResponse rule; - public RuleVersions changes(List changes) { + public RuleVersions changes(List changes) { this.changes = changes; - for (RuleVersionUpdate item : changes) { + for (VersionHistoryUpdate item : changes) { this.unparsed |= item.unparsed; } return this; } - public RuleVersions addChangesItem(RuleVersionUpdate changesItem) { + public RuleVersions addChangesItem(VersionHistoryUpdate changesItem) { if (this.changes == null) { this.changes = new ArrayList<>(); } @@ -55,11 +55,11 @@ public RuleVersions addChangesItem(RuleVersionUpdate changesItem) { @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CHANGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getChanges() { + public List getChanges() { return changes; } - public void setChanges(List changes) { + public void setChanges(List changes) { this.changes = changes; } diff --git a/src/main/java/com/datadog/api/client/v2/model/SuppressionVersionHistory.java b/src/main/java/com/datadog/api/client/v2/model/SuppressionVersionHistory.java new file mode 100644 index 00000000000..24e44f4b759 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SuppressionVersionHistory.java @@ -0,0 +1,173 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response object containing the version history of a suppression. */ +@JsonPropertyOrder({ + SuppressionVersionHistory.JSON_PROPERTY_COUNT, + SuppressionVersionHistory.JSON_PROPERTY_DATA +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SuppressionVersionHistory { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COUNT = "count"; + private Integer count; + + public static final String JSON_PROPERTY_DATA = "data"; + private Map data = null; + + public SuppressionVersionHistory count(Integer count) { + this.count = count; + return this; + } + + /** + * The number of suppression versions. maximum: 2147483647 + * + * @return count + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public SuppressionVersionHistory data(Map data) { + this.data = data; + return this; + } + + public SuppressionVersionHistory putDataItem(String key, SuppressionVersions dataItem) { + if (this.data == null) { + this.data = new HashMap<>(); + } + this.data.put(key, dataItem); + return this; + } + + /** + * The version history of a suppression. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } + + /** + * 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 SuppressionVersionHistory + */ + @JsonAnySetter + public SuppressionVersionHistory 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 SuppressionVersionHistory object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuppressionVersionHistory suppressionVersionHistory = (SuppressionVersionHistory) o; + return Objects.equals(this.count, suppressionVersionHistory.count) + && Objects.equals(this.data, suppressionVersionHistory.data) + && Objects.equals( + this.additionalProperties, suppressionVersionHistory.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuppressionVersionHistory {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\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/SuppressionVersions.java b/src/main/java/com/datadog/api/client/v2/model/SuppressionVersions.java new file mode 100644 index 00000000000..461c4820afb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SuppressionVersions.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.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; + +/** A suppression version with a list of updates. */ +@JsonPropertyOrder({ + SuppressionVersions.JSON_PROPERTY_CHANGES, + SuppressionVersions.JSON_PROPERTY_SUPPRESSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SuppressionVersions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANGES = "changes"; + private List changes = null; + + public static final String JSON_PROPERTY_SUPPRESSION = "suppression"; + private SecurityMonitoringSuppressionAttributes suppression; + + public SuppressionVersions changes(List changes) { + this.changes = changes; + for (VersionHistoryUpdate item : changes) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SuppressionVersions addChangesItem(VersionHistoryUpdate changesItem) { + if (this.changes == null) { + this.changes = new ArrayList<>(); + } + this.changes.add(changesItem); + this.unparsed |= changesItem.unparsed; + return this; + } + + /** + * A list of changes. + * + * @return changes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getChanges() { + return changes; + } + + public void setChanges(List changes) { + this.changes = changes; + } + + public SuppressionVersions suppression(SecurityMonitoringSuppressionAttributes suppression) { + this.suppression = suppression; + this.unparsed |= suppression.unparsed; + return this; + } + + /** + * The attributes of the suppression rule. + * + * @return suppression + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUPPRESSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringSuppressionAttributes getSuppression() { + return suppression; + } + + public void setSuppression(SecurityMonitoringSuppressionAttributes suppression) { + this.suppression = suppression; + } + + /** + * 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 SuppressionVersions + */ + @JsonAnySetter + public SuppressionVersions 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 SuppressionVersions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuppressionVersions suppressionVersions = (SuppressionVersions) o; + return Objects.equals(this.changes, suppressionVersions.changes) + && Objects.equals(this.suppression, suppressionVersions.suppression) + && Objects.equals(this.additionalProperties, suppressionVersions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(changes, suppression, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuppressionVersions {\n"); + sb.append(" changes: ").append(toIndentedString(changes)).append("\n"); + sb.append(" suppression: ").append(toIndentedString(suppression)).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/RuleVersionUpdate.java b/src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdate.java similarity index 80% rename from src/main/java/com/datadog/api/client/v2/model/RuleVersionUpdate.java rename to src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdate.java index b435c669748..32e8cc24dbd 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RuleVersionUpdate.java +++ b/src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdate.java @@ -18,13 +18,13 @@ /** A change in a rule version. */ @JsonPropertyOrder({ - RuleVersionUpdate.JSON_PROPERTY_CHANGE, - RuleVersionUpdate.JSON_PROPERTY_FIELD, - RuleVersionUpdate.JSON_PROPERTY_TYPE + VersionHistoryUpdate.JSON_PROPERTY_CHANGE, + VersionHistoryUpdate.JSON_PROPERTY_FIELD, + VersionHistoryUpdate.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class RuleVersionUpdate { +public class VersionHistoryUpdate { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CHANGE = "change"; private String change; @@ -33,9 +33,9 @@ public class RuleVersionUpdate { private String field; public static final String JSON_PROPERTY_TYPE = "type"; - private RuleVersionUpdateType type; + private VersionHistoryUpdateType type; - public RuleVersionUpdate change(String change) { + public VersionHistoryUpdate change(String change) { this.change = change; return this; } @@ -56,7 +56,7 @@ public void setChange(String change) { this.change = change; } - public RuleVersionUpdate field(String field) { + public VersionHistoryUpdate field(String field) { this.field = field; return this; } @@ -77,7 +77,7 @@ public void setField(String field) { this.field = field; } - public RuleVersionUpdate type(RuleVersionUpdateType type) { + public VersionHistoryUpdate type(VersionHistoryUpdateType type) { this.type = type; this.unparsed |= !type.isValid(); return this; @@ -91,11 +91,11 @@ public RuleVersionUpdate type(RuleVersionUpdateType type) { @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RuleVersionUpdateType getType() { + public VersionHistoryUpdateType getType() { return type; } - public void setType(RuleVersionUpdateType type) { + public void setType(VersionHistoryUpdateType type) { if (!type.isValid()) { this.unparsed = true; } @@ -114,10 +114,10 @@ public void setType(RuleVersionUpdateType type) { * * @param key The arbitrary key to set * @param value The associated value - * @return RuleVersionUpdate + * @return VersionHistoryUpdate */ @JsonAnySetter - public RuleVersionUpdate putAdditionalProperty(String key, Object value) { + public VersionHistoryUpdate putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -148,7 +148,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this RuleVersionUpdate object is equal to o. */ + /** Return true if this VersionHistoryUpdate object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -157,11 +157,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - RuleVersionUpdate ruleVersionUpdate = (RuleVersionUpdate) o; - return Objects.equals(this.change, ruleVersionUpdate.change) - && Objects.equals(this.field, ruleVersionUpdate.field) - && Objects.equals(this.type, ruleVersionUpdate.type) - && Objects.equals(this.additionalProperties, ruleVersionUpdate.additionalProperties); + VersionHistoryUpdate versionHistoryUpdate = (VersionHistoryUpdate) o; + return Objects.equals(this.change, versionHistoryUpdate.change) + && Objects.equals(this.field, versionHistoryUpdate.field) + && Objects.equals(this.type, versionHistoryUpdate.type) + && Objects.equals(this.additionalProperties, versionHistoryUpdate.additionalProperties); } @Override @@ -172,7 +172,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class RuleVersionUpdate {\n"); + sb.append("class VersionHistoryUpdate {\n"); sb.append(" change: ").append(toIndentedString(change)).append("\n"); sb.append(" field: ").append(toIndentedString(field)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/RuleVersionUpdateType.java b/src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdateType.java similarity index 55% rename from src/main/java/com/datadog/api/client/v2/model/RuleVersionUpdateType.java rename to src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdateType.java index 00fd1280204..921754f289b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RuleVersionUpdateType.java +++ b/src/main/java/com/datadog/api/client/v2/model/VersionHistoryUpdateType.java @@ -19,39 +19,40 @@ import java.util.Set; /** The type of change. */ -@JsonSerialize(using = RuleVersionUpdateType.RuleVersionUpdateTypeSerializer.class) -public class RuleVersionUpdateType extends ModelEnum { +@JsonSerialize(using = VersionHistoryUpdateType.VersionHistoryUpdateTypeSerializer.class) +public class VersionHistoryUpdateType extends ModelEnum { private static final Set allowedValues = new HashSet(Arrays.asList("create", "update", "delete")); - public static final RuleVersionUpdateType CREATE = new RuleVersionUpdateType("create"); - public static final RuleVersionUpdateType UPDATE = new RuleVersionUpdateType("update"); - public static final RuleVersionUpdateType DELETE = new RuleVersionUpdateType("delete"); + public static final VersionHistoryUpdateType CREATE = new VersionHistoryUpdateType("create"); + public static final VersionHistoryUpdateType UPDATE = new VersionHistoryUpdateType("update"); + public static final VersionHistoryUpdateType DELETE = new VersionHistoryUpdateType("delete"); - RuleVersionUpdateType(String value) { + VersionHistoryUpdateType(String value) { super(value, allowedValues); } - public static class RuleVersionUpdateTypeSerializer extends StdSerializer { - public RuleVersionUpdateTypeSerializer(Class t) { + public static class VersionHistoryUpdateTypeSerializer + extends StdSerializer { + public VersionHistoryUpdateTypeSerializer(Class t) { super(t); } - public RuleVersionUpdateTypeSerializer() { + public VersionHistoryUpdateTypeSerializer() { this(null); } @Override public void serialize( - RuleVersionUpdateType value, JsonGenerator jgen, SerializerProvider provider) + VersionHistoryUpdateType value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.value); } } @JsonCreator - public static RuleVersionUpdateType fromValue(String value) { - return new RuleVersionUpdateType(value); + public static VersionHistoryUpdateType fromValue(String value) { + return new VersionHistoryUpdateType(value); } } diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..24bfeae8d40 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-26T13:33:06.081Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.json new file mode 100644 index 00000000000..9e947840dd8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/security_monitoring/configuration/suppressions/this-does-not-exist/version_history", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"not_found(Suppression with ID this-does-not-exist not found)\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "067902bf-242b-ca67-ee75-a242d0407d88" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.freeze new file mode 100644 index 00000000000..d0d5ccec313 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-26T13:33:06.482Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.json new file mode 100644 index 00000000000..dfde4ad373a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_s_version_history_returns_OK_response.json @@ -0,0 +1,79 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"enabled\":true,\"name\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/security_monitoring/configuration/suppressions", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"456-piv-74h\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1764163986851,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1764163986851,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e4ecf284-d916-cf58-7572-d0e822e67625" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/security_monitoring/configuration/suppressions/456-piv-74h/version_history", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"456-piv-74h\",\"type\":\"suppression_version_history\",\"attributes\":{\"count\":1,\"data\":{\"1\":{\"suppression\":{\"id\":\"456-piv-74h\",\"name\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"data_exclusion_query\":\"\",\"version\":1,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"creation_date\":1764163986851,\"update_date\":1764163986851,\"editable\":true,\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"]},\"changes\":[]}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "14bae097-aa0a-c347-3396-bfa6a75aef1b" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/456-piv-74h", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3cca0e33-ca70-78cd-461f-84eae086ab5d" + } +] \ 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 531c84c19c1..578e8d28e54 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 @@ -833,6 +833,21 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" has the same value as "suppression.data.attributes.rule_query" And the response "data.attributes.suppression_query" is equal to "env:test" + @team:DataDog/k9-cloud-security-platform + Scenario: Get a suppression's version history returns "Not Found" response + Given new "GetSuppressionVersionHistory" request + And request contains "suppression_id" parameter with value "this-does-not-exist" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Get a suppression's version history returns "OK" response + Given new "GetSuppressionVersionHistory" request + And there is a valid "suppression" in the system + And request contains "suppression_id" parameter from "suppression.data.id" + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform Scenario: Get all security filters returns "OK" response Given new "ListSecurityFilters" 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 3799e64e630..67b48870c47 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 @@ -3830,6 +3830,12 @@ "type": "idempotent" } }, + "GetSuppressionVersionHistory": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": {