lib/elasticsearch/api/actions/cluster/info.rb in elasticsearch-api-8.10.0 vs lib/elasticsearch/api/actions/cluster/info.rb in elasticsearch-api-8.11.0

- old
+ new

@@ -25,13 +25,21 @@ # Returns different information about the cluster. # # @option arguments [List] :target Limit the information returned to the specified target. (options: _all, http, ingest, thread_pool, script) # @option arguments [Hash] :headers Custom HTTP headers # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-info.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/cluster-info.html # def info(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "cluster.info" } + + defined_params = [:target].inject({}) do |set_variables, variable| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + set_variables + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] arguments = arguments.clone headers = arguments.delete(:headers) || {} @@ -42,10 +50,10 @@ method = Elasticsearch::API::HTTP_GET path = "_info/#{Utils.__listify(_target)}" params = {} Elasticsearch::API::Response.new( - perform_request(method, path, params, body, headers) + perform_request(method, path, params, body, headers, request_opts) ) end end end end