Class: Nonnative::ConfigurationReadiness

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

Overview

Readiness check configuration for a managed process.

Readiness is optional. When present, each check declares a kind and explicit endpoint details to poll after TCP readiness succeeds. HTTP checks issue a plain unauthenticated GET and accept a final 2xx response. gRPC checks use the standard health Check over an insecure channel and accept only SERVING. Non-ready results are retried until the process timeout elapses.

Constant Summary collapse

KINDS =
%w[http grpc].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ConfigurationReadiness



26
27
28
29
30
31
32
33
34
# File 'lib/nonnative/configuration_readiness.rb', line 26

def initialize(value)
  attributes = value.respond_to?(:to_h) ? value.to_h : value
  self.kind = attribute(attributes, :kind)&.to_s
  self.port = attribute(attributes, :port)
  self.path = attribute(attributes, :path)
  self.service = attribute(attributes, :service)

  validate!
end

Instance Attribute Details

#kindString



14
15
16
# File 'lib/nonnative/configuration_readiness.rb', line 14

def kind
  @kind
end

#pathString



20
21
22
# File 'lib/nonnative/configuration_readiness.rb', line 20

def path
  @path
end

#portInteger



17
18
19
# File 'lib/nonnative/configuration_readiness.rb', line 17

def port
  @port
end

#serviceString



23
24
25
# File 'lib/nonnative/configuration_readiness.rb', line 23

def service
  @service
end

Instance Method Details

#grpc?Boolean



40
41
42
# File 'lib/nonnative/configuration_readiness.rb', line 40

def grpc?
  kind == 'grpc'
end

#http?Boolean



36
37
38
# File 'lib/nonnative/configuration_readiness.rb', line 36

def http?
  kind == 'http'
end