Skip to content

Commit 80b3c7f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Expose use_legacy_search_syntax flag in the Observability Pipelines API (#3647)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8002dcd commit 80b3c7f

2 files changed

Lines changed: 56 additions & 6 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37916,6 +37916,18 @@ components:
3791637916
items:
3791737917
$ref: '#/components/schemas/ObservabilityPipelineConfigSourceItem'
3791837918
type: array
37919+
use_legacy_search_syntax:
37920+
description: 'Set to `true` to continue using the legacy search syntax while
37921+
migrating filter queries. After migrating all queries to the new syntax,
37922+
set to `false`.
37923+
37924+
The legacy syntax is deprecated and will eventually be removed.
37925+
37926+
Requires Observability Pipelines Worker 2.11 or later.
37927+
37928+
See [Upgrade Your Filter Queries to the New Search Syntax](https://docs.datadoghq.com/observability_pipelines/guide/upgrade_your_filter_queries_to_the_new_search_syntax/)
37929+
for more information.'
37930+
type: boolean
3791937931
required:
3792037932
- sources
3792137933
- destinations

api/datadogV2/model_observability_pipeline_config.go

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ type ObservabilityPipelineConfig struct {
2525
Processors []ObservabilityPipelineConfigProcessorGroup `json:"processors,omitempty"`
2626
// A list of configured data sources for the pipeline.
2727
Sources []ObservabilityPipelineConfigSourceItem `json:"sources"`
28+
// Set to `true` to continue using the legacy search syntax while migrating filter queries. After migrating all queries to the new syntax, set to `false`.
29+
// The legacy syntax is deprecated and will eventually be removed.
30+
// Requires Observability Pipelines Worker 2.11 or later.
31+
// See [Upgrade Your Filter Queries to the New Search Syntax](https://docs.datadoghq.com/observability_pipelines/guide/upgrade_your_filter_queries_to_the_new_search_syntax/) for more information.
32+
UseLegacySearchSyntax *bool `json:"use_legacy_search_syntax,omitempty"`
2833
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2934
UnparsedObject map[string]interface{} `json:"-"`
3035
AdditionalProperties map[string]interface{} `json:"-"`
@@ -186,6 +191,34 @@ func (o *ObservabilityPipelineConfig) SetSources(v []ObservabilityPipelineConfig
186191
o.Sources = v
187192
}
188193

194+
// GetUseLegacySearchSyntax returns the UseLegacySearchSyntax field value if set, zero value otherwise.
195+
func (o *ObservabilityPipelineConfig) GetUseLegacySearchSyntax() bool {
196+
if o == nil || o.UseLegacySearchSyntax == nil {
197+
var ret bool
198+
return ret
199+
}
200+
return *o.UseLegacySearchSyntax
201+
}
202+
203+
// GetUseLegacySearchSyntaxOk returns a tuple with the UseLegacySearchSyntax field value if set, nil otherwise
204+
// and a boolean to check if the value has been set.
205+
func (o *ObservabilityPipelineConfig) GetUseLegacySearchSyntaxOk() (*bool, bool) {
206+
if o == nil || o.UseLegacySearchSyntax == nil {
207+
return nil, false
208+
}
209+
return o.UseLegacySearchSyntax, true
210+
}
211+
212+
// HasUseLegacySearchSyntax returns a boolean if a field has been set.
213+
func (o *ObservabilityPipelineConfig) HasUseLegacySearchSyntax() bool {
214+
return o != nil && o.UseLegacySearchSyntax != nil
215+
}
216+
217+
// SetUseLegacySearchSyntax gets a reference to the given bool and assigns it to the UseLegacySearchSyntax field.
218+
func (o *ObservabilityPipelineConfig) SetUseLegacySearchSyntax(v bool) {
219+
o.UseLegacySearchSyntax = &v
220+
}
221+
189222
// MarshalJSON serializes the struct using spec logic.
190223
func (o ObservabilityPipelineConfig) MarshalJSON() ([]byte, error) {
191224
toSerialize := map[string]interface{}{}
@@ -203,6 +236,9 @@ func (o ObservabilityPipelineConfig) MarshalJSON() ([]byte, error) {
203236
toSerialize["processors"] = o.Processors
204237
}
205238
toSerialize["sources"] = o.Sources
239+
if o.UseLegacySearchSyntax != nil {
240+
toSerialize["use_legacy_search_syntax"] = o.UseLegacySearchSyntax
241+
}
206242

207243
for key, value := range o.AdditionalProperties {
208244
toSerialize[key] = value
@@ -213,11 +249,12 @@ func (o ObservabilityPipelineConfig) MarshalJSON() ([]byte, error) {
213249
// UnmarshalJSON deserializes the given payload.
214250
func (o *ObservabilityPipelineConfig) UnmarshalJSON(bytes []byte) (err error) {
215251
all := struct {
216-
Destinations *[]ObservabilityPipelineConfigDestinationItem `json:"destinations"`
217-
PipelineType *ObservabilityPipelineConfigPipelineType `json:"pipeline_type,omitempty"`
218-
ProcessorGroups []ObservabilityPipelineConfigProcessorGroup `json:"processor_groups,omitempty"`
219-
Processors []ObservabilityPipelineConfigProcessorGroup `json:"processors,omitempty"`
220-
Sources *[]ObservabilityPipelineConfigSourceItem `json:"sources"`
252+
Destinations *[]ObservabilityPipelineConfigDestinationItem `json:"destinations"`
253+
PipelineType *ObservabilityPipelineConfigPipelineType `json:"pipeline_type,omitempty"`
254+
ProcessorGroups []ObservabilityPipelineConfigProcessorGroup `json:"processor_groups,omitempty"`
255+
Processors []ObservabilityPipelineConfigProcessorGroup `json:"processors,omitempty"`
256+
Sources *[]ObservabilityPipelineConfigSourceItem `json:"sources"`
257+
UseLegacySearchSyntax *bool `json:"use_legacy_search_syntax,omitempty"`
221258
}{}
222259
if err = datadog.Unmarshal(bytes, &all); err != nil {
223260
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -230,7 +267,7 @@ func (o *ObservabilityPipelineConfig) UnmarshalJSON(bytes []byte) (err error) {
230267
}
231268
additionalProperties := make(map[string]interface{})
232269
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
233-
datadog.DeleteKeys(additionalProperties, &[]string{"destinations", "pipeline_type", "processor_groups", "processors", "sources"})
270+
datadog.DeleteKeys(additionalProperties, &[]string{"destinations", "pipeline_type", "processor_groups", "processors", "sources", "use_legacy_search_syntax"})
234271
} else {
235272
return err
236273
}
@@ -245,6 +282,7 @@ func (o *ObservabilityPipelineConfig) UnmarshalJSON(bytes []byte) (err error) {
245282
o.ProcessorGroups = all.ProcessorGroups
246283
o.Processors = all.Processors
247284
o.Sources = *all.Sources
285+
o.UseLegacySearchSyntax = all.UseLegacySearchSyntax
248286

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

0 commit comments

Comments
 (0)