Class: Nonnative::ConfigurationServiceReadiness

Inherits:
Object
  • Object
show all
Defined in:
lib/nonnative/configuration_service_readiness.rb

Overview

Service readiness check configuration.

Service readiness is for externally managed dependencies. The TCP target should be the dependency endpoint that must be reachable before managed servers and processes start.

Constant Summary collapse

KINDS =
%w[tcp].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ void

Parameters:

  • value (Hash, #to_h)

    readiness check attributes



22
23
24
25
26
27
28
29
30
# File 'lib/nonnative/configuration_service_readiness.rb', line 22

def initialize(value)
  attributes = value.to_h.transform_keys(&:to_sym)

  @kind = attributes[:kind]&.to_s
  @host = attributes[:host]
  @port = attributes[:port]

  validate!
end

Instance Attribute Details

#hostString (readonly)

Returns readiness target host.

Returns:

  • (String)

    readiness target host



15
16
17
# File 'lib/nonnative/configuration_service_readiness.rb', line 15

def host
  @host
end

#kindString (readonly)

Returns readiness check kind.

Returns:

  • (String)

    readiness check kind



12
13
14
# File 'lib/nonnative/configuration_service_readiness.rb', line 12

def kind
  @kind
end

#portInteger (readonly)

Returns readiness target port.

Returns:

  • (Integer)

    readiness target port



18
19
20
# File 'lib/nonnative/configuration_service_readiness.rb', line 18

def port
  @port
end

Instance Method Details

#tcp?Boolean

Returns whether this is a TCP readiness check.

Returns:

  • (Boolean)


35
36
37
# File 'lib/nonnative/configuration_service_readiness.rb', line 35

def tcp?
  kind == 'tcp'
end