Did you know ... Search Documentation:
Pack consul_client -- prolog/consul_client.pl
PublicShow source

An interface to consul:

The module requires a local consul agent running on the default port.

- Can Bican
See also
- https://www.consul.io/
- BSD 2-clause
 consul_services(-Services:list) is semidet
Lists services registered on consul. This only lists the service names, further querying should be performed by consul_service/2.
Services- List of strings, all registered services on the consul agent.
 consul_service(+Service:atom, -Properties:dict) is semidet
Lists properties of a service registered on consul. Result is a dict of properties:
Service- the name of the service, as received from consul_services/1.
Properties- the properties of the queried service, as a dict of:
  • host: IP address of the service.
  • port: Port of the service.
  • tags: Tags associated with the service, as a list.
 read_consul_key(+Key:atom, -Value:atom) is semidet
Same as read_consul_key(Key, Value, [as(atom)]).
See also
- read_consul_key/3
 read_consul_key(+Key:atom, -Value:atom, +Options:options) is semidet
Reads a key from consul kv database
Key- Name of the key to query for.
Value- Value of the queried key.
Options- Provided options are:
  • as(+Type) Type of the value. Type can be list, string, number or atom.
 delete_consul_key(+Key:atom) is det
Deletes a key from consul kv database
Key- name of the key to delete
 update_consul_key(+Key:atom, +Value:atom) is det
Creates or updates a key in consul kv database
Key- name of the key to update
Value- new value of the key
 register_consul_service(+Service:atom, +Host:atom, +Port:integer, +Tags:list) is det
Registers a service in consul or updates the existing service
Service- service name to register
Host- IP address of the service
Port- port of the service
Tags- tags associated with the service
 deregister_consul_service(+Service:atom) is det
Deregisters a service in consul
Service- service name to deregister