Class: LogStash::Outputs::ElasticSearch::LicenseChecker
- Inherits:
-
Object
- Object
- LogStash::Outputs::ElasticSearch::LicenseChecker
- Defined in:
- lib/logstash/outputs/elasticsearch/license_checker.rb
Instance Method Summary collapse
-
#appropriate_license?(pool, url) ⇒ Boolean
Figure out if the provided license is appropriate or not The appropriate_license? methods is the method called from LogStash::Outputs::ElasticSearch::HttpClient::Pool#healthcheck!.
- #extract_license(license) ⇒ Object
-
#initialize(logger) ⇒ LicenseChecker
constructor
A new instance of LicenseChecker.
- #license_status(license) ⇒ Object
Constructor Details
#initialize(logger) ⇒ LicenseChecker
Returns a new instance of LicenseChecker.
4 5 6 |
# File 'lib/logstash/outputs/elasticsearch/license_checker.rb', line 4 def initialize(logger) @logger = logger end |
Instance Method Details
#appropriate_license?(pool, url) ⇒ Boolean
Figure out if the provided license is appropriate or not The appropriate_license? methods is the method called from LogStash::Outputs::ElasticSearch::HttpClient::Pool#healthcheck!
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/logstash/outputs/elasticsearch/license_checker.rb', line 13 def appropriate_license?(pool, url) license = extract_license(pool.get_license(url)) case license_status(license) when 'active' true when nil warn_no_license(url) false else # 'invalid', 'expired' warn_invalid_license(url, license) true end end |
#extract_license(license) ⇒ Object
30 31 32 |
# File 'lib/logstash/outputs/elasticsearch/license_checker.rb', line 30 def extract_license(license) license.fetch("license", NO_LICENSE) end |
#license_status(license) ⇒ Object
34 35 36 |
# File 'lib/logstash/outputs/elasticsearch/license_checker.rb', line 34 def license_status(license) license.fetch("status", nil) end |