Skip to content

Commit 34f658f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI documentation for keep_unmatched field in ocsf mapper processor (#3122)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8d343ff commit 34f658f

File tree

6 files changed

+109
-1
lines changed

6 files changed

+109
-1
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44855,6 +44855,11 @@ components:
4485544855
targets.
4485644856
example: service:my-service
4485744857
type: string
44858+
keep_unmatched:
44859+
description: Whether to keep an event that does not match any of the mapping
44860+
filters.
44861+
example: false
44862+
type: boolean
4485844863
mappings:
4485944864
description: A list of mapping rules to convert events to the OCSF format.
4486044865
items:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-03-16T13:02:49.264Z

cassettes/features/v2/observability_pipelines/Validate-an-observability-pipeline-with-OCSF-mapper-keep-unmatched-returns-OK-response.yml

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Validate an observability pipeline with OCSF mapper keep_unmatched returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::ObservabilityPipelinesAPI.new
5+
6+
body = DatadogAPIClient::V2::ObservabilityPipelineSpec.new({
7+
data: DatadogAPIClient::V2::ObservabilityPipelineSpecData.new({
8+
attributes: DatadogAPIClient::V2::ObservabilityPipelineDataAttributes.new({
9+
config: DatadogAPIClient::V2::ObservabilityPipelineConfig.new({
10+
destinations: [
11+
DatadogAPIClient::V2::ObservabilityPipelineDatadogLogsDestination.new({
12+
id: "datadog-logs-destination",
13+
inputs: [
14+
"my-processor-group",
15+
],
16+
type: DatadogAPIClient::V2::ObservabilityPipelineDatadogLogsDestinationType::DATADOG_LOGS,
17+
}),
18+
],
19+
processor_groups: [
20+
DatadogAPIClient::V2::ObservabilityPipelineConfigProcessorGroup.new({
21+
enabled: true,
22+
id: "my-processor-group",
23+
include: "service:my-service",
24+
inputs: [
25+
"datadog-agent-source",
26+
],
27+
processors: [
28+
DatadogAPIClient::V2::ObservabilityPipelineOcsfMapperProcessor.new({
29+
enabled: true,
30+
id: "ocsf-mapper-processor",
31+
include: "service:my-service",
32+
type: DatadogAPIClient::V2::ObservabilityPipelineOcsfMapperProcessorType::OCSF_MAPPER,
33+
keep_unmatched: true,
34+
mappings: [
35+
DatadogAPIClient::V2::ObservabilityPipelineOcsfMapperProcessorMapping.new({
36+
include: "source:cloudtrail",
37+
mapping: DatadogAPIClient::V2::ObservabilityPipelineOcsfMappingLibrary::CLOUDTRAIL_ACCOUNT_CHANGE,
38+
}),
39+
],
40+
}),
41+
],
42+
}),
43+
],
44+
sources: [
45+
DatadogAPIClient::V2::ObservabilityPipelineDatadogAgentSource.new({
46+
id: "datadog-agent-source",
47+
type: DatadogAPIClient::V2::ObservabilityPipelineDatadogAgentSourceType::DATADOG_AGENT,
48+
}),
49+
],
50+
}),
51+
name: "OCSF Mapper Keep Unmatched Pipeline",
52+
}),
53+
type: "pipelines",
54+
}),
55+
})
56+
p api_instance.validate_pipeline(body)

features/v2/observability_pipelines.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ Feature: Observability Pipelines
191191
When the request is sent
192192
Then the response status is 400 Bad Request
193193

194+
@team:DataDog/observability-pipelines
195+
Scenario: Validate an observability pipeline with OCSF mapper keep_unmatched returns "OK" response
196+
Given new "ValidatePipeline" request
197+
And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "ocsf-mapper-processor", "include": "service:my-service", "type": "ocsf_mapper", "keep_unmatched": true, "mappings": [{"include": "source:cloudtrail", "mapping": "CloudTrail Account Change"}]}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "OCSF Mapper Keep Unmatched Pipeline"}, "type": "pipelines"}}
198+
When the request is sent
199+
Then the response status is 200 OK
200+
And the response "errors" has length 0
201+
194202
@team:DataDog/observability-pipelines
195203
Scenario: Validate an observability pipeline with OCSF mapper library mapping returns "OK" response
196204
Given new "ValidatePipeline" request

lib/datadog_api_client/v2/models/observability_pipeline_ocsf_mapper_processor.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class ObservabilityPipelineOcsfMapperProcessor
3535
# A Datadog search query used to determine which logs this processor targets.
3636
attr_reader :include
3737

38+
# Whether to keep an event that does not match any of the mapping filters.
39+
attr_accessor :keep_unmatched
40+
3841
# A list of mapping rules to convert events to the OCSF format.
3942
attr_reader :mappings
4043

@@ -51,6 +54,7 @@ def self.attribute_map
5154
:'enabled' => :'enabled',
5255
:'id' => :'id',
5356
:'include' => :'include',
57+
:'keep_unmatched' => :'keep_unmatched',
5458
:'mappings' => :'mappings',
5559
:'type' => :'type'
5660
}
@@ -64,6 +68,7 @@ def self.openapi_types
6468
:'enabled' => :'Boolean',
6569
:'id' => :'String',
6670
:'include' => :'String',
71+
:'keep_unmatched' => :'Boolean',
6772
:'mappings' => :'Array<ObservabilityPipelineOcsfMapperProcessorMapping>',
6873
:'type' => :'ObservabilityPipelineOcsfMapperProcessorType'
6974
}
@@ -103,6 +108,10 @@ def initialize(attributes = {})
103108
self.include = attributes[:'include']
104109
end
105110

111+
if attributes.key?(:'keep_unmatched')
112+
self.keep_unmatched = attributes[:'keep_unmatched']
113+
end
114+
106115
if attributes.key?(:'mappings')
107116
if (value = attributes[:'mappings']).is_a?(Array)
108117
self.mappings = value
@@ -206,6 +215,7 @@ def ==(o)
206215
enabled == o.enabled &&
207216
id == o.id &&
208217
include == o.include &&
218+
keep_unmatched == o.keep_unmatched &&
209219
mappings == o.mappings &&
210220
type == o.type &&
211221
additional_properties == o.additional_properties
@@ -215,7 +225,7 @@ def ==(o)
215225
# @return [Integer] Hash code
216226
# @!visibility private
217227
def hash
218-
[display_name, enabled, id, include, mappings, type, additional_properties].hash
228+
[display_name, enabled, id, include, keep_unmatched, mappings, type, additional_properties].hash
219229
end
220230
end
221231
end

0 commit comments

Comments
 (0)