Kea 2.7.6
|
HA peer configuration. More...
#include <ha_config.h>
Public Types | |
enum | Role { PRIMARY , SECONDARY , STANDBY , BACKUP } |
Server's role in the High Availability setup. More... | |
Public Member Functions | |
PeerConfig () | |
Constructor. | |
void | addBasicAuthHttpHeader (http::PostHttpRequestJsonPtr request) const |
Adds a basic HTTP authentication header to a request when credentials are specified. | |
http::BasicHttpAuthPtr & | getBasicAuth () |
Returns non-const basic HTTP authentication. | |
const http::BasicHttpAuthPtr & | getBasicAuth () const |
Returns const basic HTTP authentication. | |
util::Optional< std::string > | getCertFile () const |
Returns server's cert-file. | |
util::Optional< std::string > | getKeyFile () const |
Returns server's key-file. | |
std::string | getLogLabel () const |
Returns a string identifying a server used in logging. | |
std::string | getName () const |
Returns server name. | |
Role | getRole () const |
Returns server's role. | |
asiolink::TlsContextPtr | getTlsContext () const |
Returns a pointer to the server's TLS context. | |
util::Optional< std::string > | getTrustAnchor () const |
Returns server's trust-anchor. | |
http::Url | getUrl () const |
Returns URL of the server's control channel. | |
bool | isAutoFailover () const |
Checks if the auto-failover function is enabled for the server. | |
void | setAutoFailover (const bool auto_failover) |
Enables/disables auto-failover function for the server. | |
void | setCertFile (const util::Optional< std::string > &cert) |
Sets server's cert-file. | |
void | setKeyFile (const util::Optional< std::string > &key) |
Sets server's key-file. | |
void | setName (const std::string &name) |
Sets server name. | |
void | setRole (const std::string &role) |
Sets servers role. | |
void | setTrustAnchor (const util::Optional< std::string > &ca) |
Sets server's trust-anchor. | |
void | setUrl (const http::Url &url) |
Sets server's URL. | |
Static Public Member Functions | |
static std::string | roleToString (const HAConfig::PeerConfig::Role &role) |
Returns role name. | |
static Role | stringToRole (const std::string &role) |
Decodes role provided as a string. | |
Public Attributes | |
asiolink::TlsContextPtr | tls_context_ |
Server TLS context. | |
HA peer configuration.
It holds configuration of one of the servers participating in the high availability configuration. It may represent configuration of this server or its partner.
Definition at line 66 of file ha_config.h.
Server's role in the High Availability setup.
The following roles are supported:
Enumerator | |
---|---|
PRIMARY | |
SECONDARY | |
STANDBY | |
BACKUP |
Definition at line 83 of file ha_config.h.
isc::ha::HAConfig::PeerConfig::PeerConfig | ( | ) |
Constructor.
Definition at line 33 of file ha_config.cc.
void isc::ha::HAConfig::PeerConfig::addBasicAuthHttpHeader | ( | http::PostHttpRequestJsonPtr | request | ) | const |
Adds a basic HTTP authentication header to a request when credentials are specified.
Definition at line 99 of file ha_config.cc.
|
inline |
Returns non-const basic HTTP authentication.
Definition at line 210 of file ha_config.h.
|
inline |
Returns const basic HTTP authentication.
Definition at line 215 of file ha_config.h.
|
inline |
Returns server's cert-file.
Definition at line 129 of file ha_config.h.
|
inline |
Returns server's key-file.
Definition at line 141 of file ha_config.h.
std::string isc::ha::HAConfig::PeerConfig::getLogLabel | ( | ) | const |
Returns a string identifying a server used in logging.
The label is constructed from server name and server URL.
Definition at line 55 of file ha_config.cc.
|
inline |
Returns server name.
Definition at line 94 of file ha_config.h.
|
inline |
Returns server's role.
Definition at line 165 of file ha_config.h.
|
inline |
Returns a pointer to the server's TLS context.
Definition at line 153 of file ha_config.h.
References tls_context_.
|
inline |
Returns server's trust-anchor.
Definition at line 117 of file ha_config.h.
|
inline |
Returns URL of the server's control channel.
Definition at line 105 of file ha_config.h.
|
inline |
Checks if the auto-failover function is enabled for the server.
Definition at line 197 of file ha_config.h.
|
static |
Returns role name.
role | Role which name should be returned. |
Definition at line 82 of file ha_config.cc.
References BACKUP, PRIMARY, SECONDARY, and STANDBY.
Referenced by isc::ha::HAService::HAService().
|
inline |
Enables/disables auto-failover function for the server.
auto_failover | Boolean value indicating if auto-failover function should be enabled/disabled for the server. |
Definition at line 205 of file ha_config.h.
|
inline |
Sets server's cert-file.
cert | Certificate file name. |
Definition at line 136 of file ha_config.h.
|
inline |
Sets server's key-file.
key | Private key file name. |
Definition at line 148 of file ha_config.h.
void isc::ha::HAConfig::PeerConfig::setName | ( | const std::string & | name | ) |
Sets server name.
name | Server name. |
BadValue | if the server name is empty. |
Definition at line 39 of file ha_config.cc.
References isc_throw, name_, and isc::util::str::trim().
void isc::ha::HAConfig::PeerConfig::setRole | ( | const std::string & | role | ) |
Sets servers role.
The following are the supported roles in the textual form:
role | Server role in the textual form. |
Definition at line 50 of file ha_config.cc.
|
inline |
Sets server's trust-anchor.
ca | Trust anchor aka Certificate Authority. |
Definition at line 124 of file ha_config.h.
|
inline |
|
static |
asiolink::TlsContextPtr isc::ha::HAConfig::PeerConfig::tls_context_ |
Server TLS context.
Definition at line 227 of file ha_config.h.
Referenced by getTlsContext().