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

Auto-generated code for 8.x #2571

Merged
merged 3 commits into from
Feb 3, 2025
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
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module Actions
# @option arguments [Boolean] :require_alias Sets require_alias for all incoming documents. Defaults to unset (false)
# @option arguments [Boolean] :require_data_stream When true, requires the destination to be a data stream (existing or to-be-created). Default is false
# @option arguments [Boolean] :list_executed_pipelines Sets list_executed_pipelines for all incoming documents. Defaults to unset (false)
# @option arguments [Boolean] :include_source_on_error True or false if to include the document source in the error message in case of parsing errors. Defaults to true.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [String|Array] :body The operation definition and data (action-data pairs), separated by newlines. Array of Strings, Header/Data pairs,
# or the conveniency "combined" format can be passed, refer to Elasticsearch::API::Utils.__bulkify documentation.
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module Actions
# @option arguments [Number] :version Explicit version number for concurrency control
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte)
# @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with
# @option arguments [Boolean] :include_source_on_error True or false if to include the document source in the error message in case of parsing errors. Defaults to true.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The document (*Required*)
#
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Actions
# @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with
# @option arguments [Boolean] :require_alias When true, requires destination to be an alias. Default is false
# @option arguments [Boolean] :require_data_stream When true, requires the destination to be a data stream (existing or to-be-created). Default is false
# @option arguments [Boolean] :include_source_on_error True or false if to include the document source in the error message in case of parsing errors. Defaults to true.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The document (*Required*)
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ module Elasticsearch
module API
module Indices
module Actions
# Resolves the specified index expressions to return information about each cluster, including the local cluster, if included.
# Resolves the specified index expressions to return information about each cluster. If no index expression is provided, this endpoint will return information about all the remote clusters that are configured on the local cluster.
#
# @option arguments [List] :name A comma-separated list of cluster:index names or wildcard expressions
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
# @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed). Only allowed when providing an index expression.
# @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled. Only allowed when providing an index expression.
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). Only allowed when providing an index expression.
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open). Only allowed when providing an index expression. (options: open, closed, hidden, none, all)
# @option arguments [Time] :timeout The maximum time to wait for remote clusters to respond
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-resolve-cluster-api.html
Expand All @@ -41,8 +42,6 @@ def resolve_cluster(arguments = {})
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

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

Expand All @@ -51,7 +50,11 @@ def resolve_cluster(arguments = {})
_name = arguments.delete(:name)

method = Elasticsearch::API::HTTP_GET
path = "_resolve/cluster/#{Utils.__listify(_name)}"
path = if _name
"_resolve/cluster/#{Utils.__listify(_name)}"
else
'_resolve/cluster'
end
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def update(arguments = {})

_task_type = arguments.delete(:task_type)

method = Elasticsearch::API::HTTP_POST
method = Elasticsearch::API::HTTP_PUT
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}/_update"
else
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Actions
# @option arguments [Number] :if_seq_no only perform the update operation if the last operation that has changed the document has the specified sequence number
# @option arguments [Number] :if_primary_term only perform the update operation if the last operation that has changed the document has the specified primary term
# @option arguments [Boolean] :require_alias When true, requires destination is an alias. Default is false
# @option arguments [Boolean] :include_source_on_error True or false if to include the document source in the error message in case of parsing errors. Defaults to true.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The request definition requires either `script` or partial `doc` (*Required*)
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,38 @@

require 'spec_helper'

describe 'client.indices#delete_alias' do

describe 'client.indices#resolve_cluster' do
let(:expected_args) do
[
'GET',
'_resolve/cluster/foo',
path,
{},
nil,
{},
{ defined_params: { name: 'foo'}, endpoint: 'indices.resolve_cluster' }
otel
]
end

context 'when there is no name specified' do
let(:client) do
Class.new { include Elasticsearch::API }.new
end
let(:path) { '_resolve/cluster' }
let(:otel) do
{ endpoint: 'indices.resolve_cluster' }
end

it 'raises an exception' do
expect {
client.indices.resolve_cluster
}.to raise_exception(ArgumentError)
it 'performs the request' do
expect(client_double.indices.resolve_cluster).to be_a Elasticsearch::API::Response
end
end


context 'when name is specified' do
let(:path) { '_resolve/cluster/foo' }
let(:otel) do
{ defined_params: { name: 'foo' }, endpoint: 'indices.resolve_cluster' }
end

it 'performs the request' do
expect(client_double.indices.resolve_cluster(name: 'foo')).to be_a Elasticsearch::API::Response
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
describe 'client#inference.update' do
let(:expected_args) do
[
'POST',
'PUT',
'_inference/foo/bar/_update',
{},
nil,
Expand Down