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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/elasticsearch/xpack.rb +7 -1
  3. data/lib/elasticsearch/xpack/api/actions/data_frame/delete_data_frame_transform.rb +10 -2
  4. data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform.rb +8 -6
  5. data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform_stats.rb +7 -5
  6. data/lib/elasticsearch/xpack/api/actions/data_frame/params_registry.rb +50 -0
  7. data/lib/elasticsearch/xpack/api/actions/data_frame/put_data_frame_transform.rb +10 -2
  8. data/lib/elasticsearch/xpack/api/actions/data_frame/start_data_frame_transform.rb +6 -4
  9. data/lib/elasticsearch/xpack/api/actions/data_frame/stop_data_frame_transform.rb +9 -6
  10. data/lib/elasticsearch/xpack/api/actions/data_frame/update_data_frame_transform.rb +45 -0
  11. data/lib/elasticsearch/xpack/api/actions/graph/explore.rb +7 -5
  12. data/lib/elasticsearch/xpack/api/actions/graph/params_registry.rb +50 -0
  13. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_policy.rb +39 -0
  14. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain.rb +40 -0
  15. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_policy.rb +38 -0
  16. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_status.rb +36 -0
  17. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/move_to_step.rb +41 -0
  18. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/params_registry.rb +50 -0
  19. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_policy.rb +40 -0
  20. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/remove_policy.rb +38 -0
  21. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry_policy.rb +38 -0
  22. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/start.rb +36 -0
  23. data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/stop.rb +36 -0
  24. data/lib/elasticsearch/xpack/api/actions/info.rb +7 -5
  25. data/lib/elasticsearch/xpack/api/actions/license/get.rb +6 -2
  26. data/lib/elasticsearch/xpack/api/actions/license/params_registry.rb +50 -0
  27. data/lib/elasticsearch/xpack/api/actions/license/post.rb +6 -2
  28. data/lib/elasticsearch/xpack/api/actions/license/post_start_basic.rb +6 -3
  29. data/lib/elasticsearch/xpack/api/actions/license/post_start_trial.rb +7 -4
  30. data/lib/elasticsearch/xpack/api/actions/machine_learning/close_job.rb +8 -5
  31. data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_datafeed.rb +6 -3
  32. data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_forecast.rb +8 -6
  33. data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_job.rb +6 -3
  34. data/lib/elasticsearch/xpack/api/actions/machine_learning/estimate_memory_usage.rb +30 -0
  35. data/lib/elasticsearch/xpack/api/actions/machine_learning/flush_job.rb +10 -7
  36. data/lib/elasticsearch/xpack/api/actions/machine_learning/forecast.rb +7 -4
  37. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_buckets.rb +15 -13
  38. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendar_events.rb +11 -9
  39. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendars.rb +8 -6
  40. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_categories.rb +7 -4
  41. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeed_stats.rb +6 -4
  42. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeeds.rb +6 -4
  43. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_filters.rb +7 -4
  44. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_influencers.rb +13 -10
  45. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_job_stats.rb +6 -4
  46. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_jobs.rb +6 -4
  47. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_model_snapshots.rb +11 -8
  48. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_overall_buckets.rb +12 -11
  49. data/lib/elasticsearch/xpack/api/actions/machine_learning/get_records.rb +13 -12
  50. data/lib/elasticsearch/xpack/api/actions/machine_learning/params_registry.rb +50 -0
  51. data/lib/elasticsearch/xpack/api/actions/machine_learning/post_data.rb +7 -4
  52. data/lib/elasticsearch/xpack/api/actions/machine_learning/revert_model_snapshot.rb +6 -5
  53. data/lib/elasticsearch/xpack/api/actions/machine_learning/set_upgrade_mode.rb +8 -6
  54. data/lib/elasticsearch/xpack/api/actions/machine_learning/start_datafeed.rb +8 -7
  55. data/lib/elasticsearch/xpack/api/actions/machine_learning/stop_datafeed.rb +8 -5
  56. data/lib/elasticsearch/xpack/api/actions/migration/get_assistance.rb +8 -6
  57. data/lib/elasticsearch/xpack/api/actions/migration/params_registry.rb +50 -0
  58. data/lib/elasticsearch/xpack/api/actions/migration/upgrade.rb +6 -5
  59. data/lib/elasticsearch/xpack/api/actions/monitoring/bulk.rb +9 -8
  60. data/lib/elasticsearch/xpack/api/actions/monitoring/params_registry.rb +50 -0
  61. data/lib/elasticsearch/xpack/api/actions/params_registry.rb +48 -0
  62. data/lib/elasticsearch/xpack/api/actions/rollup/params_registry.rb +50 -0
  63. data/lib/elasticsearch/xpack/api/actions/rollup/rollup_search.rb +7 -3
  64. data/lib/elasticsearch/xpack/api/actions/security/authenticate.rb +0 -1
  65. data/lib/elasticsearch/xpack/api/actions/security/change_password.rb +6 -4
  66. data/lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb +6 -4
  67. data/lib/elasticsearch/xpack/api/actions/security/create_api_key.rb +6 -4
  68. data/lib/elasticsearch/xpack/api/actions/security/delete_privileges.rb +6 -3
  69. data/lib/elasticsearch/xpack/api/actions/security/delete_role.rb +6 -4
  70. data/lib/elasticsearch/xpack/api/actions/security/delete_role_mapping.rb +7 -5
  71. data/lib/elasticsearch/xpack/api/actions/security/delete_user.rb +7 -5
  72. data/lib/elasticsearch/xpack/api/actions/security/disable_user.rb +10 -6
  73. data/lib/elasticsearch/xpack/api/actions/security/enable_user.rb +10 -6
  74. data/lib/elasticsearch/xpack/api/actions/security/get_api_key.rb +9 -7
  75. data/lib/elasticsearch/xpack/api/actions/security/params_registry.rb +50 -0
  76. data/lib/elasticsearch/xpack/api/actions/security/put_privileges.rb +6 -4
  77. data/lib/elasticsearch/xpack/api/actions/security/put_role.rb +6 -4
  78. data/lib/elasticsearch/xpack/api/actions/security/put_role_mapping.rb +10 -6
  79. data/lib/elasticsearch/xpack/api/actions/security/put_user.rb +6 -4
  80. data/lib/elasticsearch/xpack/api/actions/sql/params_registry.rb +50 -0
  81. data/lib/elasticsearch/xpack/api/actions/sql/query.rb +6 -3
  82. data/lib/elasticsearch/xpack/api/actions/ssl/params_registry.rb +50 -0
  83. data/lib/elasticsearch/xpack/api/actions/usage.rb +7 -2
  84. data/lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb +6 -5
  85. data/lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb +6 -3
  86. data/lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb +6 -3
  87. data/lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb +7 -4
  88. data/lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb +6 -2
  89. data/lib/elasticsearch/xpack/api/actions/watcher/params_registry.rb +50 -0
  90. data/lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb +10 -9
  91. data/lib/elasticsearch/xpack/api/actions/watcher/stats.rb +7 -2
  92. data/lib/elasticsearch/xpack/api/namespace/index_lifecycle_management.rb +22 -0
  93. data/lib/elasticsearch/xpack/version.rb +1 -1
  94. metadata +29 -3
