Class: Sensu::Settings::Validator

Inherits:
Object
  • Object
show all
Includes:
Rules, Validators
Defined in:
lib/sensu/settings/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sensu::Settings::Validators::Transport

#validate_transport

Methods included from Sensu::Settings::Validators::API

#validate_api, #validate_api_authentication

Methods included from Sensu::Settings::Validators::Client

#validate_client, #validate_client_keepalive, #validate_client_keepalive_handlers, #validate_client_keepalive_thresholds, #validate_client_redact, #validate_client_safe_mode, #validate_client_socket, #validate_client_subscriptions

Methods included from Sensu::Settings::Validators::Handler

#validate_handler, #validate_handler_filtering, #validate_handler_severities, #validate_handler_type, #validate_pipe_handler, #validate_set_handler, #validate_socket_handler, #validate_transport_handler

Methods included from Sensu::Settings::Validators::Mutator

#validate_mutator

Methods included from Sensu::Settings::Validators::Filter

#validate_filter

Methods included from Sensu::Settings::Validators::Check

#validate_check, #validate_check_flap_detection, #validate_check_handling, #validate_check_scheduling

Methods included from Sensu::Settings::Validators::Subdue

#validate_subdue, #validate_subdue_days, #validate_subdue_exceptions, #validate_subdue_time

Methods included from Rules

#either_are_set?, #items_must_be_strings, #must_be_a_hash, #must_be_a_hash_if_set, #must_be_a_numeric, #must_be_a_numeric_if_set, #must_be_a_string, #must_be_a_string_if_set, #must_be_an_array, #must_be_an_array_if_set, #must_be_an_integer, #must_be_an_integer_if_set, #must_be_boolean_if_set, #must_be_either, #must_be_either_if_set, #must_be_time, #must_match_regex

Constructor Details

#initializeValidator


15
16
17
# File 'lib/sensu/settings/validator.rb', line 15

def initialize
  @failures = []
end

Instance Attribute Details

#failuresObject (readonly)

Returns the value of attribute failures


13
14
15
# File 'lib/sensu/settings/validator.rb', line 13

def failures
  @failures
end

Instance Method Details

#reset!Object Also known as: reset


36
37
38
39
40
# File 'lib/sensu/settings/validator.rb', line 36

def reset!
  failure_count = @failures.size
  @failures = []
  failure_count
end

#run(settings, service = nil) ⇒ Array

Run the validator.


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sensu/settings/validator.rb', line 24

def run(settings, service=nil)
  validate_categories(settings)
  validate_transport(settings[:transport])
  case service
  when "client"
    validate_client(settings[:client])
  when "api"
    validate_api(settings[:api])
  end
  @failures
end