Fledge
An open source edge computing platform for industrial users
SimpleHttp Class Reference
Inheritance diagram for SimpleHttp:
Collaboration diagram for SimpleHttp:

Public Member Functions

 SimpleHttp (const std::string &host_port, unsigned int connect_timeout=0, unsigned int request_timeout=0, unsigned int retry_sleep_Time=1, unsigned int max_retry=4)
 Constructor: pass host:port & connect & request timeouts.
 
 ~SimpleHttp ()
 Destructor.
 
void setProxy (const std::string &proxy)
 Set the host and port of the proxy server. More...
 
int sendRequest (const std::string &method=std::string(HTTP_SENDER_DEFAULT_METHOD), const std::string &path=std::string(HTTP_SENDER_DEFAULT_PATH), const std::vector< std::pair< std::string, std::string >> &headers={}, const std::string &payload=std::string())
 HTTP(S) request: pass method and path, HTTP headers and POST/PUT payload. More...
 
void setAuthMethod (std::string &authMethod)
 
void setAuthBasicCredentials (std::string &authBasicCredentials)
 
std::string getHostPort ()
 
std::string getHTTPResponse ()
 
void setOCSNamespace (std::string &OCSNamespace)
 
void setOCSTenantId (std::string &OCSTenantId)
 
void setOCSClientId (std::string &OCSClientId)
 
void setOCSClientSecret (std::string &OCSClientSecret)
 
void setOCSToken (std::string &OCSToken)
 
- Public Member Functions inherited from HttpSender
 HttpSender ()
 Constructor: More...
 
virtual ~HttpSender ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from HttpSender
static std::string getOMFTracePath ()
 Constructs the file path for the OMF log. More...
 
static bool createDebugTraceDirectory ()
 Creates the '/logs/debug-trace' subdirectory in the Fledge data directory. More...
 

Member Function Documentation

◆ sendRequest()

int SimpleHttp::sendRequest ( const std::string &  method = std::string(HTTP_SENDER_DEFAULT_METHOD),
const std::string &  path = std::string(HTTP_SENDER_DEFAULT_PATH),
const std::vector< std::pair< std::string, std::string >> &  headers = {},
const std::string &  payload = std::string() 
)
virtual

HTTP(S) request: pass method and path, HTTP headers and POST/PUT payload.

Send data.

Parameters
methodThe HTTP method (GET, POST, ...)
pathThe URL path
headersThe optional headers to send
payloadThe optional data payload (for POST, PUT)
Returns
The HTTP code on success or 0 on execptions

Implements HttpSender.

◆ setProxy()

void SimpleHttp::setProxy ( const std::string &  proxy)
virtual

Set the host and port of the proxy server.

Set a proxy server.

Parameters
proxyThe name and port of the proxy server

Implements HttpSender.


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