Module: ElasticsearchServerless::API::Security::Actions
- Defined in:
- lib/elasticsearch-serverless/api/security/get_api_key.rb,
lib/elasticsearch-serverless/api/security/authenticate.rb,
lib/elasticsearch-serverless/api/security/create_api_key.rb,
lib/elasticsearch-serverless/api/security/has_privileges.rb,
lib/elasticsearch-serverless/api/security/query_api_keys.rb,
lib/elasticsearch-serverless/api/security/invalidate_api_key.rb
Instance Method Summary collapse
-
#authenticate(arguments = {}) ⇒ Object
Enables authentication as a user and retrieve information about the authenticated user.
-
#create_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
-
#get_api_key(arguments = {}) ⇒ Object
Retrieves information for one or more API keys.
-
#has_privileges(arguments = {}) ⇒ Object
Determines whether the specified user has a specified list of privileges.
-
#invalidate_api_key(arguments = {}) ⇒ Object
Invalidates one or more API keys.
-
#query_api_keys(arguments = {}) ⇒ Object
Retrieves information for API keys using a subset of query DSL.
Instance Method Details
#authenticate(arguments = {}) ⇒ Object
Enables authentication as a user and retrieve information about the authenticated user.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch-serverless/api/security/authenticate.rb', line 31 def authenticate(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil method = ElasticsearchServerless::API::HTTP_GET path = "_security/_authenticate" params = {} ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#create_api_key(arguments = {}) ⇒ Object
Creates an API key for access without requiring basic authentication.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch-serverless/api/security/create_api_key.rb', line 33 def create_api_key(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = ElasticsearchServerless::API::HTTP_PUT path = "_security/api_key" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#get_api_key(arguments = {}) ⇒ Object
Retrieves information for one or more API keys.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch-serverless/api/security/get_api_key.rb', line 37 def get_api_key(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil method = ElasticsearchServerless::API::HTTP_GET path = "_security/api_key" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#has_privileges(arguments = {}) ⇒ Object
Determines whether the specified user has a specified list of privileges.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elasticsearch-serverless/api/security/has_privileges.rb', line 33 def has_privileges(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _user = arguments.delete(:user) method = ElasticsearchServerless::API::HTTP_POST path = if _user "_security/user/#{Utils.listify(_user)}/_has_privileges" else "_security/user/_has_privileges" end params = {} ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#invalidate_api_key(arguments = {}) ⇒ Object
Invalidates one or more API keys.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/elasticsearch-serverless/api/security/invalidate_api_key.rb', line 32 def invalidate_api_key(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = ElasticsearchServerless::API::HTTP_DELETE path = "_security/api_key" params = {} ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#query_api_keys(arguments = {}) ⇒ Object
Retrieves information for API keys using a subset of query DSL
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/elasticsearch-serverless/api/security/query_api_keys.rb', line 33 def query_api_keys(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = if body ElasticsearchServerless::API::HTTP_POST else ElasticsearchServerless::API::HTTP_GET end path = "_security/_query/api_key" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |