Skip to content

Commit b604406

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e3078c2 of spec repo
1 parent acb6c39 commit b604406

21 files changed

Lines changed: 769 additions & 4 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23464,6 +23464,8 @@ components:
2346423464
$ref: "#/components/schemas/Enabled"
2346523465
name:
2346623466
$ref: "#/components/schemas/RuleName"
23467+
routing:
23468+
$ref: "#/components/schemas/NotificationRuleRouting"
2346723469
selectors:
2346823470
$ref: "#/components/schemas/Selectors"
2346923471
targets:
@@ -58623,6 +58625,76 @@ components:
5862358625
- targets
5862458626
- version
5862558627
type: object
58628+
NotificationRulePreviewNotificationStatus:
58629+
description: The notification status for the given rule type. `SUCCESS` means a matching event was found and the notification was sent successfully. `DEFAULT` means no matching event was found and a default placeholder notification was sent instead. `ERROR` means an error occurred while sending the notification.
58630+
enum:
58631+
- SUCCESS
58632+
- DEFAULT
58633+
- ERROR
58634+
example: SUCCESS
58635+
type: string
58636+
x-enum-varnames:
58637+
- SUCCESS
58638+
- DEFAULT
58639+
- ERROR
58640+
NotificationRulePreviewResponse:
58641+
description: Response from the notification preview request.
58642+
properties:
58643+
data:
58644+
$ref: "#/components/schemas/NotificationRulePreviewResponseData"
58645+
required:
58646+
- data
58647+
type: object
58648+
NotificationRulePreviewResponseAttributes:
58649+
description: Attributes of the notification preview response.
58650+
properties:
58651+
preview_results:
58652+
$ref: "#/components/schemas/NotificationRulePreviewResults"
58653+
required:
58654+
- preview_results
58655+
type: object
58656+
NotificationRulePreviewResponseData:
58657+
description: The notification preview response data.
58658+
properties:
58659+
attributes:
58660+
$ref: "#/components/schemas/NotificationRulePreviewResponseAttributes"
58661+
id:
58662+
description: The ID of the notification preview response.
58663+
example: rka-loa-zwu
58664+
type: string
58665+
type:
58666+
$ref: "#/components/schemas/NotificationRulePreviewResponseType"
58667+
required:
58668+
- type
58669+
- attributes
58670+
type: object
58671+
NotificationRulePreviewResponseType:
58672+
description: The type of the notification preview response.
58673+
enum:
58674+
- notification_preview_response
58675+
example: notification_preview_response
58676+
type: string
58677+
x-enum-varnames:
58678+
- NOTIFICATION_PREVIEW_RESPONSE
58679+
NotificationRulePreviewResult:
58680+
description: The preview result for a single rule type.
58681+
properties:
58682+
notification_status:
58683+
$ref: "#/components/schemas/NotificationRulePreviewNotificationStatus"
58684+
rule_type:
58685+
$ref: "#/components/schemas/RuleTypesItems"
58686+
required:
58687+
- rule_type
58688+
- notification_status
58689+
type: object
58690+
NotificationRulePreviewResults:
58691+
description: List of preview results for each rule type matched by the notification rule.
58692+
example:
58693+
- notification_status: DEFAULT
58694+
rule_type: log_detection
58695+
items:
58696+
$ref: "#/components/schemas/NotificationRulePreviewResult"
58697+
type: array
5862658698
NotificationRuleQuery:
5862758699
description: The query is composed of one or several key:value pairs, which can be used to filter security issues on tags and attributes.
5862858700
example: (source:production_service OR env:prod)
@@ -58633,6 +58705,22 @@ components:
5863358705
data:
5863458706
$ref: "#/components/schemas/NotificationRule"
5863558707
type: object
58708+
NotificationRuleRouting:
58709+
description: Routing configuration for the notification rule.
58710+
properties:
58711+
mode:
58712+
$ref: "#/components/schemas/NotificationRuleRoutingMode"
58713+
required:
58714+
- mode
58715+
type: object
58716+
NotificationRuleRoutingMode:
58717+
description: The routing mode for the notification rule. `manual` sends notifications to the configured targets.
58718+
enum:
58719+
- manual
58720+
example: manual
58721+
type: string
58722+
x-enum-varnames:
58723+
- MANUAL
5863658724
NotificationRulesListResponse:
5863758725
description: The list of notification rules.
5863858726
properties:
@@ -67874,6 +67962,8 @@ components:
6787467962
$ref: "#/components/schemas/Enabled"
6787567963
name:
6787667964
$ref: "#/components/schemas/RuleName"
67965+
routing:
67966+
$ref: "#/components/schemas/NotificationRuleRouting"
6787767967
selectors:
6787867968
$ref: "#/components/schemas/Selectors"
6787967969
targets:
@@ -74184,6 +74274,7 @@ components:
7418474274
- iac_misconfiguration
7418574275
- sast_vulnerability
7418674276
- secret_vulnerability
74277+
example: log_detection
7418774278
type: string
7418874279
x-enum-varnames:
7418974280
- APPLICATION_SECURITY
@@ -162221,6 +162312,73 @@ paths:
162221162312
x-unstable: |-
162222162313
**Note**: This endpoint is in preview and is subject to change.
162223162314
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
162315+
/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview:
162316+
post:
162317+
description: Send a notification preview to test that a notification rule's targets are properly configured.
162318+
operationId: SendSecurityMonitoringNotificationPreview
162319+
requestBody:
162320+
content:
162321+
application/json:
162322+
examples:
162323+
default:
162324+
value:
162325+
data:
162326+
attributes:
162327+
enabled: true
162328+
name: Rule 1
162329+
selectors:
162330+
query: env:prod
162331+
rule_types:
162332+
- log_detection
162333+
severities:
162334+
- critical
162335+
trigger_source: security_signals
162336+
targets:
162337+
- "@john.doe@email.com"
162338+
type: notification_rules
162339+
schema:
162340+
$ref: "#/components/schemas/CreateNotificationRuleParameters"
162341+
required: true
162342+
responses:
162343+
"200":
162344+
content:
162345+
application/json:
162346+
examples:
162347+
default:
162348+
value:
162349+
data:
162350+
attributes:
162351+
preview_results:
162352+
- notification_status: DEFAULT
162353+
rule_type: log_detection
162354+
id: rka-loa-zwu
162355+
type: notification_preview_response
162356+
schema:
162357+
$ref: "#/components/schemas/NotificationRulePreviewResponse"
162358+
description: OK
162359+
"400":
162360+
content:
162361+
application/json:
162362+
schema:
162363+
$ref: "#/components/schemas/JSONAPIErrorResponse"
162364+
description: Bad Request
162365+
"403":
162366+
$ref: "#/components/responses/NotAuthorizedResponse"
162367+
"429":
162368+
$ref: "#/components/responses/TooManyRequestsResponse"
162369+
security:
162370+
- apiKeyAuth: []
162371+
appKeyAuth: []
162372+
- AuthZ:
162373+
- security_monitoring_notification_profiles_read
162374+
summary: Test a notification rule
162375+
tags:
162376+
- Security Monitoring
162377+
x-codegen-request-body-name: body
162378+
"x-permission":
162379+
operator: OR
162380+
permissions:
162381+
- security_monitoring_notification_profiles_read
162224162382
/api/v2/security_monitoring/configuration/security_filters:
162225162383
get:
162226162384
description: Get the list of configured security filters with their definitions.

