Exemple #1
0
 def __init__(self,
              addr=DEFAULT_ADDR,
              host=DEFAULT_HOST,
              port=DEFAULT_PORT,
              datacenter=None,
              token=DEFAULT_TOKEN,
              scheme=DEFAULT_SCHEME,
              adapter=None,
              verify=True,
              cert=None,
              timeout=None):
     """Create a new instance of the Consul class"""
     base_uri = self._base_uri(addr=addr,
                               scheme=scheme,
                               host=host,
                               port=port)
     self._adapter = adapter() if adapter else adapters.Request(
         timeout=timeout, verify=verify, cert=cert)
     self._acl = api.ACL(base_uri, self._adapter, datacenter, token)
     self._agent = api.Agent(base_uri, self._adapter, datacenter, token)
     self._catalog = api.Catalog(base_uri, self._adapter, datacenter, token)
     self._event = api.Event(base_uri, self._adapter, datacenter, token)
     self._health = api.Health(base_uri, self._adapter, datacenter, token)
     self._coordinate = api.Coordinate(base_uri, self._adapter, datacenter,
                                       token)
     self._kv = api.KV(base_uri, self._adapter, datacenter, token)
     self._session = api.Session(base_uri, self._adapter, datacenter, token)
     self._status = api.Status(base_uri, self._adapter, datacenter, token)
     self._lock = api.Lock(base_uri, self._adapter, self._session,
                           datacenter, token)
Exemple #2
0
 def __init__(self,
              host=DEFAULT_HOST,
              port=DEFAULT_PORT,
              datacenter=None,
              token=None,
              scheme=DEFAULT_SCHEME,
              adapter=None):
     """Create a new instance of the Consul class"""
     base_uri = self._base_uri(scheme, host, port)
     self._adapter = adapter() if adapter else adapters.Request()
     self._acl = api.ACL(base_uri, self._adapter, datacenter, token)
     self._agent = api.Agent(base_uri, self._adapter, datacenter, token)
     self._catalog = api.Catalog(base_uri, self._adapter, datacenter, token)
     self._event = api.Event(base_uri, self._adapter, datacenter, token)
     self._health = api.Health(base_uri, self._adapter, datacenter, token)
     self._kv = api.KV(base_uri, self._adapter, datacenter, token)
     self._session = api.Session(base_uri, self._adapter, datacenter, token)
     self._status = api.Status(base_uri, self._adapter, datacenter, token)