diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 77abb46069d..c78c50ebd2e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -49179,6 +49179,18 @@ components: meta: $ref: '#/components/schemas/ResponseMetaAttributes' type: object + SecurityMonitoringPaginatedSuppressionsResponse: + description: Response object containing the available suppression rules with + pagination metadata. + properties: + data: + description: A list of suppressions objects. + items: + $ref: '#/components/schemas/SecurityMonitoringSuppression' + type: array + meta: + $ref: '#/components/schemas/SecurityMonitoringSuppressionsMeta' + type: object SecurityMonitoringReferenceTable: description: Reference tables used in the queries. properties: @@ -51328,6 +51340,31 @@ components: data: $ref: '#/components/schemas/SecurityMonitoringSuppression' type: object + SecurityMonitoringSuppressionSort: + description: The sort parameters used for querying suppression rules. + enum: + - name + - start_date + - expiration_date + - update_date + - enabled + - -name + - -start_date + - -expiration_date + - -update_date + - -enabled + type: string + x-enum-varnames: + - NAME + - START_DATE + - EXPIRATION_DATE + - UPDATE_DATE + - ENABLED + - NAME_DESCENDING + - START_DATE_DESCENDING + - EXPIRATION_DATE_DESCENDING + - UPDATE_DATE_DESCENDING + - ENABLED_DESCENDING SecurityMonitoringSuppressionType: default: suppressions description: The type of the resource. The value should always be `suppressions`. @@ -51423,6 +51460,31 @@ components: required: - data type: object + SecurityMonitoringSuppressionsMeta: + description: Metadata for the suppression list response. + properties: + page: + $ref: '#/components/schemas/SecurityMonitoringSuppressionsPageMeta' + type: object + SecurityMonitoringSuppressionsPageMeta: + description: Pagination metadata. + properties: + pageNumber: + description: Current page number. + example: 0 + format: int64 + type: integer + pageSize: + description: Current page size. + example: 2 + format: int64 + type: integer + totalCount: + description: Total count of suppressions. + example: 2 + format: int64 + type: integer + type: object SecurityMonitoringSuppressionsResponse: description: Response object containing the available suppression rules. properties: @@ -85556,12 +85618,29 @@ paths: required: false schema: type: string + - description: Attribute used to sort the list of suppression rules. Prefix + with `-` to sort in descending order. + in: query + name: sort + required: false + schema: + $ref: '#/components/schemas/SecurityMonitoringSuppressionSort' + - description: Size for a given page. Use `-1` to return all items. + in: query + name: page[size] + required: false + schema: + default: -1 + example: 10 + format: int64 + type: integer + - $ref: '#/components/parameters/PageNumber' responses: '200': content: application/json: schema: - $ref: '#/components/schemas/SecurityMonitoringSuppressionsResponse' + $ref: '#/components/schemas/SecurityMonitoringPaginatedSuppressionsResponse' description: OK '403': $ref: '#/components/responses/NotAuthorizedResponse' diff --git a/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions.java b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions.java index d83a0c4256c..bd2a014139c 100644 --- a/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions.java +++ b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions.java @@ -3,7 +3,7 @@ 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.SecurityMonitoringSuppressionsResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; public class Example { public static void main(String[] args) { @@ -11,7 +11,7 @@ public static void main(String[] args) { SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); try { - SecurityMonitoringSuppressionsResponse result = + SecurityMonitoringPaginatedSuppressionsResponse result = apiInstance.listSecurityMonitoringSuppressions(); System.out.println(result); } catch (ApiException e) { diff --git a/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1315707136.java b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1315707136.java new file mode 100644 index 00000000000..55634f1821c --- /dev/null +++ b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1315707136.java @@ -0,0 +1,37 @@ +// Get all suppression rules returns "OK" response with sort ascending + +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.api.SecurityMonitoringApi.ListSecurityMonitoringSuppressionsOptionalParameters; +import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionSort; + +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"); + + // there is a valid "suppression2" in the system + String SUPPRESSION2_DATA_ID = System.getenv("SUPPRESSION2_DATA_ID"); + + try { + SecurityMonitoringPaginatedSuppressionsResponse result = + apiInstance.listSecurityMonitoringSuppressions( + new ListSecurityMonitoringSuppressionsOptionalParameters() + .sort(SecurityMonitoringSuppressionSort.NAME) + .query("id:3dd-0uc-h1s OR id:886e6c3e-e543-049c-ee1b-56a1110295c0")); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#listSecurityMonitoringSuppressions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1741429096.java b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1741429096.java new file mode 100644 index 00000000000..4e032ff32af --- /dev/null +++ b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_1741429096.java @@ -0,0 +1,37 @@ +// Get all suppression rules returns "OK" response with sort descending + +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.api.SecurityMonitoringApi.ListSecurityMonitoringSuppressionsOptionalParameters; +import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionSort; + +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"); + + // there is a valid "suppression2" in the system + String SUPPRESSION2_DATA_ID = System.getenv("SUPPRESSION2_DATA_ID"); + + try { + SecurityMonitoringPaginatedSuppressionsResponse result = + apiInstance.listSecurityMonitoringSuppressions( + new ListSecurityMonitoringSuppressionsOptionalParameters() + .sort(SecurityMonitoringSuppressionSort.NAME_DESCENDING) + .query("id:3dd-0uc-h1s OR id:886e6c3e-e543-049c-ee1b-56a1110295c0")); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#listSecurityMonitoringSuppressions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_3985905558.java b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_3985905558.java new file mode 100644 index 00000000000..64a631b2c19 --- /dev/null +++ b/examples/v2/security-monitoring/ListSecurityMonitoringSuppressions_3985905558.java @@ -0,0 +1,37 @@ +// Get all suppression rules returns "OK" response with pagination + +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.api.SecurityMonitoringApi.ListSecurityMonitoringSuppressionsOptionalParameters; +import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; + +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"); + + // there is a valid "suppression2" in the system + String SUPPRESSION2_DATA_ID = System.getenv("SUPPRESSION2_DATA_ID"); + + try { + SecurityMonitoringPaginatedSuppressionsResponse result = + apiInstance.listSecurityMonitoringSuppressions( + new ListSecurityMonitoringSuppressionsOptionalParameters() + .pageSize(1L) + .pageNumber(0L) + .query("id:3dd-0uc-h1s OR id:886e6c3e-e543-049c-ee1b-56a1110295c0")); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#listSecurityMonitoringSuppressions"); + 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 20a964e4ec4..1da16233289 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 @@ -62,6 +62,7 @@ import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetUpdateRequest; import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetsResponse; import com.datadog.api.client.v2.model.SecurityMonitoringListRulesResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertPayload; import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertResponse; import com.datadog.api.client.v2.model.SecurityMonitoringRuleCreatePayload; @@ -82,6 +83,7 @@ import com.datadog.api.client.v2.model.SecurityMonitoringSignalsSort; import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionCreateRequest; import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionSort; import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionUpdateRequest; import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionsResponse; import com.datadog.api.client.v2.model.ThreatHuntingJobResponse; @@ -10543,6 +10545,9 @@ public PaginationIterable listSecurityMonitoringSignal /** Manage optional parameters to listSecurityMonitoringSuppressions. */ public static class ListSecurityMonitoringSuppressionsOptionalParameters { private String query; + private SecurityMonitoringSuppressionSort sort; + private Long pageSize; + private Long pageNumber; /** * Set query. @@ -10554,6 +10559,42 @@ public ListSecurityMonitoringSuppressionsOptionalParameters query(String query) this.query = query; return this; } + + /** + * Set sort. + * + * @param sort Attribute used to sort the list of suppression rules. Prefix with - + * to sort in descending order. (optional) + * @return ListSecurityMonitoringSuppressionsOptionalParameters + */ + public ListSecurityMonitoringSuppressionsOptionalParameters sort( + SecurityMonitoringSuppressionSort sort) { + this.sort = sort; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. Use -1 to return all items. (optional, + * default to -1) + * @return ListSecurityMonitoringSuppressionsOptionalParameters + */ + public ListSecurityMonitoringSuppressionsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListSecurityMonitoringSuppressionsOptionalParameters + */ + public ListSecurityMonitoringSuppressionsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } } /** @@ -10561,10 +10602,10 @@ public ListSecurityMonitoringSuppressionsOptionalParameters query(String query) * *

See {@link #listSecurityMonitoringSuppressionsWithHttpInfo}. * - * @return SecurityMonitoringSuppressionsResponse + * @return SecurityMonitoringPaginatedSuppressionsResponse * @throws ApiException if fails to make API call */ - public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions() + public SecurityMonitoringPaginatedSuppressionsResponse listSecurityMonitoringSuppressions() throws ApiException { return listSecurityMonitoringSuppressionsWithHttpInfo( new ListSecurityMonitoringSuppressionsOptionalParameters()) @@ -10576,9 +10617,9 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions * *

See {@link #listSecurityMonitoringSuppressionsWithHttpInfoAsync}. * - * @return CompletableFuture<SecurityMonitoringSuppressionsResponse> + * @return CompletableFuture<SecurityMonitoringPaginatedSuppressionsResponse> */ - public CompletableFuture + public CompletableFuture listSecurityMonitoringSuppressionsAsync() { return listSecurityMonitoringSuppressionsWithHttpInfoAsync( new ListSecurityMonitoringSuppressionsOptionalParameters()) @@ -10594,10 +10635,10 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions *

See {@link #listSecurityMonitoringSuppressionsWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return SecurityMonitoringSuppressionsResponse + * @return SecurityMonitoringPaginatedSuppressionsResponse * @throws ApiException if fails to make API call */ - public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions( + public SecurityMonitoringPaginatedSuppressionsResponse listSecurityMonitoringSuppressions( ListSecurityMonitoringSuppressionsOptionalParameters parameters) throws ApiException { return listSecurityMonitoringSuppressionsWithHttpInfo(parameters).getData(); } @@ -10608,9 +10649,9 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions *

See {@link #listSecurityMonitoringSuppressionsWithHttpInfoAsync}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<SecurityMonitoringSuppressionsResponse> + * @return CompletableFuture<SecurityMonitoringPaginatedSuppressionsResponse> */ - public CompletableFuture + public CompletableFuture listSecurityMonitoringSuppressionsAsync( ListSecurityMonitoringSuppressionsOptionalParameters parameters) { return listSecurityMonitoringSuppressionsWithHttpInfoAsync(parameters) @@ -10624,7 +10665,7 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions * Get the list of all suppression rules. * * @param parameters Optional parameters for the request. - * @return ApiResponse<SecurityMonitoringSuppressionsResponse> + * @return ApiResponse<SecurityMonitoringPaginatedSuppressionsResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -10635,11 +10676,14 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions * *
429 Too many requests -
*/ - public ApiResponse + public ApiResponse listSecurityMonitoringSuppressionsWithHttpInfo( ListSecurityMonitoringSuppressionsOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; String query = parameters.query; + SecurityMonitoringSuppressionSort sort = parameters.sort; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; // create path and map variables String localVarPath = "/api/v2/security_monitoring/configuration/suppressions"; @@ -10647,6 +10691,9 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); Invocation.Builder builder = apiClient.createBuilder( @@ -10665,7 +10712,7 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -10674,13 +10721,17 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions *

See {@link #listSecurityMonitoringSuppressionsWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<SecurityMonitoringSuppressionsResponse>> + * @return + * CompletableFuture<ApiResponse<SecurityMonitoringPaginatedSuppressionsResponse>> */ - public CompletableFuture> + public CompletableFuture> listSecurityMonitoringSuppressionsWithHttpInfoAsync( ListSecurityMonitoringSuppressionsOptionalParameters parameters) { Object localVarPostBody = null; String query = parameters.query; + SecurityMonitoringSuppressionSort sort = parameters.sort; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; // create path and map variables String localVarPath = "/api/v2/security_monitoring/configuration/suppressions"; @@ -10688,6 +10739,9 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions Map localVarHeaderParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); Invocation.Builder builder; try { @@ -10701,7 +10755,7 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -10714,7 +10768,7 @@ public SecurityMonitoringSuppressionsResponse listSecurityMonitoringSuppressions localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listThreatHuntingJobs. */ diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringPaginatedSuppressionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringPaginatedSuppressionsResponse.java new file mode 100644 index 00000000000..10b5fe51cfb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringPaginatedSuppressionsResponse.java @@ -0,0 +1,187 @@ +/* + * 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; + +/** Response object containing the available suppression rules with pagination metadata. */ +@JsonPropertyOrder({ + SecurityMonitoringPaginatedSuppressionsResponse.JSON_PROPERTY_DATA, + SecurityMonitoringPaginatedSuppressionsResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringPaginatedSuppressionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private SecurityMonitoringSuppressionsMeta meta; + + public SecurityMonitoringPaginatedSuppressionsResponse data( + List data) { + this.data = data; + for (SecurityMonitoringSuppression item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SecurityMonitoringPaginatedSuppressionsResponse addDataItem( + SecurityMonitoringSuppression dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of suppressions objects. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public SecurityMonitoringPaginatedSuppressionsResponse meta( + SecurityMonitoringSuppressionsMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata for the suppression list response. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringSuppressionsMeta getMeta() { + return meta; + } + + public void setMeta(SecurityMonitoringSuppressionsMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SecurityMonitoringPaginatedSuppressionsResponse + */ + @JsonAnySetter + public SecurityMonitoringPaginatedSuppressionsResponse 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 SecurityMonitoringPaginatedSuppressionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringPaginatedSuppressionsResponse + securityMonitoringPaginatedSuppressionsResponse = + (SecurityMonitoringPaginatedSuppressionsResponse) o; + return Objects.equals(this.data, securityMonitoringPaginatedSuppressionsResponse.data) + && Objects.equals(this.meta, securityMonitoringPaginatedSuppressionsResponse.meta) + && Objects.equals( + this.additionalProperties, + securityMonitoringPaginatedSuppressionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringPaginatedSuppressionsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionSort.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionSort.java new file mode 100644 index 00000000000..b3c61e52e32 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionSort.java @@ -0,0 +1,87 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The sort parameters used for querying suppression rules. */ +@JsonSerialize( + using = SecurityMonitoringSuppressionSort.SecurityMonitoringSuppressionSortSerializer.class) +public class SecurityMonitoringSuppressionSort extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "name", + "start_date", + "expiration_date", + "update_date", + "enabled", + "-name", + "-start_date", + "-expiration_date", + "-update_date", + "-enabled")); + + public static final SecurityMonitoringSuppressionSort NAME = + new SecurityMonitoringSuppressionSort("name"); + public static final SecurityMonitoringSuppressionSort START_DATE = + new SecurityMonitoringSuppressionSort("start_date"); + public static final SecurityMonitoringSuppressionSort EXPIRATION_DATE = + new SecurityMonitoringSuppressionSort("expiration_date"); + public static final SecurityMonitoringSuppressionSort UPDATE_DATE = + new SecurityMonitoringSuppressionSort("update_date"); + public static final SecurityMonitoringSuppressionSort ENABLED = + new SecurityMonitoringSuppressionSort("enabled"); + public static final SecurityMonitoringSuppressionSort NAME_DESCENDING = + new SecurityMonitoringSuppressionSort("-name"); + public static final SecurityMonitoringSuppressionSort START_DATE_DESCENDING = + new SecurityMonitoringSuppressionSort("-start_date"); + public static final SecurityMonitoringSuppressionSort EXPIRATION_DATE_DESCENDING = + new SecurityMonitoringSuppressionSort("-expiration_date"); + public static final SecurityMonitoringSuppressionSort UPDATE_DATE_DESCENDING = + new SecurityMonitoringSuppressionSort("-update_date"); + public static final SecurityMonitoringSuppressionSort ENABLED_DESCENDING = + new SecurityMonitoringSuppressionSort("-enabled"); + + SecurityMonitoringSuppressionSort(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringSuppressionSortSerializer + extends StdSerializer { + public SecurityMonitoringSuppressionSortSerializer(Class t) { + super(t); + } + + public SecurityMonitoringSuppressionSortSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringSuppressionSort value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringSuppressionSort fromValue(String value) { + return new SecurityMonitoringSuppressionSort(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionsMeta.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionsMeta.java new file mode 100644 index 00000000000..ff2e81ede3c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionsMeta.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; + +/** Metadata for the suppression list response. */ +@JsonPropertyOrder({SecurityMonitoringSuppressionsMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringSuppressionsMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private SecurityMonitoringSuppressionsPageMeta page; + + public SecurityMonitoringSuppressionsMeta page(SecurityMonitoringSuppressionsPageMeta page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Pagination metadata. + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringSuppressionsPageMeta getPage() { + return page; + } + + public void setPage(SecurityMonitoringSuppressionsPageMeta page) { + this.page = page; + } + + /** + * 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 SecurityMonitoringSuppressionsMeta + */ + @JsonAnySetter + public SecurityMonitoringSuppressionsMeta 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 SecurityMonitoringSuppressionsMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringSuppressionsMeta securityMonitoringSuppressionsMeta = + (SecurityMonitoringSuppressionsMeta) o; + return Objects.equals(this.page, securityMonitoringSuppressionsMeta.page) + && Objects.equals( + this.additionalProperties, securityMonitoringSuppressionsMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringSuppressionsMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/SecurityMonitoringSuppressionsPageMeta.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionsPageMeta.java new file mode 100644 index 00000000000..79c8a1083c3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionsPageMeta.java @@ -0,0 +1,193 @@ +/* + * 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; + +/** Pagination metadata. */ +@JsonPropertyOrder({ + SecurityMonitoringSuppressionsPageMeta.JSON_PROPERTY_PAGE_NUMBER, + SecurityMonitoringSuppressionsPageMeta.JSON_PROPERTY_PAGE_SIZE, + SecurityMonitoringSuppressionsPageMeta.JSON_PROPERTY_TOTAL_COUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringSuppressionsPageMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE_NUMBER = "pageNumber"; + private Long pageNumber; + + public static final String JSON_PROPERTY_PAGE_SIZE = "pageSize"; + private Long pageSize; + + public static final String JSON_PROPERTY_TOTAL_COUNT = "totalCount"; + private Long totalCount; + + public SecurityMonitoringSuppressionsPageMeta pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Current page number. + * + * @return pageNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPageNumber() { + return pageNumber; + } + + public void setPageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + } + + public SecurityMonitoringSuppressionsPageMeta pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Current page size. + * + * @return pageSize + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(Long pageSize) { + this.pageSize = pageSize; + } + + public SecurityMonitoringSuppressionsPageMeta totalCount(Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total count of suppressions. + * + * @return totalCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** + * 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 SecurityMonitoringSuppressionsPageMeta + */ + @JsonAnySetter + public SecurityMonitoringSuppressionsPageMeta 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 SecurityMonitoringSuppressionsPageMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringSuppressionsPageMeta securityMonitoringSuppressionsPageMeta = + (SecurityMonitoringSuppressionsPageMeta) o; + return Objects.equals(this.pageNumber, securityMonitoringSuppressionsPageMeta.pageNumber) + && Objects.equals(this.pageSize, securityMonitoringSuppressionsPageMeta.pageSize) + && Objects.equals(this.totalCount, securityMonitoringSuppressionsPageMeta.totalCount) + && Objects.equals( + this.additionalProperties, securityMonitoringSuppressionsPageMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(pageNumber, pageSize, totalCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringSuppressionsPageMeta {\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.freeze index 3f3e3c99f21..ec35b858851 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-11-07T12:27:26.759Z \ No newline at end of file +2026-01-14T17:29:03.168Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.json index d243fbd8f58..bc7ac56f941 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Delete_a_suppression_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Delete_a_suppression_rule_returns_OK_response-1762518446\",\"enabled\":true,\"name\":\"Test-Delete_a_suppression_rule_returns_OK_response-1762518446\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Delete_a_suppression_rule_returns_OK_response-1768411743\",\"enabled\":true,\"name\":\"suppression Test-Delete_a_suppression_rule_returns_OK_response-1768411743\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"uea-lab-big\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1762518447002,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Delete_a_suppression_rule_returns_OK_response-1762518446\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Delete_a_suppression_rule_returns_OK_response-1762518446\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1762518447002,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", + "body": "{\"data\":{\"id\":\"itm-ljs-0qw\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411744411,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Delete_a_suppression_rule_returns_OK_response-1768411743\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Delete_a_suppression_rule_returns_OK_response-1768411743\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411744411,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "f181dced-eb3e-bfdd-020a-40965b7229b2" + "id": "54e5a340-5de4-8285-a606-324efbc11f5d" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/uea-lab-big", + "path": "/api/v2/security_monitoring/configuration/suppressions/itm-ljs-0qw", "keepAlive": false, "secure": true }, @@ -48,18 +48,18 @@ "timeToLive": { "unlimited": true }, - "id": "2b54ce26-df1a-55f2-8376-9da4db5d8f64" + "id": "e9742d91-8c62-9396-15fd-0a073429f463" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/uea-lab-big", + "path": "/api/v2/security_monitoring/configuration/suppressions/itm-ljs-0qw", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"errors\":[\"not_found(Suppression with ID uea-lab-big not found)\"]}", + "body": "{\"errors\":[\"not_found(Suppression with ID itm-ljs-0qw not found)\"]}", "headers": { "Content-Type": [ "application/json" @@ -74,6 +74,6 @@ "timeToLive": { "unlimited": true }, - "id": "2b54ce26-df1a-55f2-8376-9da4db5d8f65" + "id": "e9742d91-8c62-9396-15fd-0a073429f464" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.freeze index a93a4d20e75..16f1a15eddc 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-11-07T12:27:27.654Z \ No newline at end of file +2026-01-14T17:29:04.856Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.json index 69727929aad..4656d9bdb38 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_a_suppression_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"enabled\":true,\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"enabled\":true,\"name\":\"suppression Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"ylq-igi-icg\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1762518447901,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1762518447901,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", + "body": "{\"data\":{\"id\":\"xno-kwg-8df\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411744987,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411744987,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -27,18 +27,18 @@ "timeToLive": { "unlimited": true }, - "id": "de8b198e-3f08-189d-bac5-8243a23a6c6e" + "id": "0f0810a4-bb6e-d06b-4e28-254f21a399de" }, { "httpRequest": { "headers": {}, "method": "GET", - "path": "/api/v2/security_monitoring/configuration/suppressions/ylq-igi-icg", + "path": "/api/v2/security_monitoring/configuration/suppressions/xno-kwg-8df", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"ylq-igi-icg\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1762518447901,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1762518447\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1762518447901,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", + "body": "{\"data\":{\"id\":\"xno-kwg-8df\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411744987,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_a_suppression_rule_returns_OK_response-1768411744\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411744987,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -53,13 +53,13 @@ "timeToLive": { "unlimited": true }, - "id": "e4ea82bb-5963-1f7b-73f1-b145f01a869a" + "id": "42e4b15c-099b-b608-2f86-850e2b995bfa" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/ylq-igi-icg", + "path": "/api/v2/security_monitoring/configuration/suppressions/xno-kwg-8df", "keepAlive": false, "secure": true }, @@ -74,6 +74,6 @@ "timeToLive": { "unlimited": true }, - "id": "eb9719a8-99ec-7157-d461-3899c802b2f0" + "id": "b106773a-5ae2-b87d-f8cb-461ca79195e7" } ] \ 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 index d0d5ccec313..66913264132 100644 --- 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 @@ -1 +1 @@ -2025-11-26T13:33:06.482Z \ No newline at end of file +2026-01-14T17:29:05.317Z \ 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 index dfde4ad373a..735862452d8 100644 --- 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 @@ -3,7 +3,7 @@ "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\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"enabled\":true,\"name\":\"suppression Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "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}}}", + "body": "{\"data\":{\"id\":\"sro-unv-k08\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411745430,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411745430,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -27,18 +27,18 @@ "timeToLive": { "unlimited": true }, - "id": "e4ecf284-d916-cf58-7572-d0e822e67625" + "id": "033e1691-28bd-d988-a146-781673716fa1" }, { "httpRequest": { "headers": {}, "method": "GET", - "path": "/api/v2/security_monitoring/configuration/suppressions/456-piv-74h/version_history", + "path": "/api/v2/security_monitoring/configuration/suppressions/sro-unv-k08/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\":[]}}}}}", + "body": "{\"data\":{\"id\":\"sro-unv-k08\",\"type\":\"suppression_version_history\",\"attributes\":{\"count\":1,\"data\":{\"1\":{\"suppression\":{\"id\":\"sro-unv-k08\",\"name\":\"suppression Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_s_version_history_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"data_exclusion_query\":\"\",\"version\":1,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"creation_date\":1768411745430,\"update_date\":1768411745430,\"editable\":true,\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"]},\"changes\":[]}}}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -53,13 +53,13 @@ "timeToLive": { "unlimited": true }, - "id": "14bae097-aa0a-c347-3396-bfa6a75aef1b" + "id": "8c3d6b9a-30ce-5406-933f-512cb644bda7" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/456-piv-74h", + "path": "/api/v2/security_monitoring/configuration/suppressions/sro-unv-k08", "keepAlive": false, "secure": true }, @@ -74,6 +74,6 @@ "timeToLive": { "unlimited": true }, - "id": "3cca0e33-ca70-78cd-461f-84eae086ab5d" + "id": "86cf8291-215a-f95c-f482-37f971f42c58" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.freeze b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.freeze new file mode 100644 index 00000000000..23cdf460db7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.freeze @@ -0,0 +1 @@ +2026-01-14T17:12:28.523Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.json b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.json new file mode 100644 index 00000000000..f61f8f48301 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_pagination.json @@ -0,0 +1,141 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"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\":\"fgz-hyr-ibu\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410748883,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410748883,\"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": "d8b623cb-fe4b-00c4-217f-366ceaa8cd81" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"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\":\"lgh-7no-380\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410749324,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"editable\":true,\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410749324,\"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": "62e38132-3fde-59a9-d031-732766e8a12a" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/security_monitoring/configuration/suppressions", + "queryStringParameters": { + "page[size]": [ + "1" + ], + "page[number]": [ + "0" + ], + "query": [ + "id:fgz-hyr-ibu OR id:lgh-7no-380" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"fgz-hyr-ibu\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410748883,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_pagination-1768410748\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410748883,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}}],\"meta\":{\"page\":{\"totalCount\":2,\"pageSize\":1,\"pageNumber\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c585a7d1-9881-dc5b-d460-b1714231b0f9" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/lgh-7no-380", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5329789a-6920-a318-48a1-5f1f7a75d084" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/fgz-hyr-ibu", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c8c4295f-3029-6d08-1e17-ce33ee527dc8" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.freeze b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.freeze new file mode 100644 index 00000000000..89bfc8cd8ef --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.freeze @@ -0,0 +1 @@ +2026-01-14T17:12:30.925Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.json b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.json new file mode 100644 index 00000000000..f7ee1372a07 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_ascending.json @@ -0,0 +1,138 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"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\":\"5cq-vnw-eza\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410751276,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410751276,\"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": "5d559937-62cf-4bb1-23bb-52331e71796c" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"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\":\"fuu-xxd-kjd\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410751710,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"editable\":true,\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410751710,\"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": "1794be2a-8757-c3e6-9bad-6e32a5279fb0" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/security_monitoring/configuration/suppressions", + "queryStringParameters": { + "sort": [ + "name" + ], + "query": [ + "id:5cq-vnw-eza OR id:fuu-xxd-kjd" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"5cq-vnw-eza\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410751276,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410751276,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}},{\"id\":\"fuu-xxd-kjd\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410751710,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"editable\":true,\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_ascending-1768410750\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410751710,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}}],\"meta\":{\"page\":{\"totalCount\":2,\"pageSize\":2,\"pageNumber\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4e579531-d85d-bac9-15a6-68f29f36e23e" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/fuu-xxd-kjd", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "457db922-e7ed-74e8-e0cf-69a4bf39c49f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/5cq-vnw-eza", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bbc4dcbf-a0a1-7255-d8b8-692d9785aa97" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.freeze b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.freeze new file mode 100644 index 00000000000..d184a46ea08 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.freeze @@ -0,0 +1 @@ +2026-01-14T17:12:33.088Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.json b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.json new file mode 100644 index 00000000000..43c5d8d3659 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_suppression_rules_returns_OK_response_with_sort_descending.json @@ -0,0 +1,138 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"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\":\"osw-qyf-tqn\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410753455,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410753455,\"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": "6804f189-09de-0950-bf78-086b20b556ca" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"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\":\"pe9-gdi-ee2\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410753872,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"editable\":true,\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410753872,\"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": "f50d4629-2389-7973-c040-32367fac199a" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/security_monitoring/configuration/suppressions", + "queryStringParameters": { + "sort": [ + "-name" + ], + "query": [ + "id:osw-qyf-tqn OR id:pe9-gdi-ee2" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"pe9-gdi-ee2\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410753872,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"editable\":true,\"enabled\":true,\"name\":\"suppression2 Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410753872,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}},{\"id\":\"osw-qyf-tqn\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768410753455,\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Get_all_suppression_rules_returns_OK_response_with_sort_descending-1768410753\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768410753455,\"updater\":{\"handle\":\"frog@datadoghq.com\",\"name\":\"frog\"},\"version\":1}}],\"meta\":{\"page\":{\"totalCount\":2,\"pageSize\":2,\"pageNumber\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5bee98ca-76eb-3a3d-746f-51d6d1f1ce66" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/pe9-gdi-ee2", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4d20b729-7b38-f715-f7df-aec60621d5e6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/osw-qyf-tqn", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f1eaffca-6f0d-6fc1-5a7a-6948b4a19559" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.freeze index 8839a50677d..e05f55dd710 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-11-07T12:27:28.613Z \ No newline at end of file +2026-01-14T17:29:05.825Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.json index 645a5152204..fd9c0afb684 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Update_a_suppression_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"enabled\":true,\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"enabled\":true,\"name\":\"suppression Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"technique:T1110-brute-force\",\"source:cloudtrail\"]},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"uqt-hh6-qbq\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1762518448839,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1762518448839,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", + "body": "{\"data\":{\"id\":\"ucv-bpf-4bc\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411745950,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411745950,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":1}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "bb8c27c9-c16b-7adf-78e2-98be963db101" + "id": "011620d6-2878-5fbd-5639-07e61fe5e4e2" }, { "httpRequest": { @@ -37,12 +37,12 @@ }, "headers": {}, "method": "PATCH", - "path": "/api/v2/security_monitoring/configuration/suppressions/uqt-hh6-qbq", + "path": "/api/v2/security_monitoring/configuration/suppressions/ucv-bpf-4bc", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"uqt-hh6-qbq\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1762518448839,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"editable\":true,\"enabled\":true,\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1762518448\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1762518449150,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":2}}}", + "body": "{\"data\":{\"id\":\"ucv-bpf-4bc\",\"type\":\"suppressions\",\"attributes\":{\"creation_date\":1768411745950,\"creator\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"data_exclusion_query\":\"\",\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"editable\":true,\"enabled\":true,\"name\":\"suppression Test-Update_a_suppression_rule_returns_OK_response-1768411745\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"tags\":[\"source:cloudtrail\",\"technique:T1110-brute-force\"],\"update_date\":1768411746111,\"updater\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"version\":2}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "448c55e0-3dab-a9db-29da-dd5cdf04a54d" + "id": "2195b1a9-82a2-a39e-a977-4a4bf2194053" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/uqt-hh6-qbq", + "path": "/api/v2/security_monitoring/configuration/suppressions/ucv-bpf-4bc", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "d894e2e4-7856-f636-96c8-8e4a1ef9a9be" + "id": "52852935-bffe-e564-35b8-1f47b1b1dead" } ] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index c717223ca71..9d69fd33f22 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1035,7 +1035,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"data\": {\n \"type\": \"suppressions\",\n \"attributes\": {\n \"enabled\": true,\n \"name\": \"{{ unique }}\",\n \"description\": \"{{ unique }}\",\n \"rule_query\": \"source:cloudtrail\",\n \"suppression_query\": \"env:test\",\n \"tags\": [\"technique:T1110-brute-force\", \"source:cloudtrail\"]\n }\n }\n}" + "value": "{\n \"data\": {\n \"type\": \"suppressions\",\n \"attributes\": {\n \"enabled\": true,\n \"name\": \"suppression {{ unique }}\",\n \"description\": \"{{ unique }}\",\n \"rule_query\": \"source:cloudtrail\",\n \"suppression_query\": \"env:test\",\n \"tags\": [\"technique:T1110-brute-force\", \"source:cloudtrail\"]\n }\n }\n}" } ], "step": "there is a valid \"suppression\" in the system", @@ -1043,6 +1043,18 @@ "tag": "Security Monitoring", "operationId": "CreateSecurityMonitoringSuppression" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"suppressions\",\n \"attributes\": {\n \"enabled\": true,\n \"name\": \"suppression2 {{ unique }}\",\n \"description\": \"{{ unique }}\",\n \"rule_query\": \"source:cloudtrail\",\n \"suppression_query\": \"env:test\",\n \"tags\": [\"technique:T1110-brute-force\", \"source:cloudtrail\"]\n }\n }\n}" + } + ], + "step": "there is a valid \"suppression2\" in the system", + "key": "suppression2", + "tag": "Security Monitoring", + "operationId": "CreateSecurityMonitoringSuppression" + }, { "parameters": [ { 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 2a6c599c306..60e9df68bb9 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 @@ -1124,6 +1124,40 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform + Scenario: Get all suppression rules returns "OK" response with pagination + Given new "ListSecurityMonitoringSuppressions" request + And there is a valid "suppression" in the system + And there is a valid "suppression2" in the system + And request contains "page[size]" parameter with value 1 + And request contains "page[number]" parameter with value 0 + And request contains "query" parameter with value "id:{{ suppression.data.id }} OR id:{{ suppression2.data.id }}" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + + @team:DataDog/k9-cloud-security-platform + Scenario: Get all suppression rules returns "OK" response with sort ascending + Given new "ListSecurityMonitoringSuppressions" request + And there is a valid "suppression" in the system + And there is a valid "suppression2" in the system + And request contains "sort" parameter with value "name" + And request contains "query" parameter with value "id:{{ suppression.data.id }} OR id:{{ suppression2.data.id }}" + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.name" is equal to "suppression {{ unique }}" + + @team:DataDog/k9-cloud-security-platform + Scenario: Get all suppression rules returns "OK" response with sort descending + Given new "ListSecurityMonitoringSuppressions" request + And there is a valid "suppression" in the system + And there is a valid "suppression2" in the system + And request contains "sort" parameter with value "-name" + And request contains "query" parameter with value "id:{{ suppression.data.id }} OR id:{{ suppression2.data.id }}" + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.name" is equal to "suppression2 {{ unique }}" + @skip @team:DataDog/k9-cloud-security-platform Scenario: Get critical assets affecting a specific rule returns "Not Found" response Given new "GetCriticalAssetsAffectingRule" request