diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f701faf62be..deeffc834b5 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -50854,6 +50854,8 @@ components: maximum: 5 minimum: 1 type: integer + suppressions: + $ref: '#/components/schemas/SensitiveDataScannerSuppressions' tags: description: List of tags. items: @@ -51075,6 +51077,32 @@ components: type: $ref: '#/components/schemas/SensitiveDataScannerStandardPatternType' type: object + SensitiveDataScannerSuppressions: + description: 'Object describing the suppressions for a rule. There are three + types of suppressions, `starts_with`, `ends_with`, and `exact_match`. + + Suppressed matches are not obfuscated, counted in metrics, or displayed in + the Findings page.' + properties: + ends_with: + description: List of strings to use for suppression of matches ending with + these strings. + items: + type: string + type: array + exact_match: + description: List of strings to use for suppression of matches exactly matching + these strings. + items: + type: string + type: array + starts_with: + description: List of strings to use for suppression of matches starting + with these strings. + items: + type: string + type: array + type: object SensitiveDataScannerTextReplacement: description: Object describing how the scanned event will be replaced. properties: diff --git a/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerRuleAttributes.java index 47b3accd16a..71cbaea1c5d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerRuleAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerRuleAttributes.java @@ -28,6 +28,7 @@ SensitiveDataScannerRuleAttributes.JSON_PROPERTY_NAMESPACES, SensitiveDataScannerRuleAttributes.JSON_PROPERTY_PATTERN, SensitiveDataScannerRuleAttributes.JSON_PROPERTY_PRIORITY, + SensitiveDataScannerRuleAttributes.JSON_PROPERTY_SUPPRESSIONS, SensitiveDataScannerRuleAttributes.JSON_PROPERTY_TAGS, SensitiveDataScannerRuleAttributes.JSON_PROPERTY_TEXT_REPLACEMENT }) @@ -60,6 +61,9 @@ public class SensitiveDataScannerRuleAttributes { public static final String JSON_PROPERTY_PRIORITY = "priority"; private Long priority; + public static final String JSON_PROPERTY_SUPPRESSIONS = "suppressions"; + private SensitiveDataScannerSuppressions suppressions; + public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -259,6 +263,31 @@ public void setPriority(Long priority) { this.priority = priority; } + public SensitiveDataScannerRuleAttributes suppressions( + SensitiveDataScannerSuppressions suppressions) { + this.suppressions = suppressions; + this.unparsed |= suppressions.unparsed; + return this; + } + + /** + * Object describing the suppressions for a rule. There are three types of suppressions, + * starts_with, ends_with, and exact_match. Suppressed matches + * are not obfuscated, counted in metrics, or displayed in the Findings page. + * + * @return suppressions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUPPRESSIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SensitiveDataScannerSuppressions getSuppressions() { + return suppressions; + } + + public void setSuppressions(SensitiveDataScannerSuppressions suppressions) { + this.suppressions = suppressions; + } + public SensitiveDataScannerRuleAttributes tags(List tags) { this.tags = tags; return this; @@ -379,6 +408,7 @@ public boolean equals(Object o) { && Objects.equals(this.namespaces, sensitiveDataScannerRuleAttributes.namespaces) && Objects.equals(this.pattern, sensitiveDataScannerRuleAttributes.pattern) && Objects.equals(this.priority, sensitiveDataScannerRuleAttributes.priority) + && Objects.equals(this.suppressions, sensitiveDataScannerRuleAttributes.suppressions) && Objects.equals(this.tags, sensitiveDataScannerRuleAttributes.tags) && Objects.equals(this.textReplacement, sensitiveDataScannerRuleAttributes.textReplacement) && Objects.equals( @@ -396,6 +426,7 @@ public int hashCode() { namespaces, pattern, priority, + suppressions, tags, textReplacement, additionalProperties); @@ -415,6 +446,7 @@ public String toString() { sb.append(" namespaces: ").append(toIndentedString(namespaces)).append("\n"); sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" suppressions: ").append(toIndentedString(suppressions)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" textReplacement: ").append(toIndentedString(textReplacement)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerSuppressions.java b/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerSuppressions.java new file mode 100644 index 00000000000..e151424a480 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SensitiveDataScannerSuppressions.java @@ -0,0 +1,223 @@ +/* + * 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; + +/** + * Object describing the suppressions for a rule. There are three types of suppressions, + * starts_with, ends_with, and exact_match. Suppressed matches are + * not obfuscated, counted in metrics, or displayed in the Findings page. + */ +@JsonPropertyOrder({ + SensitiveDataScannerSuppressions.JSON_PROPERTY_ENDS_WITH, + SensitiveDataScannerSuppressions.JSON_PROPERTY_EXACT_MATCH, + SensitiveDataScannerSuppressions.JSON_PROPERTY_STARTS_WITH +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SensitiveDataScannerSuppressions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENDS_WITH = "ends_with"; + private List endsWith = null; + + public static final String JSON_PROPERTY_EXACT_MATCH = "exact_match"; + private List exactMatch = null; + + public static final String JSON_PROPERTY_STARTS_WITH = "starts_with"; + private List startsWith = null; + + public SensitiveDataScannerSuppressions endsWith(List endsWith) { + this.endsWith = endsWith; + return this; + } + + public SensitiveDataScannerSuppressions addEndsWithItem(String endsWithItem) { + if (this.endsWith == null) { + this.endsWith = new ArrayList<>(); + } + this.endsWith.add(endsWithItem); + return this; + } + + /** + * List of strings to use for suppression of matches ending with these strings. + * + * @return endsWith + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENDS_WITH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEndsWith() { + return endsWith; + } + + public void setEndsWith(List endsWith) { + this.endsWith = endsWith; + } + + public SensitiveDataScannerSuppressions exactMatch(List exactMatch) { + this.exactMatch = exactMatch; + return this; + } + + public SensitiveDataScannerSuppressions addExactMatchItem(String exactMatchItem) { + if (this.exactMatch == null) { + this.exactMatch = new ArrayList<>(); + } + this.exactMatch.add(exactMatchItem); + return this; + } + + /** + * List of strings to use for suppression of matches exactly matching these strings. + * + * @return exactMatch + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXACT_MATCH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getExactMatch() { + return exactMatch; + } + + public void setExactMatch(List exactMatch) { + this.exactMatch = exactMatch; + } + + public SensitiveDataScannerSuppressions startsWith(List startsWith) { + this.startsWith = startsWith; + return this; + } + + public SensitiveDataScannerSuppressions addStartsWithItem(String startsWithItem) { + if (this.startsWith == null) { + this.startsWith = new ArrayList<>(); + } + this.startsWith.add(startsWithItem); + return this; + } + + /** + * List of strings to use for suppression of matches starting with these strings. + * + * @return startsWith + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STARTS_WITH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getStartsWith() { + return startsWith; + } + + public void setStartsWith(List startsWith) { + this.startsWith = startsWith; + } + + /** + * 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 SensitiveDataScannerSuppressions + */ + @JsonAnySetter + public SensitiveDataScannerSuppressions 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 SensitiveDataScannerSuppressions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SensitiveDataScannerSuppressions sensitiveDataScannerSuppressions = + (SensitiveDataScannerSuppressions) o; + return Objects.equals(this.endsWith, sensitiveDataScannerSuppressions.endsWith) + && Objects.equals(this.exactMatch, sensitiveDataScannerSuppressions.exactMatch) + && Objects.equals(this.startsWith, sensitiveDataScannerSuppressions.startsWith) + && Objects.equals( + this.additionalProperties, sensitiveDataScannerSuppressions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endsWith, exactMatch, startsWith, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SensitiveDataScannerSuppressions {\n"); + sb.append(" endsWith: ").append(toIndentedString(endsWith)).append("\n"); + sb.append(" exactMatch: ").append(toIndentedString(exactMatch)).append("\n"); + sb.append(" startsWith: ").append(toIndentedString(startsWith)).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/com/datadog/api/client/v2/api/sensitive_data_scanner.feature b/src/test/resources/com/datadog/api/client/v2/api/sensitive_data_scanner.feature index 4516e161032..13023b09bcd 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/sensitive_data_scanner.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/sensitive_data_scanner.feature @@ -196,11 +196,11 @@ Feature: Sensitive Data Scanner When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/sensitive-data-scanner + @team:DataDog/sensitive-data-scanner Scenario: Update Scanning Rule returns "Not Found" response Given new "UpdateScanningRule" request And request contains "rule_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"excluded_namespaces": ["admin.name"], "included_keyword_configuration": {"character_count": 30, "keywords": ["credit card", "cc"]}, "namespaces": ["admin"], "tags": [], "text_replacement": {"type": "none"}}, "relationships": {"group": {"data": {"type": "sensitive_data_scanner_group"}}, "standard_pattern": {"data": {"type": "sensitive_data_scanner_standard_pattern"}}}, "type": "sensitive_data_scanner_rule"}, "meta": {"version": 0}} + And body with value {"data": {"attributes": {"excluded_namespaces": ["admin.name"], "included_keyword_configuration": {"character_count": 30, "keywords": ["credit card", "cc"]}, "namespaces": ["admin"], "suppressions": {"ends_with": ["@datadoghq.com"], "exact_match": ["admin"], "starts_with": ["oli"]}, "tags": [], "text_replacement": {"type": "none"}}, "relationships": {"group": {"data": {"type": "sensitive_data_scanner_group"}}, "standard_pattern": {"data": {"type": "sensitive_data_scanner_standard_pattern"}}}, "type": "sensitive_data_scanner_rule"}, "meta": {"version": 0}} When the request is sent Then the response status is 404 Not Found