Class: Kumonos::Envoy::DiscoverService

Inherits:
Struct
  • Object
show all
Defined in:
lib/kumonos/envoy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clusterObject

Returns the value of attribute cluster

Returns:

  • (Object)

    the current value of cluster



166
167
168
# File 'lib/kumonos/envoy.rb', line 166

def cluster
  @cluster
end

#refresh_delay_msObject

Returns the value of attribute refresh_delay_ms

Returns:

  • (Object)

    the current value of refresh_delay_ms



166
167
168
# File 'lib/kumonos/envoy.rb', line 166

def refresh_delay_ms
  @refresh_delay_ms
end

Class Method Details

.build(h) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/kumonos/envoy.rb', line 168

def build(h)
  lb = h.fetch('lb')
  host, port = lb.split(':')
  cluster = Cluster.new(
    lb.split(':').first,
    'STRICT_DNS',
    h.fetch('tls'),
    h.fetch('connect_timeout_ms'),
    'ROUND_ROBIN',
    [{ 'socket_address' => { 'address' => host, 'port_value' => Integer(port) } }]
  )
  new(h.fetch('refresh_delay_ms'), cluster)
end

Instance Method Details

#to_hObject



183
184
185
186
187
# File 'lib/kumonos/envoy.rb', line 183

def to_h
  h = super
  h[:cluster] = cluster.to_h
  h
end