From 06819f0300ddd0c13f8ea9291134aa1c7a48c092 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Tue, 15 Oct 2024 15:23:23 +0100 Subject: [PATCH] [API] Adds ignore 404 parameter to query_rules.delete_ruleset --- .../api/actions/query_rules/delete_ruleset.rb | 16 ++++++++++++---- .../utils/thor/endpoint_specifics.rb | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb b/elasticsearch-api/lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb index 057962e12..f6739b40b 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb @@ -48,11 +48,19 @@ def delete_ruleset(arguments = {}) method = Elasticsearch::API::HTTP_DELETE path = "_query_rules/#{Utils.__listify(_ruleset_id)}" - params = {} + params = Utils.process_params(arguments) - Elasticsearch::API::Response.new( - perform_request(method, path, params, body, headers, request_opts) - ) + if Array(arguments[:ignore]).include?(404) + Utils.__rescue_from_not_found do + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + else + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end end end end diff --git a/elasticsearch-api/utils/thor/endpoint_specifics.rb b/elasticsearch-api/utils/thor/endpoint_specifics.rb index 5dc4d6fa6..eea5f46cd 100644 --- a/elasticsearch-api/utils/thor/endpoint_specifics.rb +++ b/elasticsearch-api/utils/thor/endpoint_specifics.rb @@ -39,6 +39,7 @@ module EndpointSpecifics indices.delete indices.delete_template indices.flush_synced + query_rules.delete_ruleset security.get_role security.get_user snapshot.delete