Skip to content

Commit c53b2ee

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for Array Processor in Logs Pipelines (#3183)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 271c7f4 commit c53b2ee

28 files changed

Lines changed: 1927 additions & 4 deletions

File tree

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-07-02 20:43:24.266572",
8-
"spec_repo_commit": "e327e6df"
7+
"regenerated": "2025-07-03 15:49:15.379622",
8+
"spec_repo_commit": "d781944f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-07-02 20:43:24.282854",
13-
"spec_repo_commit": "e327e6df"
12+
"regenerated": "2025-07-03 15:49:15.401262",
13+
"spec_repo_commit": "d781944f"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5163,6 +5163,143 @@ components:
51635163
type: string
51645164
x-enum-varnames:
51655165
- ARITHMETIC_PROCESSOR
5166+
LogsArrayProcessor:
5167+
description: 'A processor for extracting, aggregating, or transforming values
5168+
from JSON arrays within your logs.
5169+
5170+
Supported operations are:
5171+
5172+
- Select value from matching element
5173+
5174+
- Compute array length
5175+
5176+
- Append a value to an array'
5177+
properties:
5178+
is_enabled:
5179+
default: false
5180+
description: Whether or not the processor is enabled.
5181+
type: boolean
5182+
name:
5183+
description: Name of the processor.
5184+
type: string
5185+
operation:
5186+
$ref: '#/components/schemas/LogsArrayProcessorOperation'
5187+
type:
5188+
$ref: '#/components/schemas/LogsArrayProcessorType'
5189+
required:
5190+
- operation
5191+
- type
5192+
type: object
5193+
LogsArrayProcessorOperation:
5194+
description: Configuration of the array processor operation to perform.
5195+
oneOf:
5196+
- $ref: '#/components/schemas/LogsArrayProcessorOperationAppend'
5197+
- $ref: '#/components/schemas/LogsArrayProcessorOperationLength'
5198+
- $ref: '#/components/schemas/LogsArrayProcessorOperationSelect'
5199+
LogsArrayProcessorOperationAppend:
5200+
description: Operation that appends a value to a target array attribute.
5201+
properties:
5202+
preserve_source:
5203+
default: true
5204+
description: Remove or preserve the remapped source element.
5205+
type: boolean
5206+
source:
5207+
description: Attribute path containing the value to append.
5208+
example: network.client.ip
5209+
type: string
5210+
target:
5211+
description: Attribute path of the array to append to.
5212+
example: sourceIps
5213+
type: string
5214+
type:
5215+
$ref: '#/components/schemas/LogsArrayProcessorOperationAppendType'
5216+
required:
5217+
- type
5218+
- source
5219+
- target
5220+
type: object
5221+
LogsArrayProcessorOperationAppendType:
5222+
description: Operation type.
5223+
enum:
5224+
- append
5225+
example: append
5226+
type: string
5227+
x-enum-varnames:
5228+
- APPEND
5229+
LogsArrayProcessorOperationLength:
5230+
description: Operation that computes the length of a `source` array and stores
5231+
the result in the `target` attribute.
5232+
properties:
5233+
source:
5234+
description: Attribute path of the array to measure.
5235+
example: tags
5236+
type: string
5237+
target:
5238+
description: Attribute that receives the computed length.
5239+
example: tagCount
5240+
type: string
5241+
type:
5242+
$ref: '#/components/schemas/LogsArrayProcessorOperationLengthType'
5243+
required:
5244+
- type
5245+
- source
5246+
- target
5247+
type: object
5248+
LogsArrayProcessorOperationLengthType:
5249+
description: Operation type.
5250+
enum:
5251+
- length
5252+
example: length
5253+
type: string
5254+
x-enum-varnames:
5255+
- LENGTH
5256+
LogsArrayProcessorOperationSelect:
5257+
description: Operation that finds an object in a `source` array using a `filter`,
5258+
and then extracts a specific value into the `target` attribute.
5259+
properties:
5260+
filter:
5261+
description: Filter condition expressed as `key:value` used to find the
5262+
matching element.
5263+
example: name:Referrer
5264+
type: string
5265+
source:
5266+
description: Attribute path of the array to search into.
5267+
example: httpRequest.headers
5268+
type: string
5269+
target:
5270+
description: Attribute that receives the extracted value.
5271+
example: referrer
5272+
type: string
5273+
type:
5274+
$ref: '#/components/schemas/LogsArrayProcessorOperationSelectType'
5275+
value_to_extract:
5276+
description: Key of the value to extract from the matching element.
5277+
example: value
5278+
type: string
5279+
required:
5280+
- type
5281+
- source
5282+
- target
5283+
- filter
5284+
- value_to_extract
5285+
type: object
5286+
LogsArrayProcessorOperationSelectType:
5287+
description: Operation type.
5288+
enum:
5289+
- select
5290+
example: select
5291+
type: string
5292+
x-enum-varnames:
5293+
- SELECT
5294+
LogsArrayProcessorType:
5295+
default: array-processor
5296+
description: Type of logs array processor.
5297+
enum:
5298+
- array-processor
5299+
example: array-processor
5300+
type: string
5301+
x-enum-varnames:
5302+
- ARRAY_PROCESSOR
51665303
LogsAttributeRemapper:
51675304
description: 'The remapper processor remaps any source attribute(s) or tag to
51685305
another target attribute or tag.
@@ -6060,6 +6197,7 @@ components:
60606197
- $ref: '#/components/schemas/ReferenceTableLogsLookupProcessor'
60616198
- $ref: '#/components/schemas/LogsTraceRemapper'
60626199
- $ref: '#/components/schemas/LogsSpanRemapper'
6200+
- $ref: '#/components/schemas/LogsArrayProcessor'
60636201
LogsQueryCompute:
60646202
description: Define computation for a log query.
60656203
properties:
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
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+
5+
package datadogV1
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// LogsArrayProcessor A processor for extracting, aggregating, or transforming values from JSON arrays within your logs.
14+
// Supported operations are:
15+
// - Select value from matching element
16+
// - Compute array length
17+
// - Append a value to an array
18+
type LogsArrayProcessor struct {
19+
// Whether or not the processor is enabled.
20+
IsEnabled *bool `json:"is_enabled,omitempty"`
21+
// Name of the processor.
22+
Name *string `json:"name,omitempty"`
23+
// Configuration of the array processor operation to perform.
24+
Operation LogsArrayProcessorOperation `json:"operation"`
25+
// Type of logs array processor.
26+
Type LogsArrayProcessorType `json:"type"`
27+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
28+
UnparsedObject map[string]interface{} `json:"-"`
29+
AdditionalProperties map[string]interface{} `json:"-"`
30+
}
31+
32+
// NewLogsArrayProcessor instantiates a new LogsArrayProcessor object.
33+
// This constructor will assign default values to properties that have it defined,
34+
// and makes sure properties required by API are set, but the set of arguments
35+
// will change when the set of required properties is changed.
36+
func NewLogsArrayProcessor(operation LogsArrayProcessorOperation, typeVar LogsArrayProcessorType) *LogsArrayProcessor {
37+
this := LogsArrayProcessor{}
38+
var isEnabled bool = false
39+
this.IsEnabled = &isEnabled
40+
this.Operation = operation
41+
this.Type = typeVar
42+
return &this
43+
}
44+
45+
// NewLogsArrayProcessorWithDefaults instantiates a new LogsArrayProcessor object.
46+
// This constructor will only assign default values to properties that have it defined,
47+
// but it doesn't guarantee that properties required by API are set.
48+
func NewLogsArrayProcessorWithDefaults() *LogsArrayProcessor {
49+
this := LogsArrayProcessor{}
50+
var isEnabled bool = false
51+
this.IsEnabled = &isEnabled
52+
var typeVar LogsArrayProcessorType = LOGSARRAYPROCESSORTYPE_ARRAY_PROCESSOR
53+
this.Type = typeVar
54+
return &this
55+
}
56+
57+
// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise.
58+
func (o *LogsArrayProcessor) GetIsEnabled() bool {
59+
if o == nil || o.IsEnabled == nil {
60+
var ret bool
61+
return ret
62+
}
63+
return *o.IsEnabled
64+
}
65+
66+
// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise
67+
// and a boolean to check if the value has been set.
68+
func (o *LogsArrayProcessor) GetIsEnabledOk() (*bool, bool) {
69+
if o == nil || o.IsEnabled == nil {
70+
return nil, false
71+
}
72+
return o.IsEnabled, true
73+
}
74+
75+
// HasIsEnabled returns a boolean if a field has been set.
76+
func (o *LogsArrayProcessor) HasIsEnabled() bool {
77+
return o != nil && o.IsEnabled != nil
78+
}
79+
80+
// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field.
81+
func (o *LogsArrayProcessor) SetIsEnabled(v bool) {
82+
o.IsEnabled = &v
83+
}
84+
85+
// GetName returns the Name field value if set, zero value otherwise.
86+
func (o *LogsArrayProcessor) GetName() string {
87+
if o == nil || o.Name == nil {
88+
var ret string
89+
return ret
90+
}
91+
return *o.Name
92+
}
93+
94+
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
95+
// and a boolean to check if the value has been set.
96+
func (o *LogsArrayProcessor) GetNameOk() (*string, bool) {
97+
if o == nil || o.Name == nil {
98+
return nil, false
99+
}
100+
return o.Name, true
101+
}
102+
103+
// HasName returns a boolean if a field has been set.
104+
func (o *LogsArrayProcessor) HasName() bool {
105+
return o != nil && o.Name != nil
106+
}
107+
108+
// SetName gets a reference to the given string and assigns it to the Name field.
109+
func (o *LogsArrayProcessor) SetName(v string) {
110+
o.Name = &v
111+
}
112+
113+
// GetOperation returns the Operation field value.
114+
func (o *LogsArrayProcessor) GetOperation() LogsArrayProcessorOperation {
115+
if o == nil {
116+
var ret LogsArrayProcessorOperation
117+
return ret
118+
}
119+
return o.Operation
120+
}
121+
122+
// GetOperationOk returns a tuple with the Operation field value
123+
// and a boolean to check if the value has been set.
124+
func (o *LogsArrayProcessor) GetOperationOk() (*LogsArrayProcessorOperation, bool) {
125+
if o == nil {
126+
return nil, false
127+
}
128+
return &o.Operation, true
129+
}
130+
131+
// SetOperation sets field value.
132+
func (o *LogsArrayProcessor) SetOperation(v LogsArrayProcessorOperation) {
133+
o.Operation = v
134+
}
135+
136+
// GetType returns the Type field value.
137+
func (o *LogsArrayProcessor) GetType() LogsArrayProcessorType {
138+
if o == nil {
139+
var ret LogsArrayProcessorType
140+
return ret
141+
}
142+
return o.Type
143+
}
144+
145+
// GetTypeOk returns a tuple with the Type field value
146+
// and a boolean to check if the value has been set.
147+
func (o *LogsArrayProcessor) GetTypeOk() (*LogsArrayProcessorType, bool) {
148+
if o == nil {
149+
return nil, false
150+
}
151+
return &o.Type, true
152+
}
153+
154+
// SetType sets field value.
155+
func (o *LogsArrayProcessor) SetType(v LogsArrayProcessorType) {
156+
o.Type = v
157+
}
158+
159+
// MarshalJSON serializes the struct using spec logic.
160+
func (o LogsArrayProcessor) MarshalJSON() ([]byte, error) {
161+
toSerialize := map[string]interface{}{}
162+
if o.UnparsedObject != nil {
163+
return datadog.Marshal(o.UnparsedObject)
164+
}
165+
if o.IsEnabled != nil {
166+
toSerialize["is_enabled"] = o.IsEnabled
167+
}
168+
if o.Name != nil {
169+
toSerialize["name"] = o.Name
170+
}
171+
toSerialize["operation"] = o.Operation
172+
toSerialize["type"] = o.Type
173+
174+
for key, value := range o.AdditionalProperties {
175+
toSerialize[key] = value
176+
}
177+
return datadog.Marshal(toSerialize)
178+
}
179+
180+
// UnmarshalJSON deserializes the given payload.
181+
func (o *LogsArrayProcessor) UnmarshalJSON(bytes []byte) (err error) {
182+
all := struct {
183+
IsEnabled *bool `json:"is_enabled,omitempty"`
184+
Name *string `json:"name,omitempty"`
185+
Operation *LogsArrayProcessorOperation `json:"operation"`
186+
Type *LogsArrayProcessorType `json:"type"`
187+
}{}
188+
if err = datadog.Unmarshal(bytes, &all); err != nil {
189+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
190+
}
191+
if all.Operation == nil {
192+
return fmt.Errorf("required field operation missing")
193+
}
194+
if all.Type == nil {
195+
return fmt.Errorf("required field type missing")
196+
}
197+
additionalProperties := make(map[string]interface{})
198+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
199+
datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "operation", "type"})
200+
} else {
201+
return err
202+
}
203+
204+
hasInvalidField := false
205+
o.IsEnabled = all.IsEnabled
206+
o.Name = all.Name
207+
o.Operation = *all.Operation
208+
if !all.Type.IsValid() {
209+
hasInvalidField = true
210+
} else {
211+
o.Type = *all.Type
212+
}
213+
214+
if len(additionalProperties) > 0 {
215+
o.AdditionalProperties = additionalProperties
216+
}
217+
218+
if hasInvalidField {
219+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
220+
}
221+
222+
return nil
223+
}

0 commit comments

Comments
 (0)