lib/elasticsearch/api/actions/nodes/usage.rb in elasticsearch-api-8.10.0 vs lib/elasticsearch/api/actions/nodes/usage.rb in elasticsearch-api-8.11.0

- old
+ new

@@ -27,13 +27,21 @@ # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes # @option arguments [List] :metric Limit the information returned to the specified metrics (options: _all, rest_actions) # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-nodes-usage.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/cluster-nodes-usage.html # def usage(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "nodes.usage" } + + defined_params = [:node_id, :metric].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? + arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil @@ -52,10 +60,10 @@ "_nodes/usage" end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( - perform_request(method, path, params, body, headers) + perform_request(method, path, params, body, headers, request_opts) ) end end end end