AOSharedServiceLibrary
Public Member Functions | List of all members
AOSSL::ConsulAdmin Class Reference
Inheritance diagram for AOSSL::ConsulAdmin:
Inheritance graph
[legend]
Collaboration diagram for AOSSL::ConsulAdmin:
Collaboration graph
[legend]

Public Member Functions

void base64_decode_by_reference (std::string const &encoded_string, StringBuffer &ret_buffer)
 Convinience Method for base64 decoding. More...
 
StringBufferbase64_decode_safe (std::string const &encoded_string)
 Convinience Method for base64 decoding. More...
 
void add_acl_token (std::string &token)
 Add an ACL Token to the Consul Admin.
 
 ConsulAdmin (std::string &caddr)
 
 ConsulAdmin (std::string &caddr, int tout)
 
 ConsulAdmin (std::string &caddr, std::string &cert)
 
 ConsulAdmin (std::string &caddr, int tout, std::string &cert)
 
 ConsulAdmin (std::string &caddr, int tout, std::string &cert, std::string &token)
 
bool register_service (const ServiceInterface &s)
 Register the Service. More...
 
bool deregister_service (const ServiceInterface &s)
 Deregister the Service. More...
 
bool set_config_value (std::string key, std::string val)
 Set a configuration value. More...
 
bool del_config_value (std::string key)
 Delete a configuration value.
 
StringBufferservices ()
 Query the local agent for services registered. More...
 
StringBufferagent_info ()
 Query the local agent for it's info.
 
StringBufferhealthy_services ()
 Query for healthy services only.
 
StringBufferdatacenters ()
 Query the catalog for datacenters.
 
StringBuffernodes_dc (std::string data_center)
 Query the catalog for the nodes in a particular datacenter. More...
 
StringBufferservices_dc (std::string data_center)
 Query the catalog for the services in a particular datacenter. More...
 
StringBuffernodes_service (std::string service)
 Query the catalog for the nodes running a particular service. More...
 
StringBufferservices_node (std::string node, std::string data_center)
 Query the catalog for the services provided by a particular node. More...
 
bool opt_exist (std::string key)
 Does a key exist?
 
StringBufferget_opt (std::string key)
 Get an option by key.
 
void get_opt (std::string key, StringBuffer &val)
 Get an option by key.
 
void load_config ()
 Re-load configuration.
 
- Public Member Functions inherited from AOSSL::BaseHttpClient
 BaseHttpClient (std::string &vaddr, int tout, std::string &cert)
 Construct a secured HTTP Client.
 
 BaseHttpClient (std::string &vaddr, int tout)
 Construct an unsecured HTTP Client.
 
std::string get_address ()
 
std::string get_ssl_cert ()
 
std::string get_acl_token ()
 
void put_by_reference (std::string &query_url, std::string &body, AOSSL::StringBuffer &ret_buffer)
 Execute a Put query.
 
void post_by_reference (std::string &query_url, std::string &body, AOSSL::StringBuffer &ret_buffer)
 Execute a Post query.
 
void get_by_reference (std::string &query_url, AOSSL::StringBuffer &ret_buffer)
 Execute a Get query.
 
void delete_by_reference (std::string &query_url, AOSSL::StringBuffer &ret_buffer)
 Execute a Delete query.
 
void set_acl_token (std::string token_name, std::string new_token)
 Add an ACL Token.
 

Member Function Documentation

void AOSSL::ConsulAdmin::base64_decode_by_reference ( std::string const &  encoded_string,
StringBuffer ret_buffer 
)
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
ret_bufferA String buffer in which to populate the response

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::base64_decode_safe ( std::string const &  encoded_string)
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

Implements AOSSL::ConsulInterface.

bool AOSSL::ConsulAdmin::deregister_service ( const ServiceInterface s)
virtual

Deregister the Service.

Parameters
sThe Service Interface to send to the Consul Agent

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::nodes_dc ( std::string  data_center)
virtual

Query the catalog for the nodes in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::nodes_service ( std::string  service)
virtual

Query the catalog for the nodes running a particular service.

Parameters
serviceThe string identifier for the service to query

Implements AOSSL::ConsulInterface.

bool AOSSL::ConsulAdmin::register_service ( const ServiceInterface s)
virtual

Register the Service.

Parameters
sThe Service Interface to send to the Consul Agent

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::services ( )
virtual

Query the local agent for services registered.

Query the local agent for services registered

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::services_dc ( std::string  data_center)
virtual

Query the catalog for the services in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query

Implements AOSSL::ConsulInterface.

StringBuffer* AOSSL::ConsulAdmin::services_node ( std::string  node,
std::string  data_center 
)
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

Implements AOSSL::ConsulInterface.

bool AOSSL::ConsulAdmin::set_config_value ( std::string  key,
std::string  val 
)
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

Implements AOSSL::ConsulInterface.


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