Module: LogStash::PluginMixins::AwsConfig::V2

Included in:
Inputs::S3SNSSQS
Defined in:
lib/logstash/plugin_mixins/aws_config/v2.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
# File 'lib/logstash/plugin_mixins/aws_config/v2.rb', line 5

def self.included(base)
  base.extend(self)
  base.send(:include, LogStash::PluginMixins::AwsConfig::Generic)
end

Instance Method Details

#aws_options_hashObject



11
12
13
14
15
16
17
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
# File 'lib/logstash/plugin_mixins/aws_config/v2.rb', line 11

def aws_options_hash
  opts = {}

  opts[:http_proxy] = @proxy_uri if @proxy_uri

  if @role_arn
    credentials = assume_role(opts.dup)
    opts[:credentials] = credentials
  else
    credentials = aws_credentials
    opts[:credentials] = credentials if credentials
  end

  if self.respond_to?(:aws_service_endpoint)
    # used by CloudWatch to basically do the same as bellow (returns { region: region })
    opts.merge!(self.aws_service_endpoint(@region))
  else
    # NOTE: setting :region works with the aws sdk (resolves correct endpoint)
    opts[:region] = @region
  end

  opts[:endpoint] = @endpoint unless @endpoint.nil?

  if respond_to?(:additional_settings)
    opts = symbolize_keys_and_cast_true_false(additional_settings).merge(opts)
  end

  if @use_aws_bundled_ca
    aws_core_library = Gem.loaded_specs['aws-sdk-core']&.full_gem_path or fail("AWS Core library not available")
    opts[:ssl_ca_bundle] = File.expand_path('ca-bundle.crt', aws_core_library).tap do |aws_core_ca_bundle|
      fail("AWS Core CA bundle not found") unless File.exists?(aws_core_ca_bundle)
    end
  end

  return opts
end