lib/elasticsearch/xpack/api/actions/security/get_user.rb in elasticsearch-xpack-7.4.0 vs lib/elasticsearch/xpack/api/actions/security/get_user.rb in elasticsearch-xpack-7.5.0.pre.pre

- old
+ new

@@ -5,29 +5,38 @@ module Elasticsearch module XPack module API module Security module Actions + # TODO: Description - # Retrieve one or more users from the native realm # # @option arguments [List] :username A comma-separated list of usernames + # - # @see https://www.elastic.co/guide/en/x-pack/current/security-api-users.html#security-api-get-user + # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html # - def get_user(arguments={}) + def get_user(arguments = {}) + arguments = arguments.clone + + _username = arguments.delete(:username) + method = Elasticsearch::API::HTTP_GET - path = Elasticsearch::API::Utils.__pathify "_xpack/security/user", Elasticsearch::API::Utils.__listify(arguments[:username]) + path = if _username + "_security/user/#{Elasticsearch::API::Utils.__listify(_username)}" + else + "_security/user" + end params = {} - body = nil + 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 - end end + end end end end