Skip to content

Commit

Permalink
Improve the spec of Cloud SIEM historical jobs (#2289)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Dec 19, 2024
1 parent 4801553 commit da24389
Show file tree
Hide file tree
Showing 34 changed files with 394 additions and 101 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-18 19:23:44.598041",
"spec_repo_commit": "3f22290a"
"regenerated": "2024-12-19 07:26:25.280337",
"spec_repo_commit": "5dd2cbe4"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-18 19:23:44.612303",
"spec_repo_commit": "3f22290a"
"regenerated": "2024-12-19 07:26:25.294170",
"spec_repo_commit": "5dd2cbe4"
}
}
}
99 changes: 76 additions & 23 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12250,6 +12250,65 @@ components:
maximum: 2147483647
type: integer
type: object
HistoricalJobOptions:
description: Job options.
properties:
detectionMethod:
$ref: '#/components/schemas/SecurityMonitoringRuleDetectionMethod'
evaluationWindow:
$ref: '#/components/schemas/SecurityMonitoringRuleEvaluationWindow'
impossibleTravelOptions:
$ref: '#/components/schemas/SecurityMonitoringRuleImpossibleTravelOptions'
keepAlive:
$ref: '#/components/schemas/SecurityMonitoringRuleKeepAlive'
maxSignalDuration:
$ref: '#/components/schemas/SecurityMonitoringRuleMaxSignalDuration'
newValueOptions:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptions'
thirdPartyRuleOptions:
$ref: '#/components/schemas/SecurityMonitoringRuleThirdPartyOptions'
type: object
HistoricalJobQuery:
description: Query for selecting logs analyzed by the historical job.
properties:
aggregation:
$ref: '#/components/schemas/SecurityMonitoringRuleQueryAggregation'
distinctFields:
description: Field for which the cardinality is measured. Sent as an array.
items:
description: Field.
type: string
type: array
groupByFields:
description: Fields to group by.
items:
description: Field.
type: string
type: array
hasOptionalGroupByFields:
description: When false, events without a group-by value are ignored by
the query. When true, events with missing group-by fields are processed
with `N/A`, replacing the missing values.
example: false
readOnly: true
type: boolean
metrics:
description: Group of target fields to aggregate over when using the sum,
max, geo data, or new value aggregations. The sum, max, and geo data aggregations
only accept one value in this list, whereas the new value aggregation
accepts up to five values.
items:
description: Field.
type: string
type: array
name:
description: Name of the query.
type: string
query:
description: Query to run on logs.
example: a > 3
type: string
type: object
HistoricalJobResponse:
description: Historical job response.
properties:
Expand Down Expand Up @@ -14824,13 +14883,6 @@ components:
items:
$ref: '#/components/schemas/SecurityMonitoringRuleCaseCreate'
type: array
filters:
description: Additional queries to filter matched events before they are
processed. This field is deprecated for log detection, signal correlation,
and workload security rules.
items:
$ref: '#/components/schemas/SecurityMonitoringFilter'
type: array
from:
description: Starting time of data analyzed by the job.
example: 1729843470000
Expand All @@ -14849,14 +14901,14 @@ components:
example: Excessive number of failed attempts.
type: string
options:
$ref: '#/components/schemas/SecurityMonitoringRuleOptions'
$ref: '#/components/schemas/HistoricalJobOptions'
queries:
description: Queries for selecting logs analyzed by the job.
items:
$ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery'
$ref: '#/components/schemas/HistoricalJobQuery'
type: array
referenceTables:
description: Reference tables for the rule.
description: Reference tables used in the queries.
items:
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
type: array
Expand All @@ -14866,8 +14918,8 @@ components:
type: string
type: array
thirdPartyCases:
description: Cases for generating results from third-party rules. Only available
for third-party rules.
description: Cases for generating results from third-party detection method.
Only available for third-party detection method.
example: []
items:
$ref: '#/components/schemas/SecurityMonitoringThirdPartyRuleCaseCreate'
Expand Down Expand Up @@ -22792,7 +22844,7 @@ components:
$ref: '#/components/schemas/ResponseMetaAttributes'
type: object
SecurityMonitoringReferenceTable:
description: Reference table for the rule.
description: Reference tables used in the queries.
properties:
checkPresence:
description: Whether to include or exclude the matched values.
Expand All @@ -22804,7 +22856,7 @@ components:
description: The field in the log to match against the reference table.
type: string
ruleQueryName:
description: The name of the rule query to apply the reference table to.
description: The name of the query to apply the reference table to.
type: string
tableName:
description: The name of the reference table.
Expand Down Expand Up @@ -22835,7 +22887,7 @@ components:
description: Case when signal is generated.
properties:
condition:
description: 'A rule case contains logical operations (`>`,`>=`, `&&`, `||`)
description: 'A case contains logical operations (`>`,`>=`, `&&`, `||`)
to determine if a signal should be generated