docs/datadog_api_client.v2.model.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24686,13 +24686,69 @@ datadog\_api\_client.v2.model.notification\_rule\_attributes module
2468624686
:members:
2468724687
:show-inheritance:
2468824688

24689+
datadog\_api\_client.v2.model.notification\_rule\_preview\_notification\_status module
24690+
--------------------------------------------------------------------------------------
24691+
24692+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_notification_status
24693+
:members:
24694+
:show-inheritance:
24695+
24696+
datadog\_api\_client.v2.model.notification\_rule\_preview\_response module
24697+
--------------------------------------------------------------------------
24698+
24699+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_response
24700+
:members:
24701+
:show-inheritance:
24702+
24703+
datadog\_api\_client.v2.model.notification\_rule\_preview\_response\_attributes module
24704+
--------------------------------------------------------------------------------------
24705+
24706+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_response_attributes
24707+
:members:
24708+
:show-inheritance:
24709+
24710+
datadog\_api\_client.v2.model.notification\_rule\_preview\_response\_data module
24711+
--------------------------------------------------------------------------------
24712+
24713+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_response_data
24714+
:members:
24715+
:show-inheritance:
24716+
24717+
datadog\_api\_client.v2.model.notification\_rule\_preview\_response\_type module
24718+
--------------------------------------------------------------------------------
24719+
24720+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_response_type
24721+
:members:
24722+
:show-inheritance:
24723+
24724+
datadog\_api\_client.v2.model.notification\_rule\_preview\_result module
24725+
------------------------------------------------------------------------
24726+
24727+
.. automodule:: datadog_api_client.v2.model.notification_rule_preview_result
24728+
:members:
24729+
:show-inheritance:
24730+
2468924731
datadog\_api\_client.v2.model.notification\_rule\_response module
2469024732
-----------------------------------------------------------------
2469124733

2469224734
.. automodule:: datadog_api_client.v2.model.notification_rule_response
2469324735
:members:
2469424736
:show-inheritance:
2469524737

