From 4825b292d45fc190e847e1ea450752c9e729f693 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 5 Jan 2024 16:08:13 +0000 Subject: [PATCH] Regenerate client from commit bafcada7 of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 40 ++++++++++++++ docs/datadog_api_client.v2.model.rst | 7 +++ .../CreateScanningRule.py | 9 ++++ .../UpdateScanningRule.py | 23 ++++---- ..._scanner_included_keyword_configuration.py | 52 +++++++++++++++++++ .../sensitive_data_scanner_rule_attributes.py | 17 ++++++ src/datadog_api_client/v2/models/__init__.py | 4 ++ ...e_scanning_rule_returns_ok_response.frozen | 2 +- ...ate_scanning_rule_returns_ok_response.yaml | 18 ++++--- ...e_scanning_rule_returns_ok_response.frozen | 2 +- ...ate_scanning_rule_returns_ok_response.yaml | 23 ++++---- .../features/sensitive_data_scanner.feature | 8 +-- 13 files changed, 171 insertions(+), 42 deletions(-) create mode 100644 src/datadog_api_client/v2/model/sensitive_data_scanner_included_keyword_configuration.py diff --git a/.apigentools-info b/.apigentools-info index c47c5d1474..fd62c19a61 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-05 15:09:31.771541", - "spec_repo_commit": "9cbf6566" + "regenerated": "2024-01-05 16:07:37.284367", + "spec_repo_commit": "bafcada7" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-05 15:09:31.789729", - "spec_repo_commit": "9cbf6566" + "regenerated": "2024-01-05 16:07:37.299570", + "spec_repo_commit": "bafcada7" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c00a3f8543..92f333119e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16878,6 +16878,44 @@ components: meta: $ref: '#/components/schemas/SensitiveDataScannerMetaVersionOnly' type: object + SensitiveDataScannerIncludedKeywordConfiguration: + description: 'Object defining a set of keywords and a number of characters that + help reduce noise. + + You can provide a list of keywords you would like to check within a defined + proximity of the matching pattern. + + If any of the keywords are found within the proximity check, the match is + kept. + + If none are found, the match is discarded.' + properties: + character_count: + description: 'The number of characters behind a match detected by Sensitive + Data Scanner to look for the keywords defined. + + `character_count` should be greater than the maximum length of a keyword + defined for a rule.' + example: 30 + format: int64 + maximum: 50 + minimum: 1 + type: integer + keywords: + description: 'Keyword list that will be checked during scanning in order + to validate a match. + + The number of keywords in the list must be less than or equal to 20.' + example: + - credit card + - cc + items: + type: string + type: array + required: + - keywords + - character_count + type: object SensitiveDataScannerMeta: description: Meta response containing information about the API. properties: @@ -16971,6 +17009,8 @@ components: items: type: string type: array + included_keyword_configuration: + $ref: '#/components/schemas/SensitiveDataScannerIncludedKeywordConfiguration' is_enabled: description: Whether or not the rule is enabled. type: boolean diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 250551c07f..eb62643d14 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -7554,6 +7554,13 @@ sensitive\_data\_scanner\_group\_update\_response :members: :show-inheritance: +sensitive\_data\_scanner\_included\_keyword\_configuration +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration + :members: + :show-inheritance: + sensitive\_data\_scanner\_meta ------------------------------ diff --git a/examples/v2/sensitive-data-scanner/CreateScanningRule.py b/examples/v2/sensitive-data-scanner/CreateScanningRule.py index 436e06f699..5bb878baa3 100644 --- a/examples/v2/sensitive-data-scanner/CreateScanningRule.py +++ b/examples/v2/sensitive-data-scanner/CreateScanningRule.py @@ -8,6 +8,9 @@ from datadog_api_client.v2.model.sensitive_data_scanner_group import SensitiveDataScannerGroup from datadog_api_client.v2.model.sensitive_data_scanner_group_data import SensitiveDataScannerGroupData from datadog_api_client.v2.model.sensitive_data_scanner_group_type import SensitiveDataScannerGroupType +from datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration import ( + SensitiveDataScannerIncludedKeywordConfiguration, +) from datadog_api_client.v2.model.sensitive_data_scanner_meta_version_only import SensitiveDataScannerMetaVersionOnly from datadog_api_client.v2.model.sensitive_data_scanner_rule_attributes import SensitiveDataScannerRuleAttributes from datadog_api_client.v2.model.sensitive_data_scanner_rule_create import SensitiveDataScannerRuleCreate @@ -43,6 +46,12 @@ ], is_enabled=True, priority=1, + included_keyword_configuration=SensitiveDataScannerIncludedKeywordConfiguration( + keywords=[ + "credit card", + ], + character_count=35, + ), ), relationships=SensitiveDataScannerRuleRelationships( group=SensitiveDataScannerGroupData( diff --git a/examples/v2/sensitive-data-scanner/UpdateScanningRule.py b/examples/v2/sensitive-data-scanner/UpdateScanningRule.py index 8a933c2b3b..4d7cae707c 100644 --- a/examples/v2/sensitive-data-scanner/UpdateScanningRule.py +++ b/examples/v2/sensitive-data-scanner/UpdateScanningRule.py @@ -5,12 +5,11 @@ from os import environ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v2.api.sensitive_data_scanner_api import SensitiveDataScannerApi -from datadog_api_client.v2.model.sensitive_data_scanner_group import SensitiveDataScannerGroup -from datadog_api_client.v2.model.sensitive_data_scanner_group_data import SensitiveDataScannerGroupData -from datadog_api_client.v2.model.sensitive_data_scanner_group_type import SensitiveDataScannerGroupType +from datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration import ( + SensitiveDataScannerIncludedKeywordConfiguration, +) from datadog_api_client.v2.model.sensitive_data_scanner_meta_version_only import SensitiveDataScannerMetaVersionOnly from datadog_api_client.v2.model.sensitive_data_scanner_rule_attributes import SensitiveDataScannerRuleAttributes -from datadog_api_client.v2.model.sensitive_data_scanner_rule_relationships import SensitiveDataScannerRuleRelationships from datadog_api_client.v2.model.sensitive_data_scanner_rule_type import SensitiveDataScannerRuleType from datadog_api_client.v2.model.sensitive_data_scanner_rule_update import SensitiveDataScannerRuleUpdate from datadog_api_client.v2.model.sensitive_data_scanner_rule_update_request import SensitiveDataScannerRuleUpdateRequest @@ -22,9 +21,6 @@ # the "scanning_group" has a "scanning_rule" RULE_DATA_ID = environ["RULE_DATA_ID"] -# there is a valid "scanning_group" in the system -GROUP_DATA_ID = environ["GROUP_DATA_ID"] - body = SensitiveDataScannerRuleUpdateRequest( meta=SensitiveDataScannerMetaVersionOnly(), data=SensitiveDataScannerRuleUpdate( @@ -41,13 +37,12 @@ ], is_enabled=True, priority=5, - ), - relationships=SensitiveDataScannerRuleRelationships( - group=SensitiveDataScannerGroupData( - data=SensitiveDataScannerGroup( - type=SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP, - id=GROUP_DATA_ID, - ), + included_keyword_configuration=SensitiveDataScannerIncludedKeywordConfiguration( + keywords=[ + "credit card", + "cc", + ], + character_count=35, ), ), ), diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_included_keyword_configuration.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_included_keyword_configuration.py new file mode 100644 index 0000000000..612f18feed --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_included_keyword_configuration.py @@ -0,0 +1,52 @@ +# 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. +from __future__ import annotations + +from typing import List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class SensitiveDataScannerIncludedKeywordConfiguration(ModelNormal): + validations = { + "character_count": { + "inclusive_maximum": 50, + "inclusive_minimum": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "character_count": (int,), + "keywords": ([str],), + } + + attribute_map = { + "character_count": "character_count", + "keywords": "keywords", + } + + def __init__(self_, character_count: int, keywords: List[str], **kwargs): + """ + Object defining a set of keywords and a number of characters that help reduce noise. + You can provide a list of keywords you would like to check within a defined proximity of the matching pattern. + If any of the keywords are found within the proximity check, the match is kept. + If none are found, the match is discarded. + + :param character_count: The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined. + ``character_count`` should be greater than the maximum length of a keyword defined for a rule. + :type character_count: int + + :param keywords: Keyword list that will be checked during scanning in order to validate a match. + The number of keywords in the list must be less than or equal to 20. + :type keywords: [str] + """ + super().__init__(kwargs) + + self_.character_count = character_count + self_.keywords = keywords diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_rule_attributes.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_rule_attributes.py index b1e4bb069d..bd57f8e9aa 100644 --- a/src/datadog_api_client/v2/model/sensitive_data_scanner_rule_attributes.py +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_rule_attributes.py @@ -14,6 +14,9 @@ if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration import ( + SensitiveDataScannerIncludedKeywordConfiguration, + ) from datadog_api_client.v2.model.sensitive_data_scanner_text_replacement import SensitiveDataScannerTextReplacement @@ -27,6 +30,9 @@ class SensitiveDataScannerRuleAttributes(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration import ( + SensitiveDataScannerIncludedKeywordConfiguration, + ) from datadog_api_client.v2.model.sensitive_data_scanner_text_replacement import ( SensitiveDataScannerTextReplacement, ) @@ -34,6 +40,7 @@ def openapi_types(_): return { "description": (str,), "excluded_namespaces": ([str],), + "included_keyword_configuration": (SensitiveDataScannerIncludedKeywordConfiguration,), "is_enabled": (bool,), "name": (str,), "namespaces": ([str],), @@ -46,6 +53,7 @@ def openapi_types(_): attribute_map = { "description": "description", "excluded_namespaces": "excluded_namespaces", + "included_keyword_configuration": "included_keyword_configuration", "is_enabled": "is_enabled", "name": "name", "namespaces": "namespaces", @@ -59,6 +67,7 @@ def __init__( self_, description: Union[str, UnsetType] = unset, excluded_namespaces: Union[List[str], UnsetType] = unset, + included_keyword_configuration: Union[SensitiveDataScannerIncludedKeywordConfiguration, UnsetType] = unset, is_enabled: Union[bool, UnsetType] = unset, name: Union[str, UnsetType] = unset, namespaces: Union[List[str], UnsetType] = unset, @@ -77,6 +86,12 @@ def __init__( :param excluded_namespaces: Attributes excluded from the scan. If namespaces is provided, it has to be a sub-path of the namespaces array. :type excluded_namespaces: [str], optional + :param included_keyword_configuration: Object defining a set of keywords and a number of characters that help reduce noise. + You can provide a list of keywords you would like to check within a defined proximity of the matching pattern. + If any of the keywords are found within the proximity check, the match is kept. + If none are found, the match is discarded. + :type included_keyword_configuration: SensitiveDataScannerIncludedKeywordConfiguration, optional + :param is_enabled: Whether or not the rule is enabled. :type is_enabled: bool, optional @@ -103,6 +118,8 @@ def __init__( kwargs["description"] = description if excluded_namespaces is not unset: kwargs["excluded_namespaces"] = excluded_namespaces + if included_keyword_configuration is not unset: + kwargs["included_keyword_configuration"] = included_keyword_configuration if is_enabled is not unset: kwargs["is_enabled"] = is_enabled if name is not unset: diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8e056d9c2c..71a53a5ac2 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1291,6 +1291,9 @@ from datadog_api_client.v2.model.sensitive_data_scanner_group_update_response import ( SensitiveDataScannerGroupUpdateResponse, ) +from datadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configuration import ( + SensitiveDataScannerIncludedKeywordConfiguration, +) from datadog_api_client.v2.model.sensitive_data_scanner_meta import SensitiveDataScannerMeta from datadog_api_client.v2.model.sensitive_data_scanner_meta_version_only import SensitiveDataScannerMetaVersionOnly from datadog_api_client.v2.model.sensitive_data_scanner_product import SensitiveDataScannerProduct @@ -2649,6 +2652,7 @@ "SensitiveDataScannerGroupUpdate", "SensitiveDataScannerGroupUpdateRequest", "SensitiveDataScannerGroupUpdateResponse", + "SensitiveDataScannerIncludedKeywordConfiguration", "SensitiveDataScannerMeta", "SensitiveDataScannerMetaVersionOnly", "SensitiveDataScannerProduct", diff --git a/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.frozen index 66d9a10b11..f93c7c0d6e 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.frozen @@ -1 +1 @@ -2023-12-13T09:06:38.820Z \ No newline at end of file +2024-01-04T13:51:03.802Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.yaml index 575e9acf62..6441f322aa 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_scanning_rule_returns_ok_response.yaml @@ -8,7 +8,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config response: body: - string: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","type":"sensitive_data_scanner_group"},{"id":"01OnORacS5qHeVO7C97drg","type":"sensitive_data_scanner_group"}]}}},"meta":{"version":127243,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true},"included":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","attributes":{"name":"Example-Update_Scanning_Group_returns_OK_response_1696199477","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"01OnORacS5qHeVO7C97drg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}}]} + string: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","type":"sensitive_data_scanner_group"},{"id":"01OnORacS5qHeVO7C97drg","type":"sensitive_data_scanner_group"},{"id":"IuYiCydSTAWqDyW5242-XA","type":"sensitive_data_scanner_group"},{"id":"HwQk4sJHSRmhHyo6KyXHWw","type":"sensitive_data_scanner_group"},{"id":"NChKshYdT6SvdiJE62DQgg","type":"sensitive_data_scanner_group"},{"id":"q6h4G_icTLWHvnT9U90PfQ","type":"sensitive_data_scanner_group"},{"id":"sOpLckMyTYW1ZXMXMeJnnQ","type":"sensitive_data_scanner_group"},{"id":"_o1TJ7yVSoKJLD9ioIyjeQ","type":"sensitive_data_scanner_group"},{"id":"yWBB9T6cQwarJAo0GzrdXw","type":"sensitive_data_scanner_group"}]}}},"meta":{"version":135496,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true},"included":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","attributes":{"name":"Example-Update_Scanning_Group_returns_OK_response_1696199477","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"01OnORacS5qHeVO7C97drg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"IuYiCydSTAWqDyW5242-XA","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"HwQk4sJHSRmhHyo6KyXHWw","attributes":{"name":"Example-Create_Scanning_Group_returns_OK_response_1702721006","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"NChKshYdT6SvdiJE62DQgg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"q6h4G_icTLWHvnT9U90PfQ","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"sOpLckMyTYW1ZXMXMeJnnQ","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"_o1TJ7yVSoKJLD9ioIyjeQ","attributes":{"name":"Example-Create_Scanning_Group_returns_OK_response_1703945006","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"yWBB9T6cQwarJAo0GzrdXw","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}}]} ' headers: @@ -28,7 +28,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups response: body: - string: '{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":127244}} + string: '{"data":{"id":"bAkcDr-KRlCrw7Ojq_-tJg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":135497}} ' headers: @@ -38,7 +38,8 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"excluded_namespaces":["admin.name"],"is_enabled":true,"name":"Test-Create_Scanning_Rule_returns_OK_response-1702458398","namespaces":["admin"],"pattern":"pattern","priority":1,"tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}' + body: '{"data":{"attributes":{"excluded_namespaces":["admin.name"],"included_keyword_configuration":{"character_count":35,"keywords":["credit + card"]},"is_enabled":true,"name":"Test-Create_Scanning_Rule_returns_OK_response-1704376263","namespaces":["admin"],"pattern":"pattern","priority":1,"tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"bAkcDr-KRlCrw7Ojq_-tJg","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}' headers: accept: - application/json @@ -48,7 +49,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules response: body: - string: '{"data":{"id":"Xp3fpaEhSGKqtDFmXvJZwQ","attributes":{"name":"Test-Create_Scanning_Rule_returns_OK_response-1702458398","namespaces":["admin"],"excluded_namespaces":["admin.name"],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":1},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","type":"sensitive_data_scanner_group"}}}},"meta":{"version":127245}} + string: '{"data":{"id":"UwDWflSLSumJJeTlczBlGQ","attributes":{"name":"Test-Create_Scanning_Rule_returns_OK_response-1704376263","namespaces":["admin"],"excluded_namespaces":["admin.name"],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":1,"included_keyword_configuration":{"keywords":["credit + card"],"character_count":35}},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"bAkcDr-KRlCrw7Ojq_-tJg","type":"sensitive_data_scanner_group"}}}},"meta":{"version":135498}} ' headers: @@ -65,10 +67,10 @@ interactions: content-type: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/Xp3fpaEhSGKqtDFmXvJZwQ + uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/UwDWflSLSumJJeTlczBlGQ response: body: - string: '{"meta":{"version":127246}} + string: '{"meta":{"version":135499}} ' headers: @@ -85,10 +87,10 @@ interactions: content-type: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/Dyurbbz2Tk23SMEr4fcHCw + uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/bAkcDr-KRlCrw7Ojq_-tJg response: body: - string: '{"meta":{"version":127247}} + string: '{"meta":{"version":135500}} ' headers: diff --git a/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.frozen index da74cd47cf..0cca74faaa 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.frozen @@ -1 +1 @@ -2023-12-13T09:06:40.913Z \ No newline at end of file +2024-01-04T13:51:06.530Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.yaml index 426f5ddb59..b9695376b6 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_scanning_rule_returns_ok_response.yaml @@ -8,7 +8,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config response: body: - string: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","type":"sensitive_data_scanner_group"},{"id":"01OnORacS5qHeVO7C97drg","type":"sensitive_data_scanner_group"}]}}},"meta":{"version":127247,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true},"included":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","attributes":{"name":"Example-Update_Scanning_Group_returns_OK_response_1696199477","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"01OnORacS5qHeVO7C97drg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}}]} + string: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","type":"sensitive_data_scanner_group"},{"id":"01OnORacS5qHeVO7C97drg","type":"sensitive_data_scanner_group"},{"id":"IuYiCydSTAWqDyW5242-XA","type":"sensitive_data_scanner_group"},{"id":"HwQk4sJHSRmhHyo6KyXHWw","type":"sensitive_data_scanner_group"},{"id":"NChKshYdT6SvdiJE62DQgg","type":"sensitive_data_scanner_group"},{"id":"q6h4G_icTLWHvnT9U90PfQ","type":"sensitive_data_scanner_group"},{"id":"sOpLckMyTYW1ZXMXMeJnnQ","type":"sensitive_data_scanner_group"},{"id":"_o1TJ7yVSoKJLD9ioIyjeQ","type":"sensitive_data_scanner_group"},{"id":"yWBB9T6cQwarJAo0GzrdXw","type":"sensitive_data_scanner_group"}]}}},"meta":{"version":135500,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true},"included":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","attributes":{"name":"Example-Update_Scanning_Group_returns_OK_response_1696199477","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"01OnORacS5qHeVO7C97drg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"IuYiCydSTAWqDyW5242-XA","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"HwQk4sJHSRmhHyo6KyXHWw","attributes":{"name":"Example-Create_Scanning_Group_returns_OK_response_1702721006","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"NChKshYdT6SvdiJE62DQgg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"q6h4G_icTLWHvnT9U90PfQ","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"sOpLckMyTYW1ZXMXMeJnnQ","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"_o1TJ7yVSoKJLD9ioIyjeQ","attributes":{"name":"Example-Create_Scanning_Group_returns_OK_response_1703945006","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"yWBB9T6cQwarJAo0GzrdXw","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}}]} ' headers: @@ -28,7 +28,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups response: body: - string: '{"data":{"id":"LAf2eSOlTQ6RTz2rwiQGsA","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":127248}} + string: '{"data":{"id":"UrKepb39S2STztB6JA5RFQ","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":135501}} ' headers: @@ -38,7 +38,7 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"is_enabled":true,"name":"Test-Update_Scanning_Rule_returns_OK_response-1702458400","namespaces":["admin.email"],"pattern":"pattern","tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"LAf2eSOlTQ6RTz2rwiQGsA","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}' + body: '{"data":{"attributes":{"is_enabled":true,"name":"Test-Update_Scanning_Rule_returns_OK_response-1704376266","namespaces":["admin.email"],"pattern":"pattern","tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"UrKepb39S2STztB6JA5RFQ","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}' headers: accept: - application/json @@ -48,7 +48,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules response: body: - string: '{"data":{"id":"N7Hb8CgTRayW0VADXfo9Wg","attributes":{"name":"Test-Update_Scanning_Rule_returns_OK_response-1702458400","namespaces":["admin.email"],"excluded_namespaces":[],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"LAf2eSOlTQ6RTz2rwiQGsA","type":"sensitive_data_scanner_group"}}}},"meta":{"version":127249}} + string: '{"data":{"id":"G0dXCPXuSWaG3WzXKdmwdg","attributes":{"name":"Test-Update_Scanning_Rule_returns_OK_response-1704376266","namespaces":["admin.email"],"excluded_namespaces":[],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"UrKepb39S2STztB6JA5RFQ","type":"sensitive_data_scanner_group"}}}},"meta":{"version":135502}} ' headers: @@ -58,17 +58,18 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"is_enabled":true,"name":"Test-Update_Scanning_Rule_returns_OK_response-1702458400","pattern":"pattern","priority":5,"tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"id":"N7Hb8CgTRayW0VADXfo9Wg","relationships":{"group":{"data":{"id":"LAf2eSOlTQ6RTz2rwiQGsA","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}' + body: '{"data":{"attributes":{"included_keyword_configuration":{"character_count":35,"keywords":["credit + card","cc"]},"is_enabled":true,"name":"Test-Update_Scanning_Rule_returns_OK_response-1704376266","pattern":"pattern","priority":5,"tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"id":"G0dXCPXuSWaG3WzXKdmwdg","type":"sensitive_data_scanner_rule"},"meta":{}}' headers: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/N7Hb8CgTRayW0VADXfo9Wg + uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/G0dXCPXuSWaG3WzXKdmwdg response: body: - string: '{"meta":{"version":127250}} + string: '{"meta":{"version":135503}} ' headers: @@ -85,10 +86,10 @@ interactions: content-type: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/N7Hb8CgTRayW0VADXfo9Wg + uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/G0dXCPXuSWaG3WzXKdmwdg response: body: - string: '{"meta":{"version":127251}} + string: '{"meta":{"version":135504}} ' headers: @@ -105,10 +106,10 @@ interactions: content-type: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/LAf2eSOlTQ6RTz2rwiQGsA + uri: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/UrKepb39S2STztB6JA5RFQ response: body: - string: '{"meta":{"version":127252}} + string: '{"meta":{"version":135505}} ' headers: diff --git a/tests/v2/features/sensitive_data_scanner.feature b/tests/v2/features/sensitive_data_scanner.feature index 8513e27ce8..0bc18d6694 100644 --- a/tests/v2/features/sensitive_data_scanner.feature +++ b/tests/v2/features/sensitive_data_scanner.feature @@ -39,12 +39,14 @@ Feature: Sensitive Data Scanner Given a valid "configuration" in the system And there is a valid "scanning_group" in the system And new "CreateScanningRule" request - And body with value {"meta":{},"data":{"type":"sensitive_data_scanner_rule","attributes":{"name":"{{ unique }}","pattern":"pattern", "namespaces": ["admin"], "excluded_namespaces": ["admin.name"], "text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":1},"relationships":{"group":{"data":{"type":"{{ group.data.type }}","id":"{{ group.data.id }}"}}}}} + And body with value {"meta":{},"data":{"type":"sensitive_data_scanner_rule","attributes":{"name":"{{ unique }}","pattern":"pattern", "namespaces": ["admin"], "excluded_namespaces": ["admin.name"], "text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":1,"included_keyword_configuration":{"keywords":["credit card"],"character_count":35}},"relationships":{"group":{"data":{"type":"{{ group.data.type }}","id":"{{ group.data.id }}"}}}}} When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "sensitive_data_scanner_rule" And the response "data.attributes.name" is equal to "{{ unique }}" And the response "data.attributes.pattern" is equal to "pattern" + And the response "data.attributes.included_keyword_configuration.character_count" is equal to 35 + And the response "data.attributes.included_keyword_configuration.keywords[0]" is equal to "credit card" @generated @skip @team:DataDog/logs-app @team:DataDog/logs-core Scenario: Delete Scanning Group returns "Bad Request" response @@ -185,7 +187,7 @@ Feature: 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"], "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"], "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 @@ -196,6 +198,6 @@ Feature: Sensitive Data Scanner And the "scanning_group" has a "scanning_rule" And new "UpdateScanningRule" request And request contains "rule_id" parameter from "rule.data.id" - And body with value {"meta":{},"data":{"id": "{{ rule.data.id }}", "type":"sensitive_data_scanner_rule","attributes":{"name":"{{ unique }}","pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":5},"relationships":{"group":{"data":{"type":"{{ group.data.type }}","id":"{{ group.data.id }}"}}}}} + And body with value {"meta":{},"data":{"id": "{{ rule.data.id }}", "type":"sensitive_data_scanner_rule","attributes":{"name":"{{ unique }}","pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":5,"included_keyword_configuration": {"keywords": ["credit card", "cc"], "character_count":35}}}} When the request is sent Then the response status is 200 OK