Skip to content

Commit c904f5a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 19949fa of spec repo (DataDog#3456)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent ed54b40 commit c904f5a

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:
@@ -75597,6 +75687,7 @@ components:
7559775687
- iac_misconfiguration
7559875688
- sast_vulnerability
7559975689
- secret_vulnerability
75690+
example: log_detection
7560075691
type: string
7560175692
x-enum-varnames:
7560275693
- APPLICATION_SECURITY
@@ -164667,6 +164758,73 @@ paths:
164667164758
x-unstable: |-
164668164759
**Note**: This endpoint is in preview and is subject to change.
164669164760
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
164761+
/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview:
164762+
post:
164763+
description: Send a notification preview to test that a notification rule's targets are properly configured.
164764+
operationId: SendSecurityMonitoringNotificationPreview
164765+
requestBody:
164766+
content:
164767+
application/json:
164768+
examples:
164769+
default:
164770+
value:
164771+
data:
164772+
attributes:
164773+
enabled: true
164774+
name: Rule 1
164775+
selectors:
164776+
query: env:prod
164777+
rule_types:
164778+
- log_detection
164779+
severities:
164780+
- critical
164781+
trigger_source: security_signals
164782+
targets:
164783+
- "@john.doe@email.com"
164784+
type: notification_rules
164785+
schema:
164786+
$ref: "#/components/schemas/CreateNotificationRuleParameters"
164787+
required: true
164788+
responses:
164789+
"200":
164790+
content:
164791+
application/json:
164792+
examples:
164793+
default:
164794+
value:
164795+
data:
164796+
attributes:
164797+
preview_results:
164798+
- notification_status: DEFAULT
164799+
rule_type: log_detection
164800+
id: rka-loa-zwu
164801+
type: notification_preview_response
164802+
schema:
164803+
$ref: "#/components/schemas/NotificationRulePreviewResponse"
164804+
description: OK
164805+
"400":
164806+
content:
164807+
application/json:
164808+
schema:
164809+
$ref: "#/components/schemas/JSONAPIErrorResponse"
164810+
description: Bad Request
164811+
"403":
164812+
$ref: "#/components/responses/NotAuthorizedResponse"
164813+
"429":
164814+
$ref: "#/components/responses/TooManyRequestsResponse"
164815+
security:
164816+
- apiKeyAuth: []
164817+
appKeyAuth: []
164818+
- AuthZ:
164819+
- security_monitoring_notification_profiles_write
164820+
summary: Test a notification rule
164821+
tags:
164822+
- Security Monitoring
164823+
x-codegen-request-body-name: body
164824+
"x-permission":
164825+
operator: OR
164826+
permissions:
164827+
- security_monitoring_notification_profiles_write
164670164828
/api/v2/security_monitoring/configuration/security_filters:
164671164829
get:
164672164830
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
@@ -7038,6 +7038,12 @@
70387038
"type": "safe"
70397039
}
70407040
},
7041+
"SendSecurityMonitoringNotificationPreview": {
7042+
"tag": "Security Monitoring",
7043+
"undo": {
7044+
"type": "safe"
7045+
}
7046+
},
70417047
"ListSecurityFilters": {
70427048
"tag": "Security Monitoring",
70437049
"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)