Skip to content

Commit 86f88ad

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 71a3f57 of spec repo (DataDog#3480)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f913a70 commit 86f88ad

14 files changed

Lines changed: 460 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,15 @@ components:
16851685
required: true
16861686
schema:
16871687
type: string
1688+
SecurityMonitoringRuleVersion:
1689+
description: The historical version number of the rule.
1690+
in: path
1691+
name: version
1692+
required: true
1693+
schema:
1694+
example: 1
1695+
format: int64
1696+
type: integer
16881697
SecurityMonitoringSuppressionID:
16891698
description: The ID of the suppression rule
16901699
in: path
@@ -169520,6 +169529,60 @@ paths:
169520169529
operator: OR
169521169530
permissions:
169522169531
- security_monitoring_rules_read
169532+
/api/v2/security_monitoring/rules/{rule_id}/restore/{version}:
169533+
post:
169534+
description: |-
169535+
Restores a custom detection rule to a previously saved historical version.
169536+
Only custom rules can be restored. Default and partner rules return 400.
169537+
The restore creates a new version entry; it does not overwrite history.
169538+
operationId: RestoreSecurityMonitoringRule
169539+
parameters:
169540+
- $ref: "#/components/parameters/SecurityMonitoringRuleID"
169541+
- $ref: "#/components/parameters/SecurityMonitoringRuleVersion"
169542+
responses:
169543+
"200":
169544+
content:
169545+
"application/json":
169546+
examples:
169547+
default:
169548+
value:
169549+
cases:
169550+
- condition: "a > 0"
169551+
name: ""
169552+
notifications: []
169553+
status: info
169554+
id: abc-123
169555+
isEnabled: true
169556+
message: Test rule
169557+
name: My security monitoring rule.
169558+
tags: []
169559+
type: log_detection
169560+
schema:
169561+
$ref: "#/components/schemas/SecurityMonitoringRuleResponse"
169562+
description: OK
169563+
"400":
169564+
$ref: "#/components/responses/BadRequestResponse"
169565+
"403":
169566+
$ref: "#/components/responses/NotAuthorizedResponse"
169567+
"404":
169568+
$ref: "#/components/responses/NotFoundResponse"
169569+
"409":
169570+
$ref: "#/components/responses/ConflictResponse"
169571+
"429":
169572+
$ref: "#/components/responses/TooManyRequestsResponse"
169573+
security:
169574+
- apiKeyAuth: []
169575+
appKeyAuth: []
169576+
- AuthZ:
169577+
- security_monitoring_rules_write
169578+
summary: Restore a rule to a historical version
169579+
tags: ["Security Monitoring"]
169580+
"x-permission":
169581+
operator: OR
169582+
permissions:
169583+
- security_monitoring_rules_write
169584+
x-unstable: |-
169585+
**Note**: This endpoint is in beta and may be subject to changes.
169523169586
/api/v2/security_monitoring/rules/{rule_id}/test:
169524169587
post:
169525169588
description: |-
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-12T09:57:22.725Z

cassettes/features/v2/security_monitoring/Restore-a-rule-to-a-historical-version-returns-Conflict-response.yml

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-12T08:39:41.348Z

cassettes/features/v2/security_monitoring/Restore-a-rule-to-a-historical-version-returns-Not-Found-response.yml

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-12T09:57:25.549Z

cassettes/features/v2/security_monitoring/Restore-a-rule-to-a-historical-version-returns-OK-response.yml

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Restore a rule to a historical version returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.restore_security_monitoring_rule".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
8+
9+
# there is a valid "security_rule" in the system
10+
SECURITY_RULE_ID = ENV["SECURITY_RULE_ID"]
11+
p api_instance.restore_security_monitoring_rule(SECURITY_RULE_ID, 1)

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,10 @@
23522352
"v2.ConvertExistingSecurityMonitoringRule" => {
23532353
"rule_id" => "String",
23542354
},
2355+
"v2.RestoreSecurityMonitoringRule" => {
2356+
"rule_id" => "String",
2357+
"version" => "Integer",
2358+
},
23552359
"v2.TestExistingSecurityMonitoringRule" => {
23562360
"rule_id" => "String",
23572361
"body" => "SecurityMonitoringRuleTestRequest",

features/v2/given.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,22 @@
14221422
"tag": "Security Monitoring",
14231423
"operationId": "CreateSecurityMonitoringRule"
14241424
},
1425+
{
1426+
"parameters": [
1427+
{
1428+
"name": "rule_id",
1429+
"source": "security_rule.id"
1430+
},
1431+
{
1432+
"name": "body",
1433+
"value": "{\n \"name\": \"{{ unique }}-updated\",\n \"queries\": [{\n \"query\": \"@test:true\",\n \"aggregation\": \"count\",\n \"groupByFields\": [],\n \"distinctFields\": [],\n \"metrics\": []\n }],\n \"filters\": [],\n \"cases\": [{\n \"name\": \"\",\n \"status\": \"info\",\n \"condition\": \"a > 0\",\n \"notifications\": []\n }],\n \"options\": {\n \"evaluationWindow\": 900,\n \"keepAlive\": 3600,\n \"maxSignalDuration\": 86400\n },\n \"message\": \"Test rule updated\",\n \"tags\": [],\n \"isEnabled\": true\n}"
1434+
}
1435+
],
1436+
"step": "there is a valid \"security_rule_updated\" in the system",
1437+
"key": "security_rule_updated",
1438+
"tag": "Security Monitoring",
1439+
"operationId": "UpdateSecurityMonitoringRule"
1440+
},
14251441
{
14261442
"step": "a valid \"configuration\" in the system",
14271443
"key": "configuration",

0 commit comments

Comments
 (0)