mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
put docgen code back in, fixed region & ssl configs
This commit is contained in:
parent
174ec361f8
commit
1f5febc427
3 changed files with 28 additions and 8 deletions
|
@ -162,6 +162,13 @@ class LogStashConfigDocGenerator
|
|||
parse(File.new(File.join(File.dirname(file), "threadable.rb"), "r").read)
|
||||
end
|
||||
|
||||
if code =~ /include LogStash::PluginMixins/
|
||||
mixin = code.gsub(/.*include LogStash::PluginMixins::(\w+)\s.*/m, '\1')
|
||||
mixin.gsub!(/(.)([A-Z])/, '\1_\2')
|
||||
mixin.downcase!
|
||||
parse(File.new(File.join(File.dirname(file), "..", "plugin_mixins", "#{mixin}.rb")).read)
|
||||
end
|
||||
|
||||
parse(code)
|
||||
|
||||
puts "Generating docs for #{file}"
|
||||
|
|
|
@ -154,6 +154,13 @@ class LogStash::Outputs::CloudWatch < LogStash::Outputs::Base
|
|||
# add_field => [ "CW_dimensions", "prod" ]
|
||||
config :field_dimensions, :validate => :string, :default => "CW_dimensions"
|
||||
|
||||
public
|
||||
def aws_service_endpoint(region)
|
||||
return {
|
||||
:cloud_watch_endpoint => "monitoring.#{region}.amazonaws.com"
|
||||
}
|
||||
end
|
||||
|
||||
public
|
||||
def register
|
||||
require "thread"
|
||||
|
|
|
@ -32,15 +32,14 @@ module LogStash::PluginMixins::AwsConfig
|
|||
config :secret_access_key, :validate => :string
|
||||
|
||||
# Should we require (true) or disable (false) using SSL for communicating with the AWS API
|
||||
# If this option is not provided, the AWS SDK for Ruby default will be used
|
||||
config :use_ssl, :validate => :boolean
|
||||
# The AWS SDK for Ruby defaults to SSL so we preserve that
|
||||
config :use_ssl, :validate => :boolean, :default => true
|
||||
|
||||
# Path to YAML file containing a hash of AWS credentials.
|
||||
# This file will only be loaded if `access_key_id` and
|
||||
# `secret_access_key` aren't set. The contents of the
|
||||
# file should look like this:
|
||||
#
|
||||
# ---
|
||||
# :access_key_id: "12345"
|
||||
# :secret_access_key: "54321"
|
||||
#
|
||||
|
@ -67,12 +66,19 @@ module LogStash::PluginMixins::AwsConfig
|
|||
opts[:secret_access_key] = @secret_access_key
|
||||
end
|
||||
|
||||
if @use_ssl
|
||||
opts[:use_ssl] = @use_ssl
|
||||
end
|
||||
|
||||
opts[:region] = @region
|
||||
opts[:use_ssl] = @use_ssl
|
||||
|
||||
# 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
|
||||
opts.merge!(self.aws_service_endpoint(@region))
|
||||
|
||||
return opts
|
||||
end # def aws_options_hash
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue