Skip to content

Commit d543223

Browse files
committed
[API] Reorganizes Query rulesets and rules APIs
All query rules APIs are now under `query_rules` namespace. - query_rules.delete_rule - query_rules.delete_ruleset - query_rules.get_rule - query_rules.get_ruleset - query_rules.list_rulesets - query_rules.put_rule - query_rules.put_ruleset
1 parent a078d32 commit d543223

File tree

8 files changed

+182
-25
lines changed

8 files changed

+182
-25
lines changed

lib/elasticsearch-serverless/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def perform_request(method, path, params = {}, body = nil, headers = nil)
6969
:license,
7070
:logstash,
7171
:machine_learning,
72-
:query_ruleset,
72+
:query_rules,
7373
:search_application,
7474
:security,
7575
:sql,
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module ElasticsearchServerless
22+
module API
23+
module QueryRules
24+
module Actions
25+
# Deletes a query rule within a query ruleset.
26+
#
27+
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset containing the rule to delete (*Required*)
28+
# @option arguments [String] :rule_id The unique identifier of the query rule within the specified ruleset to delete (*Required*)
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
#
31+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-rule.html
32+
#
33+
def delete_rule(arguments = {})
34+
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
35+
raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]
36+
37+
arguments = arguments.clone
38+
headers = arguments.delete(:headers) || {}
39+
40+
body = nil
41+
42+
_ruleset_id = arguments.delete(:ruleset_id)
43+
44+
_rule_id = arguments.delete(:rule_id)
45+
46+
method = ElasticsearchServerless::API::HTTP_DELETE
47+
path = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
48+
params = {}
49+
50+
ElasticsearchServerless::API::Response.new(
51+
perform_request(method, path, params, body, headers)
52+
)
53+
end
54+
end
55+
end
56+
end
57+
end

lib/elasticsearch-serverless/api/query_ruleset/delete.rb renamed to lib/elasticsearch-serverless/api/query_rules/delete_ruleset.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@
2020
#
2121
module ElasticsearchServerless
2222
module API
23-
module QueryRuleset
23+
module QueryRules
2424
module Actions
2525
# Deletes a query ruleset.
26-
# This functionality is Experimental and may be changed or removed
27-
# completely in a future release. Elastic will take a best effort approach
28-
# to fix any issues, but experimental features are not subject to the
29-
# support SLA of official GA features.
3026
#
3127
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset to delete (*Required*)
3228
# @option arguments [Hash] :headers Custom HTTP headers
3329
#
3430
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html
3531
#
36-
def delete(arguments = {})
32+
def delete_ruleset(arguments = {})
3733
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
3834

3935
arguments = arguments.clone
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module ElasticsearchServerless
22+
module API
23+
module QueryRules
24+
module Actions
25+
# Returns the details about a query rule within a query ruleset
26+
#
27+
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset containing the rule to retrieve (*Required*)
28+
# @option arguments [String] :rule_id The unique identifier of the query rule within the specified ruleset to retrieve (*Required*)
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
#
31+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-rule.html
32+
#
33+
def get_rule(arguments = {})
34+
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
35+
raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]
36+
37+
arguments = arguments.clone
38+
headers = arguments.delete(:headers) || {}
39+
40+
body = nil
41+
42+
_ruleset_id = arguments.delete(:ruleset_id)
43+
44+
_rule_id = arguments.delete(:rule_id)
45+
46+
method = ElasticsearchServerless::API::HTTP_GET
47+
path = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
48+
params = {}
49+
50+
ElasticsearchServerless::API::Response.new(
51+
perform_request(method, path, params, body, headers)
52+
)
53+
end
54+
end
55+
end
56+
end
57+
end

lib/elasticsearch-serverless/api/query_ruleset/get.rb renamed to lib/elasticsearch-serverless/api/query_rules/get_ruleset.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@
2020
#
2121
module ElasticsearchServerless
2222
module API
23-
module QueryRuleset
23+
module QueryRules
2424
module Actions
2525
# Returns the details about a query ruleset
26-
# This functionality is Experimental and may be changed or removed
27-
# completely in a future release. Elastic will take a best effort approach
28-
# to fix any issues, but experimental features are not subject to the
29-
# support SLA of official GA features.
3026
#
3127
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset (*Required*)
3228
# @option arguments [Hash] :headers Custom HTTP headers
3329
#
3430
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html
3531
#
36-
def get(arguments = {})
32+
def get_ruleset(arguments = {})
3733
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
3834

3935
arguments = arguments.clone

lib/elasticsearch-serverless/api/query_ruleset/list.rb renamed to lib/elasticsearch-serverless/api/query_rules/list_rulesets.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@
2020
#
2121
module ElasticsearchServerless
2222
module API
23-
module QueryRuleset
23+
module QueryRules
2424
module Actions
2525
# Returns summarized information about existing query rulesets.
26-
# This functionality is Experimental and may be changed or removed
27-
# completely in a future release. Elastic will take a best effort approach
28-
# to fix any issues, but experimental features are not subject to the
29-
# support SLA of official GA features.
3026
#
3127
# @option arguments [Integer] :from Starting offset (default: 0)
3228
# @option arguments [Integer] :size specifies a max number of results to get
3329
# @option arguments [Hash] :headers Custom HTTP headers
3430
#
3531
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-query-rulesets.html
3632
#
37-
def list(arguments = {})
33+
def list_rulesets(arguments = {})
3834
arguments = arguments.clone
3935
headers = arguments.delete(:headers) || {}
4036

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module ElasticsearchServerless
22+
module API
23+
module QueryRules
24+
module Actions
25+
# Creates or updates a query rule within a query ruleset.
26+
#
27+
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset containing the rule to be created or updated (*Required*)
28+
# @option arguments [String] :rule_id The unique identifier of the query rule within the specified ruleset to be created or updated (*Required*)
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
# @option arguments [Hash] :body request body
31+
#
32+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-rule.html
33+
#
34+
def put_rule(arguments = {})
35+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
36+
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
37+
raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]
38+
39+
arguments = arguments.clone
40+
headers = arguments.delete(:headers) || {}
41+
42+
body = arguments.delete(:body)
43+
44+
_ruleset_id = arguments.delete(:ruleset_id)
45+
46+
_rule_id = arguments.delete(:rule_id)
47+
48+
method = ElasticsearchServerless::API::HTTP_PUT
49+
path = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
50+
params = {}
51+
52+
ElasticsearchServerless::API::Response.new(
53+
perform_request(method, path, params, body, headers)
54+
)
55+
end
56+
end
57+
end
58+
end
59+
end

lib/elasticsearch-serverless/api/query_ruleset/put.rb renamed to lib/elasticsearch-serverless/api/query_rules/put_ruleset.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@
2020
#
2121
module ElasticsearchServerless
2222
module API
23-
module QueryRuleset
23+
module QueryRules
2424
module Actions
2525
# Creates or updates a query ruleset.
26-
# This functionality is Experimental and may be changed or removed
27-
# completely in a future release. Elastic will take a best effort approach
28-
# to fix any issues, but experimental features are not subject to the
29-
# support SLA of official GA features.
3026
#
3127
# @option arguments [String] :ruleset_id The unique identifier of the query ruleset to be created or updated (*Required*)
3228
# @option arguments [Hash] :headers Custom HTTP headers
3329
# @option arguments [Hash] :body request body
3430
#
3531
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html
3632
#
37-
def put(arguments = {})
33+
def put_ruleset(arguments = {})
3834
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
3935
raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id]
4036

0 commit comments

Comments
 (0)