Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator updates #2292

Merged
merged 3 commits into from
Feb 1, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
#
def delete(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "async_search.delete" }
request_opts = { endpoint: arguments[:endpoint] || 'async_search.delete' }

defined_params = [:id].inject({}) do |set_variables, variable|
defined_params = [:id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
#
def get(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "async_search.get" }
request_opts = { endpoint: arguments[:endpoint] || 'async_search.get' }

defined_params = [:id].inject({}) do |set_variables, variable|
defined_params = [:id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
#
def status(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "async_search.status" }
request_opts = { endpoint: arguments[:endpoint] || 'async_search.status' }

defined_params = [:id].inject({}) do |set_variables, variable|
defined_params = [:id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
#
def submit(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "async_search.submit" }
request_opts = { endpoint: arguments[:endpoint] || 'async_search.submit' }

defined_params = [:index].inject({}) do |set_variables, variable|
defined_params = [:index].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -91,7 +90,7 @@ def submit(arguments = {})
path = if _index
"#{Utils.__listify(_index)}/_async_search"
else
"_async_search"
'_async_search'
end
params = Utils.process_params(arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html
#
def delete_autoscaling_policy(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "autoscaling.delete_autoscaling_policy" }
request_opts = { endpoint: arguments[:endpoint] || 'autoscaling.delete_autoscaling_policy' }

defined_params = [:name].inject({}) do |set_variables, variable|
defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
#
def get_autoscaling_capacity(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "autoscaling.get_autoscaling_capacity" }
request_opts = { endpoint: arguments[:endpoint] || 'autoscaling.get_autoscaling_capacity' }

arguments = arguments.clone
headers = arguments.delete(:headers) || {}

body = nil

method = Elasticsearch::API::HTTP_GET
path = "_autoscaling/capacity"
path = '_autoscaling/capacity'
params = {}

Elasticsearch::API::Response.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
#
def get_autoscaling_policy(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "autoscaling.get_autoscaling_policy" }
request_opts = { endpoint: arguments[:endpoint] || 'autoscaling.get_autoscaling_policy' }

defined_params = [:name].inject({}) do |set_variables, variable|
defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html
#
def put_autoscaling_policy(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "autoscaling.put_autoscaling_policy" }
request_opts = { endpoint: arguments[:endpoint] || 'autoscaling.put_autoscaling_policy' }

defined_params = [:name].inject({}) do |set_variables, variable|
defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand Down
19 changes: 9 additions & 10 deletions elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
#
def bulk(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "bulk" }
request_opts = { endpoint: arguments[:endpoint] || 'bulk' }

defined_params = [:index].inject({}) do |set_variables, variable|
defined_params = [:index].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -64,17 +63,17 @@ def bulk(arguments = {})
path = if _index
"#{Utils.__listify(_index)}/_bulk"
else
"_bulk"
'_bulk'
end
params = Utils.process_params(arguments)

if body.is_a? Array
payload = Elasticsearch::API::Utils.__bulkify(body)
else
payload = body
end
payload = if body.is_a? Array
Elasticsearch::API::Utils.__bulkify(body)
else
body
end

headers.merge!("Content-Type" => "application/x-ndjson")
headers.merge!('Content-Type' => 'application/x-ndjson')
Elasticsearch::API::Response.new(
perform_request(method, path, params, payload, headers, request_opts)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-alias.html
#
def aliases(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.aliases" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.aliases' }

defined_params = [:name].inject({}) do |set_variables, variable|
defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -56,7 +55,7 @@ def aliases(arguments = {})
path = if _name
"_cat/aliases/#{Utils.__listify(_name)}"
else
"_cat/aliases"
'_cat/aliases'
end
params = Utils.process_params(arguments)
params[:h] = Utils.__listify(params[:h]) if params[:h]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html
#
def allocation(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.allocation" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.allocation' }

defined_params = [:node_id].inject({}) do |set_variables, variable|
defined_params = [:node_id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -57,7 +56,7 @@ def allocation(arguments = {})
path = if _node_id
"_cat/allocation/#{Utils.__listify(_node_id)}"
else
"_cat/allocation"
'_cat/allocation'
end
params = Utils.process_params(arguments)
params[:h] = Utils.__listify(params[:h]) if params[:h]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-component-templates.html
#
def component_templates(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.component_templates" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.component_templates' }

defined_params = [:name].inject({}) do |set_variables, variable|
defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -56,7 +55,7 @@ def component_templates(arguments = {})
path = if _name
"_cat/component_templates/#{Utils.__listify(_name)}"
else
"_cat/component_templates"
'_cat/component_templates'
end
params = Utils.process_params(arguments)

Expand Down
7 changes: 3 additions & 4 deletions elasticsearch-api/lib/elasticsearch/api/actions/cat/count.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html
#
def count(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.count" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.count' }

defined_params = [:index].inject({}) do |set_variables, variable|
defined_params = [:index].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -54,7 +53,7 @@ def count(arguments = {})
path = if _index
"_cat/count/#{Utils.__listify(_index)}"
else
"_cat/count"
'_cat/count'
end
params = Utils.process_params(arguments)
params[:h] = Utils.__listify(params[:h]) if params[:h]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-fielddata.html
#
def fielddata(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.fielddata" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.fielddata' }

defined_params = [:fields].inject({}) do |set_variables, variable|
defined_params = [:fields].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -55,7 +54,7 @@ def fielddata(arguments = {})
path = if _fields
"_cat/fielddata/#{Utils.__listify(_fields)}"
else
"_cat/fielddata"
'_cat/fielddata'
end
params = Utils.process_params(arguments)

Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-api/lib/elasticsearch/api/actions/cat/health.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-health.html
#
def health(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.health" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.health' }

arguments = arguments.clone
headers = arguments.delete(:headers) || {}

body = nil

method = Elasticsearch::API::HTTP_GET
path = "_cat/health"
path = '_cat/health'
params = Utils.process_params(arguments)
params[:h] = Utils.__listify(params[:h]) if params[:h]

Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-api/lib/elasticsearch/api/actions/cat/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html
#
def help(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.help" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.help' }

arguments = arguments.clone
headers = arguments.delete(:headers) || {}

body = nil

method = Elasticsearch::API::HTTP_GET
path = "_cat"
path = '_cat'
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html
#
def indices(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.indices" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.indices' }

defined_params = [:index].inject({}) do |set_variables, variable|
defined_params = [:index].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -61,7 +60,7 @@ def indices(arguments = {})
path = if _index
"_cat/indices/#{Utils.__listify(_index)}"
else
"_cat/indices"
'_cat/indices'
end
params = Utils.process_params(arguments)
params[:h] = Utils.__listify(params[:h]) if params[:h]
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-api/lib/elasticsearch/api/actions/cat/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ module Actions
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html
#
def master(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.master" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.master' }

arguments = arguments.clone
headers = arguments.delete(:headers) || {}

body = nil

method = Elasticsearch::API::HTTP_GET
path = "_cat/master"
path = '_cat/master'
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ module Actions
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html
#
def ml_data_frame_analytics(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || "cat.ml_data_frame_analytics" }
request_opts = { endpoint: arguments[:endpoint] || 'cat.ml_data_frame_analytics' }

defined_params = [:id].inject({}) do |set_variables, variable|
defined_params = [:id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -57,7 +56,7 @@ def ml_data_frame_analytics(arguments = {})
path = if _id
"_cat/ml/data_frame/analytics/#{Utils.__listify(_id)}"
else
"_cat/ml/data_frame/analytics"
'_cat/ml/data_frame/analytics'
end
params = Utils.process_params(arguments)

Expand Down
Loading
Loading