Class: Sensu::Client::Validators::Check
- Inherits:
-
Object
- Object
- Sensu::Client::Validators::Check
- Includes:
- Settings::Rules, Settings::Validators::Check
- Defined in:
- lib/sensu/client/validators/check.rb
Instance Attribute Summary collapse
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
Instance Method Summary collapse
-
#initialize ⇒ Check
constructor
A new instance of Check.
-
#valid?(check) ⇒ TrueClass, FalseClass
Determine if a check definition is valid.
Constructor Details
#initialize ⇒ Check
Returns a new instance of Check.
14 15 16 |
# File 'lib/sensu/client/validators/check.rb', line 14 def initialize @failures = [] end |
Instance Attribute Details
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
12 13 14 |
# File 'lib/sensu/client/validators/check.rb', line 12 def failures @failures end |
Instance Method Details
#valid?(check) ⇒ TrueClass, FalseClass
Determine if a check definition is valid.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/sensu/client/validators/check.rb', line 22 def valid?(check) must_be_a_string(check[:output]) || invalid(check, "check output must be a string") must_be_an_integer(check[:status]) || invalid(check, "check status must be an integer") must_be_an_integer(check[:executed]) || invalid(check, "check executed timestamp must be an integer") validate_check_name(check) validate_check_handling(check) validate_check_aggregate(check) validate_check_flap_detection(check) validate_check_truncate_output(check) validate_check_source(check) if check[:source] validate_check_ttl(check) if check[:ttl] @failures.empty? end |