Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37916,6 +37916,18 @@ components:
items:
$ref: '#/components/schemas/ObservabilityPipelineConfigSourceItem'
type: array
use_legacy_search_syntax:
description: '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`.

The legacy syntax is deprecated and will eventually be removed.

Requires Observability Pipelines Worker 2.11 or later.

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.'
type: boolean
required:
- sources
- destinations
Expand Down
28 changes: 26 additions & 2 deletions features/step_definitions/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,13 @@ def build_undo_for(version, operation_id, api_instance = nil)
# Extract from path parameters
if p["source"]
param_name = p["source"]
snake_param = param_name.to_parameter
if @path_parameters&.key?(param_name)
[p["name"].to_sym, @path_parameters[param_name]]
elsif @path_parameters&.key?(param_name.to_sym)
[p["name"].to_sym, @path_parameters[param_name.to_sym]]
elsif @path_parameters&.key?(snake_param)
[p["name"].to_sym, @path_parameters[snake_param]]
else
warn "Path parameter '#{param_name}' not found"
nil
Expand Down Expand Up @@ -235,6 +238,25 @@ def build_given(api_version, operation)
result
end if operation["parameters"]

# Store path parameters for undo operations
# Path parameters are required positional parameters that are not the body
if operation["parameters"] && args
required_params = method.parameters.select { |p| p[0] == :req }

operation["parameters"].each_with_index do |p, index|
# Only store if:
# 1. Index is within required params range
# 2. Parameter is not named "body" (body is required but not a path param)
if index < required_params.length && p["name"] != "body"
param_value = args[index]
# Store with all naming variants for compatibility with undo lookup
path_parameters[p["name"]] = param_value
path_parameters[p["name"].to_parameter] = param_value
path_parameters[p["name"].to_parameter.to_sym] = param_value
end
end
end

result = method.call(*args)[0]

# register undo method
Expand Down Expand Up @@ -297,18 +319,20 @@ def model_builder(param, obj)
param_value = model_builder(parameter_name.to_parameter, fixtures.lookup(fixture_path))
param_key = parameter_name.to_parameter.to_sym
opts[param_key] = param_value
# Store in path_parameters for undo operations
# Store in path_parameters for undo operations with all naming variants
path_parameters[parameter_name] = param_value
path_parameters[param_key] = param_value
path_parameters[parameter_name.to_parameter] = param_value
end

Given(/^request contains "([^"]+)" parameter with value (.+)$/) do |parameter_name, value|
param_value = model_builder(parameter_name.to_parameter, JSON.parse(value.templated fixtures))
param_key = parameter_name.to_parameter.to_sym
opts[param_key] = param_value
# Store in path_parameters for undo operations
# Store in path_parameters for undo operations with all naming variants
path_parameters[parameter_name] = param_value
path_parameters[param_key] = param_value
path_parameters[parameter_name.to_parameter] = param_value
end

Given(/^new "([^"]+)" request$/) do |name|
Expand Down
19 changes: 16 additions & 3 deletions lib/datadog_api_client/v2/models/observability_pipeline_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class ObservabilityPipelineConfig
# A list of configured data sources for the pipeline.
attr_reader :sources

# 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`.
# The legacy syntax is deprecated and will eventually be removed.
# Requires Observability Pipelines Worker 2.11 or later.
# 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.
attr_accessor :use_legacy_search_syntax

attr_accessor :additional_properties

# Attribute mapping from ruby-style variable name to JSON key.
Expand All @@ -48,7 +54,8 @@ def self.attribute_map
:'pipeline_type' => :'pipeline_type',
:'processor_groups' => :'processor_groups',
:'processors' => :'processors',
:'sources' => :'sources'
:'sources' => :'sources',
:'use_legacy_search_syntax' => :'use_legacy_search_syntax'
}
end

Expand All @@ -60,7 +67,8 @@ def self.openapi_types
:'pipeline_type' => :'ObservabilityPipelineConfigPipelineType',
:'processor_groups' => :'Array<ObservabilityPipelineConfigProcessorGroup>',
:'processors' => :'Array<ObservabilityPipelineConfigProcessorGroup>',
:'sources' => :'Array<ObservabilityPipelineConfigSourceItem>'
:'sources' => :'Array<ObservabilityPipelineConfigSourceItem>',
:'use_legacy_search_syntax' => :'Boolean'
}
end

Expand Down Expand Up @@ -109,6 +117,10 @@ def initialize(attributes = {})
self.sources = value
end
end

if attributes.key?(:'use_legacy_search_syntax')
self.use_legacy_search_syntax = attributes[:'use_legacy_search_syntax']
end
end

# Check to see if the all the properties in the model are valid
Expand Down Expand Up @@ -171,14 +183,15 @@ def ==(o)
processor_groups == o.processor_groups &&
processors == o.processors &&
sources == o.sources &&
use_legacy_search_syntax == o.use_legacy_search_syntax &&
additional_properties == o.additional_properties
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[destinations, pipeline_type, processor_groups, processors, sources, additional_properties].hash
[destinations, pipeline_type, processor_groups, processors, sources, use_legacy_search_syntax, additional_properties].hash
end
end
end
Loading