diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb new file mode 100644 index 000000000..06dbfa574 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb @@ -0,0 +1,60 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# +module Elasticsearch + module API + module Ingest + module Actions + # Deletes an ip location database configuration + # + # @option arguments [List] :id A comma-separated list of ip location database configurations to delete + # @option arguments [Hash] :headers Custom HTTP headers + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-ip-location-database-api.html + # + def delete_ip_location_database(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'ingest.delete_ip_location_database' } + + defined_params = [:id].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = nil + + _id = arguments.delete(:id) + + method = Elasticsearch::API::HTTP_DELETE + path = "_ingest/ip_location/database/#{Utils.__listify(_id)}" + params = {} + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb new file mode 100644 index 000000000..bf000901f --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb @@ -0,0 +1,62 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# +module Elasticsearch + module API + module Ingest + module Actions + # Returns the specified ip location database configuration + # + # @option arguments [List] :id A comma-separated list of ip location database configurations to get; use `*` to get all ip location database configurations + # @option arguments [Hash] :headers Custom HTTP headers + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-ip-location-database-api.html + # + def get_ip_location_database(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'ingest.get_ip_location_database' } + + defined_params = [:id].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = nil + + _id = arguments.delete(:id) + + method = Elasticsearch::API::HTTP_GET + path = if _id + "_ingest/ip_location/database/#{Utils.__listify(_id)}" + else + '_ingest/ip_location/database' + end + params = {} + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb new file mode 100644 index 000000000..5162d8be0 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb @@ -0,0 +1,62 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# +module Elasticsearch + module API + module Ingest + module Actions + # Puts the configuration for a ip location database to be downloaded + # + # @option arguments [String] :id The id of the database configuration + # @option arguments [Hash] :headers Custom HTTP headers + # @option arguments [Hash] :body The database configuration definition (*Required*) + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.16/put-ip-location-database-api.html + # + def put_ip_location_database(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'ingest.put_ip_location_database' } + + defined_params = [:id].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] + raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = arguments.delete(:body) + + _id = arguments.delete(:id) + + method = Elasticsearch::API::HTTP_PUT + path = "_ingest/ip_location/database/#{Utils.__listify(_id)}" + params = {} + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb new file mode 100644 index 000000000..f070341d1 --- /dev/null +++ b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb @@ -0,0 +1,39 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.ingest#delete_ip_location_database' do + let(:expected_args) do + [ + 'DELETE', + '_ingest/ip_location/database/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'ingest.delete_ip_location_database' } + ] + end + + let(:client) do + Class.new { include Elasticsearch::API }.new + end + + it 'performs the request' do + expect(client_double.ingest.delete_ip_location_database(id: 'foo', body: {})).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_ip_location_database_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_ip_location_database_spec.rb new file mode 100644 index 000000000..41c356c3d --- /dev/null +++ b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_ip_location_database_spec.rb @@ -0,0 +1,39 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.ingest#get_ip_location_database' do + let(:expected_args) do + [ + 'GET', + '_ingest/ip_location/database/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'ingest.get_ip_location_database' } + ] + end + + let(:client) do + Class.new { include Elasticsearch::API }.new + end + + it 'performs the request' do + expect(client_double.ingest.get_ip_location_database(id: 'foo', body: {})).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_ip_location_database_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_ip_location_database_spec.rb new file mode 100644 index 000000000..6e3ea29c7 --- /dev/null +++ b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_ip_location_database_spec.rb @@ -0,0 +1,45 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.ingest#put_ip_location_database' do + let(:expected_args) do + [ + 'PUT', + '_ingest/ip_location/database/foo', + {}, + {}, + {}, + { defined_params: { id: 'foo' }, endpoint: 'ingest.put_ip_location_database' } + ] + end + + let(:client) do + Class.new { include Elasticsearch::API }.new + end + + it 'requires the :id argument' do + expect { + client.ingest.put_ip_location_database + }.to raise_exception(ArgumentError) + end + + it 'performs the request' do + expect(client_double.ingest.put_ip_location_database(id: 'foo', body: {})).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/rest_api/skipped_tests_free.yml b/elasticsearch-api/spec/rest_api/skipped_tests_free.yml index ade42f689..fa53c4d4d 100644 --- a/elasticsearch-api/spec/rest_api/skipped_tests_free.yml +++ b/elasticsearch-api/spec/rest_api/skipped_tests_free.yml @@ -156,3 +156,9 @@ - :file: 'ingest_geoip/40_geoip_databases.yml' :description: 'Test adding, getting, and removing geoip databases' +- + :file: 'ingest_geoip/50_ip_lookup_processor.yml' + :description: '*' +- + :file: 'ingest_geoip/60_ip_location_databases.yml' + :description: '*'