Skip to content

Commit c75164e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 19949fa of spec repo
1 parent 7a520a2 commit c75164e

19 files changed

Lines changed: 1089 additions & 6 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23518,6 +23518,8 @@ components:
2351823518
$ref: "#/components/schemas/Enabled"
2351923519
name:
2352023520
$ref: "#/components/schemas/RuleName"
23521+
routing:
23522+
$ref: "#/components/schemas/NotificationRuleRouting"
2352123523
selectors:
2352223524
$ref: "#/components/schemas/Selectors"
2352323525
targets:
@@ -59051,6 +59053,76 @@ components:
5905159053
- targets
5905259054
- version
5905359055
type: object
59056+
NotificationRulePreviewNotificationStatus:
59057+
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.
59058+
enum:
59059+
- SUCCESS
59060+
- DEFAULT
59061+
- ERROR
59062+
example: SUCCESS
59063+
type: string
59064+
x-enum-varnames:
59065+
- SUCCESS
59066+
- DEFAULT
59067+
- ERROR
59068+
NotificationRulePreviewResponse:
59069+
description: Response from the notification preview request.
59070+
properties:
59071+
data:
59072+
$ref: "#/components/schemas/NotificationRulePreviewResponseData"
59073+
required:
59074+
- data
59075+
type: object
59076+
NotificationRulePreviewResponseAttributes:
59077+
description: Attributes of the notification preview response.
59078+
properties:
59079+
preview_results:
59080+
$ref: "#/components/schemas/NotificationRulePreviewResults"
59081+
required:
59082+
- preview_results
59083+
type: object
59084+
NotificationRulePreviewResponseData:
59085+
description: The notification preview response data.
59086+
properties:
59087+
attributes:
59088+
$ref: "#/components/schemas/NotificationRulePreviewResponseAttributes"
59089+
id:
59090+
description: The ID of the notification preview response.
59091+
example: rka-loa-zwu
59092+
type: string
59093+
type:
59094+
$ref: "#/components/schemas/NotificationRulePreviewResponseType"
59095+
required:
59096+
- type
59097+
- attributes
59098+
type: object
59099+
NotificationRulePreviewResponseType:
59100+
description: The type of the notification preview response.
59101+
enum:
59102+
- notification_preview_response
59103+
example: notification_preview_response
59104+
type: string
59105+
x-enum-varnames:
59106+
- NOTIFICATION_PREVIEW_RESPONSE
59107+
NotificationRulePreviewResult:
59108+
description: The preview result for a single rule type.
59109+
properties:
59110+
notification_status:
59111+
$ref: "#/components/schemas/NotificationRulePreviewNotificationStatus"
59112+
rule_type:
59113+
$ref: "#/components/schemas/RuleTypesItems"
59114+
required:
59115+
- rule_type
59116+
- notification_status
59117+
type: object
59118+
NotificationRulePreviewResults:
59119+
description: List of preview results for each rule type matched by the notification rule.
59120+
example:
59121+
- notification_status: DEFAULT
59122+
rule_type: log_detection
59123+
items:
59124+
$ref: "#/components/schemas/NotificationRulePreviewResult"
59125+
type: array
5905459126
NotificationRuleQuery:
5905559127
description: The query is composed of one or several key:value pairs, which can be used to filter security issues on tags and attributes.
5905659128
example: (source:production_service OR env:prod)
@@ -59061,6 +59133,22 @@ components:
5906159133
data:
5906259134
$ref: "#/components/schemas/NotificationRule"
5906359135
type: object
59136+
NotificationRuleRouting:
59137+
description: Routing configuration for the notification rule.
59138+
properties:
59139+
mode:
59140+
$ref: "#/components/schemas/NotificationRuleRoutingMode"
59141+
required:
59142+
- mode
59143+
type: object
59144+
NotificationRuleRoutingMode:
59145+
description: The routing mode for the notification rule. `manual` sends notifications to the configured targets.
59146+
enum:
59147+
- manual
59148+
example: manual
59149+
type: string
59150+
x-enum-varnames:
59151+
- MANUAL
5906459152
NotificationRulesListResponse:
5906559153
description: The list of notification rules.
5906659154
properties:
@@ -68865,6 +68953,8 @@ components:
6886568953
$ref: "#/components/schemas/Enabled"
6886668954
name:
6886768955
$ref: "#/components/schemas/RuleName"
68956+
routing:
68957+
$ref: "#/components/schemas/NotificationRuleRouting"
6886868958
selectors:
6886968959
$ref: "#/components/schemas/Selectors"
6887068960
targets:
@@ -75175,6 +75265,7 @@ components:
7517575265
- iac_misconfiguration
7517675266
- sast_vulnerability
7517775267
- secret_vulnerability
75268+
example: log_detection
7517875269
type: string
7517975270
x-enum-varnames:
7518075271
- APPLICATION_SECURITY
@@ -164024,6 +164115,73 @@ paths:
164024164115
x-unstable: |-
164025164116
**Note**: This endpoint is in preview and is subject to change.
164026164117
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
164118+
/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview:
164119+
post:
164120+
description: Send a notification preview to test that a notification rule's targets are properly configured.
164121+
operationId: SendSecurityMonitoringNotificationPreview
164122+
requestBody:
164123+
content:
164124+
application/json:
164125+
examples:
164126+
default:
164127+
value:
164128+
data:
164129+
attributes:
164130+
enabled: true
164131+
name: Rule 1
164132+
selectors:
164133+
query: env:prod
164134+
rule_types:
164135+
- log_detection
164136+
severities:
164137+
- critical
164138+
trigger_source: security_signals
164139+
targets:
164140+
- "@john.doe@email.com"
164141+
type: notification_rules
164142+
schema:
164143+
$ref: "#/components/schemas/CreateNotificationRuleParameters"
164144+
required: true
164145+
responses:
164146+
"200":
164147+
content:
164148+
application/json:
164149+
examples:
164150+
default:
164151+
value:
164152+
data:
164153+
attributes:
164154+
preview_results:
164155+
- notification_status: DEFAULT
164156+
rule_type: log_detection
164157+
id: rka-loa-zwu
164158+
type: notification_preview_response
164159+
schema:
164160+
$ref: "#/components/schemas/NotificationRulePreviewResponse"
164161+
description: OK
164162+
"400":
164163+
content:
164164+
application/json:
164165+
schema:
164166+
$ref: "#/components/schemas/JSONAPIErrorResponse"
164167+
description: Bad Request
164168+
"403":
164169+
$ref: "#/components/responses/NotAuthorizedResponse"
164170+
"429":
164171+
$ref: "#/components/responses/TooManyRequestsResponse"
164172+
security:
164173+
- apiKeyAuth: []
164174+
appKeyAuth: []
164175+
- AuthZ:
164176+
- security_monitoring_notification_profiles_write
164177+
summary: Test a notification rule
164178+
tags:
164179+
- Security Monitoring
164180+
x-codegen-request-body-name: body
164181+
"x-permission":
164182+
operator: OR
164183+
permissions:
164184+
- security_monitoring_notification_profiles_write
164027164185
/api/v2/security_monitoring/configuration/security_filters:
164028164186
get:
164029164187
description: Get the list of configured security filters with their definitions.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-10T09:27:59.116Z

cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.yml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Test a notification rule returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
5+
6+
body = DatadogAPIClient::V2::CreateNotificationRuleParameters.new({
7+
data: DatadogAPIClient::V2::CreateNotificationRuleParametersData.new({
8+
attributes: DatadogAPIClient::V2::CreateNotificationRuleParametersDataAttributes.new({
9+
enabled: true,
10+
name: "Rule 1",
11+
selectors: DatadogAPIClient::V2::Selectors.new({
12+
query: "env:prod",
13+
rule_types: [
14+
DatadogAPIClient::V2::RuleTypesItems::LOG_DETECTION,
15+
],
16+
severities: [
17+
DatadogAPIClient::V2::RuleSeverity::CRITICAL,
18+
],
19+
trigger_source: DatadogAPIClient::V2::TriggerSource::SECURITY_SIGNALS,
20+
}),
21+
targets: [
22+
"@john.doe@email.com",
23+
],
24+
}),
25+
type: DatadogAPIClient::V2::NotificationRulesType::NOTIFICATION_RULES,
26+
}),
27+
})
28+
p api_instance.send_security_monitoring_notification_preview(body)

features/scenarios_model_mapping.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,9 @@
22122212
"v2.ValidateSecurityMonitoringIntegrationConfig" => {
22132213
"integration_config_id" => "String",
22142214
},
2215+
"v2.SendSecurityMonitoringNotificationPreview" => {
2216+
"body" => "CreateNotificationRuleParameters",
2217+
},
22152218
"v2.CreateSecurityFilter" => {
22162219
"body" => "SecurityFilterCreateRequest",
22172220
},

