Skip to content

Commit 0a0cde4

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

5 files changed

Lines changed: 374 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:
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
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+
// LogsExcludeAttributeProcessor Use this processor to remove an attribute from a log during processing.
14+
// The processor strips the specified attribute from the log event, which is useful
15+
// when the attribute contains sensitive data or is no longer needed downstream.
16+
type LogsExcludeAttributeProcessor struct {
17+
// Name of the log attribute to remove from the log event.
18+
AttributeToExclude string `json:"attribute_to_exclude"`
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+
// Type of logs exclude attribute processor.
24+
Type LogsExcludeAttributeProcessorType `json:"type"`
25+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
26+
UnparsedObject map[string]interface{} `json:"-"`
27+
AdditionalProperties map[string]interface{} `json:"-"`
28+
}
29+
30+
// NewLogsExcludeAttributeProcessor instantiates a new LogsExcludeAttributeProcessor object.
31+
// This constructor will assign default values to properties that have it defined,
32+
// and makes sure properties required by API are set, but the set of arguments
33+
// will change when the set of required properties is changed.
34+
func NewLogsExcludeAttributeProcessor(attributeToExclude string, typeVar LogsExcludeAttributeProcessorType) *LogsExcludeAttributeProcessor {
35+
this := LogsExcludeAttributeProcessor{}
36+
this.AttributeToExclude = attributeToExclude
37+
var isEnabled bool = false
38+
this.IsEnabled = &isEnabled
39+
this.Type = typeVar
40+
return &this
41+
}
42+
43+
// NewLogsExcludeAttributeProcessorWithDefaults instantiates a new LogsExcludeAttributeProcessor object.
44+
// This constructor will only assign default values to properties that have it defined,
45+
// but it doesn't guarantee that properties required by API are set.
46+
func NewLogsExcludeAttributeProcessorWithDefaults() *LogsExcludeAttributeProcessor {
47+
this := LogsExcludeAttributeProcessor{}
48+
var isEnabled bool = false
49+
this.IsEnabled = &isEnabled
50+
var typeVar LogsExcludeAttributeProcessorType = LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE
51+
this.Type = typeVar
52+
return &this
53+
}
54+
55+
// GetAttributeToExclude returns the AttributeToExclude field value.
56+
func (o *LogsExcludeAttributeProcessor) GetAttributeToExclude() string {
57+
if o == nil {
58+
var ret string
59+
return ret
60+
}
61+
return o.AttributeToExclude
62+
}
63+
64+
// GetAttributeToExcludeOk returns a tuple with the AttributeToExclude field value
65+
// and a boolean to check if the value has been set.
66+
func (o *LogsExcludeAttributeProcessor) GetAttributeToExcludeOk() (*string, bool) {
67+
if o == nil {
68+
return nil, false
69+
}
70+
return &o.AttributeToExclude, true
71+
}
72+
73+
// SetAttributeToExclude sets field value.
74+
func (o *LogsExcludeAttributeProcessor) SetAttributeToExclude(v string) {
75+
o.AttributeToExclude = v
76+
}
77+
78+
// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise.
79+
func (o *LogsExcludeAttributeProcessor) GetIsEnabled() bool {
80+
if o == nil || o.IsEnabled == nil {
81+
var ret bool
82+
return ret
83+
}
84+
return *o.IsEnabled
85+
}
86+
87+
// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise
88+
// and a boolean to check if the value has been set.
89+
func (o *LogsExcludeAttributeProcessor) GetIsEnabledOk() (*bool, bool) {
90+
if o == nil || o.IsEnabled == nil {
91+
return nil, false
92+
}
93+
return o.IsEnabled, true
94+
}
95+
96+
// HasIsEnabled returns a boolean if a field has been set.
97+
func (o *LogsExcludeAttributeProcessor) HasIsEnabled() bool {
98+
return o != nil && o.IsEnabled != nil
99+
}
100+
101+
// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field.
102+
func (o *LogsExcludeAttributeProcessor) SetIsEnabled(v bool) {
103+
o.IsEnabled = &v
104+
}
105+
106+
// GetName returns the Name field value if set, zero value otherwise.
107+
func (o *LogsExcludeAttributeProcessor) GetName() string {
108+
if o == nil || o.Name == nil {
109+
var ret string
110+
return ret
111+
}
112+
return *o.Name
113+
}
114+
115+
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
116+
// and a boolean to check if the value has been set.
117+
func (o *LogsExcludeAttributeProcessor) GetNameOk() (*string, bool) {
118+
if o == nil || o.Name == nil {
119+
return nil, false
120+
}
121+
return o.Name, true
122+
}
123+
124+
// HasName returns a boolean if a field has been set.
125+
func (o *LogsExcludeAttributeProcessor) HasName() bool {
126+
return o != nil && o.Name != nil
127+
}
128+
129+
// SetName gets a reference to the given string and assigns it to the Name field.
130+
func (o *LogsExcludeAttributeProcessor) SetName(v string) {
131+
o.Name = &v
132+
}
133+
134+
// GetType returns the Type field value.
135+
func (o *LogsExcludeAttributeProcessor) GetType() LogsExcludeAttributeProcessorType {
136+
if o == nil {
137+
var ret LogsExcludeAttributeProcessorType
138+
return ret
139+
}
140+
return o.Type
141+
}
142+
143+
// GetTypeOk returns a tuple with the Type field value
144+
// and a boolean to check if the value has been set.
145+
func (o *LogsExcludeAttributeProcessor) GetTypeOk() (*LogsExcludeAttributeProcessorType, bool) {
146+
if o == nil {
147+
return nil, false
148+
}
149+
return &o.Type, true
150+
}
151+
152+
// SetType sets field value.
153+
func (o *LogsExcludeAttributeProcessor) SetType(v LogsExcludeAttributeProcessorType) {
154+
o.Type = v
155+
}
156+
157+
// MarshalJSON serializes the struct using spec logic.
158+
func (o LogsExcludeAttributeProcessor) MarshalJSON() ([]byte, error) {
159+
toSerialize := map[string]interface{}{}
160+
if o.UnparsedObject != nil {
161+
return datadog.Marshal(o.UnparsedObject)
162+
}
163+
toSerialize["attribute_to_exclude"] = o.AttributeToExclude
164+
if o.IsEnabled != nil {
165+
toSerialize["is_enabled"] = o.IsEnabled
166+
}
167+
if o.Name != nil {
168+
toSerialize["name"] = o.Name
169+
}
170+
toSerialize["type"] = o.Type
171+
172+
for key, value := range o.AdditionalProperties {
173+
toSerialize[key] = value
174+
}
175+
return datadog.Marshal(toSerialize)
176+
}
177+
178+
// UnmarshalJSON deserializes the given payload.
179+
func (o *LogsExcludeAttributeProcessor) UnmarshalJSON(bytes []byte) (err error) {
180+
all := struct {
181+
AttributeToExclude *string `json:"attribute_to_exclude"`
182+
IsEnabled *bool `json:"is_enabled,omitempty"`
183+
Name *string `json:"name,omitempty"`
184+
Type *LogsExcludeAttributeProcessorType `json:"type"`
185+
}{}
186+
if err = datadog.Unmarshal(bytes, &all); err != nil {
187+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
188+
}
189+
if all.AttributeToExclude == nil {
190+
return fmt.Errorf("required field attribute_to_exclude missing")
191+
}
192+
if all.Type == nil {
193+
return fmt.Errorf("required field type missing")
194+
}
195+
additionalProperties := make(map[string]interface{})
196+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
197+
datadog.DeleteKeys(additionalProperties, &[]string{"attribute_to_exclude", "is_enabled", "name", "type"})
198+
} else {
199+
return err
200+
}
201+
202+
hasInvalidField := false
203+
o.AttributeToExclude = *all.AttributeToExclude
204+
o.IsEnabled = all.IsEnabled
205+
o.Name = all.Name
206+
if !all.Type.IsValid() {
207+
hasInvalidField = true
208+
} else {
209+
o.Type = *all.Type
210+
}
211+
212+
if len(additionalProperties) > 0 {
213+
o.AdditionalProperties = additionalProperties
214+
}
215+
216+
if hasInvalidField {
217+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
218+
}
219+
220+
return nil
221+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
// LogsExcludeAttributeProcessorType Type of logs exclude attribute processor.
14+
type LogsExcludeAttributeProcessorType string
15+
16+
// List of LogsExcludeAttributeProcessorType.
17+
const (
18+
LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE LogsExcludeAttributeProcessorType = "exclude-attribute"
19+
)
20+
21+
var allowedLogsExcludeAttributeProcessorTypeEnumValues = []LogsExcludeAttributeProcessorType{
22+
LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE,
23+
}
24+
25+
// GetAllowedValues reeturns the list of possible values.
26+
func (v *LogsExcludeAttributeProcessorType) GetAllowedValues() []LogsExcludeAttributeProcessorType {
27+
return allowedLogsExcludeAttributeProcessorTypeEnumValues
28+
}
29+
30+
// UnmarshalJSON deserializes the given payload.
31+
func (v *LogsExcludeAttributeProcessorType) UnmarshalJSON(src []byte) error {
32+
var value string
33+
err := datadog.Unmarshal(src, &value)
34+
if err != nil {
35+
return err
36+
}
37+
*v = LogsExcludeAttributeProcessorType(value)
38+
return nil
39+
}
40+
41+
// NewLogsExcludeAttributeProcessorTypeFromValue returns a pointer to a valid LogsExcludeAttributeProcessorType
42+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
43+
func NewLogsExcludeAttributeProcessorTypeFromValue(v string) (*LogsExcludeAttributeProcessorType, error) {
44+
ev := LogsExcludeAttributeProcessorType(v)
45+
if ev.IsValid() {
46+
return &ev, nil
47+
}
48+
return nil, fmt.Errorf("invalid value '%v' for LogsExcludeAttributeProcessorType: valid values are %v", v, allowedLogsExcludeAttributeProcessorTypeEnumValues)
49+
}
50+
51+
// IsValid return true if the value is valid for the enum, false otherwise.
52+
func (v LogsExcludeAttributeProcessorType) IsValid() bool {
53+
for _, existing := range allowedLogsExcludeAttributeProcessorTypeEnumValues {
54+
if existing == v {
55+
return true
56+
}
57+
}
58+
return false
59+
}
60+
61+
// Ptr returns reference to LogsExcludeAttributeProcessorType value.
62+
func (v LogsExcludeAttributeProcessorType) Ptr() *LogsExcludeAttributeProcessorType {
63+
return &v
64+
}

0 commit comments

Comments
 (0)