From 16ae730c24990e967a970bee876833c806114025 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 26 Nov 2025 13:49:05 +0000 Subject: [PATCH] Regenerate client from commit a989199 of spec repo --- .generator/schemas/v2/openapi.yaml | 131 ++++++++++++++---- docs/datadog_api_client.v2.model.rst | 63 +++++++-- .../GetSuppressionVersionHistory.py | 19 +++ .../v2/api/security_monitoring_api.py | 64 +++++++++ .../get_suppression_version_history_data.py | 68 +++++++++ ...t_suppression_version_history_data_type.py | 37 +++++ ...et_suppression_version_history_response.py | 42 ++++++ .../v2/model/rule_versions.py | 10 +- .../v2/model/suppression_version_history.py | 60 ++++++++ .../v2/model/suppression_versions.py | 60 ++++++++ ...on_update.py => version_history_update.py} | 12 +- ...type.py => version_history_update_type.py} | 14 +- src/datadog_api_client/v2/models/__init__.py | 18 ++- ..._history_returns_not_found_response.frozen | 1 + ...on_history_returns_not_found_response.yaml | 18 +++ ...version_history_returns_ok_response.frozen | 1 + ...s_version_history_returns_ok_response.yaml | 50 +++++++ tests/v2/features/security_monitoring.feature | 15 ++ tests/v2/features/undo.json | 6 + 19 files changed, 627 insertions(+), 62 deletions(-) create mode 100644 examples/v2/security-monitoring/GetSuppressionVersionHistory.py create mode 100644 src/datadog_api_client/v2/model/get_suppression_version_history_data.py create mode 100644 src/datadog_api_client/v2/model/get_suppression_version_history_data_type.py create mode 100644 src/datadog_api_client/v2/model/get_suppression_version_history_response.py create mode 100644 src/datadog_api_client/v2/model/suppression_version_history.py create mode 100644 src/datadog_api_client/v2/model/suppression_versions.py rename src/datadog_api_client/v2/model/{rule_version_update.py => version_history_update.py} (76%) rename src/datadog_api_client/v2/model/{rule_version_update_type.py => version_history_update_type.py} (63%) create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.yaml diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb71549..ca1b3d3da8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23526,6 +23526,30 @@ components: required: - data type: object + GetSuppressionVersionHistoryData: + description: Data for the suppression version history. + properties: + attributes: + $ref: '#/components/schemas/SuppressionVersionHistory' + id: + description: ID of the suppression. + type: string + type: + $ref: '#/components/schemas/GetSuppressionVersionHistoryDataType' + type: object + GetSuppressionVersionHistoryDataType: + description: Type of data. + enum: + - suppression_version_history + type: string + x-enum-varnames: + - SUPPRESSIONVERSIONHISTORY + GetSuppressionVersionHistoryResponse: + description: Response for getting the suppression version history. + properties: + data: + $ref: '#/components/schemas/GetSuppressionVersionHistoryData' + type: object GetTeamMembershipsSort: description: Specifies the order of returned team memberships enum: @@ -42745,38 +42769,13 @@ components: description: The `RuleVersionHistory` `data`. type: object type: object - RuleVersionUpdate: - description: A change in a rule version. - properties: - change: - description: The new value of the field. - example: cloud_provider:aws - type: string - field: - description: The field that was changed. - example: Tags - type: string - type: - $ref: '#/components/schemas/RuleVersionUpdateType' - type: object - RuleVersionUpdateType: - description: The type of change. - enum: - - create - - update - - delete - type: string - x-enum-varnames: - - CREATE - - UPDATE - - DELETE RuleVersions: description: A rule version with a list of updates. properties: changes: description: A list of changes. items: - $ref: '#/components/schemas/RuleVersionUpdate' + $ref: '#/components/schemas/VersionHistoryUpdate' type: array rule: $ref: '#/components/schemas/SecurityMonitoringRuleResponse' @@ -51322,6 +51321,32 @@ components: format: double type: number type: object + SuppressionVersionHistory: + description: Response object containing the version history of a suppression. + properties: + count: + description: The number of suppression versions. + format: int32 + maximum: 2147483647 + type: integer + data: + additionalProperties: + $ref: '#/components/schemas/SuppressionVersions' + description: A suppression version with a list of updates. + description: The `SuppressionVersionHistory` `data`. + type: object + type: object + SuppressionVersions: + description: A suppression version with a list of updates. + properties: + changes: + description: A list of changes. + items: + $ref: '#/components/schemas/VersionHistoryUpdate' + type: array + suppression: + $ref: '#/components/schemas/SecurityMonitoringSuppressionAttributes' + type: object TableResultV2: description: A reference table resource containing its full configuration and state. @@ -55372,6 +55397,31 @@ components: example: 1 format: int64 type: integer + VersionHistoryUpdate: + description: A change in a rule version. + properties: + change: + description: The new value of the field. + example: cloud_provider:aws + type: string + field: + description: The field that was changed. + example: Tags + type: string + type: + $ref: '#/components/schemas/VersionHistoryUpdateType' + type: object + VersionHistoryUpdateType: + description: The type of change. + enum: + - create + - update + - delete + type: string + x-enum-varnames: + - CREATE + - UPDATE + - DELETE VirusTotalAPIKey: description: The definition of the `VirusTotalAPIKey` object. properties: @@ -79065,6 +79115,35 @@ paths: summary: Update a suppression rule tags: - Security Monitoring + /api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history: + get: + description: Get a suppression's version history. + operationId: GetSuppressionVersionHistory + parameters: + - $ref: '#/components/parameters/SecurityMonitoringSuppressionID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetSuppressionVersionHistoryResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_suppressions_read + summary: Get a suppression's version history + tags: + - Security Monitoring /api/v2/security_monitoring/rules: get: description: List rules. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 60fdfd49e2..da3b8b62c1 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -9923,6 +9923,27 @@ datadog\_api\_client.v2.model.get\_sbom\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.get\_suppression\_version\_history\_data module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.get_suppression_version_history_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.get\_suppression\_version\_history\_data\_type module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.get_suppression_version_history_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.get\_suppression\_version\_history\_response module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.get_suppression_version_history_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.get\_team\_memberships\_sort module ----------------------------------------------------------------- @@ -18617,20 +18638,6 @@ datadog\_api\_client.v2.model.rule\_version\_history module :members: :show-inheritance: -datadog\_api\_client.v2.model.rule\_version\_update module ----------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.model.rule_version_update - :members: - :show-inheritance: - -datadog\_api\_client.v2.model.rule\_version\_update\_type module ----------------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.model.rule_version_update_type - :members: - :show-inheritance: - datadog\_api\_client.v2.model.rule\_versions module --------------------------------------------------- @@ -22684,6 +22691,20 @@ datadog\_api\_client.v2.model.step\_display\_bounds module :members: :show-inheritance: +datadog\_api\_client.v2.model.suppression\_version\_history module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.suppression_version_history + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.suppression\_versions module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.suppression_versions + :members: + :show-inheritance: + datadog\_api\_client.v2.model.table\_result\_v2 module ------------------------------------------------------ @@ -24616,6 +24637,20 @@ datadog\_api\_client.v2.model.validation\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.version\_history\_update module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.version_history_update + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.version\_history\_update\_type module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.version_history_update_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.virus\_total\_api\_key module ----------------------------------------------------------- diff --git a/examples/v2/security-monitoring/GetSuppressionVersionHistory.py b/examples/v2/security-monitoring/GetSuppressionVersionHistory.py new file mode 100644 index 0000000000..aaca8a253c --- /dev/null +++ b/examples/v2/security-monitoring/GetSuppressionVersionHistory.py @@ -0,0 +1,19 @@ +""" +Get a suppression's version history returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi + +# there is a valid "suppression" in the system +SUPPRESSION_DATA_ID = environ["SUPPRESSION_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.get_suppression_version_history( + suppression_id=SUPPRESSION_DATA_ID, + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/security_monitoring_api.py b/src/datadog_api_client/v2/api/security_monitoring_api.py index 30ca95c432..ee3561a57b 100644 --- a/src/datadog_api_client/v2/api/security_monitoring_api.py +++ b/src/datadog_api_client/v2/api/security_monitoring_api.py @@ -73,6 +73,7 @@ from datadog_api_client.v2.model.security_monitoring_suppression_update_request import ( SecurityMonitoringSuppressionUpdateRequest, ) +from datadog_api_client.v2.model.get_suppression_version_history_response import GetSuppressionVersionHistoryResponse from datadog_api_client.v2.model.security_monitoring_list_rules_response import SecurityMonitoringListRulesResponse from datadog_api_client.v2.model.security_monitoring_rule_response import SecurityMonitoringRuleResponse from datadog_api_client.v2.model.security_monitoring_rule_convert_response import SecurityMonitoringRuleConvertResponse @@ -1006,6 +1007,39 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_suppression_version_history_endpoint = _Endpoint( + settings={ + "response_type": (GetSuppressionVersionHistoryResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history", + "operation_id": "get_suppression_version_history", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "suppression_id": { + "required": True, + "openapi_types": (str,), + "attribute": "suppression_id", + "location": "path", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_threat_hunting_job_endpoint = _Endpoint( settings={ "response_type": (ThreatHuntingJobResponse,), @@ -2940,6 +2974,36 @@ def get_suppressions_affecting_rule( return self._get_suppressions_affecting_rule_endpoint.call_with_http_info(**kwargs) + def get_suppression_version_history( + self, + suppression_id: str, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + ) -> GetSuppressionVersionHistoryResponse: + """Get a suppression's version history. + + Get a suppression's version history. + + :param suppression_id: The ID of the suppression rule + :type suppression_id: str + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :rtype: GetSuppressionVersionHistoryResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["suppression_id"] = suppression_id + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + return self._get_suppression_version_history_endpoint.call_with_http_info(**kwargs) + def get_threat_hunting_job( self, job_id: str, diff --git a/src/datadog_api_client/v2/model/get_suppression_version_history_data.py b/src/datadog_api_client/v2/model/get_suppression_version_history_data.py new file mode 100644 index 0000000000..3c7dbca6b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/get_suppression_version_history_data.py @@ -0,0 +1,68 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.suppression_version_history import SuppressionVersionHistory + from datadog_api_client.v2.model.get_suppression_version_history_data_type import ( + GetSuppressionVersionHistoryDataType, + ) + + +class GetSuppressionVersionHistoryData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.suppression_version_history import SuppressionVersionHistory + from datadog_api_client.v2.model.get_suppression_version_history_data_type import ( + GetSuppressionVersionHistoryDataType, + ) + + return { + "attributes": (SuppressionVersionHistory,), + "id": (str,), + "type": (GetSuppressionVersionHistoryDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[SuppressionVersionHistory, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[GetSuppressionVersionHistoryDataType, UnsetType] = unset, + **kwargs, + ): + """ + Data for the suppression version history. + + :param attributes: Response object containing the version history of a suppression. + :type attributes: SuppressionVersionHistory, optional + + :param id: ID of the suppression. + :type id: str, optional + + :param type: Type of data. + :type type: GetSuppressionVersionHistoryDataType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/get_suppression_version_history_data_type.py b/src/datadog_api_client/v2/model/get_suppression_version_history_data_type.py new file mode 100644 index 0000000000..aff590cd91 --- /dev/null +++ b/src/datadog_api_client/v2/model/get_suppression_version_history_data_type.py @@ -0,0 +1,37 @@ +# 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 GetSuppressionVersionHistoryDataType(ModelSimple): + """ + Type of data. + + :param value: If omitted defaults to "suppression_version_history". Must be one of ["suppression_version_history"]. + :type value: str + """ + + allowed_values = { + "suppression_version_history", + } + SUPPRESSIONVERSIONHISTORY: ClassVar["GetSuppressionVersionHistoryDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GetSuppressionVersionHistoryDataType.SUPPRESSIONVERSIONHISTORY = GetSuppressionVersionHistoryDataType( + "suppression_version_history" +) diff --git a/src/datadog_api_client/v2/model/get_suppression_version_history_response.py b/src/datadog_api_client/v2/model/get_suppression_version_history_response.py new file mode 100644 index 0000000000..f20029c6b4 --- /dev/null +++ b/src/datadog_api_client/v2/model/get_suppression_version_history_response.py @@ -0,0 +1,42 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.get_suppression_version_history_data import GetSuppressionVersionHistoryData + + +class GetSuppressionVersionHistoryResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.get_suppression_version_history_data import GetSuppressionVersionHistoryData + + return { + "data": (GetSuppressionVersionHistoryData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[GetSuppressionVersionHistoryData, UnsetType] = unset, **kwargs): + """ + Response for getting the suppression version history. + + :param data: Data for the suppression version history. + :type data: GetSuppressionVersionHistoryData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/rule_versions.py b/src/datadog_api_client/v2/model/rule_versions.py index 98cb8d0cc4..30b0839ba9 100644 --- a/src/datadog_api_client/v2/model/rule_versions.py +++ b/src/datadog_api_client/v2/model/rule_versions.py @@ -14,7 +14,7 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.rule_version_update import RuleVersionUpdate + from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate from datadog_api_client.v2.model.security_monitoring_rule_response import SecurityMonitoringRuleResponse from datadog_api_client.v2.model.security_monitoring_standard_rule_response import ( SecurityMonitoringStandardRuleResponse, @@ -27,11 +27,11 @@ class RuleVersions(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.rule_version_update import RuleVersionUpdate + from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate from datadog_api_client.v2.model.security_monitoring_rule_response import SecurityMonitoringRuleResponse return { - "changes": ([RuleVersionUpdate],), + "changes": ([VersionHistoryUpdate],), "rule": (SecurityMonitoringRuleResponse,), } @@ -42,7 +42,7 @@ def openapi_types(_): def __init__( self_, - changes: Union[List[RuleVersionUpdate], UnsetType] = unset, + changes: Union[List[VersionHistoryUpdate], UnsetType] = unset, rule: Union[ SecurityMonitoringRuleResponse, SecurityMonitoringStandardRuleResponse, @@ -55,7 +55,7 @@ def __init__( A rule version with a list of updates. :param changes: A list of changes. - :type changes: [RuleVersionUpdate], optional + :type changes: [VersionHistoryUpdate], optional :param rule: Create a new rule. :type rule: SecurityMonitoringRuleResponse, optional diff --git a/src/datadog_api_client/v2/model/suppression_version_history.py b/src/datadog_api_client/v2/model/suppression_version_history.py new file mode 100644 index 0000000000..6e022cd373 --- /dev/null +++ b/src/datadog_api_client/v2/model/suppression_version_history.py @@ -0,0 +1,60 @@ +# 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 Dict, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.suppression_versions import SuppressionVersions + + +class SuppressionVersionHistory(ModelNormal): + validations = { + "count": { + "inclusive_maximum": 2147483647, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.suppression_versions import SuppressionVersions + + return { + "count": (int,), + "data": ({str: (SuppressionVersions,)},), + } + + attribute_map = { + "count": "count", + "data": "data", + } + + def __init__( + self_, + count: Union[int, UnsetType] = unset, + data: Union[Dict[str, SuppressionVersions], UnsetType] = unset, + **kwargs, + ): + """ + Response object containing the version history of a suppression. + + :param count: The number of suppression versions. + :type count: int, optional + + :param data: The ``SuppressionVersionHistory`` ``data``. + :type data: {str: (SuppressionVersions,)}, optional + """ + if count is not unset: + kwargs["count"] = count + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/suppression_versions.py b/src/datadog_api_client/v2/model/suppression_versions.py new file mode 100644 index 0000000000..6856eacbbb --- /dev/null +++ b/src/datadog_api_client/v2/model/suppression_versions.py @@ -0,0 +1,60 @@ +# 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.version_history_update import VersionHistoryUpdate + from datadog_api_client.v2.model.security_monitoring_suppression_attributes import ( + SecurityMonitoringSuppressionAttributes, + ) + + +class SuppressionVersions(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate + from datadog_api_client.v2.model.security_monitoring_suppression_attributes import ( + SecurityMonitoringSuppressionAttributes, + ) + + return { + "changes": ([VersionHistoryUpdate],), + "suppression": (SecurityMonitoringSuppressionAttributes,), + } + + attribute_map = { + "changes": "changes", + "suppression": "suppression", + } + + def __init__( + self_, + changes: Union[List[VersionHistoryUpdate], UnsetType] = unset, + suppression: Union[SecurityMonitoringSuppressionAttributes, UnsetType] = unset, + **kwargs, + ): + """ + A suppression version with a list of updates. + + :param changes: A list of changes. + :type changes: [VersionHistoryUpdate], optional + + :param suppression: The attributes of the suppression rule. + :type suppression: SecurityMonitoringSuppressionAttributes, optional + """ + if changes is not unset: + kwargs["changes"] = changes + if suppression is not unset: + kwargs["suppression"] = suppression + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/rule_version_update.py b/src/datadog_api_client/v2/model/version_history_update.py similarity index 76% rename from src/datadog_api_client/v2/model/rule_version_update.py rename to src/datadog_api_client/v2/model/version_history_update.py index 015e90b7a6..204bb5c384 100644 --- a/src/datadog_api_client/v2/model/rule_version_update.py +++ b/src/datadog_api_client/v2/model/version_history_update.py @@ -14,18 +14,18 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.rule_version_update_type import RuleVersionUpdateType + from datadog_api_client.v2.model.version_history_update_type import VersionHistoryUpdateType -class RuleVersionUpdate(ModelNormal): +class VersionHistoryUpdate(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.rule_version_update_type import RuleVersionUpdateType + from datadog_api_client.v2.model.version_history_update_type import VersionHistoryUpdateType return { "change": (str,), "field": (str,), - "type": (RuleVersionUpdateType,), + "type": (VersionHistoryUpdateType,), } attribute_map = { @@ -38,7 +38,7 @@ def __init__( self_, change: Union[str, UnsetType] = unset, field: Union[str, UnsetType] = unset, - type: Union[RuleVersionUpdateType, UnsetType] = unset, + type: Union[VersionHistoryUpdateType, UnsetType] = unset, **kwargs, ): """ @@ -51,7 +51,7 @@ def __init__( :type field: str, optional :param type: The type of change. - :type type: RuleVersionUpdateType, optional + :type type: VersionHistoryUpdateType, optional """ if change is not unset: kwargs["change"] = change diff --git a/src/datadog_api_client/v2/model/rule_version_update_type.py b/src/datadog_api_client/v2/model/version_history_update_type.py similarity index 63% rename from src/datadog_api_client/v2/model/rule_version_update_type.py rename to src/datadog_api_client/v2/model/version_history_update_type.py index 7d49189052..2f17ea075f 100644 --- a/src/datadog_api_client/v2/model/rule_version_update_type.py +++ b/src/datadog_api_client/v2/model/version_history_update_type.py @@ -12,7 +12,7 @@ from typing import ClassVar -class RuleVersionUpdateType(ModelSimple): +class VersionHistoryUpdateType(ModelSimple): """ The type of change. @@ -25,9 +25,9 @@ class RuleVersionUpdateType(ModelSimple): "update", "delete", } - CREATE: ClassVar["RuleVersionUpdateType"] - UPDATE: ClassVar["RuleVersionUpdateType"] - DELETE: ClassVar["RuleVersionUpdateType"] + CREATE: ClassVar["VersionHistoryUpdateType"] + UPDATE: ClassVar["VersionHistoryUpdateType"] + DELETE: ClassVar["VersionHistoryUpdateType"] @cached_property def openapi_types(_): @@ -36,6 +36,6 @@ def openapi_types(_): } -RuleVersionUpdateType.CREATE = RuleVersionUpdateType("create") -RuleVersionUpdateType.UPDATE = RuleVersionUpdateType("update") -RuleVersionUpdateType.DELETE = RuleVersionUpdateType("delete") +VersionHistoryUpdateType.CREATE = VersionHistoryUpdateType("create") +VersionHistoryUpdateType.UPDATE = VersionHistoryUpdateType("update") +VersionHistoryUpdateType.DELETE = VersionHistoryUpdateType("delete") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9cece11cff..2f75c4940b 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1916,6 +1916,9 @@ from datadog_api_client.v2.model.get_rule_version_history_data_type import GetRuleVersionHistoryDataType from datadog_api_client.v2.model.get_rule_version_history_response import GetRuleVersionHistoryResponse from datadog_api_client.v2.model.get_sbom_response import GetSBOMResponse +from datadog_api_client.v2.model.get_suppression_version_history_data import GetSuppressionVersionHistoryData +from datadog_api_client.v2.model.get_suppression_version_history_data_type import GetSuppressionVersionHistoryDataType +from datadog_api_client.v2.model.get_suppression_version_history_response import GetSuppressionVersionHistoryResponse from datadog_api_client.v2.model.get_team_memberships_sort import GetTeamMembershipsSort from datadog_api_client.v2.model.get_workflow_response import GetWorkflowResponse from datadog_api_client.v2.model.github_webhook_trigger import GithubWebhookTrigger @@ -3799,8 +3802,6 @@ from datadog_api_client.v2.model.rule_types_items import RuleTypesItems from datadog_api_client.v2.model.rule_user import RuleUser from datadog_api_client.v2.model.rule_version_history import RuleVersionHistory -from datadog_api_client.v2.model.rule_version_update import RuleVersionUpdate -from datadog_api_client.v2.model.rule_version_update_type import RuleVersionUpdateType from datadog_api_client.v2.model.rule_versions import RuleVersions from datadog_api_client.v2.model.rules_validate_query_request import RulesValidateQueryRequest from datadog_api_client.v2.model.rules_validate_query_request_data import RulesValidateQueryRequestData @@ -4541,6 +4542,8 @@ from datadog_api_client.v2.model.step import Step from datadog_api_client.v2.model.step_display import StepDisplay from datadog_api_client.v2.model.step_display_bounds import StepDisplayBounds +from datadog_api_client.v2.model.suppression_version_history import SuppressionVersionHistory +from datadog_api_client.v2.model.suppression_versions import SuppressionVersions from datadog_api_client.v2.model.table_result_v2 import TableResultV2 from datadog_api_client.v2.model.table_result_v2_array import TableResultV2Array from datadog_api_client.v2.model.table_result_v2_data import TableResultV2Data @@ -4889,6 +4892,8 @@ from datadog_api_client.v2.model.validation_error import ValidationError from datadog_api_client.v2.model.validation_error_meta import ValidationErrorMeta from datadog_api_client.v2.model.validation_response import ValidationResponse +from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate +from datadog_api_client.v2.model.version_history_update_type import VersionHistoryUpdateType from datadog_api_client.v2.model.virus_total_api_key import VirusTotalAPIKey from datadog_api_client.v2.model.virus_total_api_key_type import VirusTotalAPIKeyType from datadog_api_client.v2.model.virus_total_api_key_update import VirusTotalAPIKeyUpdate @@ -6368,6 +6373,9 @@ "GetRuleVersionHistoryDataType", "GetRuleVersionHistoryResponse", "GetSBOMResponse", + "GetSuppressionVersionHistoryData", + "GetSuppressionVersionHistoryDataType", + "GetSuppressionVersionHistoryResponse", "GetTeamMembershipsSort", "GetWorkflowResponse", "GithubWebhookTrigger", @@ -7663,8 +7671,6 @@ "RuleTypesItems", "RuleUser", "RuleVersionHistory", - "RuleVersionUpdate", - "RuleVersionUpdateType", "RuleVersions", "RulesValidateQueryRequest", "RulesValidateQueryRequestData", @@ -8197,6 +8203,8 @@ "Step", "StepDisplay", "StepDisplayBounds", + "SuppressionVersionHistory", + "SuppressionVersions", "TableResultV2", "TableResultV2Array", "TableResultV2Data", @@ -8473,6 +8481,8 @@ "ValidationError", "ValidationErrorMeta", "ValidationResponse", + "VersionHistoryUpdate", + "VersionHistoryUpdateType", "VirusTotalAPIKey", "VirusTotalAPIKeyType", "VirusTotalAPIKeyUpdate", diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.frozen new file mode 100644 index 0000000000..24bfeae8d4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-11-26T13:33:06.081Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.yaml new file mode 100644 index 0000000000..86f3340efa --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_not_found_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/this-does-not-exist/version_history + response: + body: + string: '{"errors":["not_found(Suppression with ID this-does-not-exist not found)"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.frozen new file mode 100644 index 0000000000..d0d5ccec31 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-11-26T13:33:06.482Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.yaml new file mode 100644 index 0000000000..44a5caea94 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_suppressions_version_history_returns_ok_response.yaml @@ -0,0 +1,50 @@ +interactions: +- request: + body: '{"data":{"attributes":{"description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","enabled":true,"name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","tags":["technique:T1110-brute-force","source:cloudtrail"]},"type":"suppressions"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions + response: + body: + string: '{"data":{"id":"456-piv-74h","type":"suppressions","attributes":{"creation_date":1764163986851,"creator":{"handle":"frog@datadoghq.com","name":"frog"},"data_exclusion_query":"","description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","editable":true,"enabled":true,"name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","tags":["source:cloudtrail","technique:T1110-brute-force"],"update_date":1764163986851,"updater":{"handle":"frog@datadoghq.com","name":"frog"},"version":1}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/456-piv-74h/version_history + response: + body: + string: '{"data":{"id":"456-piv-74h","type":"suppression_version_history","attributes":{"count":1,"data":{"1":{"suppression":{"id":"456-piv-74h","name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","enabled":true,"description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","data_exclusion_query":"","version":1,"creator":{"handle":"frog@datadoghq.com","name":"frog"},"updater":{"handle":"frog@datadoghq.com","name":"frog"},"creation_date":1764163986851,"update_date":1764163986851,"editable":true,"tags":["source:cloudtrail","technique:T1110-brute-force"]},"changes":[]}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/456-piv-74h + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/security_monitoring.feature b/tests/v2/features/security_monitoring.feature index 531c84c19c..578e8d28e5 100644 --- a/tests/v2/features/security_monitoring.feature +++ b/tests/v2/features/security_monitoring.feature @@ -833,6 +833,21 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" has the same value as "suppression.data.attributes.rule_query" And the response "data.attributes.suppression_query" is equal to "env:test" + @team:DataDog/k9-cloud-security-platform + Scenario: Get a suppression's version history returns "Not Found" response + Given new "GetSuppressionVersionHistory" 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 + Scenario: Get a suppression's version history returns "OK" response + Given new "GetSuppressionVersionHistory" request + And there is a valid "suppression" in the system + And request contains "suppression_id" parameter from "suppression.data.id" + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform Scenario: Get all security filters returns "OK" response Given new "ListSecurityFilters" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3799e64e63..67b48870c4 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3830,6 +3830,12 @@ "type": "idempotent" } }, + "GetSuppressionVersionHistory": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": {