features/v2/security_monitoring.feature

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ Feature: Security Monitoring
759759
@generated @skip @team:DataDog/cloud-security-posture-management
760760
Scenario: Create a new signal-based notification rule returns "Bad Request" response
761761
Given new "CreateSignalNotificationRule" request
762-
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}}
762+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}}
763763
When the request is sent
764764
Then the response status is 400 Bad Request
765765

@@ -773,7 +773,7 @@ Feature: Security Monitoring
773773
@generated @skip @team:DataDog/cloud-security-posture-management
774774
Scenario: Create a new vulnerability-based notification rule returns "Bad Request" response
775775
Given new "CreateVulnerabilityNotificationRule" request
776-
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}}
776+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}}
777777
When the request is sent
778778
Then the response status is 400 Bad Request
779779

@@ -2470,7 +2470,7 @@ Feature: Security Monitoring
24702470
Scenario: Patch a signal-based notification rule returns "The server cannot process the request because it contains invalid data." response
24712471
Given new "PatchSignalNotificationRule" request
24722472
And request contains "id" parameter from "REPLACE.ME"
2473-
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}}
2473+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}}
24742474
When the request is sent
24752475
Then the response status is 422 The server cannot process the request because it contains invalid data.
24762476

@@ -2504,7 +2504,7 @@ Feature: Security Monitoring
25042504
Scenario: Patch a vulnerability-based notification rule returns "The server cannot process the request because it contains invalid data." response
25052505
Given new "PatchVulnerabilityNotificationRule" request
25062506
And request contains "id" parameter from "REPLACE.ME"
2507-
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}}
2507+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}}
25082508
When the request is sent
25092509
Then the response status is 422 The server cannot process the request because it contains invalid data.
25102510

@@ -2611,6 +2611,20 @@ Feature: Security Monitoring
26112611
When the request is sent
26122612
Then the response status is 200 OK
26132613

2614+
@generated @skip @team:DataDog/k9-cloud-siem
2615+
Scenario: Test a notification rule returns "Bad Request" response
2616+
Given new "SendSecurityMonitoringNotificationPreview" request
2617+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}}
2618+
When the request is sent
2619+
Then the response status is 400 Bad Request
2620+
2621+
@team:DataDog/k9-cloud-siem
2622+
Scenario: Test a notification rule returns "OK" response
2623+
Given new "SendSecurityMonitoringNotificationPreview" request
2624+
And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "env:prod", "rule_types": ["log_detection"], "severities": ["critical"], "trigger_source": "security_signals"}, "targets": ["@john.doe@email.com"]}, "type": "notification_rules"}}
2625+
When the request is sent
2626+
Then the response status is 200 OK
2627+
26142628
@skip @team:DataDog/k9-cloud-siem
26152629
Scenario: Test a rule returns "Bad Request" response
26162630
Given new "TestSecurityMonitoringRule" request

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7025,6 +7025,12 @@
70257025
"type": "safe"
70267026
}
70277027
},
7028+
"SendSecurityMonitoringNotificationPreview": {
7029+
"tag": "Security Monitoring",
7030+
"undo": {
7031+
"type": "safe"
7032+
}
7033+
},
70287034
"ListSecurityFilters": {
70297035
"tag": "Security Monitoring",
70307036
"undo": {

lib/datadog_api_client/inflector.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,7 +4655,15 @@ def overrides
46554655
"v2.notification_channel_type" => "NotificationChannelType",
46564656
"v2.notification_rule" => "NotificationRule",
46574657
"v2.notification_rule_attributes" => "NotificationRuleAttributes",
4658+
"v2.notification_rule_preview_notification_status" => "NotificationRulePreviewNotificationStatus",
4659+
"v2.notification_rule_preview_response" => "NotificationRulePreviewResponse",
4660+
"v2.notification_rule_preview_response_attributes" => "NotificationRulePreviewResponseAttributes",
4661+
"v2.notification_rule_preview_response_data" => "NotificationRulePreviewResponseData",
4662+
"v2.notification_rule_preview_response_type" => "NotificationRulePreviewResponseType",
4663+
"v2.notification_rule_preview_result" => "NotificationRulePreviewResult",
46584664
"v2.notification_rule_response" => "NotificationRuleResponse",
4665+
"v2.notification_rule_routing" => "NotificationRuleRouting",
4666+
"v2.notification_rule_routing_mode" => "NotificationRuleRoutingMode",
46594667
"v2.notification_rules_list_response" => "NotificationRulesListResponse",
46604668
"v2.notification_rules_type" => "NotificationRulesType",
46614669
"v2.notion_api_key" => "NotionAPIKey",

0 commit comments

Comments
 (0)