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,39 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Graph
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Get structured information about the vertices and connections in a dataset
|
8
|
+
#
|
9
|
+
# @option arguments [List] :index A comma-separated list of index names to search;
|
10
|
+
# use `_all` or empty string to perform the operation on all indices
|
11
|
+
# @option arguments [List] :type A comma-separated list of document types to search;
|
12
|
+
# leave empty to perform the operation on all types
|
13
|
+
# @option arguments [Hash] :body The Graph Query DSL definition
|
14
|
+
# @option arguments [String] :routing Specific routing value
|
15
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
16
|
+
#
|
17
|
+
# @see https://www.elastic.co/guide/en/graph/current/explore.html
|
18
|
+
#
|
19
|
+
def explore(arguments={})
|
20
|
+
valid_params = [
|
21
|
+
:routing,
|
22
|
+
:timeout ]
|
23
|
+
|
24
|
+
arguments = arguments.clone
|
25
|
+
index = arguments.delete(:index)
|
26
|
+
type = arguments.delete(:type)
|
27
|
+
|
28
|
+
method = Elasticsearch::API::HTTP_GET
|
29
|
+
path = Elasticsearch::API::Utils.__pathify Elasticsearch::API::Utils.__listify(index), Elasticsearch::API::Utils.__listify(type), '_xpack/_graph/_explore'
|
30
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
31
|
+
body = arguments[:body]
|
32
|
+
|
33
|
+
perform_request(method, path, params, body).body
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Retrieve information about xpack, including build number/timestamp and license status
|
7
|
+
#
|
8
|
+
# @option arguments [Boolean] :human Presents additional info for humans
|
9
|
+
# (feature descriptions and X-Pack tagline)
|
10
|
+
# @option arguments [List] :categories Comma-separated list of info categories.
|
11
|
+
# (Options: build, license, features)
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/info-api.html
|
14
|
+
#
|
15
|
+
def info(arguments={})
|
16
|
+
valid_params = [
|
17
|
+
:human,
|
18
|
+
:categories ]
|
19
|
+
|
20
|
+
method = Elasticsearch::API::HTTP_GET
|
21
|
+
path = "_xpack"
|
22
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
23
|
+
body = nil
|
24
|
+
|
25
|
+
perform_request(method, path, params, body).body
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module License
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Delete a license
|
8
|
+
#
|
9
|
+
# @see https://www.elastic.co/guide/en/shield/current/license-management.html
|
10
|
+
#
|
11
|
+
def delete(arguments={})
|
12
|
+
method = Elasticsearch::API::HTTP_DELETE
|
13
|
+
path = "_xpack/license"
|
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,26 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module License
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Get a license
|
8
|
+
#
|
9
|
+
# @option arguments [Boolean] :local Return local information (default: false)
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/shield/current/license-management.html
|
12
|
+
#
|
13
|
+
def get(arguments={})
|
14
|
+
valid_params = [ :local ]
|
15
|
+
method = Elasticsearch::API::HTTP_GET
|
16
|
+
path = "_xpack/license"
|
17
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
18
|
+
body = nil
|
19
|
+
|
20
|
+
perform_request(method, path, params, body).body
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module License
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Install a license
|
8
|
+
#
|
9
|
+
# @option arguments [Hash] :body Licenses to be installed
|
10
|
+
# @option arguments [Boolean] :acknowledge Whether the user has acknowledged acknowledge messages
|
11
|
+
# (default: false)
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/shield/current/license-management.html
|
14
|
+
#
|
15
|
+
def post(arguments={})
|
16
|
+
valid_params = [ :acknowledge ]
|
17
|
+
method = Elasticsearch::API::HTTP_PUT
|
18
|
+
path = "_xpack/license"
|
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,45 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Monitoring
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Insert monitoring data in bulk
|
8
|
+
#
|
9
|
+
# @option arguments [String] :type Default document type for items which don't provide one
|
10
|
+
# @option arguments [Hash] :body The operation definition and data (action-data pairs), separated by newlines (*Required*)
|
11
|
+
# @option arguments [String] :system_id Identifier of the monitored system
|
12
|
+
# @option arguments [String] :system_api_version API version of the monitored system
|
13
|
+
# @option arguments [String] :system_version Version of the monitored system
|
14
|
+
#
|
15
|
+
# @see http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html
|
16
|
+
#
|
17
|
+
def bulk(arguments={})
|
18
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
19
|
+
|
20
|
+
valid_params = [
|
21
|
+
:system_id,
|
22
|
+
:system_api_version,
|
23
|
+
:system_version ]
|
24
|
+
|
25
|
+
arguments = arguments.clone
|
26
|
+
type = arguments.delete(:type)
|
27
|
+
body = arguments.delete(:body)
|
28
|
+
|
29
|
+
method = Elasticsearch::API::HTTP_POST
|
30
|
+
path = Elasticsearch::API::Utils.__pathify '_xpack/monitoring', type, '_bulk'
|
31
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
32
|
+
|
33
|
+
if body.is_a? Array
|
34
|
+
payload = Elasticsearch::API::Utils.__bulkify(body)
|
35
|
+
else
|
36
|
+
payload = body
|
37
|
+
end
|
38
|
+
|
39
|
+
perform_request(method, path, params, payload).body
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Retrieve details about the currently authenticated user
|
8
|
+
#
|
9
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-authenticate.html
|
10
|
+
#
|
11
|
+
def authenticate(arguments={})
|
12
|
+
valid_params = []
|
13
|
+
method = Elasticsearch::API::HTTP_GET
|
14
|
+
path = "_xpack/security/_authenticate"
|
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,34 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Change the password of a user
|
8
|
+
#
|
9
|
+
# @option arguments [String] :username The username of the user to change the password for
|
10
|
+
# @option arguments [Hash] :body the new password for the user (*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-change-password.html
|
14
|
+
#
|
15
|
+
def change_password(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, "/_password"
|
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,33 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Clears the internal user caches for specified realms
|
8
|
+
#
|
9
|
+
# @option arguments [String] :realms Comma-separated list of realms to clear (*Required*)
|
10
|
+
# @option arguments [String] :usernames Comma-separated list of usernames to clear from the cache
|
11
|
+
#
|
12
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-clear-cache.html
|
13
|
+
#
|
14
|
+
def clear_cached_realms(arguments={})
|
15
|
+
raise ArgumentError, "Required argument 'realms' missing" unless arguments[:realms]
|
16
|
+
|
17
|
+
valid_params = [ :usernames ]
|
18
|
+
|
19
|
+
arguments = arguments.clone
|
20
|
+
realms = arguments.delete(:realms)
|
21
|
+
|
22
|
+
method = Elasticsearch::API::HTTP_POST
|
23
|
+
path = Elasticsearch::API::Utils.__pathify "_xpack/security/realm/", Elasticsearch::API::Utils.__listify(realms), "_clear_cache"
|
24
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
25
|
+
body = nil
|
26
|
+
|
27
|
+
perform_request(method, path, params, body).body
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Clears the internal caches for specified roles
|
8
|
+
#
|
9
|
+
# @option arguments [String] :name Role name (*Required*)
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html#security-api-clear-role-cache
|
12
|
+
#
|
13
|
+
def clear_cached_roles(arguments={})
|
14
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
15
|
+
|
16
|
+
method = Elasticsearch::API::HTTP_PUT
|
17
|
+
path = "_xpack/security/role/#{arguments[:name]}/_clear_cache"
|
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,34 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Remove a role from the native realm
|
8
|
+
#
|
9
|
+
# @option arguments [String] :name Role name (*Required*)
|
10
|
+
# @option arguments [Boolean] :refresh Refresh the index after performing the operation
|
11
|
+
#
|
12
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html#security-api-delete-role
|
13
|
+
#
|
14
|
+
def delete_role(arguments={})
|
15
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
16
|
+
|
17
|
+
valid_params = [ :refresh ]
|
18
|
+
|
19
|
+
method = Elasticsearch::API::HTTP_DELETE
|
20
|
+
path = "_xpack/security/role/#{arguments[:name]}"
|
21
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
22
|
+
body = nil
|
23
|
+
|
24
|
+
if Array(arguments[:ignore]).include?(404)
|
25
|
+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
26
|
+
else
|
27
|
+
perform_request(method, path, params, body).body
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Remove a user from the native realm
|
8
|
+
#
|
9
|
+
# @option arguments [String] :username username (*Required*)
|
10
|
+
# @option arguments [Boolean] :refresh Refresh the index after performing the operation
|
11
|
+
#
|
12
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-users.html#security-api-delete-user
|
13
|
+
#
|
14
|
+
def delete_user(arguments={})
|
15
|
+
valid_params = [
|
16
|
+
:username,
|
17
|
+
:refresh ]
|
18
|
+
|
19
|
+
arguments = arguments.clone
|
20
|
+
username = arguments.delete(:username)
|
21
|
+
|
22
|
+
method = Elasticsearch::API::HTTP_DELETE
|
23
|
+
path = "_xpack/security/user/#{username}"
|
24
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
25
|
+
body = nil
|
26
|
+
|
27
|
+
if Array(arguments[:ignore]).include?(404)
|
28
|
+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
29
|
+
else
|
30
|
+
perform_request(method, path, params, body).body
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Retrieve one or more roles from the native realm
|
8
|
+
#
|
9
|
+
# @option arguments [String] :name Role name
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html#security-api-get-role
|
12
|
+
#
|
13
|
+
def get_role(arguments={})
|
14
|
+
method = Elasticsearch::API::HTTP_GET
|
15
|
+
path = Elasticsearch::API::Utils.__pathify "_xpack/security/role", Elasticsearch::API::Utils.__listify(arguments[:name])
|
16
|
+
params = {}
|
17
|
+
body = nil
|
18
|
+
|
19
|
+
if Array(arguments[:ignore]).include?(404)
|
20
|
+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
21
|
+
else
|
22
|
+
perform_request(method, path, params, body).body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module Security
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Retrieve one or more users from the native realm
|
8
|
+
#
|
9
|
+
# @option arguments [List] :username A comma-separated list of usernames
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/security-api-users.html#security-api-get-user
|
12
|
+
#
|
13
|
+
def get_user(arguments={})
|
14
|
+
method = Elasticsearch::API::HTTP_GET
|
15
|
+
path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", Elasticsearch::API::Utils.__listify(arguments[:username])
|
16
|
+
params = {}
|
17
|
+
body = nil
|
18
|
+
|
19
|
+
if Array(arguments[:ignore]).include?(404)
|
20
|
+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
21
|
+
else
|
22
|
+
perform_request(method, path, params, body).body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|