From bff38d67d218114e6cdce22acd318f71b487c467 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 10 Apr 2024 15:02:26 +0000 Subject: [PATCH] Regenerate client from commit 7e61ac0f of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 26 ++++++++- ...urityMonitoringSuppression_3192265332.java | 46 +++++++++++++++ ...curityMonitoringSuppressionAttributes.java | 31 ++++++++++ ...MonitoringSuppressionCreateAttributes.java | 44 ++++++++++++-- ...MonitoringSuppressionUpdateAttributes.java | 33 +++++++++++ ...uppression_rule_returns_OK_response.freeze | 2 +- ..._suppression_rule_returns_OK_response.json | 10 ++-- ...exclusion_query_returns_OK_response.freeze | 1 + ...n_exclusion_query_returns_OK_response.json | 57 +++++++++++++++++++ ...uppression_rule_returns_OK_response.freeze | 2 +- ..._suppression_rule_returns_OK_response.json | 16 +++--- ...uppression_rule_returns_OK_response.freeze | 2 +- ..._suppression_rule_returns_OK_response.json | 16 +++--- .../client/v2/api/security_monitoring.feature | 33 +++++++---- 15 files changed, 279 insertions(+), 48 deletions(-) create mode 100644 examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index 0e0d13eeee7..e3fdc31303b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-09 18:06:06.159963", - "spec_repo_commit": "fc718bc2" + "regenerated": "2024-04-10 15:00:58.406403", + "spec_repo_commit": "7e61ac0f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-09 18:06:06.178724", - "spec_repo_commit": "fc718bc2" + "regenerated": "2024-04-10 15:00:58.425050", + "spec_repo_commit": "7e61ac0f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9010c45c0c0..90e25751f7f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -18282,6 +18282,13 @@ components: type: integer creator: $ref: '#/components/schemas/SecurityMonitoringUser' + data_exclusion_query: + description: An exclusion query on the input data of the security rules, + which could be logs, Agent events, or other types of data based on the + security rule. Events matching this query are ignored by any detection + rules referenced in the suppression rule. + example: source:cloudtrail account_id:12345 + type: string description: description: A description for the suppression rule. example: This rule suppresses low-severity signals in staging environments. @@ -18330,6 +18337,13 @@ components: description: Object containing the attributes of the suppression rule to be created. properties: + data_exclusion_query: + description: An exclusion query on the input data of the security rules, + which could be logs, Agent events, or other types of data based on the + security rule. Events matching this query are ignored by any detection + rules referenced in the suppression rule. + example: source:cloudtrail account_id:12345 + type: string description: description: A description for the suppression rule. example: This rule suppresses low-severity signals in staging environments. @@ -18355,15 +18369,14 @@ components: type: string suppression_query: description: The suppression query of the suppression rule. If a signal - matches this query, it is suppressed and is not triggered . Same syntax - as the queries to search signals in the signal explorer. + matches this query, it is suppressed and is not triggered. It uses the + same syntax as the queries to search signals in the Signals Explorer. example: env:staging status:low type: string required: - name - enabled - rule_query - - suppression_query type: object SecurityMonitoringSuppressionCreateData: description: Object for a single suppression rule. @@ -18407,6 +18420,13 @@ components: SecurityMonitoringSuppressionUpdateAttributes: description: The suppression rule properties to be updated. properties: + data_exclusion_query: + description: An exclusion query on the input data of the security rules, + which could be logs, Agent events, or other types of data based on the + security rule. Events matching this query are ignored by any detection + rules referenced in the suppression rule. + example: source:cloudtrail account_id:12345 + type: string description: description: A description for the suppression rule. example: This rule suppresses low-severity signals in staging environments. diff --git a/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.java b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.java new file mode 100644 index 00000000000..ce97566be8b --- /dev/null +++ b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.java @@ -0,0 +1,46 @@ +// Create a suppression rule with an exclusion query 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.SecurityMonitoringSuppressionCreateAttributes; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionCreateData; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionCreateRequest; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringSuppressionType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + SecurityMonitoringSuppressionCreateRequest body = + new SecurityMonitoringSuppressionCreateRequest() + .data( + new SecurityMonitoringSuppressionCreateData() + .attributes( + new SecurityMonitoringSuppressionCreateAttributes() + .description( + "This rule suppresses low-severity signals in staging" + + " environments.") + .enabled(true) + .expirationDate(1703187336000L) + .name("Example-Security-Monitoring") + .ruleQuery("type:log_detection source:cloudtrail") + .dataExclusionQuery("account_id:12345")) + .type(SecurityMonitoringSuppressionType.SUPPRESSIONS)); + + try { + SecurityMonitoringSuppressionResponse result = + apiInstance.createSecurityMonitoringSuppression(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#createSecurityMonitoringSuppression"); + 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/model/SecurityMonitoringSuppressionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionAttributes.java index a50db645bb2..73a348d3b84 100644 --- a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionAttributes.java @@ -20,6 +20,7 @@ @JsonPropertyOrder({ SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_CREATION_DATE, SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_CREATOR, + SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_DATA_EXCLUSION_QUERY, SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_DESCRIPTION, SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_ENABLED, SecurityMonitoringSuppressionAttributes.JSON_PROPERTY_EXPIRATION_DATE, @@ -40,6 +41,9 @@ public class SecurityMonitoringSuppressionAttributes { public static final String JSON_PROPERTY_CREATOR = "creator"; private SecurityMonitoringUser creator; + public static final String JSON_PROPERTY_DATA_EXCLUSION_QUERY = "data_exclusion_query"; + private String dataExclusionQuery; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; @@ -110,6 +114,29 @@ public void setCreator(SecurityMonitoringUser creator) { this.creator = creator; } + public SecurityMonitoringSuppressionAttributes dataExclusionQuery(String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; + return this; + } + + /** + * An exclusion query on the input data of the security rules, which could be logs, Agent events, + * or other types of data based on the security rule. Events matching this query are ignored by + * any detection rules referenced in the suppression rule. + * + * @return dataExclusionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA_EXCLUSION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDataExclusionQuery() { + return dataExclusionQuery; + } + + public void setDataExclusionQuery(String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; + } + public SecurityMonitoringSuppressionAttributes description(String description) { this.description = description; return this; @@ -363,6 +390,8 @@ public boolean equals(Object o) { (SecurityMonitoringSuppressionAttributes) o; return Objects.equals(this.creationDate, securityMonitoringSuppressionAttributes.creationDate) && Objects.equals(this.creator, securityMonitoringSuppressionAttributes.creator) + && Objects.equals( + this.dataExclusionQuery, securityMonitoringSuppressionAttributes.dataExclusionQuery) && Objects.equals(this.description, securityMonitoringSuppressionAttributes.description) && Objects.equals(this.enabled, securityMonitoringSuppressionAttributes.enabled) && Objects.equals( @@ -384,6 +413,7 @@ public int hashCode() { return Objects.hash( creationDate, creator, + dataExclusionQuery, description, enabled, expirationDate, @@ -402,6 +432,7 @@ public String toString() { sb.append("class SecurityMonitoringSuppressionAttributes {\n"); sb.append(" creationDate: ").append(toIndentedString(creationDate)).append("\n"); sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append(" dataExclusionQuery: ").append(toIndentedString(dataExclusionQuery)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionCreateAttributes.java index 52a378b6245..2636b948c92 100644 --- a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionCreateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionCreateAttributes.java @@ -19,6 +19,7 @@ /** Object containing the attributes of the suppression rule to be created. */ @JsonPropertyOrder({ + SecurityMonitoringSuppressionCreateAttributes.JSON_PROPERTY_DATA_EXCLUSION_QUERY, SecurityMonitoringSuppressionCreateAttributes.JSON_PROPERTY_DESCRIPTION, SecurityMonitoringSuppressionCreateAttributes.JSON_PROPERTY_ENABLED, SecurityMonitoringSuppressionCreateAttributes.JSON_PROPERTY_EXPIRATION_DATE, @@ -30,6 +31,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class SecurityMonitoringSuppressionCreateAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_EXCLUSION_QUERY = "data_exclusion_query"; + private String dataExclusionQuery; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; @@ -54,13 +58,34 @@ public SecurityMonitoringSuppressionCreateAttributes() {} public SecurityMonitoringSuppressionCreateAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, - @JsonProperty(required = true, value = JSON_PROPERTY_RULE_QUERY) String ruleQuery, - @JsonProperty(required = true, value = JSON_PROPERTY_SUPPRESSION_QUERY) - String suppressionQuery) { + @JsonProperty(required = true, value = JSON_PROPERTY_RULE_QUERY) String ruleQuery) { this.enabled = enabled; this.name = name; this.ruleQuery = ruleQuery; - this.suppressionQuery = suppressionQuery; + } + + public SecurityMonitoringSuppressionCreateAttributes dataExclusionQuery( + String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; + return this; + } + + /** + * An exclusion query on the input data of the security rules, which could be logs, Agent events, + * or other types of data based on the security rule. Events matching this query are ignored by + * any detection rules referenced in the suppression rule. + * + * @return dataExclusionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA_EXCLUSION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDataExclusionQuery() { + return dataExclusionQuery; + } + + public void setDataExclusionQuery(String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; } public SecurityMonitoringSuppressionCreateAttributes description(String description) { @@ -174,12 +199,14 @@ public SecurityMonitoringSuppressionCreateAttributes suppressionQuery(String sup /** * The suppression query of the suppression rule. If a signal matches this query, it is suppressed - * and is not triggered . Same syntax as the queries to search signals in the signal explorer. + * and is not triggered. It uses the same syntax as the queries to search signals in the Signals + * Explorer. * * @return suppressionQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_SUPPRESSION_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSuppressionQuery() { return suppressionQuery; } @@ -247,6 +274,9 @@ public boolean equals(Object o) { SecurityMonitoringSuppressionCreateAttributes securityMonitoringSuppressionCreateAttributes = (SecurityMonitoringSuppressionCreateAttributes) o; return Objects.equals( + this.dataExclusionQuery, + securityMonitoringSuppressionCreateAttributes.dataExclusionQuery) + && Objects.equals( this.description, securityMonitoringSuppressionCreateAttributes.description) && Objects.equals(this.enabled, securityMonitoringSuppressionCreateAttributes.enabled) && Objects.equals( @@ -263,6 +293,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + dataExclusionQuery, description, enabled, expirationDate, @@ -276,6 +307,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SecurityMonitoringSuppressionCreateAttributes {\n"); + sb.append(" dataExclusionQuery: ").append(toIndentedString(dataExclusionQuery)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionUpdateAttributes.java index e57968b47f5..783c5bf056c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionUpdateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSuppressionUpdateAttributes.java @@ -19,6 +19,7 @@ /** The suppression rule properties to be updated. */ @JsonPropertyOrder({ + SecurityMonitoringSuppressionUpdateAttributes.JSON_PROPERTY_DATA_EXCLUSION_QUERY, SecurityMonitoringSuppressionUpdateAttributes.JSON_PROPERTY_DESCRIPTION, SecurityMonitoringSuppressionUpdateAttributes.JSON_PROPERTY_ENABLED, SecurityMonitoringSuppressionUpdateAttributes.JSON_PROPERTY_EXPIRATION_DATE, @@ -31,6 +32,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class SecurityMonitoringSuppressionUpdateAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_EXCLUSION_QUERY = "data_exclusion_query"; + private String dataExclusionQuery; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; @@ -52,6 +56,30 @@ public class SecurityMonitoringSuppressionUpdateAttributes { public static final String JSON_PROPERTY_VERSION = "version"; private Integer version; + public SecurityMonitoringSuppressionUpdateAttributes dataExclusionQuery( + String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; + return this; + } + + /** + * An exclusion query on the input data of the security rules, which could be logs, Agent events, + * or other types of data based on the security rule. Events matching this query are ignored by + * any detection rules referenced in the suppression rule. + * + * @return dataExclusionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA_EXCLUSION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDataExclusionQuery() { + return dataExclusionQuery; + } + + public void setDataExclusionQuery(String dataExclusionQuery) { + this.dataExclusionQuery = dataExclusionQuery; + } + public SecurityMonitoringSuppressionUpdateAttributes description(String description) { this.description = description; return this; @@ -273,6 +301,9 @@ public boolean equals(Object o) { SecurityMonitoringSuppressionUpdateAttributes securityMonitoringSuppressionUpdateAttributes = (SecurityMonitoringSuppressionUpdateAttributes) o; return Objects.equals( + this.dataExclusionQuery, + securityMonitoringSuppressionUpdateAttributes.dataExclusionQuery) + && Objects.equals( this.description, securityMonitoringSuppressionUpdateAttributes.description) && Objects.equals(this.enabled, securityMonitoringSuppressionUpdateAttributes.enabled) && Objects.equals( @@ -290,6 +321,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + dataExclusionQuery, description, enabled, expirationDate, @@ -304,6 +336,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SecurityMonitoringSuppressionUpdateAttributes {\n"); + sb.append(" dataExclusionQuery: ").append(toIndentedString(dataExclusionQuery)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); diff --git a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.freeze index cc25655a1b4..311c12c3437 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.freeze @@ -1 +1 @@ -2024-01-11T10:06:23.179Z \ No newline at end of file +2024-04-08T09:56:58.589Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.json index 36d52e8834b..a97013f949d 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"enabled\":true,\"expiration_date\":1703187336000,\"name\":\"Test-Create_a_suppression_rule_returns_OK_response-1704967583\",\"rule_query\":\"type:log_detection source:cloudtrail\",\"suppression_query\":\"env:staging status:low\"},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"enabled\":true,\"expiration_date\":1703187336000,\"name\":\"Test-Create_a_suppression_rule_returns_OK_response-1712570218\",\"rule_query\":\"type:log_detection source:cloudtrail\",\"suppression_query\":\"env:staging status:low\"},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"5sx-nhj-htc\",\"attributes\":{\"name\":\"Test-Create_a_suppression_rule_returns_OK_response-1704967583\",\"enabled\":true,\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"rule_query\":\"type:log_detection source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"expiration_date\":1703187336000,\"version\":1,\"creation_date\":1704967583506,\"update_date\":1704967583506,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "body": "{\"data\":{\"id\":\"mu8-qje-pys\",\"attributes\":{\"name\":\"Test-Create_a_suppression_rule_returns_OK_response-1712570218\",\"enabled\":true,\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"rule_query\":\"type:log_detection source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"log_exclusion_query\":\"\",\"data_exclusion_query\":\"\",\"expiration_date\":1703187336000,\"version\":1,\"creation_date\":1712570219298,\"update_date\":1712570219298,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "06dec730-58ad-7ecc-2764-224c70dc8bb1" + "id": "a9dfe349-62b8-7652-2695-8539d321adc0" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/5sx-nhj-htc", + "path": "/api/v2/security_monitoring/configuration/suppressions/mu8-qje-pys", "keepAlive": false, "secure": true }, @@ -52,6 +52,6 @@ "timeToLive": { "unlimited": true }, - "id": "2d5046a8-e77b-ef3b-2544-26e42b43a7aa" + "id": "4a92fd5b-a337-ac23-47c5-74b1bfdf06e6" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze new file mode 100644 index 00000000000..42e62d263a9 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-04-08T09:57:01.815Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.json new file mode 100644 index 00000000000..ad8405a0bad --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"data_exclusion_query\":\"account_id:12345\",\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"enabled\":true,\"expiration_date\":1703187336000,\"name\":\"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1712570221\",\"rule_query\":\"type:log_detection source:cloudtrail\"},\"type\":\"suppressions\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/security_monitoring/configuration/suppressions", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"2dj-cxs-dg6\",\"attributes\":{\"name\":\"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1712570221\",\"enabled\":true,\"description\":\"This rule suppresses low-severity signals in staging environments.\",\"rule_query\":\"type:log_detection source:cloudtrail\",\"suppression_query\":\"\",\"log_exclusion_query\":\"account_id:12345\",\"data_exclusion_query\":\"account_id:12345\",\"expiration_date\":1703187336000,\"version\":1,\"creation_date\":1712570222285,\"update_date\":1712570222285,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f761e438-cef4-76d0-b59f-e66684b8d331" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/security_monitoring/configuration/suppressions/2dj-cxs-dg6", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c8824d37-b2ff-1bcd-4ce7-5db594e55a3d" + } +] \ 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 513c4886510..7409a388df9 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 @@ -2024-01-11T10:06:31.876Z \ No newline at end of file +2024-04-08T09:57:31.186Z \ 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 d2098983e93..6783ef4141a 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-1704967591\",\"enabled\":true,\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1704967591\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\"},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"enabled\":true,\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\"},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"vac-d9u-mmr\",\"attributes\":{\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1704967591\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1704967591\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"version\":1,\"creation_date\":1704967592204,\"update_date\":1704967592204,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "body": "{\"data\":{\"id\":\"zrh-zwa-bgu\",\"attributes\":{\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"log_exclusion_query\":\"\",\"data_exclusion_query\":\"\",\"version\":1,\"creation_date\":1712570252683,\"update_date\":1712570252683,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,18 +27,18 @@ "timeToLive": { "unlimited": true }, - "id": "50e8bc48-db89-3343-e42b-8cd91d6f7efd" + "id": "70e7f137-fe19-0c5a-29b7-0b2c57525341" }, { "httpRequest": { "headers": {}, "method": "GET", - "path": "/api/v2/security_monitoring/configuration/suppressions/vac-d9u-mmr", + "path": "/api/v2/security_monitoring/configuration/suppressions/zrh-zwa-bgu", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"vac-d9u-mmr\",\"attributes\":{\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1704967591\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1704967591\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"version\":1,\"creation_date\":1704967592204,\"update_date\":1704967592204,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "body": "{\"data\":{\"id\":\"zrh-zwa-bgu\",\"attributes\":{\"name\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"enabled\":true,\"description\":\"Test-Get_a_suppression_rule_returns_OK_response-1712570251\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"log_exclusion_query\":\"\",\"data_exclusion_query\":\"\",\"version\":1,\"creation_date\":1712570252683,\"update_date\":1712570252683,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -53,13 +53,13 @@ "timeToLive": { "unlimited": true }, - "id": "c6a4d879-0428-23d3-f173-8d8ea1756d4d" + "id": "c16b2d81-6d76-c171-a4df-4c49a64dffa0" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/vac-d9u-mmr", + "path": "/api/v2/security_monitoring/configuration/suppressions/zrh-zwa-bgu", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "e4715e19-3992-be16-4df3-0b501939f0a5" + "id": "3146ff65-246e-3b67-bf0c-c41e1d553817" } ] \ 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 1fae5f63e7c..8af9e82dae2 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 @@ -2024-01-11T10:06:37.000Z \ No newline at end of file +2024-04-08T09:57:43.431Z \ 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 6973342168f..df3b5cf6b23 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-1704967597\",\"enabled\":true,\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1704967597\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\"},\"type\":\"suppressions\"}}" + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"enabled\":true,\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\"},\"type\":\"suppressions\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"xhe-kbx-qym\",\"attributes\":{\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1704967597\",\"enabled\":true,\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1704967597\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"version\":1,\"creation_date\":1704967597310,\"update_date\":1704967597310,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "body": "{\"data\":{\"id\":\"h4v-y6f-ycg\",\"attributes\":{\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"enabled\":true,\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:test\",\"log_exclusion_query\":\"\",\"data_exclusion_query\":\"\",\"version\":1,\"creation_date\":1712570264756,\"update_date\":1712570264756,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "0a4df5bd-ebd7-d792-15d6-7c824b5d87ed" + "id": "5d902b92-e705-116e-f0c1-5bfe8e88af47" }, { "httpRequest": { @@ -37,12 +37,12 @@ }, "headers": {}, "method": "PATCH", - "path": "/api/v2/security_monitoring/configuration/suppressions/xhe-kbx-qym", + "path": "/api/v2/security_monitoring/configuration/suppressions/h4v-y6f-ycg", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"xhe-kbx-qym\",\"attributes\":{\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1704967597\",\"enabled\":true,\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1704967597\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"version\":2,\"creation_date\":1704967597310,\"update_date\":1704967597660,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", + "body": "{\"data\":{\"id\":\"h4v-y6f-ycg\",\"attributes\":{\"name\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"enabled\":true,\"description\":\"Test-Update_a_suppression_rule_returns_OK_response-1712570263\",\"rule_query\":\"source:cloudtrail\",\"suppression_query\":\"env:staging status:low\",\"log_exclusion_query\":\"\",\"data_exclusion_query\":\"\",\"version\":2,\"creation_date\":1712570264756,\"update_date\":1712570265486,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"},\"updater\":{\"name\":null,\"handle\":\"frog@datadoghq.com\"}},\"type\":\"suppressions\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "99982b4a-97d2-80b2-4d88-fa946de48bab" + "id": "b1755b12-3f70-3b83-5958-c98158b107db" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/security_monitoring/configuration/suppressions/xhe-kbx-qym", + "path": "/api/v2/security_monitoring/configuration/suppressions/h4v-y6f-ycg", "keepAlive": false, "secure": true }, @@ -82,6 +82,6 @@ "timeToLive": { "unlimited": true }, - "id": "53571d32-147b-a6c7-9637-4188f8e863a6" + "id": "39b7f07b-3937-0624-219a-eb6147a0e41a" } ] \ 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 b505f2a4fcb..ba592532d60 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 @@ -160,18 +160,18 @@ Feature: Security Monitoring @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "Bad Request" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "Conflict" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 409 Conflict - @team:DataDog/k9-cloud-security-platform + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "OK" response Given new "CreateSecurityMonitoringSuppression" request And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} @@ -181,6 +181,17 @@ Feature: Security Monitoring And the response "data.attributes.enabled" is equal to true And the response "data.attributes.rule_query" is equal to "type:log_detection source:cloudtrail" + @skip-validation @team:DataDog/k9-cloud-security-platform + Scenario: Create a suppression rule with an exclusion query returns "OK" response + Given new "CreateSecurityMonitoringSuppression" request + And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "data_exclusion_query": "account_id:12345"}, "type": "suppressions"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "suppressions" + And the response "data.attributes.enabled" is equal to true + And the response "data.attributes.rule_query" is equal to "type:log_detection source:cloudtrail" + And the response "data.attributes.data_exclusion_query" is equal to "account_id:12345" + @skip @team:DataDog/k9-cloud-security-platform Scenario: Delete a non existing rule returns "Not Found" response Given new "DeleteSecurityMonitoringRule" request @@ -188,7 +199,7 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found - @team:DataDog/k9-cloud-security-platform + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Delete a security filter returns "No Content" response Given there is a valid "security_filter" in the system And new "DeleteSecurityFilter" request @@ -217,7 +228,7 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found - @team:DataDog/k9-cloud-security-platform + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Delete a suppression rule returns "OK" response Given there is a valid "suppression" in the system And new "DeleteSecurityMonitoringSuppression" request @@ -368,14 +379,14 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK - @team:DataDog/k9-cloud-security-platform + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Get a suppression rule returns "Not Found" response Given new "GetSecurityMonitoringSuppression" 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 + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Get a suppression rule returns "OK" response Given new "GetSecurityMonitoringSuppression" request And there is a valid "suppression" in the system @@ -547,7 +558,7 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Bad Request" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 400 Bad Request @@ -555,7 +566,7 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Concurrent Modification" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 409 Concurrent Modification @@ -563,11 +574,11 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Not Found" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 404 Not Found - @team:DataDog/k9-cloud-security-platform + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Update a suppression rule returns "OK" response Given new "UpdateSecurityMonitoringSuppression" request And there is a valid "suppression" in the system