Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
233 changes: 232 additions & 1 deletion .generator/schemas/v1/openapi.yaml

Large diffs are not rendered by default.

15,704 changes: 14,741 additions & 963 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

653 changes: 372 additions & 281 deletions api/datadog/configuration.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
FORMULAANDFUNCTIONEVENTSDATASOURCE_INCIDENT_ANALYTICS FormulaAndFunctionEventsDataSource = "incident_analytics"
FORMULAANDFUNCTIONEVENTSDATASOURCE_PRODUCT_ANALYTICS FormulaAndFunctionEventsDataSource = "product_analytics"
FORMULAANDFUNCTIONEVENTSDATASOURCE_ON_CALL_EVENTS FormulaAndFunctionEventsDataSource = "on_call_events"
FORMULAANDFUNCTIONEVENTSDATASOURCE_ERRORS FormulaAndFunctionEventsDataSource = "errors"
)

var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEventsDataSource{
Expand All @@ -44,6 +45,7 @@ var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEv
FORMULAANDFUNCTIONEVENTSDATASOURCE_INCIDENT_ANALYTICS,
FORMULAANDFUNCTIONEVENTSDATASOURCE_PRODUCT_ANALYTICS,
FORMULAANDFUNCTIONEVENTSDATASOURCE_ON_CALL_EVENTS,
FORMULAANDFUNCTIONEVENTSDATASOURCE_ERRORS,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down
221 changes: 221 additions & 0 deletions api/datadogV1/model_logs_exclude_attribute_processor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV1

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// LogsExcludeAttributeProcessor Use this processor to remove an attribute from a log during processing.
// The processor strips the specified attribute from the log event, which is useful
// when the attribute contains sensitive data or is no longer needed downstream.
type LogsExcludeAttributeProcessor struct {
// Name of the log attribute to remove from the log event.
AttributeToExclude string `json:"attribute_to_exclude"`
// Whether or not the processor is enabled.
IsEnabled *bool `json:"is_enabled,omitempty"`
// Name of the processor.
Name *string `json:"name,omitempty"`
// Type of logs exclude attribute processor.
Type LogsExcludeAttributeProcessorType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewLogsExcludeAttributeProcessor instantiates a new LogsExcludeAttributeProcessor object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewLogsExcludeAttributeProcessor(attributeToExclude string, typeVar LogsExcludeAttributeProcessorType) *LogsExcludeAttributeProcessor {
this := LogsExcludeAttributeProcessor{}
this.AttributeToExclude = attributeToExclude
var isEnabled bool = false
this.IsEnabled = &isEnabled
this.Type = typeVar
return &this
}

// NewLogsExcludeAttributeProcessorWithDefaults instantiates a new LogsExcludeAttributeProcessor object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewLogsExcludeAttributeProcessorWithDefaults() *LogsExcludeAttributeProcessor {
this := LogsExcludeAttributeProcessor{}
var isEnabled bool = false
this.IsEnabled = &isEnabled
var typeVar LogsExcludeAttributeProcessorType = LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE
this.Type = typeVar
return &this
}

// GetAttributeToExclude returns the AttributeToExclude field value.
func (o *LogsExcludeAttributeProcessor) GetAttributeToExclude() string {
if o == nil {
var ret string
return ret
}
return o.AttributeToExclude
}

// GetAttributeToExcludeOk returns a tuple with the AttributeToExclude field value
// and a boolean to check if the value has been set.
func (o *LogsExcludeAttributeProcessor) GetAttributeToExcludeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.AttributeToExclude, true
}

// SetAttributeToExclude sets field value.
func (o *LogsExcludeAttributeProcessor) SetAttributeToExclude(v string) {
o.AttributeToExclude = v
}

// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise.
func (o *LogsExcludeAttributeProcessor) GetIsEnabled() bool {
if o == nil || o.IsEnabled == nil {
var ret bool
return ret
}
return *o.IsEnabled
}

// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsExcludeAttributeProcessor) GetIsEnabledOk() (*bool, bool) {
if o == nil || o.IsEnabled == nil {
return nil, false
}
return o.IsEnabled, true
}

// HasIsEnabled returns a boolean if a field has been set.
func (o *LogsExcludeAttributeProcessor) HasIsEnabled() bool {
return o != nil && o.IsEnabled != nil
}

// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field.
func (o *LogsExcludeAttributeProcessor) SetIsEnabled(v bool) {
o.IsEnabled = &v
}

// GetName returns the Name field value if set, zero value otherwise.
func (o *LogsExcludeAttributeProcessor) GetName() string {
if o == nil || o.Name == nil {
var ret string
return ret
}
return *o.Name
}

// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsExcludeAttributeProcessor) GetNameOk() (*string, bool) {
if o == nil || o.Name == nil {
return nil, false
}
return o.Name, true
}

// HasName returns a boolean if a field has been set.
func (o *LogsExcludeAttributeProcessor) HasName() bool {
return o != nil && o.Name != nil
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *LogsExcludeAttributeProcessor) SetName(v string) {
o.Name = &v
}

// GetType returns the Type field value.
func (o *LogsExcludeAttributeProcessor) GetType() LogsExcludeAttributeProcessorType {
if o == nil {
var ret LogsExcludeAttributeProcessorType
return ret
}
return o.Type
}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *LogsExcludeAttributeProcessor) GetTypeOk() (*LogsExcludeAttributeProcessorType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}

// SetType sets field value.
func (o *LogsExcludeAttributeProcessor) SetType(v LogsExcludeAttributeProcessorType) {
o.Type = v
}

