elasticsearch-xpack 7.3.0 → 7.4.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0aa4a8d4dc0d5cb53f1f1c84fced0773310872d6130173d2ce935330d7b07090
4
- data.tar.gz: 6af0a1fe2995ca424aec5914fae9b4a884895442aa5ad09c5cca74b0a5feeb13
3
+ metadata.gz: 7913c8a63a2df01c7d876709583348cb2eaac5fb46532164567c8095d527c377
4
+ data.tar.gz: 3c512f17307d2014b39c7ae9b0ca0f8b9ae558efa70f9f160aa0f39e6f931391
5
5
  SHA512:
6
- metadata.gz: 4ddbf54710f11af50108d6b2e8c68a7a51cf5300ecfa579b1e95111a6d0e7391f2fcaec6e66ace7f35887e821264b7de3fd74c88b14c44e72cbc339bf385256a
7
- data.tar.gz: 677489d21d61e33d56683862c0417c096963624bf5bddbd5faec396dbbbbe52e2b8899f8b3c10a4351d1ecf56bae9fb9ea0caf3c3788f6e8cc3e5c477f0f305c
6
+ metadata.gz: 4e7ff84451376fc5f87cefe883ff79fca0fe2415ecbd87f1cdc92890d48a01d9575bfd4bb7314b017173d3d3e5db47212a55a375ffc98cae5b963e5ee59cf5fd
7
+ data.tar.gz: fc1a7fb35baf259cd4b2f7a031107c80b43180a31d0b08d70dee8eb386bf39582413b531b726e9257dec12d6b225aba32f78282e071efd5955b4f46b61e2f494
@@ -4,7 +4,9 @@
4
4
 
5
5
  require "elasticsearch/api"
6
6
  require "elasticsearch/xpack/version"
7
+ require "elasticsearch/xpack/api/actions/params_registry"
7
8
 
9
+ Dir[ File.expand_path('../xpack/api/actions/**/params_registry.rb', __FILE__) ].each { |f| require f }
8
10
  Dir[ File.expand_path('../xpack/api/actions/**/*.rb', __FILE__) ].each { |f| require f }
9
11
  Dir[ File.expand_path('../xpack/api/namespace/**/*.rb', __FILE__) ].each { |f| require f }
10
12
 
@@ -25,7 +27,7 @@ module Elasticsearch
25
27
  end
26
28
  end
27
29
 
28
- Elasticsearch::API::COMMON_PARAMS.push :job_id, :datafeed_id, :filter_id, :snapshot_id, :category_id
30
+ Elasticsearch::API::COMMON_PARAMS.push :job_id, :datafeed_id, :filter_id, :snapshot_id, :category_id, :policy_id
29
31
 
30
32
  module Elasticsearch
31
33
  module Transport
@@ -69,6 +71,10 @@ module Elasticsearch
69
71
  def data_frame
70
72
  @data_frame ||= xpack.data_frame
71
73
  end
74
+
75
+ def ilm
76
+ @ilm ||= xpack.ilm
77
+ end
72
78
  end
73
79
  end
74
80
  end if defined?(Elasticsearch::Transport::Client)
@@ -11,21 +11,29 @@ module Elasticsearch
11
11
  # Deletes an existing data frame transform.
12
12
  #
13
13
  # @option arguments [String] :transform_id The id of the transform to delete. *Required*
14
+ # @option arguments [Boolean] :force When `true`, the transform is deleted regardless of its current state.
15
+ # The default value is `false`, meaning that the transform must be `stopped` before it can be deleted.
14
16
  #
15
17
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html
16
18
  #
17
19
  # @since 7.2.0
18
20
  def delete_data_frame_transform(arguments={})
19
21
  raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id]
20
- transform_id = URI.escape(arguments[:transform_id])
22
+ arguments.clone
23
+ transform_id = URI.escape(arguments.delete(:transform_id))
21
24
 
22
25
  method = Elasticsearch::API::HTTP_DELETE
23
26
  path = "_data_frame/transforms/#{transform_id}"
