Module: Splunker::Configuration
- Included in:
- Client
- Defined in:
- lib/splunker/configuration.rb
Constant Summary collapse
- MUTABLE_OPTION_KEYS =
[:endpoint, :username, :password, :app, :ssl_verify]
- MUTABLE_IMPLEMENTED_OPTION_KEYS =
These options are mutable, but their setters are manually implemented
[:auth_mode]
- READONLY_OPTION_KEYS =
[:request_handler]
- DEFAULT_ENDPOINT =
"https://localhost:8089"
- DEFAULT_APP_NAME =
"search"
- DEFAULT_SSL_VERIFY =
true
Class Method Summary collapse
Instance Method Summary collapse
- #auth_mode=(mode) ⇒ Object
- #configuration ⇒ Object
- #configure {|_self| ... } ⇒ Object
- #reset ⇒ Object
Class Method Details
.included(base) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/splunker/configuration.rb', line 12 def self.included(base) base.class_eval do attr_accessor *MUTABLE_OPTION_KEYS attr_reader *MUTABLE_IMPLEMENTED_OPTION_KEYS attr_reader *READONLY_OPTION_KEYS end end |
Instance Method Details
#auth_mode=(mode) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/splunker/configuration.rb', line 30 def auth_mode=(mode) @request_handler = if mode.nil? nil else Auth.create(mode, self) end end |
#configuration ⇒ Object
24 25 26 27 28 |
# File 'lib/splunker/configuration.rb', line 24 def configuration MUTABLE_OPTION_KEYS.inject({}) do |conf,key| conf.merge!(key=>self.send(key)) end end |
#configure {|_self| ... } ⇒ Object
20 21 22 |
# File 'lib/splunker/configuration.rb', line 20 def configure yield self end |
#reset ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/splunker/configuration.rb', line 38 def reset self.endpoint = DEFAULT_ENDPOINT self.app = DEFAULT_APP_NAME self.ssl_verify = DEFAULT_SSL_VERIFY self.auth_mode = nil @username = @password = nil self.request_handler.reset unless self.request_handler.nil? end |