Skip to content

Commit bd20e19

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 0d57a17 of spec repo
1 parent 686e823 commit bd20e19

File tree

8 files changed

+267
-4
lines changed

8 files changed

+267
-4
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "04d09cb",
3-
"generated": "2025-07-23 09:22:24.045"
2+
"spec_repo_commit": "0d57a17",
3+
"generated": "2025-07-23 13:37:40.455"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34885,6 +34885,27 @@ components:
3488534885
- $ref: '#/components/schemas/SecurityMonitoringStandardRulePayload'
3488634886
- $ref: '#/components/schemas/SecurityMonitoringSignalRulePayload'
3488734887
- $ref: '#/components/schemas/CloudConfigurationRulePayload'
34888+
SecurityMonitoringSchedulingOptions:
34889+
description: Options for scheduled rules. When this field is present, the rule
34890+
runs based on the schedule. When absent, it runs real-time on ingested logs.
34891+
nullable: true
34892+
properties:
34893+
rrule:
34894+
description: Schedule for the rule queries, written in RRULE syntax. See
34895+
[RFC](https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html)
34896+
for syntax reference.
34897+
example: FREQ=HOURLY;INTERVAL=1;
34898+
type: string
34899+
start:
34900+
description: Start date for the schedule, in ISO 8601 format without timezone.
34901+
example: '2025-07-14T12:00:00'
34902+
type: string
34903+
timezone:
34904+
description: Time zone of the start date, in the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
34905+
format.
34906+
example: America/New_York
34907+
type: string
34908+
type: object
3488834909
SecurityMonitoringSignal:
3488934910
description: Object description of a security signal.
3489034911
properties:
@@ -35563,6 +35584,12 @@ components:
3556335584
SecurityMonitoringStandardRuleCreatePayload:
3556435585
description: Create a new rule.
3556535586
properties:
35587+
calculatedFields:
35588+
description: Calculated fields. Only allowed for scheduled rules, i.e. when
35589+
schedulingOptions is also defined.
35590+
items:
35591+
$ref: '#/components/schemas/CalculatedField'
35592+
type: array
3556635593
cases:
3556735594
description: Cases for generating signals.
3556835595
example: []
@@ -35615,6 +35642,8 @@ components:
3561535642
items:
3561635643
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3561735644
type: array
35645+
schedulingOptions:
35646+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3561835647
tags:
3561935648
description: Tags for generated signals.
3562035649
example:
@@ -35760,6 +35789,14 @@ components:
3576035789
example: false
3576135790
readOnly: true
3576235791
type: boolean
35792+
index:
35793+
description: '**This field is currently unstable and might be removed in
35794+
minor version upgrade.**
35795+
35796+
The index to run the query on, if the `dataSource` is `logs`. Only used
35797+
for scheduled rules, i.e. when the `schedulingOptions` field is present
35798+
in the rule payload.'
35799+
type: string
3576335800
metric:
3576435801
deprecated: true
3576535802
description: '(Deprecated) The target field to aggregate over when using
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Create a scheduled detection rule returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
5+
6+
body = DatadogAPIClient::V2::SecurityMonitoringStandardRuleCreatePayload.new({
7+
name: "Example-Security-Monitoring",
8+
queries: [
9+
DatadogAPIClient::V2::SecurityMonitoringStandardRuleQuery.new({
10+
query: "@test:true",
11+
aggregation: DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation::COUNT,
12+
group_by_fields: [],
13+
distinct_fields: [],
14+
index: "main",
15+
}),
16+
],
17+
filters: [],
18+
cases: [
19+
DatadogAPIClient::V2::SecurityMonitoringRuleCaseCreate.new({
20+
name: "",
21+
status: DatadogAPIClient::V2::SecurityMonitoringRuleSeverity::INFO,
22+
condition: "a > 0",
23+
notifications: [],
24+
}),
25+
],
26+
options: DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new({
27+
evaluation_window: DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow::FIFTEEN_MINUTES,
28+
keep_alive: DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive::ONE_HOUR,
29+
max_signal_duration: DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration::ONE_DAY,
30+
}),
31+
message: "Test rule",
32+
tags: [],
33+
is_enabled: true,
34+
type: DatadogAPIClient::V2::SecurityMonitoringRuleTypeCreate::LOG_DETECTION,
35+
scheduling_options: DatadogAPIClient::V2::SecurityMonitoringSchedulingOptions.new({
36+
rrule: "FREQ=HOURLY;INTERVAL=2;",
37+
start: "2025-06-18T12:00:00",
38+
timezone: "Europe/Paris",
39+
}),
40+
})
41+
p api_instance.create_security_monitoring_rule(body)