@@ -0,0 +1,38 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Retrieves a lifecycle policy
12
+ #
13
+ # @option arguments [String] :policy_id Identifier for the policy
14
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
15
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
16
+ #
17
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html
18
+ #
19
+ def get_policy(arguments={})
20
+ method = Elasticsearch::API::HTTP_GET
21
+ path = Elasticsearch::API::Utils.__pathify "_ilm/policy",
22
+ Elasticsearch::API::Utils.__escape(arguments[:policy_id])
23
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
24
+ body = nil
25
+
26
+ perform_request(method, path, params, body).body
27
+ end
28
+
29
+ # Register this action with its valid params when the module is loaded.
30
+ #
31
+ ParamsRegistry.register(:get_policy, [ :master_timeout,
32
+ :timeout ].freeze)
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Retrieves the current index lifecycle management (ILM) status
12
+ #
13
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
14
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
15
+ #
16
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html
17
+ #
18
+ def get_status(arguments={})
19
+ method = Elasticsearch::API::HTTP_GET
20
+ path = "_ilm/status"
21
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
+ body = nil
23
+
24
+ perform_request(method, path, params, body).body
25
+ end
26
+
27
+ # Register this action with its valid params when the module is loaded.
28
+ #
29
+ ParamsRegistry.register(:get_status, [ :master_timeout,
30
+ :timeout ].freeze)
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Triggers execution of a specific step in the lifecycle policy
12
+ #
13
+ # @option arguments [String] :index The target index (*Required*)
14
+ # @option arguments [Hash] :body The request template content (*Required*)
15
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
16
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
17
+ #
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html
19
+ #
20
+ def move_to_step(arguments={})
21
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
22
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
23
+ method = Elasticsearch::API::HTTP_POST
24
+ index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))
25
+ path = Elasticsearch::API::Utils.__pathify "_ilm/move",
26
+ index
27
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
28
+ body = arguments[:body]
29
+
30
+ perform_request(method, path, params, body).body
31
+ end
32
+
33
+ # Register this action with its valid params when the module is loaded.
34
+ #
35
+ ParamsRegistry.register(:move_to_step, [ :master_timeout,
36
+ :timeout ].freeze)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ 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 IndexLifecycleManagement
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
@@ -0,0 +1,40 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Register a new watch in or update an existing one
12
+ #
13
+ # @option arguments [String] :policy_id Identifier for the policy (*Required*)
14
+ # @option arguments [Hash] :body The policy (*Required*)
15
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
16
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
17
+ #
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html
19
+ #
20
+ def put_policy(arguments={})
21
+ raise ArgumentError, "Required argument 'policy_id' missing" unless arguments[:policy_id]
22
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
23
+ method = Elasticsearch::API::HTTP_PUT
24
+ path = Elasticsearch::API::Utils.__pathify "_ilm/policy",
25
+ Elasticsearch::API::Utils.__escape(arguments[:policy_id])
26
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
27
+ body = arguments[:body]
28
+
29
+ perform_request(method, path, params, body).body
30
+ end
31
+
32
+ # Register this action with its valid params when the module is loaded.
33
+ #
34
+ ParamsRegistry.register(:put_policy, [ :master_timeout,
35
+ :timeout ].freeze)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,38 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Removes the assigned lifecycle policy from an index
12
+ #
13
+ # @option arguments [String] :index The target index (*Required*)
14
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
15
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
16
+ #
17
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html
18
+ #
19
+ def remove_policy(arguments={})
20
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
21
+ method = Elasticsearch::API::HTTP_POST
22
+ index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))
23
+ path = Elasticsearch::API::Utils.__pathify index, "_ilm/remove"
24
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
25
+ body = nil
26
+
27
+ perform_request(method, path, params, body).body
28
+ end
29
+
30
+ # Register this action with its valid params when the module is loaded.
31
+ #
32
+ ParamsRegistry.register(:remove_policy, [ :master_timeout,
33
+ :timeout ].freeze)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Retry executing the policy for an index that is in the ERROR step
12
+ #
13
+ # @option arguments [String] :index The target index (*Required*)
14
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
15
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
16
+ #
17
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html
18
+ #
19
+ def retry_policy(arguments={})
20
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
21
+ method = Elasticsearch::API::HTTP_POST
22
+ index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))
23
+ path = Elasticsearch::API::Utils.__pathify index, "_ilm/retry"
24
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
25
+ body = nil
26
+
27
+ perform_request(method, path, params, body).body
28
+ end
29
+
30
+ # Register this action with its valid params when the module is loaded.
31
+ #
32
+ ParamsRegistry.register(:retry_policy, [ :master_timeout,
33
+ :timeout ].freeze)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Start the index lifecycle management (ILM) plugin
12
+ #
13
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
14
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
15
+ #
16
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html
17
+ #
18
+ def start(arguments={})
19
+ method = Elasticsearch::API::HTTP_POST
20
+ path = "_ilm/start"
21
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
+ body = nil
23
+
24
+ perform_request(method, path, params, body).body
25
+ end
26
+
27
+ # Register this action with its valid params when the module is loaded.
28
+ #
29
+ ParamsRegistry.register(:start, [ :master_timeout,
30
+ :timeout ].freeze)
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
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 IndexLifecycleManagement
9
+ module Actions
10
+
11
+ # Stop the index lifecycle management (ILM) plugin
12
+ #
13
+ # @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node
14
+ # @option arguments [Time] :timeout Specifies the period of time to wait for a response.
15
+ #
16
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html
17
+ #
18
+ def stop(arguments={})
19
+ method = Elasticsearch::API::HTTP_POST
20
+ path = "_ilm/stop"
21
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
+ body = nil
23
+
24
+ perform_request(method, path, params, body).body
25
+ end
26
+
27
+ # Register this action with its valid params when the module is loaded.
28
+ #
29
+ ParamsRegistry.register(:stop, [ :master_timeout,
30
+ :timeout ].freeze)
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -17,17 +17,19 @@ module Elasticsearch
17
17
  # @see https://www.elastic.co/guide/en/x-pack/current/info-api.html
18
18
  #
19
19
  def info(arguments={})
20
- valid_params = [
21
- :human,
22
- :categories ]
23
-
24
20
  method = Elasticsearch::API::HTTP_GET
25
21
  path = "_xpack"
26
- params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
22
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
27
23
  body = nil
28
24
 
29
25
  perform_request(method, path, params, body).body
30
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(:info, [ :human,
32
+ :categories ].freeze)
31
33
  end
32
34
  end
33
35
  end
@@ -15,14 +15,18 @@ module Elasticsearch
15
15
  # @see https://www.elastic.co/guide/en/x-pack/current/license-management.html
16
16
  #
17
17
  def get(arguments={})
18
- valid_params = [ :local ]
19
18
  method = Elasticsearch::API::HTTP_GET
20
19
  path = "_xpack/license"
21
- params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
20
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
21
  body = nil
23
22
 
24
23
  perform_request(method, path, params, body).body
25
24
  end
25
+
26
+ # Register this action with its valid params when the module is loaded.
27
+ #
28
+ # @since 7.4.0
29
+ ParamsRegistry.register(:get, [ :local ].freeze)
26
30
  end
27
31
  end
28
32
  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 License
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