diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4ae4adc660..b45344d6de 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -131055,6 +131055,14 @@ components: type: $ref: "#/components/schemas/SensitiveDataScannerGroupType" type: object + SensitiveDataScannerGroupTarget: + description: Datadog product whose scanning groups are served by the target-scoped group routes. + enum: + - llm_observability + example: llm_observability + type: string + x-enum-varnames: + - LLM_OBSERVABILITY SensitiveDataScannerGroupType: default: sensitive_data_scanner_group description: Sensitive Data Scanner group type. @@ -131495,6 +131503,104 @@ components: to a standard pattern. If set to `false`, the specified suppressions are applied. type: boolean type: object + SensitiveDataScannerTargetGroupAttributes: + description: Attributes of a scanning group of a target. + properties: + description: + description: Description of the group. + example: "" + type: string + filter: + $ref: "#/components/schemas/SensitiveDataScannerFilter" + is_enabled: + description: Whether or not the group is enabled. + example: true + type: boolean + name: + description: Name of the group. + example: Agent Observability Span Scanning + type: string + product_list: + description: Products the scanning group applies to. + example: + - llm_observability + items: + $ref: "#/components/schemas/SensitiveDataScannerGroupTarget" + type: array + samplings: + description: Sampling rates per product type. Always empty for these targets. + items: + $ref: "#/components/schemas/SensitiveDataScannerSamplings" + type: array + required: + - name + - description + - product_list + - is_enabled + - filter + - samplings + type: object + SensitiveDataScannerTargetGroupData: + description: A scanning group of a target. + properties: + attributes: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupAttributes" + id: + description: ID of the group. + example: 6f1c2a4e-3b5d-4e8f-9a7b-1c2d3e4f5a6b + type: string + relationships: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupRelationships" + type: + $ref: "#/components/schemas/SensitiveDataScannerGroupType" + required: + - id + - type + - attributes + - relationships + type: object + SensitiveDataScannerTargetGroupIncludedArray: + description: Rules of the returned groups. + items: + $ref: "#/components/schemas/SensitiveDataScannerRuleIncludedItem" + type: array + SensitiveDataScannerTargetGroupListResponse: + description: Scanning groups of a target, with their rules included. + properties: + data: + description: Scanning groups of the target, in order. + items: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupData" + type: array + included: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupIncludedArray" + meta: + $ref: "#/components/schemas/SensitiveDataScannerMeta" + required: + - data + - meta + type: object + SensitiveDataScannerTargetGroupRelationships: + description: Relationships of a scanning group of a target. + properties: + rules: + $ref: "#/components/schemas/SensitiveDataScannerRuleData" + required: + - rules + type: object + SensitiveDataScannerTargetGroupResponse: + description: A scanning group of a target, with its rules included. + properties: + data: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupData" + included: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupIncludedArray" + meta: + $ref: "#/components/schemas/SensitiveDataScannerMeta" + required: + - data + - meta + type: object SensitiveDataScannerTextReplacement: description: Object describing how the scanned event will be replaced. properties: @@ -255047,6 +255153,199 @@ paths: operator: OR permissions: - data_scanner_read + /api/v2/sensitive-data-scanner/groups: + get: + description: |- + List the scanning groups of a target, with their rules included. + Only the `llm_observability` target is supported. Scanning groups of logs, RUM, events, and APM + are listed by the List Scanning Groups endpoint. + If the organization has no scanning group for the target, its default group is stored and returned, + so it can be edited. This does not change what gets scanned, because the default rules already apply. + operationId: ListTargetScanningGroups + parameters: + - description: Target whose scanning groups are listed. + in: query + name: filter[target] + required: true + schema: + $ref: "#/components/schemas/SensitiveDataScannerGroupTarget" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + description: "" + filter: + query: "" + is_enabled: true + name: Agent Observability Span Scanning + product_list: + - llm_observability + samplings: [] + id: 6f1c2a4e-3b5d-4e8f-9a7b-1c2d3e4f5a6b + relationships: + rules: + data: + - id: 0e9d8c7b-6a5f-4e3d-8c1b-0a9f8e7d6c5b + type: sensitive_data_scanner_rule + type: sensitive_data_scanner_group + included: + - attributes: + description: Detects credit card numbers. + excluded_namespaces: [] + included_keyword_configuration: + character_count: 30 + keywords: + - credit card + use_recommended_keywords: true + is_enabled: true + name: Credit card scanner + namespaces: [] + priority: 1 + suppressions: + use_recommended_suppressions: true + tags: + - sensitive_data:credit_card + - sensitive_data_category:financial + text_replacement: + replacement_string: "[Credit card scanner]" + type: replacement_string + id: 0e9d8c7b-6a5f-4e3d-8c1b-0a9f8e7d6c5b + relationships: + group: + data: + id: 6f1c2a4e-3b5d-4e8f-9a7b-1c2d3e4f5a6b + type: sensitive_data_scanner_group + standard_pattern: + data: + id: ruleIdBank-123456789 + type: sensitive_data_scanner_standard_pattern + type: sensitive_data_scanner_rule + meta: {} + schema: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List Scanning Groups of a target + tags: + - Sensitive Data Scanner + "x-permission": + operator: OR + permissions: + - data_scanner_read + /api/v2/sensitive-data-scanner/groups/{group_id}: + get: + description: |- + Get a scanning group, with its rules included. + Only scanning groups of the `llm_observability` target are returned. Other scanning groups + are reported as not found. + operationId: GetScanningGroup + parameters: + - $ref: "#/components/parameters/SensitiveDataScannerGroupID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: "" + filter: + query: "" + is_enabled: true + name: Agent Observability Span Scanning + product_list: + - llm_observability + samplings: [] + id: 6f1c2a4e-3b5d-4e8f-9a7b-1c2d3e4f5a6b + relationships: + rules: + data: + - id: 0e9d8c7b-6a5f-4e3d-8c1b-0a9f8e7d6c5b + type: sensitive_data_scanner_rule + type: sensitive_data_scanner_group + included: + - attributes: + description: Detects credit card numbers. + excluded_namespaces: [] + included_keyword_configuration: + character_count: 30 + keywords: + - credit card + use_recommended_keywords: true + is_enabled: true + name: Credit card scanner + namespaces: [] + priority: 1 + suppressions: + use_recommended_suppressions: true + tags: + - sensitive_data:credit_card + - sensitive_data_category:financial + text_replacement: + replacement_string: "[Credit card scanner]" + type: replacement_string + id: 0e9d8c7b-6a5f-4e3d-8c1b-0a9f8e7d6c5b + relationships: + group: + data: + id: 6f1c2a4e-3b5d-4e8f-9a7b-1c2d3e4f5a6b + type: sensitive_data_scanner_group + standard_pattern: + data: + id: ruleIdBank-123456789 + type: sensitive_data_scanner_standard_pattern + type: sensitive_data_scanner_rule + meta: {} + schema: + $ref: "#/components/schemas/SensitiveDataScannerTargetGroupResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get Scanning Group + tags: + - Sensitive Data Scanner + "x-permission": + operator: OR + permissions: + - data_scanner_read /api/v2/series: post: description: |- diff --git a/examples/v2/sensitive-data-scanner/GetScanningGroup.py b/examples/v2/sensitive-data-scanner/GetScanningGroup.py new file mode 100644 index 0000000000..44b4c37d95 --- /dev/null +++ b/examples/v2/sensitive-data-scanner/GetScanningGroup.py @@ -0,0 +1,17 @@ +""" +Get Scanning Group returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.sensitive_data_scanner_api import SensitiveDataScannerApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = SensitiveDataScannerApi(api_client) + response = api_instance.get_scanning_group( + group_id="group_id", + ) + + print(response) diff --git a/examples/v2/sensitive-data-scanner/ListTargetScanningGroups.py b/examples/v2/sensitive-data-scanner/ListTargetScanningGroups.py new file mode 100644 index 0000000000..a65f079639 --- /dev/null +++ b/examples/v2/sensitive-data-scanner/ListTargetScanningGroups.py @@ -0,0 +1,18 @@ +""" +List Scanning Groups of a target returns "OK" response +""" + +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_target import SensitiveDataScannerGroupTarget + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = SensitiveDataScannerApi(api_client) + response = api_instance.list_target_scanning_groups( + filter_target=SensitiveDataScannerGroupTarget.LLM_OBSERVABILITY, + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/sensitive_data_scanner_api.py b/src/datadog_api_client/v2/api/sensitive_data_scanner_api.py index 707eaa9aca..0fdc6b1cad 100644 --- a/src/datadog_api_client/v2/api/sensitive_data_scanner_api.py +++ b/src/datadog_api_client/v2/api/sensitive_data_scanner_api.py @@ -45,6 +45,13 @@ from datadog_api_client.v2.model.sensitive_data_scanner_standard_patterns_response_data import ( SensitiveDataScannerStandardPatternsResponseData, ) +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_list_response import ( + SensitiveDataScannerTargetGroupListResponse, +) +from datadog_api_client.v2.model.sensitive_data_scanner_group_target import SensitiveDataScannerGroupTarget +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_response import ( + SensitiveDataScannerTargetGroupResponse, +) class SensitiveDataScannerApi: @@ -149,6 +156,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_scanning_group_endpoint = _Endpoint( + settings={ + "response_type": (SensitiveDataScannerTargetGroupResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/sensitive-data-scanner/groups/{group_id}", + "operation_id": "get_scanning_group", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "group_id": { + "required": True, + "openapi_types": (str,), + "attribute": "group_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_scanning_groups_endpoint = _Endpoint( settings={ "response_type": (SensitiveDataScannerGetConfigResponse,), @@ -181,6 +211,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_target_scanning_groups_endpoint = _Endpoint( + settings={ + "response_type": (SensitiveDataScannerTargetGroupListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/sensitive-data-scanner/groups", + "operation_id": "list_target_scanning_groups", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_target": { + "required": True, + "openapi_types": (SensitiveDataScannerGroupTarget,), + "attribute": "filter[target]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._reorder_scanning_groups_endpoint = _Endpoint( settings={ "response_type": (SensitiveDataScannerReorderGroupsResponse,), @@ -335,6 +388,25 @@ def delete_scanning_rule( return self._delete_scanning_rule_endpoint.call_with_http_info(**kwargs) + def get_scanning_group( + self, + group_id: str, + ) -> SensitiveDataScannerTargetGroupResponse: + """Get Scanning Group. + + Get a scanning group, with its rules included. + Only scanning groups of the ``llm_observability`` target are returned. Other scanning groups + are reported as not found. + + :param group_id: The ID of a group of rules. + :type group_id: str + :rtype: SensitiveDataScannerTargetGroupResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["group_id"] = group_id + + return self._get_scanning_group_endpoint.call_with_http_info(**kwargs) + def list_scanning_groups( self, ) -> SensitiveDataScannerGetConfigResponse: @@ -359,6 +431,27 @@ def list_standard_patterns( kwargs: Dict[str, Any] = {} return self._list_standard_patterns_endpoint.call_with_http_info(**kwargs) + def list_target_scanning_groups( + self, + filter_target: SensitiveDataScannerGroupTarget, + ) -> SensitiveDataScannerTargetGroupListResponse: + """List Scanning Groups of a target. + + List the scanning groups of a target, with their rules included. + Only the ``llm_observability`` target is supported. Scanning groups of logs, RUM, events, and APM + are listed by the List Scanning Groups endpoint. + If the organization has no scanning group for the target, its default group is stored and returned, + so it can be edited. This does not change what gets scanned, because the default rules already apply. + + :param filter_target: Target whose scanning groups are listed. + :type filter_target: SensitiveDataScannerGroupTarget + :rtype: SensitiveDataScannerTargetGroupListResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["filter_target"] = filter_target + + return self._list_target_scanning_groups_endpoint.call_with_http_info(**kwargs) + def reorder_scanning_groups( self, body: SensitiveDataScannerConfigRequest, diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_group_target.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_group_target.py new file mode 100644 index 0000000000..d28edc5168 --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_group_target.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class SensitiveDataScannerGroupTarget(ModelSimple): + """ + Datadog product whose scanning groups are served by the target-scoped group routes. + + :param value: If omitted defaults to "llm_observability". Must be one of ["llm_observability"]. + :type value: str + """ + + allowed_values = { + "llm_observability", + } + LLM_OBSERVABILITY: ClassVar["SensitiveDataScannerGroupTarget"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SensitiveDataScannerGroupTarget.LLM_OBSERVABILITY = SensitiveDataScannerGroupTarget("llm_observability") diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_attributes.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_attributes.py new file mode 100644 index 0000000000..6f38f80245 --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_attributes.py @@ -0,0 +1,83 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_filter import SensitiveDataScannerFilter + from datadog_api_client.v2.model.sensitive_data_scanner_group_target import SensitiveDataScannerGroupTarget + from datadog_api_client.v2.model.sensitive_data_scanner_samplings import SensitiveDataScannerSamplings + + +class SensitiveDataScannerTargetGroupAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_filter import SensitiveDataScannerFilter + from datadog_api_client.v2.model.sensitive_data_scanner_group_target import SensitiveDataScannerGroupTarget + from datadog_api_client.v2.model.sensitive_data_scanner_samplings import SensitiveDataScannerSamplings + + return { + "description": (str,), + "filter": (SensitiveDataScannerFilter,), + "is_enabled": (bool,), + "name": (str,), + "product_list": ([SensitiveDataScannerGroupTarget],), + "samplings": ([SensitiveDataScannerSamplings],), + } + + attribute_map = { + "description": "description", + "filter": "filter", + "is_enabled": "is_enabled", + "name": "name", + "product_list": "product_list", + "samplings": "samplings", + } + + def __init__( + self_, + description: str, + filter: SensitiveDataScannerFilter, + is_enabled: bool, + name: str, + product_list: List[SensitiveDataScannerGroupTarget], + samplings: List[SensitiveDataScannerSamplings], + **kwargs, + ): + """ + Attributes of a scanning group of a target. + + :param description: Description of the group. + :type description: str + + :param filter: Filter for the Scanning Group. + :type filter: SensitiveDataScannerFilter + + :param is_enabled: Whether or not the group is enabled. + :type is_enabled: bool + + :param name: Name of the group. + :type name: str + + :param product_list: Products the scanning group applies to. + :type product_list: [SensitiveDataScannerGroupTarget] + + :param samplings: Sampling rates per product type. Always empty for these targets. + :type samplings: [SensitiveDataScannerSamplings] + """ + super().__init__(kwargs) + + self_.description = description + self_.filter = filter + self_.is_enabled = is_enabled + self_.name = name + self_.product_list = product_list + self_.samplings = samplings diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_data.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_data.py new file mode 100644 index 0000000000..6c9f286d00 --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_data.py @@ -0,0 +1,77 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_attributes import ( + SensitiveDataScannerTargetGroupAttributes, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_relationships import ( + SensitiveDataScannerTargetGroupRelationships, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_group_type import SensitiveDataScannerGroupType + + +class SensitiveDataScannerTargetGroupData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_attributes import ( + SensitiveDataScannerTargetGroupAttributes, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_relationships import ( + SensitiveDataScannerTargetGroupRelationships, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_group_type import SensitiveDataScannerGroupType + + return { + "attributes": (SensitiveDataScannerTargetGroupAttributes,), + "id": (str,), + "relationships": (SensitiveDataScannerTargetGroupRelationships,), + "type": (SensitiveDataScannerGroupType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: SensitiveDataScannerTargetGroupAttributes, + id: str, + relationships: SensitiveDataScannerTargetGroupRelationships, + type: SensitiveDataScannerGroupType, + **kwargs, + ): + """ + A scanning group of a target. + + :param attributes: Attributes of a scanning group of a target. + :type attributes: SensitiveDataScannerTargetGroupAttributes + + :param id: ID of the group. + :type id: str + + :param relationships: Relationships of a scanning group of a target. + :type relationships: SensitiveDataScannerTargetGroupRelationships + + :param type: Sensitive Data Scanner group type. + :type type: SensitiveDataScannerGroupType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_list_response.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_list_response.py new file mode 100644 index 0000000000..2a23e6b9f8 --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_list_response.py @@ -0,0 +1,71 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_data import SensitiveDataScannerTargetGroupData + from datadog_api_client.v2.model.sensitive_data_scanner_rule_included_item import ( + SensitiveDataScannerRuleIncludedItem, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_meta import SensitiveDataScannerMeta + + +class SensitiveDataScannerTargetGroupListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_data import ( + SensitiveDataScannerTargetGroupData, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_rule_included_item import ( + SensitiveDataScannerRuleIncludedItem, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_meta import SensitiveDataScannerMeta + + return { + "data": ([SensitiveDataScannerTargetGroupData],), + "included": ([SensitiveDataScannerRuleIncludedItem],), + "meta": (SensitiveDataScannerMeta,), + } + + attribute_map = { + "data": "data", + "included": "included", + "meta": "meta", + } + + def __init__( + self_, + data: List[SensitiveDataScannerTargetGroupData], + meta: SensitiveDataScannerMeta, + included: Union[List[SensitiveDataScannerRuleIncludedItem], UnsetType] = unset, + **kwargs, + ): + """ + Scanning groups of a target, with their rules included. + + :param data: Scanning groups of the target, in order. + :type data: [SensitiveDataScannerTargetGroupData] + + :param included: Rules of the returned groups. + :type included: [SensitiveDataScannerRuleIncludedItem], optional + + :param meta: Meta response. Always an empty object. + :type meta: SensitiveDataScannerMeta + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_relationships.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_relationships.py new file mode 100644 index 0000000000..16b92c7e16 --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_relationships.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_rule_data import SensitiveDataScannerRuleData + + +class SensitiveDataScannerTargetGroupRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_rule_data import SensitiveDataScannerRuleData + + return { + "rules": (SensitiveDataScannerRuleData,), + } + + attribute_map = { + "rules": "rules", + } + + def __init__(self_, rules: SensitiveDataScannerRuleData, **kwargs): + """ + Relationships of a scanning group of a target. + + :param rules: Rules included in the group. + :type rules: SensitiveDataScannerRuleData + """ + super().__init__(kwargs) + + self_.rules = rules diff --git a/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_response.py b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_response.py new file mode 100644 index 0000000000..96e181162a --- /dev/null +++ b/src/datadog_api_client/v2/model/sensitive_data_scanner_target_group_response.py @@ -0,0 +1,71 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_data import SensitiveDataScannerTargetGroupData + from datadog_api_client.v2.model.sensitive_data_scanner_rule_included_item import ( + SensitiveDataScannerRuleIncludedItem, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_meta import SensitiveDataScannerMeta + + +class SensitiveDataScannerTargetGroupResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.sensitive_data_scanner_target_group_data import ( + SensitiveDataScannerTargetGroupData, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_rule_included_item import ( + SensitiveDataScannerRuleIncludedItem, + ) + from datadog_api_client.v2.model.sensitive_data_scanner_meta import SensitiveDataScannerMeta + + return { + "data": (SensitiveDataScannerTargetGroupData,), + "included": ([SensitiveDataScannerRuleIncludedItem],), + "meta": (SensitiveDataScannerMeta,), + } + + attribute_map = { + "data": "data", + "included": "included", + "meta": "meta", + } + + def __init__( + self_, + data: SensitiveDataScannerTargetGroupData, + meta: SensitiveDataScannerMeta, + included: Union[List[SensitiveDataScannerRuleIncludedItem], UnsetType] = unset, + **kwargs, + ): + """ + A scanning group of a target, with its rules included. + + :param data: A scanning group of a target. + :type data: SensitiveDataScannerTargetGroupData + + :param included: Rules of the returned groups. + :type included: [SensitiveDataScannerRuleIncludedItem], optional + + :param meta: Meta response. Always an empty object. + :type meta: SensitiveDataScannerMeta + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 2b97d25c74..37ab856f86 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -11617,6 +11617,7 @@ SensitiveDataScannerGroupRelationships, ) from datadog_api_client.v2.model.sensitive_data_scanner_group_response import SensitiveDataScannerGroupResponse +from datadog_api_client.v2.model.sensitive_data_scanner_group_target import SensitiveDataScannerGroupTarget from datadog_api_client.v2.model.sensitive_data_scanner_group_type import SensitiveDataScannerGroupType from datadog_api_client.v2.model.sensitive_data_scanner_group_update import SensitiveDataScannerGroupUpdate from datadog_api_client.v2.model.sensitive_data_scanner_group_update_request import ( @@ -11674,6 +11675,19 @@ SensitiveDataScannerStandardPatternsResponseItem, ) from datadog_api_client.v2.model.sensitive_data_scanner_suppressions import SensitiveDataScannerSuppressions +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_attributes import ( + SensitiveDataScannerTargetGroupAttributes, +) +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_data import SensitiveDataScannerTargetGroupData +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_list_response import ( + SensitiveDataScannerTargetGroupListResponse, +) +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_relationships import ( + SensitiveDataScannerTargetGroupRelationships, +) +from datadog_api_client.v2.model.sensitive_data_scanner_target_group_response import ( + SensitiveDataScannerTargetGroupResponse, +) from datadog_api_client.v2.model.sensitive_data_scanner_text_replacement import SensitiveDataScannerTextReplacement from datadog_api_client.v2.model.sensitive_data_scanner_text_replacement_type import ( SensitiveDataScannerTextReplacementType, @@ -21653,6 +21667,7 @@ "SensitiveDataScannerGroupList", "SensitiveDataScannerGroupRelationships", "SensitiveDataScannerGroupResponse", + "SensitiveDataScannerGroupTarget", "SensitiveDataScannerGroupType", "SensitiveDataScannerGroupUpdate", "SensitiveDataScannerGroupUpdateRequest", @@ -21686,6 +21701,11 @@ "SensitiveDataScannerStandardPatternsResponseData", "SensitiveDataScannerStandardPatternsResponseItem", "SensitiveDataScannerSuppressions", + "SensitiveDataScannerTargetGroupAttributes", + "SensitiveDataScannerTargetGroupData", + "SensitiveDataScannerTargetGroupListResponse", + "SensitiveDataScannerTargetGroupRelationships", + "SensitiveDataScannerTargetGroupResponse", "SensitiveDataScannerTextReplacement", "SensitiveDataScannerTextReplacementType", "SerialExecution", diff --git a/tests/v2/features/sensitive_data_scanner.feature b/tests/v2/features/sensitive_data_scanner.feature index 3abab68e58..c550e751e9 100644 --- a/tests/v2/features/sensitive_data_scanner.feature +++ b/tests/v2/features/sensitive_data_scanner.feature @@ -116,6 +116,41 @@ Feature: Sensitive Data Scanner When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/sensitive-data-scanner + Scenario: Get Scanning Group returns "Bad Request" response + Given new "GetScanningGroup" request + And request contains "group_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/sensitive-data-scanner + Scenario: Get Scanning Group returns "Not Found" response + Given new "GetScanningGroup" request + And request contains "group_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/sensitive-data-scanner + Scenario: Get Scanning Group returns "OK" response + Given new "GetScanningGroup" request + And request contains "group_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/sensitive-data-scanner + Scenario: List Scanning Groups of a target returns "Bad Request" response + Given new "ListTargetScanningGroups" request + And request contains "filter[target]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/sensitive-data-scanner + Scenario: List Scanning Groups of a target returns "OK" response + Given new "ListTargetScanningGroups" request + And request contains "filter[target]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/sensitive-data-scanner Scenario: List Scanning Groups returns "Bad Request" response Given new "ListScanningGroups" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 94d2e66680..150a6d63ca 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -10198,6 +10198,18 @@ "type": "safe" } }, + "ListTargetScanningGroups": { + "tag": "Sensitive Data Scanner", + "undo": { + "type": "safe" + } + }, + "GetScanningGroup": { + "tag": "Sensitive Data Scanner", + "undo": { + "type": "safe" + } + }, "SubmitMetrics": { "tag": "Metrics", "undo": {