24
- params = {}
27
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
25
28
  body = nil
26
29
 
27
30
  perform_request(method, path, params, body).body
28
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(:delete_data_frame_transform, [ :force ].freeze)
29
37
  end
30
38
  end
31
39
  end
@@ -22,18 +22,20 @@ module Elasticsearch
22
22
  arguments = arguments.clone
23
23
  transform_id = URI.escape(arguments.delete(:transform_id))
24
24
 
25
- valid_params = [
26
- :from,
27
- :size,
28
- :allow_no_match]
29
-
30
25
  method = Elasticsearch::API::HTTP_GET
31
26
  path = Elasticsearch::API::Utils.__pathify('_data_frame/transforms', Elasticsearch::API::Utils.__listify(transform_id))
32
- params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, valid_params)
27
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
33
28
  body = nil
34
29
 
35
30
  perform_request(method, path, params, body).body
36
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(:get_data_frame_transform, [ :from,
37
+ :size,
38
+ :allow_no_match ].freeze)
37
39
  end
38
40
  end
39
41
  end
@@ -22,17 +22,19 @@ module Elasticsearch
22
22
  arguments = arguments.clone
23
23
  transform_id = URI.escape(arguments.delete(:transform_id))
24
24
 
25
- valid_params = [
26
- :from,
27
- :size]
28
-
29
25
  method = Elasticsearch::API::HTTP_GET
30
26
  path = Elasticsearch::API::Utils.__pathify('_data_frame/transforms', Elasticsearch::API::Utils.__listify(transform_id), '_stats')
31
- params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, valid_params)
27
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
32
28
  body = nil
33
29
 
34
30
  perform_request(method, path, params, body).body
35
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(:get_data_frame_transform_stats, [ :from,
37
+ :size ].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 DataFrame
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
@@ -12,6 +12,8 @@ module Elasticsearch
12
12
  #
13
13
  # @option arguments [Hash] :transform_id The id of the new transform. *Required*
14
14
  # @option arguments [Hash] :body The data frame transform definition. *Required*
15
+ # @option arguments [Boolean] :defer_validation If validations should be deferred until transform starts,
16
+ # defaults to false.
15
17
  #
16
18
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html
17
19
  #
@@ -20,15 +22,21 @@ module Elasticsearch
20
22
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
21
23
  raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id]
22
24
 
23
- transform_id = URI.escape(arguments[:transform_id])
25
+ arguments = arguments.clone
26
+ transform_id = URI.escape(arguments.delete(:transform_id))
24
27
  body = arguments[:body]
25
28
 
26
29
  method = Elasticsearch::API::HTTP_PUT
27
30
  path = "_data_frame/transforms/#{transform_id}"
28
- params = {}
31
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
29
32
 
30
33
  perform_request(method, path, params, body).body
31
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(:put_data_frame_transform, [ :defer_validation ].freeze)
32
40
  end
33
41
  end
34
42
  end
@@ -21,16 +21,18 @@ module Elasticsearch
21
21
  arguments = arguments.clone
22
22
  transform_id = URI.escape(arguments.delete(:transform_id))
23
23
 
24
- valid_params = [
25
- :timeout]
26
-
27
24
  method = Elasticsearch::API::HTTP_POST
28
25
  path = "_data_frame/transforms/#{transform_id}/_start"
29
- params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
26
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
30
27
  body = nil
31
28
 
32
29
  perform_request(method, path, params, body).body
33
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(:start_data_frame_transform, [ :timeout ].freeze)
34
36
  end
35
37
  end
36
38
  end
@@ -24,18 +24,21 @@ module Elasticsearch
24
24
  arguments = arguments.clone
25
25
  transform_id = URI.escape(arguments.delete(:transform_id))
26
26
 
27
- valid_params = [
28
- :timeout,
29
- :wait_for_completion,
30
- :allow_no_match ]
31
-
32
27
  method = Elasticsearch::API::HTTP_POST