based on the event counts in the previously defined queries.'
Expand All @@ -22844,7 +22896,7 @@ components:
description: Name of the case.
type: string
notifications:
description: Notification targets for each rule case.
description: Notification targets.
items:
description: Notification.
type: string
Expand Down Expand Up @@ -22906,7 +22958,8 @@ components:
description: 'A time window is specified to match when at least one of the cases
matches true. This is a sliding window

and evaluates in real time. For third party rules, this field is not used.'
and evaluates in real time. For third party detection method, this field is
not used.'
enum:
- 0
- 60
Expand Down Expand Up @@ -22935,7 +22988,7 @@ components:
x-enum-varnames:
- LOG4SHELL
SecurityMonitoringRuleImpossibleTravelOptions:
description: Options on impossible travel rules.
description: Options on impossible travel detection method.
properties:
baselineUserLocations:
$ref: '#/components/schemas/SecurityMonitoringRuleImpossibleTravelOptionsBaselineUserLocations'
Expand All @@ -22951,7 +23004,7 @@ components:
SecurityMonitoringRuleKeepAlive:
description: "Once a signal is generated, the signal will remain \u201Copen\u201D
if a case is matched at least once within\nthis keep alive window. For third
party rules, this field is not used."
party detection method, this field is not used."
enum:
- 0
- 60
Expand Down Expand Up @@ -23009,7 +23062,7 @@ components:
- TWELVE_HOURS
- ONE_DAY
SecurityMonitoringRuleNewValueOptions:
description: Options on new value rules.
description: Options on new value detection method.
properties:
forgetAfter:
$ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsForgetAfter'
Expand Down Expand Up @@ -23079,7 +23132,7 @@ components:
- ZERO_OCCURRENCES
- ONE_OCCURRENCE
SecurityMonitoringRuleOptions:
description: Options on rules.
description: Options.
properties:
complianceRuleOptions:
$ref: '#/components/schemas/CloudConfigurationComplianceRuleOptions'
Expand Down Expand Up @@ -23221,7 +23274,7 @@ components:
type: array
type: object
SecurityMonitoringRuleThirdPartyOptions:
description: Options on third party rules.
description: Options on third party detection method.
properties:
defaultNotifications:
description: Notification targets for the logs that do not correspond to
Expand Down Expand Up @@ -24621,7 +24674,7 @@ components:
description: Name of the case.
type: string
notifications:
description: Notification targets for each rule case.
description: Notification targets for each case.
items:
description: Notification.
type: string
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4981,6 +4981,20 @@ datadog\_api\_client.v2.model.historical\_job\_list\_meta module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.historical\_job\_options module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.historical_job_options
:members:
:show-inheritance:

datadog\_api\_client.v2.model.historical\_job\_query module
-----------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.historical_job_query
:members:
:show-inheritance:

datadog\_api\_client.v2.model.historical\_job\_response module
--------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions examples/v2/security-monitoring/RunHistoricalJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.historical_job_options import HistoricalJobOptions
from datadog_api_client.v2.model.historical_job_query import HistoricalJobQuery
from datadog_api_client.v2.model.job_definition import JobDefinition
from datadog_api_client.v2.model.run_historical_job_request import RunHistoricalJobRequest
from datadog_api_client.v2.model.run_historical_job_request_attributes import RunHistoricalJobRequestAttributes
Expand All @@ -17,12 +19,10 @@
from datadog_api_client.v2.model.security_monitoring_rule_max_signal_duration import (
SecurityMonitoringRuleMaxSignalDuration,
)
from datadog_api_client.v2.model.security_monitoring_rule_options import SecurityMonitoringRuleOptions
from datadog_api_client.v2.model.security_monitoring_rule_query_aggregation import (
SecurityMonitoringRuleQueryAggregation,
)
from datadog_api_client.v2.model.security_monitoring_rule_severity import SecurityMonitoringRuleSeverity
from datadog_api_client.v2.model.security_monitoring_standard_rule_query import SecurityMonitoringStandardRuleQuery

body = RunHistoricalJobRequest(
data=RunHistoricalJobRequestData(
Expand All @@ -32,7 +32,7 @@
type="log_detection",
name="Excessive number of failed attempts.",
queries=[
SecurityMonitoringStandardRuleQuery(
HistoricalJobQuery(
query="source:non_existing_src_weekend",
aggregation=SecurityMonitoringRuleQueryAggregation.COUNT,
group_by_fields=[],
Expand All @@ -47,7 +47,7 @@
condition="a > 1",
),
],
options=SecurityMonitoringRuleOptions(
options=HistoricalJobOptions(
keep_alive=SecurityMonitoringRuleKeepAlive.ONE_HOUR,
max_signal_duration=SecurityMonitoringRuleMaxSignalDuration.ONE_DAY,
evaluation_window=SecurityMonitoringRuleEvaluationWindow.FIFTEEN_MINUTES,
Expand Down
Loading

0 comments on commit da24389

Please sign in to comment.