Skip to content

Commit 23e428b

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ab0bbeb of spec repo
1 parent ba14c4f commit 23e428b

File tree

16 files changed

+627
-0
lines changed

16 files changed

+627
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20456,6 +20456,8 @@ components:
2045620456
$ref: '#/components/schemas/SecurityMonitoringRuleMaxSignalDuration'
2045720457
newValueOptions:
2045820458
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptions'
20459+
sequenceDetectionOptions:
20460+
$ref: '#/components/schemas/SecurityMonitoringRuleSequenceDetectionOptions'
2045920461
thirdPartyRuleOptions:
2046020462
$ref: '#/components/schemas/SecurityMonitoringRuleThirdPartyOptions'
2046120463
type: object
@@ -40758,6 +40760,7 @@ components:
4075840760
- hardcoded
4075940761
- third_party
4076040762
- anomaly_threshold
40763+
- sequence_detection
4076140764
type: string
4076240765
x-enum-varnames:
4076340766
- THRESHOLD
@@ -40767,6 +40770,7 @@ components:
4076740770
- HARDCODED
4076840771
- THIRD_PARTY
4076940772
- ANOMALY_THRESHOLD
40773+
- SEQUENCE_DETECTION
4077040774
SecurityMonitoringRuleEvaluationWindow:
4077140775
description: 'A time window is specified to match when at least one of the cases
4077240776
matches true. This is a sliding window
@@ -40980,6 +40984,8 @@ components:
4098040984
$ref: '#/components/schemas/SecurityMonitoringRuleMaxSignalDuration'
4098140985
newValueOptions:
4098240986
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptions'
40987+
sequenceDetectionOptions:
40988+
$ref: '#/components/schemas/SecurityMonitoringRuleSequenceDetectionOptions'
4098340989
thirdPartyRuleOptions:
4098440990
$ref: '#/components/schemas/SecurityMonitoringRuleThirdPartyOptions'
4098540991
type: object
@@ -41055,6 +41061,47 @@ components:
4105541061
oneOf:
4105641062
- $ref: '#/components/schemas/SecurityMonitoringStandardRuleResponse'
4105741063
- $ref: '#/components/schemas/SecurityMonitoringSignalRuleResponse'
41064+
SecurityMonitoringRuleSequenceDetectionOptions:
41065+
description: Options on sequence detection method.
41066+
properties:
41067+
stepTransitions:
41068+
description: Transitions defining the allowed order of steps and their evaluation
41069+
windows.
41070+
items:
41071+
$ref: '#/components/schemas/SecurityMonitoringRuleSequenceDetectionStepTransition'
41072+
type: array
41073+
steps:
41074+
description: Steps that define the conditions to be matched in sequence.
41075+
items:
41076+
$ref: '#/components/schemas/SecurityMonitoringRuleSequenceDetectionStep'
41077+
type: array
41078+
type: object
41079+
SecurityMonitoringRuleSequenceDetectionStep:
41080+
description: Step definition for sequence detection containing the step name,
41081+
condition, and evaluation window.
41082+
properties:
41083+
condition:
41084+
description: Condition referencing rule queries (e.g., `a > 0`).
41085+
type: string
41086+
evaluationWindow:
41087+
$ref: '#/components/schemas/SecurityMonitoringRuleEvaluationWindow'
41088+
name:
41089+
description: Unique name identifying the step.
41090+
type: string
41091+
type: object
41092+
SecurityMonitoringRuleSequenceDetectionStepTransition:
41093+
description: Transition from a parent step to a child step within a sequence
41094+
detection rule.
41095+
properties:
41096+
child:
41097+
description: Name of the child step.
41098+
type: string
41099+
evaluationWindow:
41100+
$ref: '#/components/schemas/SecurityMonitoringRuleEvaluationWindow'
41101+
parent:
41102+
description: Name of the parent step.
41103+
type: string
41104+
type: object
4105841105
SecurityMonitoringRuleSeverity:
4105941106
description: Severity of the Security Signal.
4106041107
enum:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-09-12T15:45:55.719Z"
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"log": {
3+
"_recordingName": "Security Monitoring/Create a detection rule with detection method 'sequence_detection' returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "faa8ed427532bf09665284cdbb2daf9c",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 1000,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 589,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"cases\":[{\"condition\":\"step_b > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"isEnabled\":true,\"message\":\"Logs and signals asdf\",\"name\":\"Test-Create_a_detection_rule_with_detection_method_sequence_detection_returns_OK_response-1757691955\",\"options\":{\"detectionMethod\":\"sequence_detection\",\"evaluationWindow\":0,\"keepAlive\":300,\"maxSignalDuration\":600,\"sequenceDetectionOptions\":{\"stepTransitions\":[{\"child\":\"step_b\",\"evaluationWindow\":900,\"parent\":\"step_a\"}],\"steps\":[{\"condition\":\"a > 0\",\"evaluationWindow\":60,\"name\":\"step_a\"},{\"condition\":\"b > 0\",\"evaluationWindow\":60,\"name\":\"step_b\"}]}},\"queries\":[{\"aggregation\":\"count\",\"dataSource\":\"logs\",\"distinctFields\":[],\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"name\":\"\",\"query\":\"service:logs-rule-reducer source:paul test2\"},{\"aggregation\":\"count\",\"dataSource\":\"logs\",\"distinctFields\":[],\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"name\":\"\",\"query\":\"service:logs-rule-reducer source:paul test1\"}],\"tags\":[],\"type\":\"log_detection\"}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules"
39+
},
40+
"response": {
41+
"bodySize": 1378,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1378,
45+
"text": "{\"name\":\"Test-Create_a_detection_rule_with_detection_method_sequence_detection_returns_OK_response-1757691955\",\"createdAt\":1757691955862,\"isDefault\":false,\"isPartner\":false,\"isEnabled\":true,\"isBeta\":false,\"isDeleted\":false,\"isDeprecated\":false,\"queries\":[{\"query\":\"service:logs-rule-reducer source:paul test2\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"},{\"query\":\"service:logs-rule-reducer source:paul test1\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"}],\"options\":{\"evaluationWindow\":0,\"detectionMethod\":\"sequence_detection\",\"maxSignalDuration\":600,\"keepAlive\":300,\"sequenceDetectionOptions\":{\"steps\":[{\"name\":\"step_a\",\"condition\":\"a \\u003e 0\",\"evaluationWindow\":60},{\"name\":\"step_b\",\"condition\":\"b \\u003e 0\",\"evaluationWindow\":60}],\"stepTransitions\":[{\"parent\":\"step_a\",\"child\":\"step_b\",\"evaluationWindow\":900}]}},\"cases\":[{\"name\":\"\",\"status\":\"info\",\"notifications\":[],\"condition\":\"step_b \\u003e 0\"}],\"message\":\"Logs and signals asdf\",\"tags\":[],\"hasExtendedTitle\":false,\"type\":\"log_detection\",\"filters\":[],\"version\":1,\"id\":\"k0l-txb-xxx\",\"blocking\":false,\"metadata\":{\"entities\":null,\"sources\":null},\"creationAuthorId\":1445416,\"creator\":{\"handle\":\"[email protected]\",\"name\":\"frog\"},\"updater\":{\"handle\":\"\",\"name\":\"\"}}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 655,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2025-09-12T15:45:55.723Z",
61+
"time": 207
62+
},
63+
{
64+
"_id": "d7239dc51220cdcb7c3c9788a4feafa5",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "*/*"
75+
}
76+
],
77+
"headersSize": 536,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/k0l-txb-xxx"
82+
},
83+
"response": {
84+
"bodySize": 0,
85+
"content": {
86+
"mimeType": "text/plain",
87+
"size": 0
88+
},
89+
"cookies": [],
90+
"headers": [],
91+
"headersSize": 601,
92+
"httpVersion": "HTTP/1.1",
93+
"redirectURL": "",
94+
"status": 204,
95+
"statusText": "No Content"
96+
},
97+
"startedDateTime": "2025-09-12T15:45:55.938Z",
98+
"time": 232
99+
}
100+
],
101+
"pages": [],
102+
"version": "1.2"
103+
}
104+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-09-12T15:43:48.016Z"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"log": {
3+
"_recordingName": "Security Monitoring/Validate a detection rule with detection method 'sequence_detection' returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "7c3af95d617e9512f01309e2f2ec4f07",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 856,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "*/*"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 588,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"cases\":[{\"condition\":\"step_b > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"hasExtendedTitle\":true,\"isEnabled\":true,\"message\":\"My security monitoring rule\",\"name\":\"My security monitoring rule\",\"options\":{\"detectionMethod\":\"sequence_detection\",\"evaluationWindow\":0,\"keepAlive\":300,\"maxSignalDuration\":600,\"sequenceDetectionOptions\":{\"stepTransitions\":[{\"child\":\"step_b\",\"evaluationWindow\":900,\"parent\":\"step_a\"}],\"steps\":[{\"condition\":\"a > 0\",\"evaluationWindow\":60,\"name\":\"step_a\"},{\"condition\":\"b > 0\",\"evaluationWindow\":60,\"name\":\"step_b\"}]}},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[\"@userIdentity.assumed_role\"],\"name\":\"\",\"query\":\"source:source_here\"},{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"name\":\"\",\"query\":\"source:source_here2\"}],\"tags\":[\"env:prod\",\"team:security\"],\"type\":\"log_detection\"}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/validation"
39+
},
40+
"response": {
41+
"bodySize": 0,
42+
"content": {
43+
"mimeType": "text/plain",
44+
"size": 0
45+
},
46+
"cookies": [],
47+
"headers": [],
48+
"headersSize": 601,
49+
"httpVersion": "HTTP/1.1",
50+
"redirectURL": "",
51+
"status": 204,
52+
"statusText": "No Content"
53+
},
54+
"startedDateTime": "2025-09-12T15:43:48.019Z",
55+
"time": 114
56+
}
57+
],
58+
"pages": [],
59+
"version": "1.2"
60+
}
61+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* Create a detection rule with detection method 'sequence_detection' returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.SecurityMonitoringApi(configuration);
9+
10+
const params: v2.SecurityMonitoringApiCreateSecurityMonitoringRuleRequest = {
11+
body: {
12+
name: "Example-Security-Monitoring",
13+
type: "log_detection",
14+
isEnabled: true,
15+
queries: [
16+
{
17+
aggregation: "count",
18+
dataSource: "logs",
19+
distinctFields: [],
20+
groupByFields: [],
21+
hasOptionalGroupByFields: false,
22+
name: "",
23+
query: "service:logs-rule-reducer source:paul test2",
24+
},
25+
{
26+
aggregation: "count",
27+
dataSource: "logs",
28+
distinctFields: [],
29+
groupByFields: [],
30+
hasOptionalGroupByFields: false,
31+
name: "",
32+
query: "service:logs-rule-reducer source:paul test1",
33+
},
34+
],
35+
cases: [
36+
{
37+
name: "",
38+
status: "info",
39+
notifications: [],
40+
condition: "step_b > 0",
41+
},
42+
],
43+
message: "Logs and signals asdf",
44+
options: {
45+
detectionMethod: "sequence_detection",
46+
evaluationWindow: 0,
47+
keepAlive: 300,
48+
maxSignalDuration: 600,
49+
sequenceDetectionOptions: {
50+
stepTransitions: [
51+
{
52+
child: "step_b",
53+
evaluationWindow: 900,
54+
parent: "step_a",
55+
},
56+
],
57+
steps: [
58+
{
59+
condition: "a > 0",
60+
evaluationWindow: 60,
61+
name: "step_a",
62+
},
63+
{
64+
condition: "b > 0",
65+
evaluationWindow: 60,
66+
name: "step_b",
67+
},
68+
],
69+
},
70+
},
71+
tags: [],
72+
},
73+
};
74+
75+
apiInstance
76+
.createSecurityMonitoringRule(params)
77+
.then((data: v2.SecurityMonitoringRuleResponse) => {
78+
console.log(
79+
"API called successfully. Returned data: " + JSON.stringify(data)
80+
);
81+
})
82+
.catch((error: any) => console.error(error));

0 commit comments

Comments
 (0)