AOSharedServiceLibrary
Public Member Functions | List of all members
ConsulInterface Class Referenceabstract

The Consul Administrator, who handles configuration & service discovery. More...

#include <consul_interface.h>

Public Member Functions

virtual std::string base64_decode (std::string const &encoded_string)=0
 Convinience Method for base64 decoding. More...
 
virtual AOSSL::StringBufferbase64_decode_safe (std::string const &encoded_string)=0
 Convinience Method for base64 decoding. More...
 
virtual bool register_service (const ServiceInterface &s)=0
 Register the Service. More...
 
virtual bool deregister_service (const ServiceInterface &s)=0
 Deregister the Service. More...
 
virtual bool set_config_value (std::string key, std::string val)=0
 Set a configuration value. More...
 
virtual std::string get_config_value (std::string key)=0
 Get a configuration value. More...
 
virtual AOSSL::StringBufferget_config_value_safe (std::string key)=0
 Get a configuration value. More...
 
virtual bool del_config_value (std::string key)=0
 Delete a configuration value.
 
virtual std::string services ()=0
 Query the local agent for services registered. More...
 
virtual AOSSL::StringBufferservices_safe ()=0
 Query the local agent for services registered.
 
virtual std::string agent_info ()=0
 Query the local agent for it's info. More...
 
virtual AOSSL::StringBufferagent_info_safe ()=0
 Query the local agent for it's info.
 
virtual std::string healthy_services ()=0
 Query for healthy services only. More...
 
virtual AOSSL::StringBufferhealthy_services_safe ()=0
 Query for healthy services only.
 
virtual std::string datacenters ()=0
 Query the catalog for datacenters. More...
 
virtual AOSSL::StringBufferdatacenters_safe ()=0
 Query the catalog for datacenters.
 
virtual std::string nodes_dc (std::string data_center)=0
 Query the catalog for the nodes in a particular datacenter. More...
 
virtual AOSSL::StringBuffernodes_dc_safe (std::string data_center)=0
 Query the catalog for the nodes in a particular datacenter. More...
 
virtual std::string services_dc (std::string data_center)=0
 Query the catalog for the services in a particular datacenter. More...
 
virtual AOSSL::StringBufferservices_dc_safe (std::string data_center)=0
 Query the catalog for the services in a particular datacenter. More...
 
virtual std::string nodes_service (std::string service)=0
 Query the catalog for the nodes running a particular service. More...
 
virtual AOSSL::StringBuffernodes_service_safe (std::string service)=0
 Query the catalog for the nodes running a particular service. More...
 
virtual std::string services_node (std::string node, std::string data_center)=0
 Query the catalog for the services provided by a particular node. More...
 
virtual AOSSL::StringBufferservices_node_safe (std::string node, std::string data_center)=0
 Query the catalog for the services provided by a particular node. More...
 

Detailed Description

The Consul Administrator, who handles configuration & service discovery.

This relies on the HTTP Administrator, and takes in a Service object in order to register. It's responses are JSON strings that are recieved from Consul. Note that the values returned from the Key-Value store will be stored in base64 format

Member Function Documentation

virtual std::string ConsulInterface::agent_info ( )
pure virtual

Query the local agent for it's info.

Deprecated:
Will be removed in v2.0
virtual std::string ConsulInterface::base64_decode ( std::string const &  encoded_string)
pure virtual

Convinience Method for base64 decoding.

Deprecated:
Will be removed in v2.0. This is needed as all configuration values are returned from Consul in base64, and need to be decoded after the json is parsed.
Parameters
encoded_stringThe string to decode
virtual AOSSL::StringBuffer* ConsulInterface::base64_decode_safe ( std::string const &  encoded_string)
pure virtual

Convinience Method for base64 decoding.

This is needed as all configuration values are returned from Consul in base64, and need to be decoded after the json is parsed.

Parameters
encoded_stringThe string to decode
virtual std::string ConsulInterface::datacenters ( )
pure virtual

Query the catalog for datacenters.

Deprecated:
Will be removed in v2.0
virtual bool ConsulInterface::deregister_service ( const ServiceInterface s)
pure virtual

Deregister the Service.

Parameters
sThe Service Interface to send to the Consul Agent
virtual std::string ConsulInterface::get_config_value ( std::string  key)
pure virtual

Get a configuration value.

Deprecated:
Will be removed in v2.0
Parameters
keyA string key that will be retrieved from the KV Store
virtual AOSSL::StringBuffer* ConsulInterface::get_config_value_safe ( std::string  key)
pure virtual

Get a configuration value.

Parameters
keyA string key that will be retrieved from the KV Store
virtual std::string ConsulInterface::healthy_services ( )
pure virtual

Query for healthy services only.

Deprecated:
Will be removed in v2.0
virtual std::string ConsulInterface::nodes_dc ( std::string  data_center)
pure virtual

Query the catalog for the nodes in a particular datacenter.

Deprecated:
Will be removed in v2.0
Parameters
data_centerThe string identifier for the data center to query
virtual AOSSL::StringBuffer* ConsulInterface::nodes_dc_safe ( std::string  data_center)
pure virtual

Query the catalog for the nodes in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query
virtual std::string ConsulInterface::nodes_service ( std::string  service)
pure virtual

Query the catalog for the nodes running a particular service.

Deprecated:
Will be removed in v2.0
Parameters
serviceThe string identifier for the service to query
virtual AOSSL::StringBuffer* ConsulInterface::nodes_service_safe ( std::string  service)
pure virtual

Query the catalog for the nodes running a particular service.

Parameters
serviceThe string identifier for the service to query
virtual bool ConsulInterface::register_service ( const ServiceInterface s)
pure virtual

Register the Service.

Parameters
sThe Service Interface to send to the Consul Agent
virtual std::string ConsulInterface::services ( )
pure virtual

Query the local agent for services registered.

Deprecated:
Will be removed in v2.0
virtual std::string ConsulInterface::services_dc ( std::string  data_center)
pure virtual

Query the catalog for the services in a particular datacenter.

Deprecated:
Will be removed in v2.0
Parameters
data_centerThe string identifier for the data center to query
virtual AOSSL::StringBuffer* ConsulInterface::services_dc_safe ( std::string  data_center)
pure virtual

Query the catalog for the services in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query
virtual std::string ConsulInterface::services_node ( std::string  node,
std::string  data_center 
)
pure virtual

Query the catalog for the services provided by a particular node.

Deprecated:
Will be removed in v2.0
virtual AOSSL::StringBuffer* ConsulInterface::services_node_safe ( std::string  node,
std::string  data_center 
)
pure virtual

Query the catalog for the services provided by a particular node.

Parameters
nodeThe string identifier for the node to query
data_centerThe string id for the data center which holds the node
virtual bool ConsulInterface::set_config_value ( std::string  key,
std::string  val 
)
pure virtual

Set a configuration value.

If the key does not exist, then this will add it. Otherwise, it will update the existing key.

Parameters
keyA string key that will be created/updated in the KV Store
valA string value that will be stored in the KV Store

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