Skip to content

Commit

Permalink
[API] Updates create_service_token with generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Nov 17, 2022
1 parent e89f0d5 commit 3f6c1bf
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ def create_service_token(arguments = {})

_name = arguments.delete(:name)

if _namespace && _service && _name
method = Elasticsearch::API::HTTP_PUT
path = "_security/service/#{Utils.__listify(_namespace)}/#{Utils.__listify(_service)}/credential/token/#{Utils.__listify(_name)}"
else
method = Elasticsearch::API::HTTP_POST
path = "_security/service/#{Utils.__listify(_namespace)}/#{Utils.__listify(_service)}/credential/token"
end
method = _name ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST
path = if _namespace && _service && _name
"_security/service/#{Utils.__listify(_namespace)}/#{Utils.__listify(_service)}/credential/token/#{Utils.__listify(_name)}"
else
"_security/service/#{Utils.__listify(_namespace)}/#{Utils.__listify(_service)}/credential/token"
end
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
Expand Down

0 comments on commit 3f6c1bf

Please sign in to comment.