Skip to content

Commit 6077707

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Cloud SIEM - Add instantaneousBaseline feature parameter. (DataDog#2814)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3d9b63f commit 6077707

6 files changed

Lines changed: 105 additions & 1 deletion

.generator/schemas/v2/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47596,6 +47596,8 @@ components:
4759647596
properties:
4759747597
forgetAfter:
4759847598
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsForgetAfter'
47599+
instantaneousBaseline:
47600+
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsInstantaneousBaseline'
4759947601
learningDuration:
4760047602
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningDuration'
4760147603
learningMethod:
@@ -47621,6 +47623,13 @@ components:
4762147623
- TWO_WEEKS
4762247624
- THREE_WEEKS
4762347625
- FOUR_WEEKS
47626+
SecurityMonitoringRuleNewValueOptionsInstantaneousBaseline:
47627+
description: When set to true, Datadog uses previous values that fall within
47628+
the defined learning window to construct the baseline, enabling the system
47629+
to establish an accurate baseline more rapidly rather than relying solely
47630+
on gradual learning over time.
47631+
example: false
47632+
type: boolean
4762447633
SecurityMonitoringRuleNewValueOptionsLearningDuration:
4762547634
default: 0
4762647635
description: 'The duration in days during which values are learned, and after
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-12-10T08:37:17.537Z

cassettes/features/v2/security_monitoring/Validate-a-detection-rule-with-detection-method-new-value-with-enabled-feature-instantaneousBaseline-returns-OK-response.yml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Validate a detection rule with detection method 'new_value' with enabled feature 'instantaneousBaseline' returns "OK"
2+
response
3+
4+
require "datadog_api_client"
5+
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
6+
7+
body = DatadogAPIClient::V2::SecurityMonitoringStandardRulePayload.new({
8+
cases: [
9+
DatadogAPIClient::V2::SecurityMonitoringRuleCaseCreate.new({
10+
name: "",
11+
status: DatadogAPIClient::V2::SecurityMonitoringRuleSeverity::INFO,
12+
notifications: [],
13+
}),
14+
],
15+
has_extended_title: true,
16+
is_enabled: true,
17+
message: "My security monitoring rule",
18+
name: "My security monitoring rule",
19+
options: DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new({
20+
evaluation_window: DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow::ZERO_MINUTES,
21+
keep_alive: DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive::FIVE_MINUTES,
22+
max_signal_duration: DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration::TEN_MINUTES,
23+
detection_method: DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod::NEW_VALUE,
24+
new_value_options: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions.new({
25+
forget_after: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter::ONE_WEEK,
26+
instantaneous_baseline: true,
27+
learning_duration: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration::ONE_DAY,
28+
learning_threshold: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningThreshold::ZERO_OCCURRENCES,
29+
learning_method: DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningMethod::DURATION,
30+
}),
31+
}),
32+
queries: [
33+
DatadogAPIClient::V2::SecurityMonitoringStandardRuleQuery.new({
34+
query: "source:source_here",
35+
group_by_fields: [
36+
"@userIdentity.assumed_role",
37+
],
38+
distinct_fields: [],
39+
metric: "name",
40+
metrics: [
41+
"name",
42+
],
43+
aggregation: DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation::NEW_VALUE,
44+
name: "",
45+
data_source: DatadogAPIClient::V2::SecurityMonitoringStandardDataSource::LOGS,
46+
}),
47+
],
48+
tags: [
49+
"env:prod",
50+
"team:security",
51+
],
52+
type: DatadogAPIClient::V2::SecurityMonitoringRuleTypeCreate::LOG_DETECTION,
53+
})
54+
api_instance.validate_security_monitoring_rule(body)

features/v2/security_monitoring.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,13 @@ Feature: Security Monitoring
17641764
When the request is sent
17651765
Then the response status is 204 OK
17661766

1767+
@team:DataDog/k9-cloud-security-platform
1768+
Scenario: Validate a detection rule with detection method 'new_value' with enabled feature 'instantaneousBaseline' returns "OK" response
1769+
Given new "ValidateSecurityMonitoringRule" request
1770+
And body with value {"cases":[{"name":"","status":"info","notifications":[]}],"hasExtendedTitle":true,"isEnabled":true,"message":"My security monitoring rule","name":"My security monitoring rule","options":{"evaluationWindow":0,"keepAlive":300,"maxSignalDuration":600,"detectionMethod":"new_value","newValueOptions":{"forgetAfter":7,"instantaneousBaseline":true,"learningDuration":1,"learningThreshold":0,"learningMethod":"duration"}},"queries":[{"query":"source:source_here","groupByFields":["@userIdentity.assumed_role"],"distinctFields":[],"metric":"name","metrics":["name"],"aggregation":"new_value","name":"","dataSource":"logs"}],"tags":["env:prod","team:security"],"type":"log_detection"}
1771+
When the request is sent
1772+
Then the response status is 204 OK
1773+
17671774
@team:DataDog/k9-cloud-security-platform
17681775
Scenario: Validate a detection rule with detection method 'sequence_detection' returns "OK" response
17691776
Given new "ValidateSecurityMonitoringRule" request

lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class SecurityMonitoringRuleNewValueOptions
2424
# The duration in days after which a learned value is forgotten.
2525
attr_accessor :forget_after
2626

27+
# When set to true, Datadog uses previous values that fall within the defined learning window to construct the baseline, enabling the system to establish an accurate baseline more rapidly rather than relying solely on gradual learning over time.
28+
attr_accessor :instantaneous_baseline
29+
2730
# The duration in days during which values are learned, and after which signals will be generated for values that
2831
# weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned.
2932
attr_accessor :learning_duration
@@ -41,6 +44,7 @@ class SecurityMonitoringRuleNewValueOptions
4144
def self.attribute_map
4245
{
4346
:'forget_after' => :'forgetAfter',
47+
:'instantaneous_baseline' => :'instantaneousBaseline',
4448
:'learning_duration' => :'learningDuration',
4549
:'learning_method' => :'learningMethod',
4650
:'learning_threshold' => :'learningThreshold'
@@ -52,6 +56,7 @@ def self.attribute_map
5256
def self.openapi_types
5357
{
5458
:'forget_after' => :'SecurityMonitoringRuleNewValueOptionsForgetAfter',
59+
:'instantaneous_baseline' => :'Boolean',
5560
:'learning_duration' => :'SecurityMonitoringRuleNewValueOptionsLearningDuration',
5661
:'learning_method' => :'SecurityMonitoringRuleNewValueOptionsLearningMethod',
5762
:'learning_threshold' => :'SecurityMonitoringRuleNewValueOptionsLearningThreshold'
@@ -80,6 +85,10 @@ def initialize(attributes = {})
8085
self.forget_after = attributes[:'forget_after']
8186
end
8287

88+
if attributes.key?(:'instantaneous_baseline')
89+
self.instantaneous_baseline = attributes[:'instantaneous_baseline']
90+
end
91+
8392
if attributes.key?(:'learning_duration')
8493
self.learning_duration = attributes[:'learning_duration']
8594
end
@@ -120,6 +129,7 @@ def ==(o)
120129
return true if self.equal?(o)
121130
self.class == o.class &&
122131
forget_after == o.forget_after &&
132+
instantaneous_baseline == o.instantaneous_baseline &&
123133
learning_duration == o.learning_duration &&
124134
learning_method == o.learning_method &&
125135
learning_threshold == o.learning_threshold &&
@@ -130,7 +140,7 @@ def ==(o)
130140
# @return [Integer] Hash code
131141
# @!visibility private
132142
def hash
133-
[forget_after, learning_duration, learning_method, learning_threshold, additional_properties].hash
143+
[forget_after, instantaneous_baseline, learning_duration, learning_method, learning_threshold, additional_properties].hash
134144
end
135145
end
136146
end

0 commit comments

Comments
 (0)