hlcc 2.0.0-beta2+pre1
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
utils.nomad_consul_helper.ConsulClient Class Reference

Dummy Consul client wrapper. More...

Public Member Functions

def __init__ (self, host=None, port=None)
 Simple consul client.
 
def get_server (self)
 Get consul server.
 
def get_ip_and_port (self, service)
 Get service (IP_address,port) of the given service if in consul db.
 
def get_uri (self, service, cii_srv='zpb.rr')
 Get CII URL.
 
def get_if_uri (self, service, iface, cii_srv='zpb.rr')
 Get CII URL for an interface on the given service.
 

Protected Attributes

 _cons
 

Detailed Description

Dummy Consul client wrapper.

Constructor & Destructor Documentation

◆ __init__()

def utils.nomad_consul_helper.ConsulClient.__init__ (   self,
  host = None,
  port = None 
)

Simple consul client.

The constructor connects to Consul on the given host and port. If the host is None (default), it looks first for the CONSUL_HTTP_ADDR environment variable and, if this is not set, uses the 127.0.0.1 localhost IP address. If the port is None (default), it looks first for the CONSUL_HTTP_ADDR environment variable and, if this is not set, uses the 8500 default port. CONSUL_HTTP_ADDR is defined as the URL for consul in the format: http://<host>:<port> Notice that is port != None, a value defined in CONSUL_HTTP_ADDR is overridden by port.

Member Function Documentation

◆ get_if_uri()

def utils.nomad_consul_helper.ConsulClient.get_if_uri (   self,
  service,
  iface,
  cii_srv = 'zpb.rr' 
)

Get CII URL for an interface on the given service.

◆ get_ip_and_port()

def utils.nomad_consul_helper.ConsulClient.get_ip_and_port (   self,
  service 
)

Get service (IP_address,port) of the given service if in consul db.

ToDo GCH 20230202: may be port is not a good name, since we return also the IP

◆ get_server()

def utils.nomad_consul_helper.ConsulClient.get_server (   self)

Get consul server.

◆ get_uri()

def utils.nomad_consul_helper.ConsulClient.get_uri (   self,
  service,
  cii_srv = 'zpb.rr' 
)

Get CII URL.

Member Data Documentation

◆ _cons

utils.nomad_consul_helper.ConsulClient._cons
protected

The documentation for this class was generated from the following file: