diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ca425e6bd9f2..5423824d0a66 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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 diff --git a/features/step_definitions/request.rb b/features/step_definitions/request.rb index 5e0d64fe4b53..8682557b083d 100644 --- a/features/step_definitions/request.rb +++ b/features/step_definitions/request.rb @@ -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 @@ -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 @@ -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| diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_config.rb b/lib/datadog_api_client/v2/models/observability_pipeline_config.rb index 0fae61d9128b..eb155c23c39d 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_config.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_config.rb @@ -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. @@ -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 @@ -60,7 +67,8 @@ def self.openapi_types :'pipeline_type' => :'ObservabilityPipelineConfigPipelineType', :'processor_groups' => :'Array', :'processors' => :'Array', - :'sources' => :'Array' + :'sources' => :'Array', + :'use_legacy_search_syntax' => :'Boolean' } end @@ -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 @@ -171,6 +183,7 @@ 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 @@ -178,7 +191,7 @@ def ==(o) # @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