Module: Splunk::Pickaxe

Defined in:
lib/splunk/pickaxe.rb,
lib/splunk/pickaxe/cli.rb,
lib/splunk/pickaxe/client.rb,
lib/splunk/pickaxe/config.rb,
lib/splunk/pickaxe/objects.rb,
lib/splunk/pickaxe/version.rb,
lib/splunk/pickaxe/objects/tags.rb,
lib/splunk/pickaxe/objects/alerts.rb,
lib/splunk/pickaxe/objects/reports.rb,
lib/splunk/pickaxe/objects/dashboards.rb,
lib/splunk/pickaxe/objects/eventtypes.rb,
lib/splunk/pickaxe/objects/field_extractions.rb

Defined Under Namespace

Classes: Alerts, CLI, Client, Config, Dashboards, EventTypes, FieldExtractions, Objects, Reports, Tags

Constant Summary collapse

VERSION =
'2.0.0'

Class Method Summary collapse

Class Method Details

.configure(environment, username, password, execution_path = Dir.getwd) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/splunk/pickaxe.rb', line 10

def self.configure(environment, username, password, execution_path = Dir.getwd)
  config = Config.load execution_path

  raise "Unknown environment [#{environment}]. Expected #{config.environments.keys}" unless config.environments.key?(environment)

  uri = URI(config.environments[environment])

  puts "Connecting to splunk [#{uri}]"
  service = Splunk.connect(
    scheme: uri.scheme.to_sym,
    host: uri.host,
    port: uri.port,
    username: username,
    password: password,
    namespace: config.namespace
  )

  Client.new service, environment.downcase, config
end