33
28
  path = "_data_frame/transforms/#{Elasticsearch::API::Utils.__listify(transform_id)}/_stop"
34
- params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, valid_params)
29
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
35
30
  body = nil
36
31
 
37
32
  perform_request(method, path, params, body).body
38
33
  end
34
+
35
+
36
+ # Register this action with its valid params when the module is loaded.
37
+ #
38
+ # @since 7.4.0
39
+ ParamsRegistry.register(:stop_data_frame_transform, [ :timeout,
40
+ :wait_for_completion,
41
+ :allow_no_match ].freeze)
39
42
  end
40
43
  end
41
44
  end
@@ -0,0 +1,45 @@
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 DataFrame
9
+ module Actions
10
+
11
+ # Updates an existing data frame transform.
12
+ #
13
+ # @option arguments [Hash] :transform_id The id of the new transform. *Required*
14
+ # @option arguments [Hash] :body The update data frame transform definition. *Required*
15
+ # @option arguments [Boolean] :defer_validation If validations should be deferred until data frame
16
+ # transform starts, defaults to false.
17
+ #
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-data-frame-transform.html
19
+ #
20
+ # @since 7.4.0
21
+ def update_data_frame_transform(arguments={})
22
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
23
+ raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id]
24
+ arguments = arguments.clone
25
+
26
+ transform_id = URI.escape(arguments.delete(:transform_id))
27
+ body = arguments.delete(:body)
28
+
29
+ method = Elasticsearch::API::HTTP_POST
30
+ path = "_data_frame/transforms/#{transform_id}/_update"
31
+ params = Elasticsearch::API::Utils.__validate_and_extract_params(arguments, ParamsRegistry.get(__method__))
32
+
33
+ perform_request(method, path, params, body).body
34
+ end
35
+
36
+
37
+ # Register this action with its valid params when the module is loaded.
38
+ #
39
+ # @since 7.4.0
40
+ ParamsRegistry.register(:update_data_frame_transform, [ :defer_validation ].freeze)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -21,21 +21,23 @@ module Elasticsearch
21
21
  # @see https://www.elastic.co/guide/en/graph/current/explore.html
22
22
  #
23
23
  def explore(arguments={})
24
- valid_params = [
25
- :routing,
26
- :timeout ]
27
-
28
24
  arguments = arguments.clone
29
25
  index = arguments.delete(:index)
30
26
  type = arguments.delete(:type)
31
27
 
32
28
  method = Elasticsearch::API::HTTP_GET
33
29
  path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), Elasticsearch::API::Utils.__listify(type), '_graph/explore'
34
- params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
30
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
35
31
  body = arguments[:body]
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(:explore, [ :routing,
40
+ :timeout ].freeze)
39
41
  end
40
42
  end
41
43
  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 Graph
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,39 @@
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
+ # Deletes 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-delete-lifecycle.html
18
+ #
19
+ def delete_policy(arguments={})
20
+ raise ArgumentError, "Required argument 'policy_id' missing" unless arguments[:policy_id]
21
+ method = Elasticsearch::API::HTTP_DELETE
22
+ path = Elasticsearch::API::Utils.__pathify "_ilm/policy",
23
+ Elasticsearch::API::Utils.__escape(arguments[:policy_id])
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(:delete_policy, [ :master_timeout,
33
+ :timeout ].freeze)
34
+
35
+ end
36
+ end
37
+ end
38
+ end
39
+ 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
+ # Shows an index’s current lifecycle status
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-explain-lifecycle.html
18
+ #
19
+ def explain(arguments={})
20
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
21
+ index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))
22
+
23
+ method = Elasticsearch::API::HTTP_GET
24
+ path = Elasticsearch::API::Utils.__pathify index, "_ilm/explain"
25
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
26
+ body = nil
27
+
28
+ perform_request(method, path, params, body).body
29
+ end
30
+
31
+ # Register this action with its valid params when the module is loaded.
32
+ #
33
+ ParamsRegistry.register(:explain, [ :master_timeout,
34
+ :timeout ].freeze)
35
+
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end