features/v2/security_monitoring.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,24 @@ Feature: Security Monitoring
295295
When the request is sent
296296
Then the response status is 201 Successfully created the notification rule.
297297

298+
@team:DataDog/k9-cloud-security-platform
299+
Scenario: Create a scheduled detection rule returns "OK" response
300+
Given new "CreateSecurityMonitoringRule" request
301+
And body with value {"name":"{{ unique }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"index":"main"}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection", "schedulingOptions": {"rrule": "FREQ=HOURLY;INTERVAL=2;", "start": "2025-06-18T12:00:00", "timezone": "Europe/Paris"}}
302+
When the request is sent
303+
Then the response status is 200 OK
304+
And the response "name" is equal to "{{ unique }}"
305+
And the response "type" is equal to "log_detection"
306+
And the response "message" is equal to "Test rule"
307+
And the response "schedulingOptions" is equal to {"rrule": "FREQ=HOURLY;INTERVAL=2;", "start": "2025-06-18T12:00:00", "timezone": "Europe/Paris"}
308+
309+
@team:DataDog/k9-cloud-security-platform
310+
Scenario: Create a scheduled rule without rrule returns "Bad Request" response
311+
Given new "CreateSecurityMonitoringRule" request
312+
And body with value {"name":"{{ unique }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"index":"main"}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection", "schedulingOptions": {"start": "2025-06-18T12:00:00", "timezone": "Europe/Paris"}}
313+
When the request is sent
314+
Then the response status is 400 Bad Request
315+
298316
@generated @skip @team:DataDog/k9-cloud-security-platform
299317
Scenario: Create a security filter returns "Bad Request" response
300318
Given new "CreateSecurityFilter" request

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,7 @@ def overrides
30913091
"v2.security_monitoring_rule_type_test" => "SecurityMonitoringRuleTypeTest",
30923092
"v2.security_monitoring_rule_update_payload" => "SecurityMonitoringRuleUpdatePayload",
30933093
"v2.security_monitoring_rule_validate_payload" => "SecurityMonitoringRuleValidatePayload",
3094+
"v2.security_monitoring_scheduling_options" => "SecurityMonitoringSchedulingOptions",
30943095
"v2.security_monitoring_signal" => "SecurityMonitoringSignal",
30953096
"v2.security_monitoring_signal_archive_reason" => "SecurityMonitoringSignalArchiveReason",
30963097
"v2.security_monitoring_signal_assignee_update_attributes" => "SecurityMonitoringSignalAssigneeUpdateAttributes",
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Options for scheduled rules. When this field is present, the rule runs based on the schedule. When absent, it runs real-time on ingested logs.
21+
class SecurityMonitoringSchedulingOptions
22+
include BaseGenericModel
23+
24+
# Schedule for the rule queries, written in RRULE syntax. See [RFC](https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html) for syntax reference.
25+
attr_accessor :rrule
26+
27+
# Start date for the schedule, in ISO 8601 format without timezone.
28+
attr_accessor :start
29+
30+
# Time zone of the start date, in the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format.
31+
attr_accessor :timezone
32+
33+
attr_accessor :additional_properties
34+
35+
# Attribute mapping from ruby-style variable name to JSON key.
36+
# @!visibility private
37+
def self.attribute_map
38+
{
39+
:'rrule' => :'rrule',
40+
:'start' => :'start',
41+
:'timezone' => :'timezone'
42+
}
43+
end
44+
45+
# Attribute type mapping.
46+
# @!visibility private
47+
def self.openapi_types
48+
{
49+
:'rrule' => :'String',
50+
:'start' => :'String',
51+
:'timezone' => :'String'
52+
}
53+
end
54+
55+
# Initializes the object
56+
# @param attributes [Hash] Model attributes in the form of hash
57+
# @!visibility private
58+
def initialize(attributes = {})
59+
if (!attributes.is_a?(Hash))
60+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringSchedulingOptions` initialize method"
61+
end
62+
63+
self.additional_properties = {}
64+
# check to see if the attribute exists and convert string to symbol for hash key
65+
attributes = attributes.each_with_object({}) { |(k, v), h|
66+
if (!self.class.attribute_map.key?(k.to_sym))
67+
self.additional_properties[k.to_sym] = v
68+
else
69+
h[k.to_sym] = v
70+
end
71+
}
72+
73+
if attributes.key?(:'rrule')
74+
self.rrule = attributes[:'rrule']
75+
end
76+
77+
if attributes.key?(:'start')
78+
self.start = attributes[:'start']
79+
end
80+
81+
if attributes.key?(:'timezone')
82+
self.timezone = attributes[:'timezone']
83+
end
84+
end
85+
86+
# Returns the object in the form of hash, with additionalProperties support.
87+
# @return [Hash] Returns the object in the form of hash
88+
# @!visibility private
89+
def to_hash
90+
hash = {}
91+
self.class.attribute_map.each_pair do |attr, param|
92+
value = self.send(attr)
93+
if value.nil?
94+
is_nullable = self.class.openapi_nullable.include?(attr)
95+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
96+
end
97+
98+
hash[param] = _to_hash(value)
99+
end
100+
self.additional_properties.each_pair do |attr, value|
101+
hash[attr] = value
102+
end
103+
hash
104+
end
105+
106+
# Checks equality by comparing each attribute.
107+
# @param o [Object] Object to be compared
108+
# @!visibility private
109+
def ==(o)
110+
return true if self.equal?(o)
111+
self.class == o.class &&
112+
rrule == o.rrule &&
113+
start == o.start &&
114+
timezone == o.timezone &&
115+
additional_properties == o.additional_properties
116+
end
117+
118+
# Calculates hash code according to all attributes.
119+
# @return [Integer] Hash code
120+
# @!visibility private
121+
def hash
122+
[rrule, start, timezone, additional_properties].hash
123+
end
124+
end
125+
end

lib/datadog_api_client/v2/models/security_monitoring_standard_rule_create_payload.rb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ module DatadogAPIClient::V2
2121
class SecurityMonitoringStandardRuleCreatePayload
2222
include BaseGenericModel
2323

24+
# Calculated fields. Only allowed for scheduled rules, i.e. when schedulingOptions is also defined.
25+
attr_accessor :calculated_fields
26+
2427
# Cases for generating signals.
2528
attr_reader :cases
2629

@@ -51,6 +54,9 @@ class SecurityMonitoringStandardRuleCreatePayload
5154
# Reference tables for the rule.
5255
attr_accessor :reference_tables
5356

57+
# Options for scheduled rules. When this field is present, the rule runs based on the schedule. When absent, it runs real-time on ingested logs.
58+
attr_accessor :scheduling_options
59+
5460
# Tags for generated signals.
5561
attr_accessor :tags
5662

@@ -66,6 +72,7 @@ class SecurityMonitoringStandardRuleCreatePayload
6672
# @!visibility private
6773
def self.attribute_map
6874
{
75+
:'calculated_fields' => :'calculatedFields',
6976
:'cases' => :'cases',
7077
:'filters' => :'filters',
7178
:'group_signals_by' => :'groupSignalsBy',
@@ -76,6 +83,7 @@ def self.attribute_map
7683
:'options' => :'options',
7784
:'queries' => :'queries',
7885
:'reference_tables' => :'referenceTables',
86+
:'scheduling_options' => :'schedulingOptions',
7987
:'tags' => :'tags',
8088
:'third_party_cases' => :'thirdPartyCases',
8189
:'type' => :'type'
@@ -86,6 +94,7 @@ def self.attribute_map
8694
# @!visibility private
8795
def self.openapi_types
8896
{
97+
:'calculated_fields' => :'Array<CalculatedField>',
8998
:'cases' => :'Array<SecurityMonitoringRuleCaseCreate>',
9099
:'filters' => :'Array<SecurityMonitoringFilter>',
91100
:'group_signals_by' => :'Array<String>',
@@ -96,12 +105,21 @@ def self.openapi_types
96105
:'options' => :'SecurityMonitoringRuleOptions',
97106
:'queries' => :'Array<SecurityMonitoringStandardRuleQuery>',
98107
:'reference_tables' => :'Array<SecurityMonitoringReferenceTable>',
108+
:'scheduling_options' => :'SecurityMonitoringSchedulingOptions',
99109
:'tags' => :'Array<String>',
100110
:'third_party_cases' => :'Array<SecurityMonitoringThirdPartyRuleCaseCreate>',
101111
:'type' => :'SecurityMonitoringRuleTypeCreate'
102112
}
103113
end
104114

115+
# List of attributes with nullable: true
116+
# @!visibility private
117+
def self.openapi_nullable
118+
Set.new([
119+
:'scheduling_options',
120+
])
121+
end
122+
105123
# Initializes the object
106124
# @param attributes [Hash] Model attributes in the form of hash
107125
# @!visibility private
@@ -120,6 +138,12 @@ def initialize(attributes = {})
120138
end
121139
}
122140

141+
if attributes.key?(:'calculated_fields')
142+
if (value = attributes[:'calculated_fields']).is_a?(Array)
143+
self.calculated_fields = value
144+
end
145+
end
146+
123147
if attributes.key?(:'cases')
124148
if (value = attributes[:'cases']).is_a?(Array)
125149
self.cases = value
@@ -170,6 +194,10 @@ def initialize(attributes = {})
170194
end
171195
end
172196

197+
if attributes.key?(:'scheduling_options')
198+
self.scheduling_options = attributes[:'scheduling_options']
199+
end
200+
173201
if attributes.key?(:'tags')
174202
if (value = attributes[:'tags']).is_a?(Array)
175203
self.tags = value
@@ -286,6 +314,7 @@ def to_hash
286314
def ==(o)
287315
return true if self.equal?(o)
288316
self.class == o.class &&
317+
calculated_fields == o.calculated_fields &&
289318
cases == o.cases &&
290319
filters == o.filters &&
291320
group_signals_by == o.group_signals_by &&
@@ -296,6 +325,7 @@ def ==(o)
296325
options == o.options &&
297326
queries == o.queries &&
298327
reference_tables == o.reference_tables &&
328+
scheduling_options == o.scheduling_options &&
299329
tags == o.tags &&
300330
third_party_cases == o.third_party_cases &&
301331
type == o.type &&
@@ -306,7 +336,7 @@ def ==(o)
306336
# @return [Integer] Hash code
307337
# @!visibility private
308338
def hash
309-
[cases, filters, group_signals_by, has_extended_title, is_enabled, message, name, options, queries, reference_tables, tags, third_party_cases, type, additional_properties].hash
339+
[calculated_fields, cases, filters, group_signals_by, has_extended_title, is_enabled, message, name, options, queries, reference_tables, scheduling_options, tags, third_party_cases, type, additional_properties].hash
310340
end
311341
end
312342
end

0 commit comments

Comments
 (0)