Class: FaradayMiddleware::AwsSigV4

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_aws-elasticsearch-service.rb

Overview

monkey patch

Instance Method Summary collapse

Constructor Details

#initialize(app, options = nil) ⇒ AwsSigV4

Returns a new instance of AwsSigV4.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/fluent/plugin/out_aws-elasticsearch-service.rb', line 208

def initialize(app, options = nil)
  super(app)

  credentials = options.fetch(:credentials)
  service_name = options.fetch(:service_name)
  region = options.fetch(:region)
  @signer =
    begin
      if credentials.is_a?(Proc)
        signer = lambda do
          Aws::Sigv4::Signer.new(service: service_name, region: region, credentials: credentials.call)
        end
        def signer.sign_request(req)
          self.call.sign_request(req)
        end
        signer
      else
        Aws::Sigv4::Signer.new(service: service_name, region: region, credentials: credentials)
      end
    end

  @net_http = app.is_a?(Faraday::Adapter::NetHttp)
end

Instance Method Details

#initialize_origin_from_aws_elasticsearch_service_outputObject



206
# File 'lib/fluent/plugin/out_aws-elasticsearch-service.rb', line 206

alias :initialize_origin_from_aws_elasticsearch_service_output :initialize