Skip to content

Commit 67c6f40

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Support Cloud SIEM scheduled rules in API client (#3242)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 2fae060 commit 67c6f40

15 files changed

+927
-49
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": "c5cca50",
3-
"generated": "2025-08-07 18:05:06.066"
2+
"spec_repo_commit": "d02c8a3",
3+
"generated": "2025-08-08 12:08:37.437"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36336,6 +36336,12 @@ components:
3633636336
SecurityMonitoringRuleUpdatePayload:
3633736337
description: Update an existing rule.
3633836338
properties:
36339+
calculatedFields:
36340+
description: Calculated fields. Only allowed for scheduled rules - in other
36341+
words, when schedulingOptions is also defined.
36342+
items:
36343+
$ref: '#/components/schemas/CalculatedField'
36344+
type: array
3633936345
cases:
3634036346
description: Cases for generating signals.
3634136347
items:
@@ -36392,6 +36398,8 @@ components:
3639236398
items:
3639336399
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3639436400
type: array
36401+
schedulingOptions:
36402+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3639536403
tags:
3639636404
description: Tags for generated signals.
3639736405
items:
@@ -36418,6 +36426,27 @@ components:
3641836426
- $ref: '#/components/schemas/SecurityMonitoringStandardRulePayload'
3641936427
- $ref: '#/components/schemas/SecurityMonitoringSignalRulePayload'
3642036428
- $ref: '#/components/schemas/CloudConfigurationRulePayload'
36429+
SecurityMonitoringSchedulingOptions:
36430+
description: Options for scheduled rules. When this field is present, the rule
36431+
runs based on the schedule. When absent, it runs real-time on ingested logs.
36432+
nullable: true
36433+
properties:
36434+
rrule:
36435+
description: Schedule for the rule queries, written in RRULE syntax. See
36436+
[RFC](https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html)
36437+
for syntax reference.
36438+
example: FREQ=HOURLY;INTERVAL=1;
36439+
type: string
36440+
start:
36441+
description: Start date for the schedule, in ISO 8601 format without timezone.
36442+
example: '2025-07-14T12:00:00'
36443+
type: string
36444+
timezone:
36445+
description: Time zone of the start date, in the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
36446+
format.
36447+
example: America/New_York
36448+
type: string
36449+
type: object
3642136450
SecurityMonitoringSignal:
3642236451
description: Object description of a security signal.
3642336452
properties:
@@ -37096,6 +37125,12 @@ components:
3709637125
SecurityMonitoringStandardRuleCreatePayload:
3709737126
description: Create a new rule.
3709837127
properties:
37128+
calculatedFields:
37129+
description: Calculated fields. Only allowed for scheduled rules - in other
37130+
words, when schedulingOptions is also defined.
37131+
items:
37132+
$ref: '#/components/schemas/CalculatedField'
37133+
type: array
3709937134
cases:
3710037135
description: Cases for generating signals.
3710137136
example: []
@@ -37148,6 +37183,8 @@ components:
3714837183
items:
3714937184
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3715037185
type: array
37186+
schedulingOptions:
37187+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3715137188
tags:
3715237189
description: Tags for generated signals.
3715337190
example:
@@ -37177,6 +37214,12 @@ components:
3717737214
SecurityMonitoringStandardRulePayload:
3717837215
description: The payload of a rule.
3717937216
properties:
37217+
calculatedFields:
37218+
description: Calculated fields. Only allowed for scheduled rules - in other
37219+
words, when schedulingOptions is also defined.
37220+
items:
37221+
$ref: '#/components/schemas/CalculatedField'
37222+
type: array
3718037223
cases:
3718137224
description: Cases for generating signals.
3718237225
example: []
@@ -37237,6 +37280,8 @@ components:
3723737280
items:
3723837281
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3723937282
type: array
37283+
schedulingOptions:
37284+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3724037285
tags:
3724137286
description: Tags for generated signals.
3724237287
example:
@@ -37293,6 +37338,14 @@ components:
3729337338
example: false
3729437339
readOnly: true
3729537340
type: boolean
37341+
index:
37342+
description: '**This field is currently unstable and might be removed in
37343+
a minor version upgrade.**
37344+
37345+
The index to run the query on, if the `dataSource` is `logs`. Only used
37346+
for scheduled rules - in other words, when the `schedulingOptions` field
37347+
is present in the rule payload.'
37348+
type: string
3729637349
metric:
3729737350
deprecated: true
3729837351
description: '(Deprecated) The target field to aggregate over when using
@@ -37320,6 +37373,12 @@ components:
3732037373
SecurityMonitoringStandardRuleResponse:
3732137374
description: Rule.
3732237375
properties:
37376+
calculatedFields:
37377+
description: Calculated fields. Only allowed for scheduled rules - in other
37378+
words, when schedulingOptions is also defined.
37379+
items:
37380+
$ref: '#/components/schemas/CalculatedField'
37381+
type: array
3732337382
cases:
3732437383
description: Cases for generating signals.
3732537384
items:
@@ -37405,6 +37464,8 @@ components:
3740537464
items:
3740637465
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3740737466
type: array
37467+
schedulingOptions:
37468+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3740837469
tags:
3740937470
description: Tags for generated signals.
3741037471
items:
@@ -37436,6 +37497,12 @@ components:
3743637497
SecurityMonitoringStandardRuleTestPayload:
3743737498
description: The payload of a rule to test
3743837499
properties:
37500+
calculatedFields:
37501+
description: Calculated fields. Only allowed for scheduled rules - in other
37502+
words, when schedulingOptions is also defined.
37503+
items:
37504+
$ref: '#/components/schemas/CalculatedField'
37505+
type: array
3743937506
cases:
3744037507
description: Cases for generating signals.
3744137508
example: []
@@ -37488,6 +37555,8 @@ components:
3748837555
items:
3748937556
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
3749037557
type: array
37558+
schedulingOptions:
37559+
$ref: '#/components/schemas/SecurityMonitoringSchedulingOptions'
3749137560
tags:
3749237561
description: Tags for generated signals.
3749337562
example:

api/datadogV2/model_security_monitoring_rule_update_payload.go

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010

1111
// SecurityMonitoringRuleUpdatePayload Update an existing rule.
1212
type SecurityMonitoringRuleUpdatePayload struct {
13+
// Calculated fields. Only allowed for scheduled rules - in other words, when schedulingOptions is also defined.
14+
CalculatedFields []CalculatedField `json:"calculatedFields,omitempty"`
1315
// Cases for generating signals.
1416
Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"`
1517
// How to generate compliance signals. Useful for cloud_configuration rules only.
@@ -36,6 +38,8 @@ type SecurityMonitoringRuleUpdatePayload struct {
3638
Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"`
3739
// Reference tables for the rule.
3840
ReferenceTables []SecurityMonitoringReferenceTable `json:"referenceTables,omitempty"`
41+
// 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.
42+
SchedulingOptions NullableSecurityMonitoringSchedulingOptions `json:"schedulingOptions,omitempty"`
3943
// Tags for generated signals.
4044
Tags []string `json:"tags,omitempty"`
4145
// Cases for generating signals from third-party rules. Only available for third-party rules.
@@ -64,6 +68,34 @@ func NewSecurityMonitoringRuleUpdatePayloadWithDefaults() *SecurityMonitoringRul
6468
return &this
6569
}
6670

71+
// GetCalculatedFields returns the CalculatedFields field value if set, zero value otherwise.
72+
func (o *SecurityMonitoringRuleUpdatePayload) GetCalculatedFields() []CalculatedField {
73+
if o == nil || o.CalculatedFields == nil {
74+
var ret []CalculatedField
75+
return ret
76+
}
77+
return o.CalculatedFields
78+
}
79+
80+
// GetCalculatedFieldsOk returns a tuple with the CalculatedFields field value if set, nil otherwise
81+
// and a boolean to check if the value has been set.
82+
func (o *SecurityMonitoringRuleUpdatePayload) GetCalculatedFieldsOk() (*[]CalculatedField, bool) {
83+
if o == nil || o.CalculatedFields == nil {
84+
return nil, false
85+
}
86+
return &o.CalculatedFields, true
87+
}
88+
89+
// HasCalculatedFields returns a boolean if a field has been set.
90+
func (o *SecurityMonitoringRuleUpdatePayload) HasCalculatedFields() bool {
91+
return o != nil && o.CalculatedFields != nil
92+
}
93+
94+
// SetCalculatedFields gets a reference to the given []CalculatedField and assigns it to the CalculatedFields field.
95+
func (o *SecurityMonitoringRuleUpdatePayload) SetCalculatedFields(v []CalculatedField) {
96+
o.CalculatedFields = v
97+
}
98+
6799
// GetCases returns the Cases field value if set, zero value otherwise.
68100
func (o *SecurityMonitoringRuleUpdatePayload) GetCases() []SecurityMonitoringRuleCase {
69101
if o == nil || o.Cases == nil {
@@ -428,6 +460,45 @@ func (o *SecurityMonitoringRuleUpdatePayload) SetReferenceTables(v []SecurityMon
428460
o.ReferenceTables = v
429461
}
430462

463+
// GetSchedulingOptions returns the SchedulingOptions field value if set, zero value otherwise (both if not set or set to explicit null).
464+
func (o *SecurityMonitoringRuleUpdatePayload) GetSchedulingOptions() SecurityMonitoringSchedulingOptions {
465+
if o == nil || o.SchedulingOptions.Get() == nil {
466+
var ret SecurityMonitoringSchedulingOptions
467+
return ret
468+
}
469+
return *o.SchedulingOptions.Get()
470+
}
471+
472+
// GetSchedulingOptionsOk returns a tuple with the SchedulingOptions field value if set, nil otherwise
473+
// and a boolean to check if the value has been set.
474+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
475+
func (o *SecurityMonitoringRuleUpdatePayload) GetSchedulingOptionsOk() (*SecurityMonitoringSchedulingOptions, bool) {
476+
if o == nil {
477+
return nil, false
478+
}
479+
return o.SchedulingOptions.Get(), o.SchedulingOptions.IsSet()
480+
}
481+
482+
// HasSchedulingOptions returns a boolean if a field has been set.
483+
func (o *SecurityMonitoringRuleUpdatePayload) HasSchedulingOptions() bool {
484+
return o != nil && o.SchedulingOptions.IsSet()
485+
}
486+
487+
// SetSchedulingOptions gets a reference to the given NullableSecurityMonitoringSchedulingOptions and assigns it to the SchedulingOptions field.
488+
func (o *SecurityMonitoringRuleUpdatePayload) SetSchedulingOptions(v SecurityMonitoringSchedulingOptions) {
489+
o.SchedulingOptions.Set(&v)
490+
}
491+
492+
// SetSchedulingOptionsNil sets the value for SchedulingOptions to be an explicit nil.
493+
func (o *SecurityMonitoringRuleUpdatePayload) SetSchedulingOptionsNil() {
494+
o.SchedulingOptions.Set(nil)
495+
}
496+
497+
// UnsetSchedulingOptions ensures that no value is present for SchedulingOptions, not even an explicit nil.
498+
func (o *SecurityMonitoringRuleUpdatePayload) UnsetSchedulingOptions() {
499+
o.SchedulingOptions.Unset()
500+
}
501+
431502
// GetTags returns the Tags field value if set, zero value otherwise.
432503
func (o *SecurityMonitoringRuleUpdatePayload) GetTags() []string {
433504
if o == nil || o.Tags == nil {
@@ -518,6 +589,9 @@ func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) {
518589
if o.UnparsedObject != nil {
519590
return datadog.Marshal(o.UnparsedObject)
520591
}
592+
if o.CalculatedFields != nil {
593+
toSerialize["calculatedFields"] = o.CalculatedFields
594+
}
521595
if o.Cases != nil {
522596
toSerialize["cases"] = o.Cases
523597
}
@@ -557,6 +631,9 @@ func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) {
557631
if o.ReferenceTables != nil {
558632
toSerialize["referenceTables"] = o.ReferenceTables
559633
}
634+
if o.SchedulingOptions.IsSet() {
635+
toSerialize["schedulingOptions"] = o.SchedulingOptions.Get()
636+
}
560637
if o.Tags != nil {
561638
toSerialize["tags"] = o.Tags
562639
}
@@ -576,6 +653,7 @@ func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) {
576653
// UnmarshalJSON deserializes the given payload.
577654
func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err error) {
578655
all := struct {
656+
CalculatedFields []CalculatedField `json:"calculatedFields,omitempty"`
579657
Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"`
580658
ComplianceSignalOptions *CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions,omitempty"`
581659
CustomMessage *string `json:"customMessage,omitempty"`
@@ -589,6 +667,7 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e
589667
Options *SecurityMonitoringRuleOptions `json:"options,omitempty"`
590668
Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"`
591669
ReferenceTables []SecurityMonitoringReferenceTable `json:"referenceTables,omitempty"`
670+
SchedulingOptions NullableSecurityMonitoringSchedulingOptions `json:"schedulingOptions,omitempty"`
592671
Tags []string `json:"tags,omitempty"`
593672
ThirdPartyCases []SecurityMonitoringThirdPartyRuleCase `json:"thirdPartyCases,omitempty"`
594673
Version *int32 `json:"version,omitempty"`
@@ -598,12 +677,13 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e
598677
}
599678
additionalProperties := make(map[string]interface{})
600679
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
601-
datadog.DeleteKeys(additionalProperties, &[]string{"cases", "complianceSignalOptions", "customMessage", "customName", "filters", "groupSignalsBy", "hasExtendedTitle", "isEnabled", "message", "name", "options", "queries", "referenceTables", "tags", "thirdPartyCases", "version"})
680+
datadog.DeleteKeys(additionalProperties, &[]string{"calculatedFields", "cases", "complianceSignalOptions", "customMessage", "customName", "filters", "groupSignalsBy", "hasExtendedTitle", "isEnabled", "message", "name", "options", "queries", "referenceTables", "schedulingOptions", "tags", "thirdPartyCases", "version"})
602681
} else {
603682
return err
604683
}
605684

606685
hasInvalidField := false
686+
o.CalculatedFields = all.CalculatedFields
607687
o.Cases = all.Cases
608688
if all.ComplianceSignalOptions != nil && all.ComplianceSignalOptions.UnparsedObject != nil && o.UnparsedObject == nil {
609689
hasInvalidField = true
@@ -623,6 +703,7 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e
623703
o.Options = all.Options
624704
o.Queries = all.Queries
625705
o.ReferenceTables = all.ReferenceTables
706+
o.SchedulingOptions = all.SchedulingOptions
626707
o.Tags = all.Tags
627708
o.ThirdPartyCases = all.ThirdPartyCases
628709
o.Version = all.Version

0 commit comments

Comments
 (0)