Skip to content

Commit 5d69285

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add exclude-attribute processor to logs pipelines (#3510)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4062645 commit 5d69285

9 files changed

Lines changed: 190 additions & 24 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6215,6 +6215,38 @@ components:
62156215
type: string
62166216
x-enum-varnames:
62176217
- DECODER_PROCESSOR
6218+
LogsExcludeAttributeProcessor:
6219+
description: |-
6220+
Use this processor to remove an attribute from a log during processing.
6221+
The processor strips the specified attribute from the log event, which is useful
6222+
when the attribute contains sensitive data or is no longer needed downstream.
6223+
properties:
6224+
attribute_to_exclude:
6225+
description: Name of the log attribute to remove from the log event.
6226+
example: foo
6227+
type: string
6228+
is_enabled:
6229+
default: false
6230+
description: Whether or not the processor is enabled.
6231+
type: boolean
6232+
name:
6233+
description: Name of the processor.
6234+
type: string
6235+
type:
6236+
$ref: "#/components/schemas/LogsExcludeAttributeProcessorType"
6237+
required:
6238+
- type
6239+
- attribute_to_exclude
6240+
type: object
6241+
LogsExcludeAttributeProcessorType:
6242+
default: exclude-attribute
6243+
description: Type of logs exclude attribute processor.
6244+
enum:
6245+
- exclude-attribute
6246+
example: exclude-attribute
6247+
type: string
6248+
x-enum-varnames:
6249+
- EXCLUDE_ATTRIBUTE
62186250
LogsExclusion:
62196251
description: Represents the index exclusion filter object from configuration API.
62206252
properties:
@@ -6822,6 +6854,7 @@ components:
68226854
- $ref: "#/components/schemas/LogsArrayProcessor"
68236855
- $ref: "#/components/schemas/LogsDecoderProcessor"
68246856
- $ref: "#/components/schemas/LogsSchemaProcessor"
6857+
- $ref: "#/components/schemas/LogsExcludeAttributeProcessor"
68256858
LogsQueryCompute:
68266859
description: Define computation for a log query.
68276860
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,20 @@ datadog\_api\_client.v1.model.logs\_decoder\_processor\_type module
20272027
:members:
20282028
:show-inheritance:
20292029

2030+
datadog\_api\_client.v1.model.logs\_exclude\_attribute\_processor module
2031+
------------------------------------------------------------------------
2032+
2033+
.. automodule:: datadog_api_client.v1.model.logs_exclude_attribute_processor
2034+
:members:
2035+
:show-inheritance:
2036+
2037+
datadog\_api\_client.v1.model.logs\_exclude\_attribute\_processor\_type module
2038+
------------------------------------------------------------------------------
2039+
2040+
.. automodule:: datadog_api_client.v1.model.logs_exclude_attribute_processor_type
2041+
:members:
2042+
:show-inheritance:
2043+
20302044
datadog\_api\_client.v1.model.logs\_exclusion module
20312045
----------------------------------------------------
20322046

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v1.model.logs_exclude_attribute_processor_type import LogsExcludeAttributeProcessorType
18+
19+
20+
class LogsExcludeAttributeProcessor(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v1.model.logs_exclude_attribute_processor_type import LogsExcludeAttributeProcessorType
24+
25+
return {
26+
"attribute_to_exclude": (str,),
27+
"is_enabled": (bool,),
28+
"name": (str,),
29+
"type": (LogsExcludeAttributeProcessorType,),
30+
}
31+
32+
attribute_map = {
33+
"attribute_to_exclude": "attribute_to_exclude",
34+
"is_enabled": "is_enabled",
35+
"name": "name",
36+
"type": "type",
37+
}
38+
39+
def __init__(
40+
self_,
41+
attribute_to_exclude: str,
42+
type: LogsExcludeAttributeProcessorType,
43+
is_enabled: Union[bool, UnsetType] = unset,
44+
name: Union[str, UnsetType] = unset,
45+
**kwargs,
46+
):
47+
"""
48+
Use this processor to remove an attribute from a log during processing.
49+
The processor strips the specified attribute from the log event, which is useful
50+
when the attribute contains sensitive data or is no longer needed downstream.
51+
52+
:param attribute_to_exclude: Name of the log attribute to remove from the log event.
53+
:type attribute_to_exclude: str
54+
55+
:param is_enabled: Whether or not the processor is enabled.
56+
:type is_enabled: bool, optional
57+
58+
:param name: Name of the processor.
59+
:type name: str, optional
60+
61+
:param type: Type of logs exclude attribute processor.
62+
:type type: LogsExcludeAttributeProcessorType
63+
"""
64+
if is_enabled is not unset:
65+
kwargs["is_enabled"] = is_enabled
66+
if name is not unset:
67+
kwargs["name"] = name
68+
super().__init__(kwargs)
69+
70+
self_.attribute_to_exclude = attribute_to_exclude
71+
self_.type = type
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class LogsExcludeAttributeProcessorType(ModelSimple):
16+
"""
17+
Type of logs exclude attribute processor.
18+
19+
:param value: If omitted defaults to "exclude-attribute". Must be one of ["exclude-attribute"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"exclude-attribute",
25+
}
26+
EXCLUDE_ATTRIBUTE: ClassVar["LogsExcludeAttributeProcessorType"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
LogsExcludeAttributeProcessorType.EXCLUDE_ATTRIBUTE = LogsExcludeAttributeProcessorType("exclude-attribute")

src/datadog_api_client/v1/model/logs_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from datadog_api_client.v1.model.logs_array_processor import LogsArrayProcessor
3737
from datadog_api_client.v1.model.logs_decoder_processor import LogsDecoderProcessor
3838
from datadog_api_client.v1.model.logs_schema_processor import LogsSchemaProcessor
39+
from datadog_api_client.v1.model.logs_exclude_attribute_processor import LogsExcludeAttributeProcessor
3940

4041

4142
class LogsPipeline(ModelNormal):
@@ -105,6 +106,7 @@ def __init__(
105106
LogsArrayProcessor,
106107
LogsDecoderProcessor,
107108
LogsSchemaProcessor,
109+
LogsExcludeAttributeProcessor,
108110
]
109111
],
110112
UnsetType,

src/datadog_api_client/v1/model/logs_pipeline_processor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from datadog_api_client.v1.model.logs_array_processor import LogsArrayProcessor
3737
from datadog_api_client.v1.model.logs_decoder_processor import LogsDecoderProcessor
3838
from datadog_api_client.v1.model.logs_schema_processor import LogsSchemaProcessor
39+
from datadog_api_client.v1.model.logs_exclude_attribute_processor import LogsExcludeAttributeProcessor
3940

4041

4142
class LogsPipelineProcessor(ModelNormal):
@@ -96,6 +97,7 @@ def __init__(
9697
LogsArrayProcessor,
9798
LogsDecoderProcessor,
9899
LogsSchemaProcessor,
100+
LogsExcludeAttributeProcessor,
99101
]
100102
],
101103
UnsetType,

src/datadog_api_client/v1/model/logs_processor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ def __init__(self, **kwargs):
112112
113113
:param schema: Configuration of the schema data to use.
114114
:type schema: LogsSchemaData
115+
116+
:param attribute_to_exclude: Name of the log attribute to remove from the log event.
117+
:type attribute_to_exclude: str
115118
"""
116119
super().__init__(kwargs)
117120

@@ -144,6 +147,7 @@ def _composed_schemas(_):
144147
from datadog_api_client.v1.model.logs_array_processor import LogsArrayProcessor
145148
from datadog_api_client.v1.model.logs_decoder_processor import LogsDecoderProcessor
146149
from datadog_api_client.v1.model.logs_schema_processor import LogsSchemaProcessor
150+
from datadog_api_client.v1.model.logs_exclude_attribute_processor import LogsExcludeAttributeProcessor
147151

148152
return {
149153
"oneOf": [
@@ -167,5 +171,6 @@ def _composed_schemas(_):
167171
LogsArrayProcessor,
168172
LogsDecoderProcessor,
169173
LogsSchemaProcessor,
174+
LogsExcludeAttributeProcessor,
170175
],
171176
}

src/datadog_api_client/v1/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@
341341
LogsDecoderProcessorInputRepresentation,
342342
)
343343
from datadog_api_client.v1.model.logs_decoder_processor_type import LogsDecoderProcessorType
344+
from datadog_api_client.v1.model.logs_exclude_attribute_processor import LogsExcludeAttributeProcessor
345+
from datadog_api_client.v1.model.logs_exclude_attribute_processor_type import LogsExcludeAttributeProcessorType
344346
from datadog_api_client.v1.model.logs_exclusion import LogsExclusion
345347
from datadog_api_client.v1.model.logs_exclusion_filter import LogsExclusionFilter
346348
from datadog_api_client.v1.model.logs_filter import LogsFilter
@@ -1638,6 +1640,8 @@
16381640
"LogsDecoderProcessorBinaryToTextEncoding",
16391641
"LogsDecoderProcessorInputRepresentation",
16401642
"LogsDecoderProcessorType",
1643+
"LogsExcludeAttributeProcessor",
1644+
"LogsExcludeAttributeProcessorType",
16411645
"LogsExclusion",
16421646
"LogsExclusionFilter",
16431647
"LogsFilter",

0 commit comments

Comments
 (0)