elasticsearch-xpack 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elasticsearch/xpack.rb +7 -1
- data/lib/elasticsearch/xpack/api/actions/data_frame/delete_data_frame_transform.rb +10 -2
- data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform_stats.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/data_frame/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/data_frame/put_data_frame_transform.rb +10 -2
- data/lib/elasticsearch/xpack/api/actions/data_frame/start_data_frame_transform.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/data_frame/stop_data_frame_transform.rb +9 -6
- data/lib/elasticsearch/xpack/api/actions/data_frame/update_data_frame_transform.rb +45 -0
- data/lib/elasticsearch/xpack/api/actions/graph/explore.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/graph/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_policy.rb +39 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain.rb +40 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_status.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/move_to_step.rb +41 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_policy.rb +40 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/remove_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/start.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/stop.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/info.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/license/get.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/license/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/license/post.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/license/post_start_basic.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/license/post_start_trial.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/close_job.rb +8 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_datafeed.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_forecast.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_job.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/estimate_memory_usage.rb +30 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/flush_job.rb +10 -7
- data/lib/elasticsearch/xpack/api/actions/machine_learning/forecast.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_buckets.rb +15 -13
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendar_events.rb +11 -9
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendars.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_categories.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeed_stats.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeeds.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_filters.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_influencers.rb +13 -10
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_job_stats.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_jobs.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_model_snapshots.rb +11 -8
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_overall_buckets.rb +12 -11
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_records.rb +13 -12
- data/lib/elasticsearch/xpack/api/actions/machine_learning/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/post_data.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/revert_model_snapshot.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/set_upgrade_mode.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/start_datafeed.rb +8 -7
- data/lib/elasticsearch/xpack/api/actions/machine_learning/stop_datafeed.rb +8 -5
- data/lib/elasticsearch/xpack/api/actions/migration/get_assistance.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/migration/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/migration/upgrade.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/monitoring/bulk.rb +9 -8
- data/lib/elasticsearch/xpack/api/actions/monitoring/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/params_registry.rb +48 -0
- data/lib/elasticsearch/xpack/api/actions/rollup/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/rollup/rollup_search.rb +7 -3
- data/lib/elasticsearch/xpack/api/actions/security/authenticate.rb +0 -1
- data/lib/elasticsearch/xpack/api/actions/security/change_password.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/create_api_key.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/delete_privileges.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/security/delete_role.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/delete_role_mapping.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/security/delete_user.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/security/disable_user.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/enable_user.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/get_api_key.rb +9 -7
- data/lib/elasticsearch/xpack/api/actions/security/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/security/put_privileges.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/put_role.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/put_role_mapping.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/put_user.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/sql/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/sql/query.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/ssl/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/usage.rb +7 -2
- data/lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/watcher/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb +10 -9
- data/lib/elasticsearch/xpack/api/actions/watcher/stats.rb +7 -2
- data/lib/elasticsearch/xpack/api/namespace/index_lifecycle_management.rb +22 -0
- data/lib/elasticsearch/xpack/version.rb +1 -1
- metadata +29 -3
|
@@ -11,25 +11,29 @@ module Elasticsearch
|
|
|
11
11
|
# Enable a user
|
|
12
12
|
#
|
|
13
13
|
# @option arguments [String] :username The username of the user to enable
|
|
14
|
-
# @option arguments [String] :refresh If `true` (the default) then refresh the affected shards to make this
|
|
14
|
+
# @option arguments [String] :refresh If `true` (the default) then refresh the affected shards to make this
|
|
15
|
+
# operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search,
|
|
16
|
+
# if `false` then do nothing with refreshes. (options: true, false, wait_for)
|
|
15
17
|
#
|
|
16
18
|
# @see https://www.elastic.co/guide/en/x-pack/5.4/security-api-users.html
|
|
17
19
|
#
|
|
18
20
|
def enable_user(arguments={})
|
|
19
|
-
valid_params = [
|
|
20
|
-
:username,
|
|
21
|
-
:refresh ]
|
|
22
|
-
|
|
23
21
|
arguments = arguments.clone
|
|
24
22
|
username = arguments.delete(:username)
|
|
25
23
|
|
|
26
24
|
method = Elasticsearch::API::HTTP_PUT
|
|
27
25
|
path = "_xpack/security/user/#{username}/_enable"
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
26
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
27
|
body = nil
|
|
30
28
|
|
|
31
29
|
perform_request(method, path, params, body).body
|
|
32
30
|
end
|
|
31
|
+
|
|
32
|
+
# Register this action with its valid params when the module is loaded.
|
|
33
|
+
#
|
|
34
|
+
# @since 7.4.0
|
|
35
|
+
ParamsRegistry.register(:enable_user, [ :username,
|
|
36
|
+
:refresh ].freeze)
|
|
33
37
|
end
|
|
34
38
|
end
|
|
35
39
|
end
|
|
@@ -21,18 +21,20 @@ module Elasticsearch
|
|
|
21
21
|
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html
|
|
22
22
|
#
|
|
23
23
|
def get_api_key(arguments={})
|
|
24
|
-
|
|
25
|
-
valid_params = [ :id,
|
|
26
|
-
:name,
|
|
27
|
-
:username,
|
|
28
|
-
:realm_name ]
|
|
29
|
-
|
|
30
24
|
method = Elasticsearch::API::HTTP_GET
|
|
31
25
|
path = "_security/api_key"
|
|
32
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
26
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
33
27
|
|
|
34
28
|
perform_request(method, path, params).body
|
|
35
29
|
end
|
|
30
|
+
|
|
31
|
+
# Register this action with its valid params when the module is loaded.
|
|
32
|
+
#
|
|
33
|
+
# @since 7.4.0
|
|
34
|
+
ParamsRegistry.register(:get_api_key, [ :id,
|
|
35
|
+
:name,
|
|
36
|
+
:username,
|
|
37
|
+
:realm_name ].freeze)
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
# See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
module Elasticsearch
|
|
6
|
+
module XPack
|
|
7
|
+
module API
|
|
8
|
+
module Security
|
|
9
|
+
module Actions
|
|
10
|
+
module ParamsRegistry
|
|
11
|
+
|
|
12
|
+
extend self
|
|
13
|
+
|
|
14
|
+
# A Mapping of all the actions to their list of valid params.
|
|
15
|
+
#
|
|
16
|
+
# @since 7.4.0
|
|
17
|
+
PARAMS = {}
|
|
18
|
+
|
|
19
|
+
# Register an action with its list of valid params.
|
|
20
|
+
#
|
|
21
|
+
# @example Register the action.
|
|
22
|
+
# ParamsRegistry.register(:benchmark, [ :verbose ])
|
|
23
|
+
#
|
|
24
|
+
# @param [ Symbol ] action The action to register.
|
|
25
|
+
# @param [ Array[Symbol] ] valid_params The list of valid params.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
def register(action, valid_params)
|
|
29
|
+
PARAMS[action.to_sym] = valid_params
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get the list of valid params for a given action.
|
|
33
|
+
#
|
|
34
|
+
# @example Get the list of valid params.
|
|
35
|
+
# ParamsRegistry.get(:benchmark)
|
|
36
|
+
#
|
|
37
|
+
# @param [ Symbol ] action The action.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Array<Symbol> ] The list of valid params for the action.
|
|
40
|
+
#
|
|
41
|
+
# @since 7.4.0
|
|
42
|
+
def get(action)
|
|
43
|
+
PARAMS.fetch(action, [])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -16,16 +16,18 @@ module Elasticsearch
|
|
|
16
16
|
#
|
|
17
17
|
def put_privileges(arguments={})
|
|
18
18
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
19
|
-
|
|
20
|
-
valid_params = [ :refresh ]
|
|
21
|
-
|
|
22
19
|
method = Elasticsearch::API::HTTP_PUT
|
|
23
20
|
path = "_xpack/security/privilege"
|
|
24
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
21
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
25
22
|
body = arguments[:body]
|
|
26
23
|
|
|
27
24
|
perform_request(method, path, params, body).body
|
|
28
25
|
end
|
|
26
|
+
|
|
27
|
+
# Register this action with its valid params when the module is loaded.
|
|
28
|
+
#
|
|
29
|
+
# @since 7.4.0
|
|
30
|
+
ParamsRegistry.register(:put_privileges, [ :refresh ].freeze)
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
|
@@ -19,16 +19,18 @@ module Elasticsearch
|
|
|
19
19
|
def put_role(arguments={})
|
|
20
20
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
|
21
21
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
22
|
-
|
|
23
|
-
valid_params = [ :refresh ]
|
|
24
|
-
|
|
25
22
|
method = Elasticsearch::API::HTTP_PUT
|
|
26
23
|
path = "_xpack/security/role/#{arguments[:name]}"
|
|
27
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
24
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
28
25
|
body = arguments[:body]
|
|
29
26
|
|
|
30
27
|
perform_request(method, path, params, body).body
|
|
31
28
|
end
|
|
29
|
+
|
|
30
|
+
# Register this action with its valid params when the module is loaded.
|
|
31
|
+
#
|
|
32
|
+
# @since 7.4.0
|
|
33
|
+
ParamsRegistry.register(:put_role, [ :refresh ].freeze)
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
36
|
end
|
|
@@ -12,27 +12,31 @@ module Elasticsearch
|
|
|
12
12
|
#
|
|
13
13
|
# @option arguments [String] :name Role-mapping name (*Required*)
|
|
14
14
|
# @option arguments [Hash] :body The role to add (*Required*)
|
|
15
|
-
# @option arguments [String] :refresh If `true` (the default) then refresh the affected shards to make this
|
|
15
|
+
# @option arguments [String] :refresh If `true` (the default) then refresh the affected shards to make this
|
|
16
|
+
# operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search,
|
|
17
|
+
# if `false` then do nothing with refreshes. (options: true, false, wait_for)
|
|
16
18
|
#
|
|
17
19
|
# @see https://www.elastic.co/guide/en/x-pack/master/security-api-role-mapping.html#security-api-put-role-mapping
|
|
18
20
|
#
|
|
19
21
|
def put_role_mapping(arguments={})
|
|
20
22
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
|
21
23
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
22
|
-
valid_params = [
|
|
23
|
-
:name,
|
|
24
|
-
:refresh ]
|
|
25
|
-
|
|
26
24
|
arguments = arguments.clone
|
|
27
25
|
name = arguments.delete(:name)
|
|
28
26
|
|
|
29
27
|
method = Elasticsearch::API::HTTP_PUT
|
|
30
28
|
path = "_xpack/security/role_mapping/#{name}"
|
|
31
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
29
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
32
30
|
body = arguments[:body]
|
|
33
31
|
|
|
34
32
|
perform_request(method, path, params, body).body
|
|
35
33
|
end
|
|
34
|
+
|
|
35
|
+
# Register this action with its valid params when the module is loaded.
|
|
36
|
+
#
|
|
37
|
+
# @since 7.4.0
|
|
38
|
+
ParamsRegistry.register(:put_role_mapping, [ :name,
|
|
39
|
+
:refresh ].freeze)
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
end
|
|
@@ -19,19 +19,21 @@ module Elasticsearch
|
|
|
19
19
|
def put_user(arguments={})
|
|
20
20
|
raise ArgumentError, "Required argument 'username' missing" unless arguments[:username]
|
|
21
21
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
22
|
-
|
|
23
|
-
valid_params = [ :refresh ]
|
|
24
|
-
|
|
25
22
|
arguments = arguments.clone
|
|
26
23
|
username = arguments.delete(:username)
|
|
27
24
|
|
|
28
25
|
method = Elasticsearch::API::HTTP_PUT
|
|
29
26
|
path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", username
|
|
30
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
27
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
31
28
|
body = arguments[:body]
|
|
32
29
|
|
|
33
30
|
perform_request(method, path, params, body).body
|
|
34
31
|
end
|
|
32
|
+
|
|
33
|
+
# Register this action with its valid params when the module is loaded.
|
|
34
|
+
#
|
|
35
|
+
# @since 7.4.0
|
|
36
|
+
ParamsRegistry.register(:put_user, [ :refresh ].freeze)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
# See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
module Elasticsearch
|
|
6
|
+
module XPack
|
|
7
|
+
module API
|
|
8
|
+
module SQL
|
|
9
|
+
module Actions
|
|
10
|
+
module ParamsRegistry
|
|
11
|
+
|
|
12
|
+
extend self
|
|
13
|
+
|
|
14
|
+
# A Mapping of all the actions to their list of valid params.
|
|
15
|
+
#
|
|
16
|
+
# @since 7.4.0
|
|
17
|
+
PARAMS = {}
|
|
18
|
+
|
|
19
|
+
# Register an action with its list of valid params.
|
|
20
|
+
#
|
|
21
|
+
# @example Register the action.
|
|
22
|
+
# ParamsRegistry.register(:benchmark, [ :verbose ])
|
|
23
|
+
#
|
|
24
|
+
# @param [ Symbol ] action The action to register.
|
|
25
|
+
# @param [ Array[Symbol] ] valid_params The list of valid params.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
def register(action, valid_params)
|
|
29
|
+
PARAMS[action.to_sym] = valid_params
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get the list of valid params for a given action.
|
|
33
|
+
#
|
|
34
|
+
# @example Get the list of valid params.
|
|
35
|
+
# ParamsRegistry.get(:benchmark)
|
|
36
|
+
#
|
|
37
|
+
# @param [ Symbol ] action The action.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Array<Symbol> ] The list of valid params for the action.
|
|
40
|
+
#
|
|
41
|
+
# @since 7.4.0
|
|
42
|
+
def get(action)
|
|
43
|
+
PARAMS.fetch(action, [])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -17,15 +17,18 @@ module Elasticsearch
|
|
|
17
17
|
#
|
|
18
18
|
def query(arguments={})
|
|
19
19
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
20
|
-
valid_params = [
|
|
21
|
-
:format ]
|
|
22
20
|
method = Elasticsearch::API::HTTP_POST
|
|
23
21
|
path = "_xpack/sql"
|
|
24
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
22
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
25
23
|
body = arguments[:body]
|
|
26
24
|
|
|
27
25
|
perform_request(method, path, params, body).body
|
|
28
26
|
end
|
|
27
|
+
|
|
28
|
+
# Register this action with its valid params when the module is loaded.
|
|
29
|
+
#
|
|
30
|
+
# @since 7.4.0
|
|
31
|
+
ParamsRegistry.register(:query, [ :format ].freeze)
|
|
29
32
|
end
|
|
30
33
|
end
|
|
31
34
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
# See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
module Elasticsearch
|
|
6
|
+
module XPack
|
|
7
|
+
module API
|
|
8
|
+
module SSL
|
|
9
|
+
module Actions
|
|
10
|
+
module ParamsRegistry
|
|
11
|
+
|
|
12
|
+
extend self
|
|
13
|
+
|
|
14
|
+
# A Mapping of all the actions to their list of valid params.
|
|
15
|
+
#
|
|
16
|
+
# @since 7.4.0
|
|
17
|
+
PARAMS = {}
|
|
18
|
+
|
|
19
|
+
# Register an action with its list of valid params.
|
|
20
|
+
#
|
|
21
|
+
# @example Register the action.
|
|
22
|
+
# ParamsRegistry.register(:benchmark, [ :verbose ])
|
|
23
|
+
#
|
|
24
|
+
# @param [ Symbol ] action The action to register.
|
|
25
|
+
# @param [ Array[Symbol] ] valid_params The list of valid params.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
def register(action, valid_params)
|
|
29
|
+
PARAMS[action.to_sym] = valid_params
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get the list of valid params for a given action.
|
|
33
|
+
#
|
|
34
|
+
# @example Get the list of valid params.
|
|
35
|
+
# ParamsRegistry.get(:benchmark)
|
|
36
|
+
#
|
|
37
|
+
# @param [ Symbol ] action The action.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Array<Symbol> ] The list of valid params for the action.
|
|
40
|
+
#
|
|
41
|
+
# @since 7.4.0
|
|
42
|
+
def get(action)
|
|
43
|
+
PARAMS.fetch(action, [])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -13,14 +13,19 @@ module Elasticsearch
|
|
|
13
13
|
#
|
|
14
14
|
#
|
|
15
15
|
def usage(arguments={})
|
|
16
|
-
valid_params = [ :master_timeout ]
|
|
17
16
|
method = Elasticsearch::API::HTTP_GET
|
|
18
17
|
path = "_xpack/usage"
|
|
19
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
18
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
20
19
|
body = nil
|
|
21
20
|
|
|
22
21
|
perform_request(method, path, params, body).body
|
|
23
22
|
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Register this action with its valid params when the module is loaded.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
ParamsRegistry.register(:usage, [ :master_timeout ].freeze)
|
|
24
29
|
end
|
|
25
30
|
end
|
|
26
31
|
end
|
|
@@ -18,10 +18,6 @@ module Elasticsearch
|
|
|
18
18
|
#
|
|
19
19
|
def ack_watch(arguments={})
|
|
20
20
|
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
|
21
|
-
|
|
22
|
-
valid_params = [
|
|
23
|
-
:master_timeout ]
|
|
24
|
-
|
|
25
21
|
arguments = arguments.clone
|
|
26
22
|
watch_id = arguments.delete(:watch_id)
|
|
27
23
|
action_id = arguments.delete(:action_id)
|
|
@@ -31,11 +27,16 @@ module Elasticsearch
|
|
|
31
27
|
path = "_xpack/watcher/watch/#{watch_id}/_ack"
|
|
32
28
|
path << "/#{action_id}" if action_id
|
|
33
29
|
|
|
34
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
30
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
35
31
|
body = nil
|
|
36
32
|
|
|
37
33
|
perform_request(method, path, params, body).body
|
|
38
34
|
end
|
|
35
|
+
|
|
36
|
+
# Register this action with its valid params when the module is loaded.
|
|
37
|
+
#
|
|
38
|
+
# @since 7.4.0
|
|
39
|
+
ParamsRegistry.register(:ack_watch, [ :master_timeout ].freeze)
|
|
39
40
|
end
|
|
40
41
|
end
|
|
41
42
|
end
|
|
@@ -17,18 +17,21 @@ module Elasticsearch
|
|
|
17
17
|
#
|
|
18
18
|
def activate_watch(arguments={})
|
|
19
19
|
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
|
20
|
-
valid_params = [ :master_timeout ]
|
|
21
|
-
|
|
22
20
|
arguments = arguments.clone
|
|
23
21
|
watch_id = arguments.delete(:watch_id)
|
|
24
22
|
|
|
25
23
|
method = Elasticsearch::API::HTTP_PUT
|
|
26
24
|
path = "_xpack/watcher/watch/#{watch_id}/_activate"
|
|
27
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
25
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
28
26
|
body = nil
|
|
29
27
|
|
|
30
28
|
perform_request(method, path, params, body).body
|
|
31
29
|
end
|
|
30
|
+
|
|
31
|
+
# Register this action with its valid params when the module is loaded.
|
|
32
|
+
#
|
|
33
|
+
# @since 7.4.0
|
|
34
|
+
ParamsRegistry.register(:activate_watch, [ :master_timeout ].freeze)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
end
|
|
@@ -17,18 +17,21 @@ module Elasticsearch
|
|
|
17
17
|
#
|
|
18
18
|
def deactivate_watch(arguments={})
|
|
19
19
|
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
|
20
|
-
valid_params = [ :master_timeout ]
|
|
21
|
-
|
|
22
20
|
arguments = arguments.clone
|
|
23
21
|
watch_id = arguments.delete(:watch_id)
|
|
24
22
|
|
|
25
23
|
method = Elasticsearch::API::HTTP_PUT
|
|
26
24
|
path = "_xpack/watcher/watch/#{watch_id}/_deactivate"
|
|
27
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
25
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
28
26
|
body = nil
|
|
29
27
|
|
|
30
28
|
perform_request(method, path, params, body).body
|
|
31
29
|
end
|
|
30
|
+
|
|
31
|
+
# Register this action with its valid params when the module is loaded.
|
|
32
|
+
#
|
|
33
|
+
# @since 7.4.0
|
|
34
|
+
ParamsRegistry.register(:deactivate_watch, [ :master_timeout ].freeze)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
end
|