Class: Schked::LivenessProbeConfig
- Inherits:
-
Object
- Object
- Schked::LivenessProbeConfig
- Defined in:
- lib/schked/liveness_probe.rb
Constant Summary collapse
- DEFAULTS =
{ enabled: false, bind: "0.0.0.0", port: 8080, path: "/healthz", heartbeat_interval: 5, heartbeat_threshold: 15 }.freeze
Instance Attribute Summary collapse
-
#bind ⇒ Object
readonly
Returns the value of attribute bind.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#heartbeat_interval ⇒ Object
readonly
Returns the value of attribute heartbeat_interval.
-
#heartbeat_threshold ⇒ Object
readonly
Returns the value of attribute heartbeat_threshold.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ LivenessProbeConfig
constructor
A new instance of LivenessProbeConfig.
- #to_h ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ LivenessProbeConfig
Returns a new instance of LivenessProbeConfig.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/schked/liveness_probe.rb', line 19 def initialize(attrs = {}) attrs = DEFAULTS.merge(attrs) @enabled = !!attrs[:enabled] @bind = validate_bind(attrs[:bind]) @port = validate_port(attrs[:port]) @path = validate_path(attrs[:path]) @heartbeat_interval = validate_positive_integer(attrs[:heartbeat_interval], :heartbeat_interval) @heartbeat_threshold = validate_threshold(attrs[:heartbeat_threshold], attrs[:heartbeat_interval]) end |
Instance Attribute Details
#bind ⇒ Object (readonly)
Returns the value of attribute bind.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def bind @bind end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def enabled @enabled end |
#heartbeat_interval ⇒ Object (readonly)
Returns the value of attribute heartbeat_interval.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def heartbeat_interval @heartbeat_interval end |
#heartbeat_threshold ⇒ Object (readonly)
Returns the value of attribute heartbeat_threshold.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def heartbeat_threshold @heartbeat_threshold end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/schked/liveness_probe.rb', line 8 def port @port end |
Instance Method Details
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/schked/liveness_probe.rb', line 30 def to_h { enabled: enabled, bind: bind, port: port, path: path, heartbeat_interval: heartbeat_interval, heartbeat_threshold: heartbeat_threshold } end |