24738+
datadog\_api\_client.v2.model.notification\_rule\_routing module
24739+
----------------------------------------------------------------
24740+
24741+
.. automodule:: datadog_api_client.v2.model.notification_rule_routing
24742+
:members:
24743+
:show-inheritance:
24744+
24745+
datadog\_api\_client.v2.model.notification\_rule\_routing\_mode module
24746+
----------------------------------------------------------------------
24747+
24748+
.. automodule:: datadog_api_client.v2.model.notification_rule_routing_mode
24749+
:members:
24750+
:show-inheritance:
24751+
2469624752
datadog\_api\_client.v2.model.notification\_rules\_list\_response module
2469724753
------------------------------------------------------------------------
2469824754

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
Test a notification rule returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
7+
from datadog_api_client.v2.model.create_notification_rule_parameters import CreateNotificationRuleParameters
8+
from datadog_api_client.v2.model.create_notification_rule_parameters_data import CreateNotificationRuleParametersData
9+
from datadog_api_client.v2.model.create_notification_rule_parameters_data_attributes import (
10+
CreateNotificationRuleParametersDataAttributes,
11+
)
12+
from datadog_api_client.v2.model.notification_rules_type import NotificationRulesType
13+
from datadog_api_client.v2.model.rule_severity import RuleSeverity
14+
from datadog_api_client.v2.model.rule_types_items import RuleTypesItems
15+
from datadog_api_client.v2.model.selectors import Selectors
16+
from datadog_api_client.v2.model.trigger_source import TriggerSource
17+
18+
body = CreateNotificationRuleParameters(
19+
data=CreateNotificationRuleParametersData(
20+
attributes=CreateNotificationRuleParametersDataAttributes(
21+
enabled=True,
22+
name="Rule 1",
23+
selectors=Selectors(
24+
query="env:prod",
25+
rule_types=[
26+
RuleTypesItems.LOG_DETECTION,
27+
],
28+
severities=[
29+
RuleSeverity.CRITICAL,
30+
],
31+
trigger_source=TriggerSource.SECURITY_SIGNALS,
32+
),
33+
targets=[
34+
"@john.doe@email.com",
35+
],
36+
),
37+
type=NotificationRulesType.NOTIFICATION_RULES,
38+
),
39+
)
40+
41+
configuration = Configuration()
42+
with ApiClient(configuration) as api_client:
43+
api_instance = SecurityMonitoringApi(api_client)
44+
response = api_instance.send_security_monitoring_notification_preview(body=body)
45+
46+
print(response)

src/datadog_api_client/v2/api/security_monitoring_api.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
from datadog_api_client.v2.model.security_monitoring_integration_config_update_request import (
104104
SecurityMonitoringIntegrationConfigUpdateRequest,
105105
)
106+
from datadog_api_client.v2.model.notification_rule_preview_response import NotificationRulePreviewResponse
106107
from datadog_api_client.v2.model.security_filters_response import SecurityFiltersResponse
107108
from datadog_api_client.v2.model.security_filter_response import SecurityFilterResponse
108109
from datadog_api_client.v2.model.security_filter_create_request import SecurityFilterCreateRequest
@@ -3548,6 +3549,26 @@ def __init__(self, api_client=None):
35483549
api_client=api_client,
35493550
)
35503551

3552+
self._send_security_monitoring_notification_preview_endpoint = _Endpoint(
3553+
settings={
3554+
"response_type": (NotificationRulePreviewResponse,),
3555+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
3556+
"endpoint_path": "/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview",
3557+
"operation_id": "send_security_monitoring_notification_preview",
3558+
"http_method": "POST",
3559+
"version": "v2",
3560+
},
3561+
params_map={
3562+
"body": {
3563+
"required": True,
3564+
"openapi_types": (CreateNotificationRuleParameters,),
3565+
"location": "body",
3566+
},
3567+
},
3568+
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
3569+
api_client=api_client,
3570+
)
3571+
35513572
self._test_existing_security_monitoring_rule_endpoint = _Endpoint(
35523573
settings={
35533574
"response_type": (SecurityMonitoringRuleTestResponse,),
@@ -7403,6 +7424,22 @@ def search_security_monitoring_signals_with_pagination(
74037424
}
74047425
return endpoint.call_with_http_info_paginated(pagination)
74057426

7427+
def send_security_monitoring_notification_preview(
7428+
self,
7429+
body: CreateNotificationRuleParameters,
7430+
) -> NotificationRulePreviewResponse:
7431+
"""Test a notification rule.
7432+
7433+
Send a notification preview to test that a notification rule's targets are properly configured.
7434+
7435+
:type body: CreateNotificationRuleParameters
7436+
:rtype: NotificationRulePreviewResponse
7437+
"""
7438+
kwargs: Dict[str, Any] = {}
7439+
kwargs["body"] = body
7440+
7441+
return self._send_security_monitoring_notification_preview_endpoint.call_with_http_info(**kwargs)
7442+
74067443
def test_existing_security_monitoring_rule(
74077444
self,
74087445
rule_id: str,

0 commit comments

Comments
 (0)