Sha256: a416905e892e4fb99c1f7e62528a39a35ddecac3600c5235d506a2b656dc006d

Contents?: true

Size: 1.75 KB

Versions: 15

Compression:

Stored size: 1.75 KB

Contents

# encoding: utf-8
require "logstash/namespace"
require "logstash/logging"
require "logstash/util/loggable"
require "erb"

require_relative "elasticsearch_config"
require_relative "kibana_config"
require_relative "logstash_config"

module LogStash module Modules class Scaffold
  include LogStash::Util::Loggable

  attr_reader :directory, :module_name, :kibana_version_parts
  attr_reader :kibana_configuration, :logstash_configuration, :elasticsearch_configuration

  def initialize(name, directory)
    @module_name = name
    @directory = directory  # this is the 'configuration folder in the GEM root.'
    @kibana_version_parts = "6.0.0".split('.') # this is backup in case kibana client fails to connect
    logger.info("Initializing module", :module_name => name, :directory => directory)
  end

  def add_kibana_version(version_parts)
    @kibana_version_parts = version_parts
  end

  def import(import_engine, kibana_import_engine)
    @elasticsearch_configuration.resources.each do |resource|
      import_engine.put(resource)
    end
    @kibana_configuration.resources.each do |resource|
      kibana_import_engine.put(resource)
    end
  end

  def with_settings(module_settings)
    @logstash_configuration = LogStashConfig.new(self, module_settings)
    @kibana_configuration = KibanaConfig.new(self, module_settings)
    @elasticsearch_configuration = ElasticsearchConfig.new(self, module_settings)
    self
  end

  def config_string()
    # settings should be set earlier by the caller.
    # settings should be the subset from the YAML file with a structure like
    # {"name" => "plugin name", "k1" => "v1", "k2" => "v2"}, etc.
    return nil if @logstash_configuration.nil?
    @logstash_configuration.config_string
  end
end end end # class LogStash::Modules::Scaffold

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
logstash-core-6.2.4-java lib/logstash/modules/scaffold.rb
logstash-core-6.2.3-java lib/logstash/modules/scaffold.rb
logstash-core-6.1.4-java lib/logstash/modules/scaffold.rb
logstash-core-6.2.2-java lib/logstash/modules/scaffold.rb
logstash-core-6.2.1-java lib/logstash/modules/scaffold.rb
logstash-core-6.2.0-java lib/logstash/modules/scaffold.rb
logstash-core-6.1.3-java lib/logstash/modules/scaffold.rb
logstash-core-6.1.2-java lib/logstash/modules/scaffold.rb
logstash-core-6.1.1-java lib/logstash/modules/scaffold.rb
logstash-core-6.1.0-java lib/logstash/modules/scaffold.rb
logstash-core-6.0.1-java lib/logstash/modules/scaffold.rb
logstash-core-6.0.0-java lib/logstash/modules/scaffold.rb
logstash-core-6.0.0.rc2-java lib/logstash/modules/scaffold.rb
logstash-core-6.0.0.rc1-java lib/logstash/modules/scaffold.rb
logstash-core-6.0.0.beta2-java lib/logstash/modules/scaffold.rb