Sha256: d05d8a60d8250deddad1456cd5a8bf5927befd8e851e0aed482ae556aa2f762a
Contents?: true
Size: 1.05 KB
Versions: 21
Compression:
Stored size: 1.05 KB
Contents
# # DESCRIPTION: # Common helper methods # # DEPENDENCIES: # gem: elasticsearch # gem: sensu-plugin # # USAGE: # # NOTES: # # LICENSE: # Brendan Gibat <brendan.gibat@gmail.com> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require_relative 'elasticsearch-query.rb' module ElasticsearchCommon include ElasticsearchQuery def initialize super() end def client transport_class = nil if config[:transport] == 'AWS' transport_class = Elasticsearch::Transport::Transport::HTTP::AWS end host = { host: config[:host], port: config[:port], request_timeout: config[:timeout], scheme: config[:scheme] } if !config[:user].nil? && !config[:password].nil? host[:user] = config[:user] host[:password] = config[:password] host[:scheme] = 'https' unless config[:scheme] end @client ||= Elasticsearch::Client.new(transport_class: transport_class, hosts: [host], region: config[:region]) end end
Version data entries
21 entries across 21 versions & 1 rubygems