elasticsearch-xpack 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +95 -0
- data/elasticsearch-xpack.gemspec +39 -0
- data/examples/watcher/error_500.rb +163 -0
- data/lib/elasticsearch/xpack.rb +32 -0
- data/lib/elasticsearch/xpack/api/actions/graph/explore.rb +39 -0
- data/lib/elasticsearch/xpack/api/actions/info.rb +30 -0
- data/lib/elasticsearch/xpack/api/actions/license/delete.rb +23 -0
- data/lib/elasticsearch/xpack/api/actions/license/get.rb +26 -0
- data/lib/elasticsearch/xpack/api/actions/license/post.rb +28 -0
- data/lib/elasticsearch/xpack/api/actions/monitoring/bulk.rb +45 -0
- data/lib/elasticsearch/xpack/api/actions/security/authenticate.rb +24 -0
- data/lib/elasticsearch/xpack/api/actions/security/change_password.rb +34 -0
- data/lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb +33 -0
- data/lib/elasticsearch/xpack/api/actions/security/clear_cached_roles.rb +27 -0
- data/lib/elasticsearch/xpack/api/actions/security/delete_role.rb +34 -0
- data/lib/elasticsearch/xpack/api/actions/security/delete_user.rb +37 -0
- data/lib/elasticsearch/xpack/api/actions/security/get_role.rb +29 -0
- data/lib/elasticsearch/xpack/api/actions/security/get_user.rb +29 -0
- data/lib/elasticsearch/xpack/api/actions/security/put_role.rb +32 -0
- data/lib/elasticsearch/xpack/api/actions/security/put_user.rb +34 -0
- data/lib/elasticsearch/xpack/api/actions/usage.rb +23 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb +32 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb +32 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb +35 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb +28 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/get_watch.rb +27 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb +35 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/restart.rb +23 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/start.rb +24 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/stats.rb +27 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/stop.rb +24 -0
- data/lib/elasticsearch/xpack/api/namespace/graph.rb +18 -0
- data/lib/elasticsearch/xpack/api/namespace/license.rb +18 -0
- data/lib/elasticsearch/xpack/api/namespace/monitoring.rb +18 -0
- data/lib/elasticsearch/xpack/api/namespace/security.rb +18 -0
- data/lib/elasticsearch/xpack/api/namespace/watcher.rb +18 -0
- data/lib/elasticsearch/xpack/version.rb +5 -0
- metadata +297 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Update or create a role for the native shield realm
|
8
|
+
#
|
9
|
+
# @option arguments [String] :name Role name (*Required*)
|
10
|
+
# @option arguments [Hash] :body The role to add (*Required*)
|
11
|
+
# @option arguments [Boolean] :refresh Refresh the index after performing the operation
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html#security-api-put-role
|
14
|
+
#
|
15
|
+
def put_role(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
17
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
18
|
+
|
19
|
+
valid_params = [ :refresh ]
|
20
|
+
|
21
|
+
method = Elasticsearch::API::HTTP_PUT
|
22
|
+
path = "_xpack/security/role/#{arguments[:name]}"
|
23
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
24
|
+
body = arguments[:body]
|
25
|
+
|
26
|
+
perform_request(method, path, params, body).body
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Update or create a user for the native realm
|
8
|
+
#
|
9
|
+
# @option arguments [String] :username The username of the User (*Required*)
|
10
|
+
# @option arguments [Hash] :body The user to add (*Required*)
|
11
|
+
# @option arguments [Boolean] :refresh Refresh the index after performing the operation
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-users.html#security-api-put-user
|
14
|
+
#
|
15
|
+
def put_user(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
17
|
+
|
18
|
+
valid_params = [ :refresh ]
|
19
|
+
|
20
|
+
arguments = arguments.clone
|
21
|
+
username = arguments.delete(:username)
|
22
|
+
|
23
|
+
method = Elasticsearch::API::HTTP_PUT
|
24
|
+
path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", username
|
25
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
26
|
+
body = arguments[:body]
|
27
|
+
|
28
|
+
perform_request(method, path, params, body).body
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Retrieve information about X-Pack features usage
|
7
|
+
#
|
8
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
9
|
+
#
|
10
|
+
#
|
11
|
+
def usage(arguments={})
|
12
|
+
valid_params = [ :master_timeout ]
|
13
|
+
method = Elasticsearch::API::HTTP_GET
|
14
|
+
path = "_xpack/usage"
|
15
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
16
|
+
body = nil
|
17
|
+
|
18
|
+
perform_request(method, path, params, body).body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Acknowledge watch actions to throttle their executions
|
8
|
+
#
|
9
|
+
# @option arguments [String] :watch_id Watch ID (*Required*)
|
10
|
+
# @option arguments [List] :action_id A comma-separated list of the action ids to be acked (default: all)
|
11
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
12
|
+
#
|
13
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-ack-watch.html
|
14
|
+
#
|
15
|
+
def ack_watch(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
17
|
+
|
18
|
+
valid_params = [
|
19
|
+
:master_timeout,
|
20
|
+
:action_id ]
|
21
|
+
|
22
|
+
arguments = arguments.clone
|
23
|
+
watch_id = arguments.delete(:watch_id)
|
24
|
+
|
25
|
+
method = Elasticsearch::API::HTTP_PUT
|
26
|
+
path = "_xpack/watcher/watch/#{watch_id}/_ack"
|
27
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
28
|
+
body = nil
|
29
|
+
|
30
|
+
perform_request(method, path, params, body).body
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Activate a currently inactive watch
|
8
|
+
#
|
9
|
+
# @option arguments [String] :watch_id Watch ID (*Required*)
|
10
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
11
|
+
#
|
12
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-activate-watch.html
|
13
|
+
#
|
14
|
+
def activate_watch(arguments={})
|
15
|
+
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
16
|
+
valid_params = [ :master_timeout ]
|
17
|
+
|
18
|
+
arguments = arguments.clone
|
19
|
+
watch_id = arguments.delete(:watch_id)
|
20
|
+
|
21
|
+
method = Elasticsearch::API::HTTP_PUT
|
22
|
+
path = "_xpack/watcher/watch/#{watch_id}/_activate"
|
23
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
24
|
+
body = nil
|
25
|
+
|
26
|
+
perform_request(method, path, params, body).body
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Deactivate a currently active watch
|
8
|
+
#
|
9
|
+
# @option arguments [String] :watch_id Watch ID (*Required*)
|
10
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
11
|
+
#
|
12
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-deactivate-watch.html
|
13
|
+
#
|
14
|
+
def deactivate_watch(arguments={})
|
15
|
+
raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]
|
16
|
+
valid_params = [ :master_timeout ]
|
17
|
+
|
18
|
+
arguments = arguments.clone
|
19
|
+
watch_id = arguments.delete(:watch_id)
|
20
|
+
|
21
|
+
method = Elasticsearch::API::HTTP_PUT
|
22
|
+
path = "_xpack/watcher/watch/#{watch_id}/_deactivate"
|
23
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
24
|
+
body = nil
|
25
|
+
|
26
|
+
perform_request(method, path, params, body).body
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Remove a watch
|
8
|
+
#
|
9
|
+
# @option arguments [String] :id Watch ID (*Required*)
|
10
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
11
|
+
# @option arguments [Boolean] :force Specify if this request should be forced and ignore locks
|
12
|
+
#
|
13
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/appendix-api-delete-watch.html
|
14
|
+
#
|
15
|
+
def delete_watch(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
17
|
+
valid_params = [
|
18
|
+
:master_timeout,
|
19
|
+
:force ]
|
20
|
+
method = Elasticsearch::API::HTTP_DELETE
|
21
|
+
path = "_xpack/watcher/watch/#{arguments[:id]}"
|
22
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
23
|
+
body = nil
|
24
|
+
|
25
|
+
if Array(arguments[:ignore]).include?(404)
|
26
|
+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
27
|
+
else
|
28
|
+
perform_request(method, path, params, body).body
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Force the execution of a stored watch
|
8
|
+
#
|
9
|
+
# @option arguments [String] :id Watch ID
|
10
|
+
# @option arguments [Hash] :body Execution control
|
11
|
+
# @option arguments [Boolean] :debug indicates whether the watch should execute in debug mode
|
12
|
+
#
|
13
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-execute-watch.html
|
14
|
+
#
|
15
|
+
def execute_watch(arguments={})
|
16
|
+
valid_params = [ :debug ]
|
17
|
+
method = Elasticsearch::API::HTTP_PUT
|
18
|
+
path = "_xpack/watcher/watch/#{arguments[:id]}/_execute"
|
19
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
20
|
+
body = arguments[:body]
|
21
|
+
|
22
|
+
perform_request(method, path, params, body).body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Retrieve a watch
|
8
|
+
#
|
9
|
+
# @option arguments [String] :id Watch ID (*Required*)
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/watcher-api-get-watch.html
|
12
|
+
#
|
13
|
+
def get_watch(arguments={})
|
14
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
15
|
+
|
16
|
+
method = Elasticsearch::API::HTTP_GET
|
17
|
+
path = "_xpack/watcher/watch/#{arguments[:id]}"
|
18
|
+
params = {}
|
19
|
+
body = nil
|
20
|
+
|
21
|
+
perform_request(method, path, params, body).body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Register a new watch in or update an existing one
|
8
|
+
#
|
9
|
+
# @option arguments [String] :id Watch ID (*Required*)
|
10
|
+
# @option arguments [Hash] :body The watch (*Required*)
|
11
|
+
# @option arguments [Duration] :master_timeout Specify timeout for watch write operation
|
12
|
+
# @option arguments [Boolean] :active Specify whether the watch is in/active by default
|
13
|
+
#
|
14
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-put-watch.html
|
15
|
+
#
|
16
|
+
def put_watch(arguments={})
|
17
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
18
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
19
|
+
|
20
|
+
valid_params = [
|
21
|
+
:master_timeout,
|
22
|
+
:active ]
|
23
|
+
|
24
|
+
method = Elasticsearch::API::HTTP_PUT
|
25
|
+
path = "_xpack/watcher/watch/#{arguments[:id]}"
|
26
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
27
|
+
body = arguments[:body]
|
28
|
+
|
29
|
+
perform_request(method, path, params, body).body
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Start and stop the Watcher service
|
8
|
+
#
|
9
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-restart.html
|
10
|
+
#
|
11
|
+
def restart(arguments={})
|
12
|
+
method = Elasticsearch::API::HTTP_POST
|
13
|
+
path = "_xpack/watcher/_restart"
|
14
|
+
params = {}
|
15
|
+
body = nil
|
16
|
+
|
17
|
+
perform_request(method, path, params, body).body
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Start the Watcher service
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-start.html
|
11
|
+
#
|
12
|
+
def start(arguments={})
|
13
|
+
method = Elasticsearch::API::HTTP_POST
|
14
|
+
path = "_xpack/watcher/_start"
|
15
|
+
params = {}
|
16
|
+
body = nil
|
17
|
+
|
18
|
+
perform_request(method, path, params, body).body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Return the current Watcher metrics
|
8
|
+
#
|
9
|
+
# @option arguments [String] :metric Additional metrics to be included in the response
|
10
|
+
# (options: _all, queued_watches, pending_watches)
|
11
|
+
#
|
12
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/watcher-api-stats.html
|
13
|
+
#
|
14
|
+
def stats(arguments={})
|
15
|
+
valid_params = [ :metric ]
|
16
|
+
method = Elasticsearch::API::HTTP_GET
|
17
|
+
path = "_xpack/watcher/stats"
|
18
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
19
|
+
body = nil
|
20
|
+
|
21
|
+
perform_request(method, path, params, body).body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Watcher
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Stop the Watcher service
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# @see http://www.elastic.co/guide/en/x-pack/current/watcher-api-stop.html
|
11
|
+
#
|
12
|
+
def stop(arguments={})
|
13
|
+
method = Elasticsearch::API::HTTP_POST
|
14
|
+
path = "_xpack/watcher/_stop"
|
15
|
+
params = {}
|
16
|
+
body = nil
|
17
|
+
|
18
|
+
perform_request(method, path, params, body).body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Graph
|
5
|
+
module Actions; end
|
6
|
+
|
7
|
+
class GraphClient
|
8
|
+
include Elasticsearch::API::Common::Client, Elasticsearch::API::Common::Client::Base, Graph::Actions
|
9
|
+
end
|
10
|
+
|
11
|
+
def graph
|
12
|
+
@graph ||= GraphClient.new(self)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|