Skip to content

Commit d1b3294

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1881dc2 of spec repo
1 parent c53f924 commit d1b3294

File tree

7 files changed

+141
-0
lines changed

7 files changed

+141
-0
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:
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""
2+
Validate an observability pipeline with OCSF mapper keep_unmatched returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi
7+
from datadog_api_client.v2.model.observability_pipeline_config import ObservabilityPipelineConfig
8+
from datadog_api_client.v2.model.observability_pipeline_config_processor_group import (
9+
ObservabilityPipelineConfigProcessorGroup,
10+
)
11+
from datadog_api_client.v2.model.observability_pipeline_data_attributes import ObservabilityPipelineDataAttributes
12+
from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source import (
13+
ObservabilityPipelineDatadogAgentSource,
14+
)
15+
from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source_type import (
16+
ObservabilityPipelineDatadogAgentSourceType,
17+
)
18+
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination import (
19+
ObservabilityPipelineDatadogLogsDestination,
20+
)
21+
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import (
22+
ObservabilityPipelineDatadogLogsDestinationType,
23+
)
24+
from datadog_api_client.v2.model.observability_pipeline_ocsf_mapper_processor import (
25+
ObservabilityPipelineOcsfMapperProcessor,
26+
)
27+
from datadog_api_client.v2.model.observability_pipeline_ocsf_mapper_processor_mapping import (
28+
ObservabilityPipelineOcsfMapperProcessorMapping,
29+
)
30+
from datadog_api_client.v2.model.observability_pipeline_ocsf_mapper_processor_type import (
31+
ObservabilityPipelineOcsfMapperProcessorType,
32+
)
33+
from datadog_api_client.v2.model.observability_pipeline_spec import ObservabilityPipelineSpec
34+
from datadog_api_client.v2.model.observability_pipeline_spec_data import ObservabilityPipelineSpecData
35+
36+
body = ObservabilityPipelineSpec(
37+
data=ObservabilityPipelineSpecData(
38+
attributes=ObservabilityPipelineDataAttributes(
39+
config=ObservabilityPipelineConfig(
40+
destinations=[
41+
ObservabilityPipelineDatadogLogsDestination(
42+
id="datadog-logs-destination",
43+
inputs=[
44+
"my-processor-group",
45+
],
46+
type=ObservabilityPipelineDatadogLogsDestinationType.DATADOG_LOGS,
47+
),
48+
],
49+
processor_groups=[
50+
ObservabilityPipelineConfigProcessorGroup(
51+
enabled=True,
52+
id="my-processor-group",
53+
include="service:my-service",
54+
inputs=[
55+
"datadog-agent-source",
56+
],
57+
processors=[
58+
ObservabilityPipelineOcsfMapperProcessor(
59+
enabled=True,
60+
id="ocsf-mapper-processor",
61+
include="service:my-service",
62+
type=ObservabilityPipelineOcsfMapperProcessorType.OCSF_MAPPER,
63+
keep_unmatched=True,
64+
mappings=[
65+
ObservabilityPipelineOcsfMapperProcessorMapping(
66+
include="source:cloudtrail",
67+
mapping="CloudTrail Account Change",
68+
),
69+
],
70+
),
71+
],
72+
),
73+
],
74+
sources=[
75+
ObservabilityPipelineDatadogAgentSource(
76+
id="datadog-agent-source",
77+
type=ObservabilityPipelineDatadogAgentSourceType.DATADOG_AGENT,
78+
),
79+
],
80+
),
81+
name="OCSF Mapper Keep Unmatched Pipeline",
82+
),
83+
type="pipelines",
84+
),
85+
)
86+
87+
configuration = Configuration()
88+
with ApiClient(configuration) as api_client:
89+
api_instance = ObservabilityPipelinesApi(api_client)
90+
response = api_instance.validate_pipeline(body=body)
91+
92+
print(response)

src/datadog_api_client/v2/model/observability_pipeline_config_processor_item.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def __init__(self, **kwargs):
6666
:param metrics: Configuration for generating individual metrics.
6767
:type metrics: [ObservabilityPipelineGeneratedMetric], optional
6868
69+
:param keep_unmatched: Whether to keep an event that does not match any of the mapping filters.
70+
:type keep_unmatched: bool, optional
71+
6972
:param mappings: A list of mapping rules to convert events to the OCSF format.
7073
:type mappings: [ObservabilityPipelineOcsfMapperProcessorMapping]
7174

src/datadog_api_client/v2/model/observability_pipeline_ocsf_mapper_processor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def openapi_types(_):
3737
"enabled": (bool,),
3838
"id": (str,),
3939
"include": (str,),
40+
"keep_unmatched": (bool,),
4041
"mappings": ([ObservabilityPipelineOcsfMapperProcessorMapping],),
4142
"type": (ObservabilityPipelineOcsfMapperProcessorType,),
4243
}
@@ -46,6 +47,7 @@ def openapi_types(_):
4647
"enabled": "enabled",
4748
"id": "id",
4849
"include": "include",
50+
"keep_unmatched": "keep_unmatched",
4951
"mappings": "mappings",
5052
"type": "type",
5153
}
@@ -58,6 +60,7 @@ def __init__(
5860
mappings: List[ObservabilityPipelineOcsfMapperProcessorMapping],
5961
type: ObservabilityPipelineOcsfMapperProcessorType,
6062
display_name: Union[str, UnsetType] = unset,
63+
keep_unmatched: Union[bool, UnsetType] = unset,
6164
**kwargs,
6265
):
6366
"""
@@ -77,6 +80,9 @@ def __init__(
7780
:param include: A Datadog search query used to determine which logs this processor targets.
7881
:type include: str
7982
83+
:param keep_unmatched: Whether to keep an event that does not match any of the mapping filters.
84+
:type keep_unmatched: bool, optional
85+
8086
:param mappings: A list of mapping rules to convert events to the OCSF format.
8187
:type mappings: [ObservabilityPipelineOcsfMapperProcessorMapping]
8288
@@ -85,6 +91,8 @@ def __init__(
8591
"""
8692
if display_name is not unset:
8793
kwargs["display_name"] = display_name
94+
if keep_unmatched is not unset:
95+
kwargs["keep_unmatched"] = keep_unmatched
8896
super().__init__(kwargs)
8997

9098
self_.enabled = enabled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-03-16T13:02:49.264Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
interactions:
2+
- request:
3+
body: '{"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","keep_unmatched":true,"mappings":[{"include":"source:cloudtrail","mapping":"CloudTrail
4+
Account Change"}],"type":"ocsf_mapper"}]}],"sources":[{"id":"datadog-agent-source","type":"datadog_agent"}]},"name":"OCSF
5+
Mapper Keep Unmatched Pipeline"},"type":"pipelines"}}'
6+
headers:
7+
accept:
8+
- application/json
9+
content-type:
10+
- application/json
11+
method: POST
12+
uri: https://api.datadoghq.com/api/v2/obs-pipelines/pipelines/validate
13+
response:
14+
body:
15+
string: '{"errors":[]}
16+
17+
'
18+
headers:
19+
content-type:
20+
- application/vnd.api+json
21+
status:
22+
code: 200
23+
message: OK
24+
version: 1

tests/v2/features/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

0 commit comments

Comments
 (0)