diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 478df242ef..bcbb1f1500 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -45082,6 +45082,125 @@ components: meta: $ref: "#/components/schemas/MonthlyCostAttributionMeta" type: object + MuteDataType: + default: mute + description: Mute resource type. + enum: + - mute + example: mute + type: string + x-enum-varnames: + - MUTE + MuteFindingsMuteAttributes: + description: Mute properties to apply to the findings. + properties: + description: + description: Additional information about the reason why the findings are muted or unmuted. This field has a limit of 280 characters. + example: "To be resolved later." + type: string + expire_at: + description: >- + The expiration date of the mute action (Unix ms). It must be set to a value greater than the current timestamp. If this field is not provided, the findings remain muted indefinitely. + example: 1778721573794 + format: int64 + type: integer + is_muted: + description: Whether the findings should be muted or unmuted. + example: true + type: boolean + reason: + $ref: "#/components/schemas/MuteFindingsReason" + description: The reason why the findings are muted or unmuted. + required: + - is_muted + - reason + type: object + MuteFindingsReason: + description: The reason why the findings are muted or unmuted. + enum: + - PENDING_FIX + - FALSE_POSITIVE + - OTHER + - NO_FIX + - DUPLICATE + - RISK_ACCEPTED + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK + example: PENDING_FIX + type: string + x-enum-varnames: + - PENDING_FIX + - FALSE_POSITIVE + - OTHER + - NO_FIX + - DUPLICATE + - RISK_ACCEPTED + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK + MuteFindingsRequest: + description: Request to mute or unmute security findings. + properties: + data: + $ref: "#/components/schemas/MuteFindingsRequestData" + required: + - data + type: object + MuteFindingsRequestData: + description: Data of the mute request. + properties: + attributes: + $ref: "#/components/schemas/MuteFindingsRequestDataAttributes" + id: + description: Unique identifier of the mute request. + example: "93bfeb70-af47-424d-908a-948d3f08e37f" + type: string + relationships: + $ref: "#/components/schemas/MuteFindingsRequestDataRelationships" + type: + $ref: "#/components/schemas/MuteDataType" + required: + - attributes + - relationships + - type + type: object + MuteFindingsRequestDataAttributes: + description: Attributes of the mute request. + properties: + mute: + $ref: "#/components/schemas/MuteFindingsMuteAttributes" + required: + - mute + type: object + MuteFindingsRequestDataRelationships: + description: Relationships of the mute request. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to mute or unmute. + required: + - findings + type: object + MuteFindingsResponse: + description: Response for the mute or unmute request. + properties: + data: + $ref: "#/components/schemas/MuteFindingsResponseData" + type: object + MuteFindingsResponseData: + description: Data of the mute response. + properties: + id: + description: Unique identifier of the mute request. + example: "93bfeb70-af47-424d-908a-948d3f08e37f" + type: string + type: + $ref: "#/components/schemas/MuteDataType" + required: + - type + - id + type: object NotebookCreateData: description: Notebook creation data properties: @@ -118827,6 +118946,74 @@ paths: permissions: - security_monitoring_findings_write - appsec_vm_write + /api/v2/security/findings/mute: + patch: + description: >- + Mute or unmute security findings. + + You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. + - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. + operationId: MuteSecurityFindings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + mute: + description: "To be resolved later." + expire_at: 1778721573794 + is_muted: true + reason: "RISK_ACCEPTED" + relationships: + findings: + data: + - id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: "findings" + type: "mute" + schema: + $ref: "#/components/schemas/MuteFindingsRequest" + required: true + responses: + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/MuteFindingsResponse" + description: Accepted + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: "Unprocessable Entity" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Mute or unmute security findings + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security/findings/search: post: description: |- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index f3472ab77b..4d064f7f08 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -19716,6 +19716,69 @@ datadog\_api\_client.v2.model.ms\_teams\_integration\_metadata\_teams\_item modu :members: :show-inheritance: +datadog\_api\_client.v2.model.mute\_data\_type module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_mute\_attributes module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_findings_mute_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_reason module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_findings_reason + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_request module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.mute_findings_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_request\_data module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.mute_findings_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_request\_data\_attributes module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.mute_findings_request_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_request\_data\_relationships module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_findings_request_data_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_response module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_findings_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.mute\_findings\_response\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.mute_findings_response_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.notebook\_create\_data module ----------------------------------------------------------- diff --git a/examples/v2/security-monitoring/MuteSecurityFindings.py b/examples/v2/security-monitoring/MuteSecurityFindings.py new file mode 100644 index 0000000000..72d2ea4bbb --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings.py @@ -0,0 +1,49 @@ +""" +Mute or unmute security findings returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi +from datadog_api_client.v2.model.finding_data import FindingData +from datadog_api_client.v2.model.finding_data_type import FindingDataType +from datadog_api_client.v2.model.findings import Findings +from datadog_api_client.v2.model.mute_data_type import MuteDataType +from datadog_api_client.v2.model.mute_findings_mute_attributes import MuteFindingsMuteAttributes +from datadog_api_client.v2.model.mute_findings_reason import MuteFindingsReason +from datadog_api_client.v2.model.mute_findings_request import MuteFindingsRequest +from datadog_api_client.v2.model.mute_findings_request_data import MuteFindingsRequestData +from datadog_api_client.v2.model.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes +from datadog_api_client.v2.model.mute_findings_request_data_relationships import MuteFindingsRequestDataRelationships + +body = MuteFindingsRequest( + data=MuteFindingsRequestData( + attributes=MuteFindingsRequestDataAttributes( + mute=MuteFindingsMuteAttributes( + description="To be resolved later.", + expire_at=1778721573794, + is_muted=True, + reason=MuteFindingsReason.PENDING_FIX, + ), + ), + id="93bfeb70-af47-424d-908a-948d3f08e37f", + relationships=MuteFindingsRequestDataRelationships( + findings=Findings( + data=[ + FindingData( + id="ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + type=FindingDataType.FINDINGS, + ), + ], + ), + ), + type=MuteDataType.MUTE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["mute_security_findings"] = True +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.mute_security_findings(body=body) + + print(response) diff --git a/examples/v2/security-monitoring/MuteSecurityFindings_298521544.py b/examples/v2/security-monitoring/MuteSecurityFindings_298521544.py new file mode 100644 index 0000000000..04dcbb195a --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings_298521544.py @@ -0,0 +1,47 @@ +""" +Unmute security findings returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi +from datadog_api_client.v2.model.finding_data import FindingData +from datadog_api_client.v2.model.finding_data_type import FindingDataType +from datadog_api_client.v2.model.findings import Findings +from datadog_api_client.v2.model.mute_data_type import MuteDataType +from datadog_api_client.v2.model.mute_findings_mute_attributes import MuteFindingsMuteAttributes +from datadog_api_client.v2.model.mute_findings_reason import MuteFindingsReason +from datadog_api_client.v2.model.mute_findings_request import MuteFindingsRequest +from datadog_api_client.v2.model.mute_findings_request_data import MuteFindingsRequestData +from datadog_api_client.v2.model.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes +from datadog_api_client.v2.model.mute_findings_request_data_relationships import MuteFindingsRequestDataRelationships + +body = MuteFindingsRequest( + data=MuteFindingsRequestData( + attributes=MuteFindingsRequestDataAttributes( + mute=MuteFindingsMuteAttributes( + description="Resolved.", + is_muted=False, + reason=MuteFindingsReason.NO_PENDING_FIX, + ), + ), + relationships=MuteFindingsRequestDataRelationships( + findings=Findings( + data=[ + FindingData( + id="ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + type=FindingDataType.FINDINGS, + ), + ], + ), + ), + type=MuteDataType.MUTE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["mute_security_findings"] = True +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.mute_security_findings(body=body) + + print(response) diff --git a/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.py b/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.py new file mode 100644 index 0000000000..0448afc8e0 --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.py @@ -0,0 +1,48 @@ +""" +Mute security findings returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi +from datadog_api_client.v2.model.finding_data import FindingData +from datadog_api_client.v2.model.finding_data_type import FindingDataType +from datadog_api_client.v2.model.findings import Findings +from datadog_api_client.v2.model.mute_data_type import MuteDataType +from datadog_api_client.v2.model.mute_findings_mute_attributes import MuteFindingsMuteAttributes +from datadog_api_client.v2.model.mute_findings_reason import MuteFindingsReason +from datadog_api_client.v2.model.mute_findings_request import MuteFindingsRequest +from datadog_api_client.v2.model.mute_findings_request_data import MuteFindingsRequestData +from datadog_api_client.v2.model.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes +from datadog_api_client.v2.model.mute_findings_request_data_relationships import MuteFindingsRequestDataRelationships + +body = MuteFindingsRequest( + data=MuteFindingsRequestData( + attributes=MuteFindingsRequestDataAttributes( + mute=MuteFindingsMuteAttributes( + description="To be resolved later.", + expire_at=1778721573794, + is_muted=True, + reason=MuteFindingsReason.RISK_ACCEPTED, + ), + ), + relationships=MuteFindingsRequestDataRelationships( + findings=Findings( + data=[ + FindingData( + id="ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + type=FindingDataType.FINDINGS, + ), + ], + ), + ), + type=MuteDataType.MUTE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["mute_security_findings"] = True +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.mute_security_findings(body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 38ce4ec198..104762de45 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -350,6 +350,7 @@ def __init__( "v2.list_vulnerabilities": False, "v2.list_vulnerable_assets": False, "v2.mute_findings": False, + "v2.mute_security_findings": False, "v2.run_historical_job": False, "v2.search_security_monitoring_histsignals": False, "v2.get_code_coverage_branch_summary": False, 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 1ea82d4bcc..e73937eca4 100644 --- a/src/datadog_api_client/v2/api/security_monitoring_api.py +++ b/src/datadog_api_client/v2/api/security_monitoring_api.py @@ -48,6 +48,8 @@ from datadog_api_client.v2.model.attach_case_request import AttachCaseRequest from datadog_api_client.v2.model.attach_jira_issue_request import AttachJiraIssueRequest from datadog_api_client.v2.model.create_jira_issue_request_array import CreateJiraIssueRequestArray +from datadog_api_client.v2.model.mute_findings_response import MuteFindingsResponse +from datadog_api_client.v2.model.mute_findings_request import MuteFindingsRequest from datadog_api_client.v2.model.security_findings_search_request import SecurityFindingsSearchRequest from datadog_api_client.v2.model.list_assets_sbo_ms_response import ListAssetsSBOMsResponse from datadog_api_client.v2.model.asset_type import AssetType @@ -2615,6 +2617,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._mute_security_findings_endpoint = _Endpoint( + settings={ + "response_type": (MuteFindingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/security/findings/mute", + "operation_id": "mute_security_findings", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (MuteFindingsRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._patch_signal_notification_rule_endpoint = _Endpoint( settings={ "response_type": (NotificationRuleResponse,), @@ -5652,6 +5674,26 @@ def mute_findings( return self._mute_findings_endpoint.call_with_http_info(**kwargs) + def mute_security_findings( + self, + body: MuteFindingsRequest, + ) -> MuteFindingsResponse: + """Mute or unmute security findings. + + Mute or unmute security findings. + You can mute or unmute up to 100 security findings per request. The request body must include ``is_muted`` and ``reason`` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + + * To mute a finding: ``PENDING_FIX`` , ``FALSE_POSITIVE`` , ``OTHER`` , ``NO_FIX`` , ``DUPLICATE`` , ``RISK_ACCEPTED``. + * To unmute a finding: ``NO_PENDING_FIX`` , ``HUMAN_ERROR`` , ``NO_LONGER_ACCEPTED_RISK`` , ``OTHER``. + + :type body: MuteFindingsRequest + :rtype: MuteFindingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._mute_security_findings_endpoint.call_with_http_info(**kwargs) + def patch_signal_notification_rule( self, id: str, diff --git a/src/datadog_api_client/v2/model/mute_data_type.py b/src/datadog_api_client/v2/model/mute_data_type.py new file mode 100644 index 0000000000..cb5a5eb8a4 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_data_type.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 MuteDataType(ModelSimple): + """ + Mute resource type. + + :param value: If omitted defaults to "mute". Must be one of ["mute"]. + :type value: str + """ + + allowed_values = { + "mute", + } + MUTE: ClassVar["MuteDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MuteDataType.MUTE = MuteDataType("mute") diff --git a/src/datadog_api_client/v2/model/mute_findings_mute_attributes.py b/src/datadog_api_client/v2/model/mute_findings_mute_attributes.py new file mode 100644 index 0000000000..6b673fb37e --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_mute_attributes.py @@ -0,0 +1,69 @@ +# 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.mute_findings_reason import MuteFindingsReason + + +class MuteFindingsMuteAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_findings_reason import MuteFindingsReason + + return { + "description": (str,), + "expire_at": (int,), + "is_muted": (bool,), + "reason": (MuteFindingsReason,), + } + + attribute_map = { + "description": "description", + "expire_at": "expire_at", + "is_muted": "is_muted", + "reason": "reason", + } + + def __init__( + self_, + is_muted: bool, + reason: MuteFindingsReason, + description: Union[str, UnsetType] = unset, + expire_at: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Mute properties to apply to the findings. + + :param description: Additional information about the reason why the findings are muted or unmuted. This field has a limit of 280 characters. + :type description: str, optional + + :param expire_at: The expiration date of the mute action (Unix ms). It must be set to a value greater than the current timestamp. If this field is not provided, the findings remain muted indefinitely. + :type expire_at: int, optional + + :param is_muted: Whether the findings should be muted or unmuted. + :type is_muted: bool + + :param reason: The reason why the findings are muted or unmuted. + :type reason: MuteFindingsReason + """ + if description is not unset: + kwargs["description"] = description + if expire_at is not unset: + kwargs["expire_at"] = expire_at + super().__init__(kwargs) + + self_.is_muted = is_muted + self_.reason = reason diff --git a/src/datadog_api_client/v2/model/mute_findings_reason.py b/src/datadog_api_client/v2/model/mute_findings_reason.py new file mode 100644 index 0000000000..173c068b92 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_reason.py @@ -0,0 +1,59 @@ +# 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 MuteFindingsReason(ModelSimple): + """ + The reason why the findings are muted or unmuted. + + :param value: Must be one of ["PENDING_FIX", "FALSE_POSITIVE", "OTHER", "NO_FIX", "DUPLICATE", "RISK_ACCEPTED", "NO_PENDING_FIX", "HUMAN_ERROR", "NO_LONGER_ACCEPTED_RISK"]. + :type value: str + """ + + allowed_values = { + "PENDING_FIX", + "FALSE_POSITIVE", + "OTHER", + "NO_FIX", + "DUPLICATE", + "RISK_ACCEPTED", + "NO_PENDING_FIX", + "HUMAN_ERROR", + "NO_LONGER_ACCEPTED_RISK", + } + PENDING_FIX: ClassVar["MuteFindingsReason"] + FALSE_POSITIVE: ClassVar["MuteFindingsReason"] + OTHER: ClassVar["MuteFindingsReason"] + NO_FIX: ClassVar["MuteFindingsReason"] + DUPLICATE: ClassVar["MuteFindingsReason"] + RISK_ACCEPTED: ClassVar["MuteFindingsReason"] + NO_PENDING_FIX: ClassVar["MuteFindingsReason"] + HUMAN_ERROR: ClassVar["MuteFindingsReason"] + NO_LONGER_ACCEPTED_RISK: ClassVar["MuteFindingsReason"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MuteFindingsReason.PENDING_FIX = MuteFindingsReason("PENDING_FIX") +MuteFindingsReason.FALSE_POSITIVE = MuteFindingsReason("FALSE_POSITIVE") +MuteFindingsReason.OTHER = MuteFindingsReason("OTHER") +MuteFindingsReason.NO_FIX = MuteFindingsReason("NO_FIX") +MuteFindingsReason.DUPLICATE = MuteFindingsReason("DUPLICATE") +MuteFindingsReason.RISK_ACCEPTED = MuteFindingsReason("RISK_ACCEPTED") +MuteFindingsReason.NO_PENDING_FIX = MuteFindingsReason("NO_PENDING_FIX") +MuteFindingsReason.HUMAN_ERROR = MuteFindingsReason("HUMAN_ERROR") +MuteFindingsReason.NO_LONGER_ACCEPTED_RISK = MuteFindingsReason("NO_LONGER_ACCEPTED_RISK") diff --git a/src/datadog_api_client/v2/model/mute_findings_request.py b/src/datadog_api_client/v2/model/mute_findings_request.py new file mode 100644 index 0000000000..7a497b4cc5 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_request.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.mute_findings_request_data import MuteFindingsRequestData + + +class MuteFindingsRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_findings_request_data import MuteFindingsRequestData + + return { + "data": (MuteFindingsRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: MuteFindingsRequestData, **kwargs): + """ + Request to mute or unmute security findings. + + :param data: Data of the mute request. + :type data: MuteFindingsRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/mute_findings_request_data.py b/src/datadog_api_client/v2/model/mute_findings_request_data.py new file mode 100644 index 0000000000..881ccc6388 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_request_data.py @@ -0,0 +1,76 @@ +# 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.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes + from datadog_api_client.v2.model.mute_findings_request_data_relationships import ( + MuteFindingsRequestDataRelationships, + ) + from datadog_api_client.v2.model.mute_data_type import MuteDataType + + +class MuteFindingsRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes + from datadog_api_client.v2.model.mute_findings_request_data_relationships import ( + MuteFindingsRequestDataRelationships, + ) + from datadog_api_client.v2.model.mute_data_type import MuteDataType + + return { + "attributes": (MuteFindingsRequestDataAttributes,), + "id": (str,), + "relationships": (MuteFindingsRequestDataRelationships,), + "type": (MuteDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: MuteFindingsRequestDataAttributes, + relationships: MuteFindingsRequestDataRelationships, + type: MuteDataType, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Data of the mute request. + + :param attributes: Attributes of the mute request. + :type attributes: MuteFindingsRequestDataAttributes + + :param id: Unique identifier of the mute request. + :type id: str, optional + + :param relationships: Relationships of the mute request. + :type relationships: MuteFindingsRequestDataRelationships + + :param type: Mute resource type. + :type type: MuteDataType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.attributes = attributes + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/mute_findings_request_data_attributes.py b/src/datadog_api_client/v2/model/mute_findings_request_data_attributes.py new file mode 100644 index 0000000000..fe92460632 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_request_data_attributes.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.mute_findings_mute_attributes import MuteFindingsMuteAttributes + + +class MuteFindingsRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_findings_mute_attributes import MuteFindingsMuteAttributes + + return { + "mute": (MuteFindingsMuteAttributes,), + } + + attribute_map = { + "mute": "mute", + } + + def __init__(self_, mute: MuteFindingsMuteAttributes, **kwargs): + """ + Attributes of the mute request. + + :param mute: Mute properties to apply to the findings. + :type mute: MuteFindingsMuteAttributes + """ + super().__init__(kwargs) + + self_.mute = mute diff --git a/src/datadog_api_client/v2/model/mute_findings_request_data_relationships.py b/src/datadog_api_client/v2/model/mute_findings_request_data_relationships.py new file mode 100644 index 0000000000..28ef24f05f --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_request_data_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.findings import Findings + + +class MuteFindingsRequestDataRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.findings import Findings + + return { + "findings": (Findings,), + } + + attribute_map = { + "findings": "findings", + } + + def __init__(self_, findings: Findings, **kwargs): + """ + Relationships of the mute request. + + :param findings: A list of security findings. + :type findings: Findings + """ + super().__init__(kwargs) + + self_.findings = findings diff --git a/src/datadog_api_client/v2/model/mute_findings_response.py b/src/datadog_api_client/v2/model/mute_findings_response.py new file mode 100644 index 0000000000..70f32ad972 --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_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.mute_findings_response_data import MuteFindingsResponseData + + +class MuteFindingsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_findings_response_data import MuteFindingsResponseData + + return { + "data": (MuteFindingsResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[MuteFindingsResponseData, UnsetType] = unset, **kwargs): + """ + Response for the mute or unmute request. + + :param data: Data of the mute response. + :type data: MuteFindingsResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/mute_findings_response_data.py b/src/datadog_api_client/v2/model/mute_findings_response_data.py new file mode 100644 index 0000000000..f34df3becb --- /dev/null +++ b/src/datadog_api_client/v2/model/mute_findings_response_data.py @@ -0,0 +1,46 @@ +# 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.mute_data_type import MuteDataType + + +class MuteFindingsResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.mute_data_type import MuteDataType + + return { + "id": (str,), + "type": (MuteDataType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: MuteDataType, **kwargs): + """ + Data of the mute response. + + :param id: Unique identifier of the mute request. + :type id: str + + :param type: Mute resource type. + :type type: MuteDataType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 840a90e1c4..ffa026ad88 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3741,6 +3741,15 @@ from datadog_api_client.v2.model.monthly_cost_attribution_meta import MonthlyCostAttributionMeta from datadog_api_client.v2.model.monthly_cost_attribution_pagination import MonthlyCostAttributionPagination from datadog_api_client.v2.model.monthly_cost_attribution_response import MonthlyCostAttributionResponse +from datadog_api_client.v2.model.mute_data_type import MuteDataType +from datadog_api_client.v2.model.mute_findings_mute_attributes import MuteFindingsMuteAttributes +from datadog_api_client.v2.model.mute_findings_reason import MuteFindingsReason +from datadog_api_client.v2.model.mute_findings_request import MuteFindingsRequest +from datadog_api_client.v2.model.mute_findings_request_data import MuteFindingsRequestData +from datadog_api_client.v2.model.mute_findings_request_data_attributes import MuteFindingsRequestDataAttributes +from datadog_api_client.v2.model.mute_findings_request_data_relationships import MuteFindingsRequestDataRelationships +from datadog_api_client.v2.model.mute_findings_response import MuteFindingsResponse +from datadog_api_client.v2.model.mute_findings_response_data import MuteFindingsResponseData from datadog_api_client.v2.model.notebook_create_data import NotebookCreateData from datadog_api_client.v2.model.notebook_create_request import NotebookCreateRequest from datadog_api_client.v2.model.notebook_resource_type import NotebookResourceType @@ -10214,6 +10223,15 @@ "MonthlyCostAttributionMeta", "MonthlyCostAttributionPagination", "MonthlyCostAttributionResponse", + "MuteDataType", + "MuteFindingsMuteAttributes", + "MuteFindingsReason", + "MuteFindingsRequest", + "MuteFindingsRequestData", + "MuteFindingsRequestDataAttributes", + "MuteFindingsRequestDataRelationships", + "MuteFindingsResponse", + "MuteFindingsResponseData", "NotebookCreateData", "NotebookCreateRequest", "NotebookResourceType", diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.frozen new file mode 100644 index 0000000000..c70fc98419 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:46:59.369Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.yaml new file mode 100644 index 0000000000..def66d1d21 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_accepted_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1778721573794,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"data":{"id":"7a0bd082-5c8a-4ea3-a8a5-c5036e083ddb","type":"mute"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.frozen new file mode 100644 index 0000000000..2343aeed26 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:13:25.084Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.yaml new file mode 100644 index 0000000000..a2be4cd116 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_not_found_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1778721573794,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not + found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.frozen new file mode 100644 index 0000000000..4217cf20b9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:19:46.205Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.yaml new file mode 100644 index 0000000000..5b37ae75d4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_security_findings_returns_unprocessable_entity_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"Invalid + expiration date. Please provide an expiration date in the future"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.frozen b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.frozen new file mode 100644 index 0000000000..aeddfe329e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:48:26.948Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.yaml b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.yaml new file mode 100644 index 0000000000..881ae89549 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_accepted_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"NO_PENDING_FIX"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"data":{"id":"4ae87c1e-099b-4f63-af21-3568cf226263","type":"mute"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.frozen new file mode 100644 index 0000000000..2e3bb3a33a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:23:28.911Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.yaml new file mode 100644 index 0000000000..64b277b0ba --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_not_found_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"NO_PENDING_FIX"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not + found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.frozen b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.frozen new file mode 100644 index 0000000000..1c328239af --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.frozen @@ -0,0 +1 @@ +2026-04-27T16:23:50.077Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.yaml b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.yaml new file mode 100644 index 0000000000..1b19f4c44d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_unmute_security_findings_returns_unprocessable_entity_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"The + provided reason is not valid for the specified mute action. Possible values: + [NO_PENDING_FIX HUMAN_ERROR NO_LONGER_ACCEPTED_RISK OTHER]"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +version: 1 diff --git a/tests/v2/features/security_monitoring.feature b/tests/v2/features/security_monitoring.feature index 9c65c8a95b..820747b79b 100644 --- a/tests/v2/features/security_monitoring.feature +++ b/tests/v2/features/security_monitoring.feature @@ -1864,6 +1864,62 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Bad Request" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @team:DataDog/cloud-security-posture-management Scenario: Patch a signal-based notification rule returns "Bad Request" response Given new "PatchSignalNotificationRule" request @@ -2065,6 +2121,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "NO_PENDING_FIX"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "NO_PENDING_FIX"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @skip-validation @team:DataDog/k9-cloud-siem Scenario: Update a cloud configuration rule's details returns "OK" response Given new "UpdateSecurityMonitoringRule" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index efb20d6825..974daba713 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5308,6 +5308,12 @@ "type": "unsafe" } }, + "MuteSecurityFindings": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "SearchSecurityFindings": { "tag": "Security Monitoring", "undo": {