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

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
# File 'lib/logstash/plugin_mixins/aws_config/v2.rb', line 11

def aws_options_hash
  opts = {}

  if @access_key_id.is_a?(NilClass) ^ @secret_access_key.is_a?(NilClass)
    @logger.warn("Likely config error: Only one of access_key_id or secret_access_key was provided but not both.")
  end

  opts[:credentials] = credentials if credentials

  opts[:http_proxy] = @proxy_uri if @proxy_uri

  # The AWS SDK for Ruby doesn't know how to make an endpoint hostname from a region
  # for example us-west-1 -> foosvc.us-west-1.amazonaws.com
  # So our plugins need to know how to generate their endpoints from a region
  # Furthermore, they need to know the symbol required to set that value in the AWS SDK
  # Classes using this module must implement aws_service_endpoint(region:string)
  # which must return a hash with one key, the aws sdk for ruby config symbol of the service
  # endpoint, which has a string value of the service endpoint hostname
  # for example, CloudWatch, { :cloud_watch_endpoint => "monitoring.#{region}.amazonaws.com" }
  # For a list, see https://github.com/aws/aws-sdk-ruby/blob/master/lib/aws/core/configuration.rb
  if self.respond_to?(:aws_service_endpoint)
    opts.merge!(self.aws_service_endpoint(@region))
  else
    opts.merge!({ :region => @region })
  end

  return opts
end