Class: AwsV4Signer

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/logstash/outputs/amazon_es/aws_v4_signer_impl.rb

Defined Under Namespace

Classes: Request

Instance Method Summary collapse

Constructor Details

#initialize(app, options = nil) ⇒ AwsV4Signer

Returns a new instance of AwsV4Signer.



39
40
41
42
43
# File 'lib/logstash/outputs/amazon_es/aws_v4_signer_impl.rb', line 39

def initialize(app, options = nil)
  super(app)
  @options = options
  @net_http = app.is_a?(Faraday::Adapter::NetHttp)
end

Instance Method Details

#call(env) ⇒ Object



45
46
47
48
49
50
# File 'lib/logstash/outputs/amazon_es/aws_v4_signer_impl.rb', line 45

def call(env)
  normalize_for_net_http!(env)
  req = Request.new(env)
  signer().sign(req)
  @app.call(env)
end

#signerObject



32
33
34
35
36
37
# File 'lib/logstash/outputs/amazon_es/aws_v4_signer_impl.rb', line 32

def signer
  credentials = @options.fetch(:credentials)
  service_name = @options.fetch(:service_name)
  region = @options.fetch(:region)
  Aws::Signers::V4.new(credentials, service_name, region)
end