Module: Elasticsearch::XPack::API::Security::Actions
- Included in:
- SecurityClient
- Defined in:
- lib/elasticsearch/xpack/api/namespace/security.rb,
lib/elasticsearch/xpack/api/actions/security/get_role.rb,
lib/elasticsearch/xpack/api/actions/security/get_user.rb,
lib/elasticsearch/xpack/api/actions/security/put_role.rb,
lib/elasticsearch/xpack/api/actions/security/put_user.rb,
lib/elasticsearch/xpack/api/actions/security/get_token.rb,
lib/elasticsearch/xpack/api/actions/security/delete_role.rb,
lib/elasticsearch/xpack/api/actions/security/delete_user.rb,
lib/elasticsearch/xpack/api/actions/security/enable_user.rb,
lib/elasticsearch/xpack/api/actions/security/get_api_key.rb,
lib/elasticsearch/xpack/api/actions/security/authenticate.rb,
lib/elasticsearch/xpack/api/actions/security/disable_user.rb,
lib/elasticsearch/xpack/api/actions/security/create_api_key.rb,
lib/elasticsearch/xpack/api/actions/security/get_privileges.rb,
lib/elasticsearch/xpack/api/actions/security/has_privileges.rb,
lib/elasticsearch/xpack/api/actions/security/put_privileges.rb,
lib/elasticsearch/xpack/api/actions/security/change_password.rb,
lib/elasticsearch/xpack/api/actions/security/get_role_mapping.rb,
lib/elasticsearch/xpack/api/actions/security/invalidate_token.rb,
lib/elasticsearch/xpack/api/actions/security/put_role_mapping.rb,
lib/elasticsearch/xpack/api/actions/security/delete_privileges.rb,
lib/elasticsearch/xpack/api/actions/security/clear_cached_roles.rb,
lib/elasticsearch/xpack/api/actions/security/invalidate_api_key.rb,
lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb,
lib/elasticsearch/xpack/api/actions/security/delete_role_mapping.rb,
lib/elasticsearch/xpack/api/actions/security/get_user_privileges.rb
Instance Method Summary collapse
-
#authenticate(arguments = {}) ⇒ Object
Retrieve details about the currently authenticated user.
-
#change_password(arguments = {}) ⇒ Object
Change the password of a user.
-
#clear_cached_realms(arguments = {}) ⇒ Object
Clears the internal user caches for specified realms.
-
#clear_cached_roles(arguments = {}) ⇒ Object
Clears the internal caches for specified roles.
-
#create_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
- #delete_privileges(arguments = {}) ⇒ Object
-
#delete_role(arguments = {}) ⇒ Object
Remove a role from the native realm.
-
#delete_role_mapping(arguments = {}) ⇒ Object
Delete a role mapping.
-
#delete_user(arguments = {}) ⇒ Object
Remove a user from the native realm.
-
#disable_user(arguments = {}) ⇒ Object
Disable a user.
-
#enable_user(arguments = {}) ⇒ Object
Enable a user.
-
#get_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
-
#get_privileges(arguments = {}) ⇒ Object
Retrieve one or more roles from the native realm.
-
#get_role(arguments = {}) ⇒ Object
Retrieve one or more roles from the native realm.
-
#get_role_mapping(arguments = {}) ⇒ Object
Retrieve the mapping for a role.
-
#get_token(arguments = {}) ⇒ Object
Obtain a token for OAuth 2.0 auhentication.
-
#get_user(arguments = {}) ⇒ Object
Retrieve one or more users from the native realm.
-
#get_user_privileges(arguments = {}) ⇒ Object
Get user privileges.
-
#has_privileges(arguments = {}) ⇒ Object
Remove a role from the native realm.
-
#invalidate_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
-
#invalidate_token(arguments = {}) ⇒ Object
Delete a token for OAuth 2.0 auhentication.
-
#put_privileges(arguments = {}) ⇒ Object
Add a privilege.
-
#put_role(arguments = {}) ⇒ Object
Update or create a role for the native shield realm.
-
#put_role_mapping(arguments = {}) ⇒ Object
Add a mapping for a role.
-
#put_user(arguments = {}) ⇒ Object
Update or create a user for the native realm.
Instance Method Details
#authenticate(arguments = {}) ⇒ Object
Retrieve details about the currently authenticated user
28 29 30 31 32 33 34 35 36 |
# File 'lib/elasticsearch/xpack/api/actions/security/authenticate.rb', line 28 def authenticate(arguments={}) valid_params = [] method = Elasticsearch::API::HTTP_GET path = "_xpack/security/_authenticate" params = {} body = nil perform_request(method, path, params, body).body end |
#change_password(arguments = {}) ⇒ Object
Change the password of a user
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/xpack/api/actions/security/change_password.rb', line 32 def change_password(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :refresh ] arguments = arguments.clone username = arguments.delete(:username) method = Elasticsearch::API::HTTP_PUT path = Elasticsearch::API::Utils.__pathify "_xpack/security/user/", username, "/_password" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#clear_cached_realms(arguments = {}) ⇒ Object
Clears the internal user caches for specified realms
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb', line 31 def clear_cached_realms(arguments={}) raise ArgumentError, "Required argument 'realms' missing" unless arguments[:realms] valid_params = [ :usernames ] arguments = arguments.clone realms = arguments.delete(:realms) method = Elasticsearch::API::HTTP_POST path = Elasticsearch::API::Utils.__pathify "_xpack/security/realm/", Elasticsearch::API::Utils.__listify(realms), "_clear_cache" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#clear_cached_roles(arguments = {}) ⇒ Object
Clears the internal caches for specified roles
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/xpack/api/actions/security/clear_cached_roles.rb', line 30 def clear_cached_roles(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/role/#{arguments[:name]}/_clear_cache" params = {} body = nil perform_request(method, path, params, body).body end |
#create_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/xpack/api/actions/security/create_api_key.rb', line 34 def create_api_key(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :refresh ] method = Elasticsearch::API::HTTP_PUT path = "_security/api_key" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params perform_request(method, path, params, arguments[:body]).body end |
#delete_privileges(arguments = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/xpack/api/actions/security/delete_privileges.rb', line 10 def delete_privileges(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'application' missing" unless arguments[:application] valid_params = [ :refresh ] method = Elasticsearch::API::HTTP_DELETE path = "_xpack/security/privilege/#{arguments.delete(:application)}/#{arguments[:name]}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#delete_role(arguments = {}) ⇒ Object
Remove a role from the native realm
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/xpack/api/actions/security/delete_role.rb', line 31 def delete_role(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :refresh ] method = Elasticsearch::API::HTTP_DELETE path = "_xpack/security/role/#{arguments[:name]}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#delete_role_mapping(arguments = {}) ⇒ Object
Delete a role mapping
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/elasticsearch/xpack/api/actions/security/delete_role_mapping.rb', line 31 def delete_role_mapping(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] valid_params = [ :name, :refresh ] arguments = arguments.clone name = arguments.delete(:name) method = Elasticsearch::API::HTTP_DELETE path = "_xpack/security/role_mapping/#{name}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#delete_user(arguments = {}) ⇒ Object
Remove a user from the native realm
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/xpack/api/actions/security/delete_user.rb', line 31 def delete_user(arguments={}) valid_params = [ :username, :refresh ] arguments = arguments.clone username = arguments.delete(:username) method = Elasticsearch::API::HTTP_DELETE path = "_xpack/security/user/#{username}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#disable_user(arguments = {}) ⇒ Object
Disable a user
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/elasticsearch/xpack/api/actions/security/disable_user.rb', line 31 def disable_user(arguments={}) valid_params = [ :username, :refresh ] arguments = arguments.clone username = arguments.delete(:username) method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/user/#{username}/_disable" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#enable_user(arguments = {}) ⇒ Object
Enable a user
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/elasticsearch/xpack/api/actions/security/enable_user.rb', line 31 def enable_user(arguments={}) valid_params = [ :username, :refresh ] arguments = arguments.clone username = arguments.delete(:username) method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/user/#{username}/_enable" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#get_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_api_key.rb', line 36 def get_api_key(arguments={}) valid_params = [ :id, :name, :username, :realm_name ] method = Elasticsearch::API::HTTP_GET path = "_security/api_key" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params perform_request(method, path, params).body end |
#get_privileges(arguments = {}) ⇒ Object
Retrieve one or more roles from the native realm
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_privileges.rb', line 13 def get_privileges(arguments={}) method = Elasticsearch::API::HTTP_GET path = Elasticsearch::API::Utils.__pathify "_xpack/security/privilege", arguments[:application], Elasticsearch::API::Utils.__listify(arguments[:name]) params = {} body = nil perform_request(method, path, params, body).body end |
#get_role(arguments = {}) ⇒ Object
Retrieve one or more roles from the native realm
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_role.rb', line 30 def get_role(arguments={}) method = Elasticsearch::API::HTTP_GET path = Elasticsearch::API::Utils.__pathify "_xpack/security/role", Elasticsearch::API::Utils.__listify(arguments[:name]) params = {} body = nil if Array(arguments[:ignore]).include?(404) Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#get_role_mapping(arguments = {}) ⇒ Object
Retrieve the mapping for a role
30 31 32 33 34 35 36 37 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_role_mapping.rb', line 30 def get_role_mapping(arguments={}) method = Elasticsearch::API::HTTP_GET path = "_xpack/security/role_mapping/#{Elasticsearch::API::Utils.__listify(arguments[:name])}" params = {} body = nil perform_request(method, path, params, body).body end |
#get_token(arguments = {}) ⇒ Object
Obtain a token for OAuth 2.0 auhentication
30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_token.rb', line 30 def get_token(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] method = Elasticsearch::API::HTTP_POST path = "_xpack/security/oauth2/token" params = {} body = arguments[:body] perform_request(method, path, params, body).body end |
#get_user(arguments = {}) ⇒ Object
Retrieve one or more users from the native realm
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_user.rb', line 30 def get_user(arguments={}) method = Elasticsearch::API::HTTP_GET path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", Elasticsearch::API::Utils.__listify(arguments[:username]) params = {} body = nil if Array(arguments[:ignore]).include?(404) Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#get_user_privileges(arguments = {}) ⇒ Object
Get user privileges
9 10 11 12 13 14 15 |
# File 'lib/elasticsearch/xpack/api/actions/security/get_user_privileges.rb', line 9 def get_user_privileges(arguments={}) method = Elasticsearch::API::HTTP_GET params = {} body = nil perform_request(method, '_xpack/security/user/_privileges', params, body).body end |
#has_privileges(arguments = {}) ⇒ Object
Remove a role from the native realm
14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/xpack/api/actions/security/has_privileges.rb', line 14 def has_privileges(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] method = Elasticsearch::API::HTTP_GET path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", arguments[:user], "_has_privileges" perform_request(method, path, {}, arguments[:body]).body end |
#invalidate_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/xpack/api/actions/security/invalidate_api_key.rb', line 30 def invalidate_api_key(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] method = Elasticsearch::API::HTTP_DELETE path = "_security/api_key" params = {} perform_request(method, path, params, arguments[:body]).body end |
#invalidate_token(arguments = {}) ⇒ Object
Delete a token for OAuth 2.0 auhentication
30 31 32 33 34 35 36 37 38 |
# File 'lib/elasticsearch/xpack/api/actions/security/invalidate_token.rb', line 30 def invalidate_token(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] method = Elasticsearch::API::HTTP_DELETE path = "_xpack/security/oauth2/token" params = {} body = arguments[:body] perform_request(method, path, params, body).body end |
#put_privileges(arguments = {}) ⇒ Object
Add a privilege
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/elasticsearch/xpack/api/actions/security/put_privileges.rb', line 13 def put_privileges(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :refresh ] method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/privilege" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_role(arguments = {}) ⇒ Object
Update or create a role for the native shield realm
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/xpack/api/actions/security/put_role.rb', line 32 def put_role(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :refresh ] method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/role/#{arguments[:name]}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_role_mapping(arguments = {}) ⇒ Object
Add a mapping for a role
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/xpack/api/actions/security/put_role_mapping.rb', line 32 def put_role_mapping(arguments={}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :name, :refresh ] arguments = arguments.clone name = arguments.delete(:name) method = Elasticsearch::API::HTTP_PUT path = "_xpack/security/role_mapping/#{name}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#put_user(arguments = {}) ⇒ Object
Update or create a user for the native realm
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/elasticsearch/xpack/api/actions/security/put_user.rb', line 32 def put_user(arguments={}) raise ArgumentError, "Required argument 'username' missing" unless arguments[:username] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :refresh ] arguments = arguments.clone username = arguments.delete(:username) method = Elasticsearch::API::HTTP_PUT path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", username params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |