Module: Fluent::KinesisHelper::Initialize

Included in:
Fluent::KinesisHelper
Defined in:
lib/fluent/plugin/kinesis_helper/initialize.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fluent/plugin/kinesis_helper/initialize.rb', line 18

def initialize
  super
  class << self
    define_method('log') { $log } unless method_defined?(:log)

    require 'aws-sdk'
    require 'fluent/plugin/kinesis_helper/format'
    require 'fluent/plugin/kinesis_helper/client'
    require 'fluent/plugin/kinesis_helper/credentials'
    include Format, Client, Credentials

    case
    when api?
      require 'fluent/plugin/kinesis_helper/api'
      include API
    when kpl?
      require 'fluent/plugin/kinesis_helper/kpl'
      require 'fluent/version'
      if Gem::Version.new(Fluent::VERSION) < Gem::Version.new('0.12.20')
        # Backport from https://github.com/fluent/fluentd/pull/757
        require 'fluent/plugin/patched_detach_process_impl'
        include PatchedDetachProcessImpl
      end
      include KPL
    end

    def request_type
      self.class.request_type
    end

    def api?
      self.class.api?
    end

    def kpl?
      self.class.kpl?
    end
  end
end