Client.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-consul
#include "oatpp-consul/Client.hpp"

Client

oatpp::consul::Client provides convenience methods above oatpp::consul::rest::Client

namespace oatpp { namespace consul { 
  class Client {}
}}

Methods

Return Type Name Summary
std::shared_ptr<rest::Client> getRestClient get oatpp::consul::rest::Client
rest::KVMetadata::ObjectWrapper kvGetMetadata Get metadata for key containing base64 encoded value along with other fields
rest::KVMetadata::ObjectWrapper kvGetMetadataInDC Same as kvGetMetadata(key) but for given datacenter (DC)
oatpp::String kvGet Get value by key
oatpp::String kvGetInDC Get value by key for given datacenter
Type::ObjectWrapper kvGetAsDto Get value by key and deserialize it to DTO object using given objectMapper
Type::ObjectWrapper kvGetAsDtoInDC Get value by key for given datacenter and deserialize it to DTO object using given objectMapper
bool kvPut Put value for key
bool kvPutInDC Put value for key for given datacenter
bool kvDelete Delete value for key
bool kvDeleteInDC Delete value for key for given datacenter

Client::getRestClient

get oatpp::consul::rest::Client rest::Client provides more flexible

std::shared_ptr<rest::Client> getRestClient()

Client::kvGetMetadata

Get metadata for key containing base64 encoded value along with other fields

rest::KVMetadata::ObjectWrapper kvGetMetadata(const oatpp::String& key) const

Client::kvGetMetadataInDC

Same as kvGetMetadata(key) but for given datacenter (DC)

rest::KVMetadata::ObjectWrapper kvGetMetadataInDC(const oatpp::String& key, const oatpp::String& datacenter) const

Client::kvGet

Get value by key

oatpp::String kvGet(const oatpp::String& key) const

Client::kvGetInDC

Get value by key for given datacenter

oatpp::String kvGetInDC(const oatpp::String& key, const oatpp::String& datacenter) const

Client::kvGetAsDto

Get value by key and deserialize it to DTO object using given objectMapper

template<class Type>
typename Type::ObjectWrapper kvGetAsDto(const oatpp::String& key, const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const

Client::kvGetAsDtoInDC

Get value by key for given datacenter and deserialize it to DTO object using given objectMapper

template<class Type>
typename Type::ObjectWrapper kvGetAsDtoInDC(const oatpp::String& key,
                                            const oatpp::String& datacenter,
                                            const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const

Client::kvPut

Put value for key

bool kvPut(const oatpp::String& key, const oatpp::String& value) const

Client::kvPutInDC

Put value for key for given datacenter

bool kvPutInDC(const oatpp::String& key, const oatpp::String& value, const oatpp::String& datacenter) const

Client::kvDelete

Delete value for key

bool kvDelete(const oatpp::String& key) const

Client::kvDeleteInDC

Delete value for key for given datacenter

bool kvDeleteInDC(const oatpp::String& key, const oatpp::String& datacenter) const

Client::Error

Client call error.

namespace oatpp { namespace consul { 
  class Client {
    class Error : public std::runtime_error {}
  };
}}

Methods

Return Type Name Summary
[none] Error Constructor.
oatpp::String& getMessage Get error message.
v_int32 getHttpErrorCode Get http error code.

Client::Error::Error

Constructor.

  • @param message - error message.
  • @param httpErrorCode - http error code.

Error(const oatpp::String& message, v_int32 httpErrorCode)
  :std::runtime_error(message->c_str())
  , m_message(message)

Client::Error::getMessage

Get error message.

oatpp::String& getMessage()

Client::Error::getHttpErrorCode

Get http error code.

  • @return - http error code.

v_int32 getHttpErrorCode()