// MarshalJSON serializes the struct using spec logic.
func (o LogsExcludeAttributeProcessor) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["attribute_to_exclude"] = o.AttributeToExclude
if o.IsEnabled != nil {
toSerialize["is_enabled"] = o.IsEnabled
}
if o.Name != nil {
toSerialize["name"] = o.Name
}
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *LogsExcludeAttributeProcessor) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
AttributeToExclude *string `json:"attribute_to_exclude"`
IsEnabled *bool `json:"is_enabled,omitempty"`
Name *string `json:"name,omitempty"`
Type *LogsExcludeAttributeProcessorType `json:"type"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.AttributeToExclude == nil {
return fmt.Errorf("required field attribute_to_exclude missing")
}
if all.Type == nil {
return fmt.Errorf("required field type missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"attribute_to_exclude", "is_enabled", "name", "type"})
} else {
return err
}

hasInvalidField := false
o.AttributeToExclude = *all.AttributeToExclude
o.IsEnabled = all.IsEnabled
o.Name = all.Name
if !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = *all.Type
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
64 changes: 64 additions & 0 deletions api/datadogV1/model_logs_exclude_attribute_processor_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV1

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// LogsExcludeAttributeProcessorType Type of logs exclude attribute processor.
type LogsExcludeAttributeProcessorType string

// List of LogsExcludeAttributeProcessorType.
const (
LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE LogsExcludeAttributeProcessorType = "exclude-attribute"
)

var allowedLogsExcludeAttributeProcessorTypeEnumValues = []LogsExcludeAttributeProcessorType{
LOGSEXCLUDEATTRIBUTEPROCESSORTYPE_EXCLUDE_ATTRIBUTE,
}

// GetAllowedValues reeturns the list of possible values.
func (v *LogsExcludeAttributeProcessorType) GetAllowedValues() []LogsExcludeAttributeProcessorType {
return allowedLogsExcludeAttributeProcessorTypeEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *LogsExcludeAttributeProcessorType) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = LogsExcludeAttributeProcessorType(value)
return nil
}

// NewLogsExcludeAttributeProcessorTypeFromValue returns a pointer to a valid LogsExcludeAttributeProcessorType
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewLogsExcludeAttributeProcessorTypeFromValue(v string) (*LogsExcludeAttributeProcessorType, error) {
ev := LogsExcludeAttributeProcessorType(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for LogsExcludeAttributeProcessorType: valid values are %v", v, allowedLogsExcludeAttributeProcessorTypeEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v LogsExcludeAttributeProcessorType) IsValid() bool {
for _, existing := range allowedLogsExcludeAttributeProcessorTypeEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to LogsExcludeAttributeProcessorType value.
func (v LogsExcludeAttributeProcessorType) Ptr() *LogsExcludeAttributeProcessorType {
return &v
}
32 changes: 32 additions & 0 deletions api/datadogV1/model_logs_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type LogsProcessor struct {
LogsArrayProcessor *LogsArrayProcessor
LogsDecoderProcessor *LogsDecoderProcessor
LogsSchemaProcessor *LogsSchemaProcessor
LogsExcludeAttributeProcessor *LogsExcludeAttributeProcessor

// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
Expand Down Expand Up @@ -135,6 +136,11 @@ func LogsSchemaProcessorAsLogsProcessor(v *LogsSchemaProcessor) LogsProcessor {
return LogsProcessor{LogsSchemaProcessor: v}
}

// LogsExcludeAttributeProcessorAsLogsProcessor is a convenience function that returns LogsExcludeAttributeProcessor wrapped in LogsProcessor.
func LogsExcludeAttributeProcessorAsLogsProcessor(v *LogsExcludeAttributeProcessor) LogsProcessor {
return LogsProcessor{LogsExcludeAttributeProcessor: v}
}

// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *LogsProcessor) UnmarshalJSON(data []byte) error {
var err error
Expand Down Expand Up @@ -479,6 +485,23 @@ func (obj *LogsProcessor) UnmarshalJSON(data []byte) error {
obj.LogsSchemaProcessor = nil
}

// try to unmarshal data into LogsExcludeAttributeProcessor
err = datadog.Unmarshal(data, &obj.LogsExcludeAttributeProcessor)
if err == nil {
if obj.LogsExcludeAttributeProcessor != nil && obj.LogsExcludeAttributeProcessor.UnparsedObject == nil {
jsonLogsExcludeAttributeProcessor, _ := datadog.Marshal(obj.LogsExcludeAttributeProcessor)
if string(jsonLogsExcludeAttributeProcessor) == "{}" { // empty struct
obj.LogsExcludeAttributeProcessor = nil
} else {
match++
}
} else {
obj.LogsExcludeAttributeProcessor = nil
}
} else {
obj.LogsExcludeAttributeProcessor = nil
}

if match != 1 { // more than 1 match
// reset to nil
obj.LogsGrokParser = nil
Expand All @@ -501,6 +524,7 @@ func (obj *LogsProcessor) UnmarshalJSON(data []byte) error {
obj.LogsArrayProcessor = nil
obj.LogsDecoderProcessor = nil
obj.LogsSchemaProcessor = nil
obj.LogsExcludeAttributeProcessor = nil
return datadog.Unmarshal(data, &obj.UnparsedObject)
}
return nil // exactly one match
Expand Down Expand Up @@ -588,6 +612,10 @@ func (obj LogsProcessor) MarshalJSON() ([]byte, error) {
return datadog.Marshal(&obj.LogsSchemaProcessor)
}

if obj.LogsExcludeAttributeProcessor != nil {
return datadog.Marshal(&obj.LogsExcludeAttributeProcessor)
}

if obj.UnparsedObject != nil {
return datadog.Marshal(obj.UnparsedObject)
}
Expand Down Expand Up @@ -676,6 +704,10 @@ func (obj *LogsProcessor) GetActualInstance() interface{} {
return obj.LogsSchemaProcessor
}

if obj.LogsExcludeAttributeProcessor != nil {
return obj.LogsExcludeAttributeProcessor
}

// all schemas are nil
return nil
}
Loading
Loading