Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 105 additions & 26 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
63 changes: 49 additions & 14 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------------------------------------

Expand Down Expand Up @@ -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
---------------------------------------------------

Expand Down Expand Up @@ -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
------------------------------------------------------

Expand Down Expand Up @@ -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
-----------------------------------------------------------

Expand Down
19 changes: 19 additions & 0 deletions examples/v2/security-monitoring/GetSuppressionVersionHistory.py
Original file line number Diff line number Diff line change
@@ -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)
64 changes: 64 additions & 0 deletions src/datadog_api_client/v2/api/security_monitoring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,),
Expand Down Expand Up @@ -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,
Expand Down
Loading