Class: Philae::EtcdClusterProbe

Inherits:
CollectionProbe show all
Defined in:
lib/philae/etcd_cluster_probe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CollectionProbe

#check

Constructor Details

#initialize(name, endpoints, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil) ⇒ EtcdClusterProbe

Returns a new instance of EtcdClusterProbe.

Parameters:

  • read_timeout (Integer) (defaults to: 1)

    Timeout in second for the HTTP request

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/philae/etcd_cluster_probe.rb', line 9

def initialize(name, endpoints, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil)
  raise ArgumentError, 'empty endpoints' if endpoints.nil? || endpoints.empty?

  @etcd_probes = endpoints.map do |endpoint|
    endpoint_uri = URI(endpoint)
    next EtcdProbe.new(
      "#{name}-#{endpoint_uri.host}-#{endpoint_uri.port}",
      endpoint_uri.host,
      endpoint_uri.port,
      read_timeout: read_timeout, cacert: cacert,
      ssl_cert: ssl_cert, ssl_key: ssl_key,
    )
  end

  @name = name
end

Instance Attribute Details

#etcd_probesObject (readonly)

Returns the value of attribute etcd_probes.



6
7
8
# File 'lib/philae/etcd_cluster_probe.rb', line 6

def etcd_probes
  @etcd_probes
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/philae/etcd_cluster_probe.rb', line 6

def name
  @name
end

Instance Method Details

#probesObject



26
27
28
# File 'lib/philae/etcd_cluster_probe.rb', line 26

def probes
  return @etcd_probes
end