Class: Elasticsearch::Transport::AWS4
- Inherits:
-
Transport::HTTP::Faraday
- Object
- Transport::HTTP::Faraday
- Elasticsearch::Transport::AWS4
- Defined in:
- lib/elasticsearch/transport/aws4.rb
Instance Method Summary collapse
-
#initialize(arguments = {}, &block) ⇒ AWS4
constructor
A new instance of AWS4.
- #perform_request(method, path, params = {}, body = nil) ⇒ Object
Constructor Details
#initialize(arguments = {}, &block) ⇒ AWS4
Returns a new instance of AWS4.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/elasticsearch/transport/aws4.rb', line 17 def initialize(arguments = {}, &block) super arguments @signer = Aws::Signers::V4.new( Aws::Credentials.new( arguments[:options][:aws4][:key], arguments[:options][:aws4][:secret] ), "es", arguments[:options][:aws4][:region] ) end |
Instance Method Details
#perform_request(method, path, params = {}, body = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elasticsearch/transport/aws4.rb', line 30 def perform_request(method, path, params = {}, body = nil) Elasticsearch::Transport::Transport::Base.instance_method(:perform_request).bind(self).call(method, path, params, body) do |connection, url| connection.connection.run_request( method.downcase.to_sym, url, (body ? __convert_to_json(body) : ""), {} ) do |request| @signer.sign(request) end end end |