16 #define HTTP_SENDER_USER_AGENT "Fledge http sender" 17 #define HTTP_SENDER_DEFAULT_METHOD "GET" 18 #define HTTP_SENDER_DEFAULT_PATH "/" 34 virtual void setProxy(
const std::string& proxy) = 0;
40 const std::string& method = std::string(HTTP_SENDER_DEFAULT_METHOD),
41 const std::string& path = std::string(HTTP_SENDER_DEFAULT_PATH),
42 const std::vector<std::pair<std::string, std::string>>& headers = {},
43 const std::string& payload = std::string()
46 virtual std::string getHostPort() = 0;
47 virtual std::string getHTTPResponse() = 0;
49 virtual void setAuthMethod (std::string& authMethod) = 0;
50 virtual void setAuthBasicCredentials(std::string& authBasicCredentials) = 0;
53 virtual void setOCSNamespace (std::string& OCSNamespace) = 0;
54 virtual void setOCSTenantId (std::string& OCSTenantId) = 0;
55 virtual void setOCSClientId (std::string& OCSClientId) = 0;
56 virtual void setOCSClientSecret (std::string& OCSClientSecret) = 0;
57 virtual void setOCSToken (std::string& OCSToken) = 0;
81 m_errmsg = serverReply;
84 virtual const char *what()
const throw()
86 return m_errmsg.c_str();
101 m_errmsg = serverReply;
104 virtual const char *what()
const throw()
106 return m_errmsg.c_str();
110 std::string m_errmsg;
119 Conflict (
const std::string& serverReply)
121 m_errmsg = serverReply;
124 virtual const char *what()
const throw()
126 return m_errmsg.c_str();
130 std::string m_errmsg;
virtual void setProxy(const std::string &proxy)=0
Set a proxy server.
virtual 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())=0
HTTP(S) request: pass method and path, HTTP headers and POST/PUT payload.
Unauthorized exception.
Definition: http_sender.h:96
HttpSender()
Constructor:
Definition: http_sender.cpp:26
static std::string getOMFTracePath()
Constructs the file path for the OMF log.
Definition: http_sender.cpp:102
BadRequest exception.
Definition: http_sender.h:76
static bool createDebugTraceDirectory()
Creates the '/logs/debug-trace' subdirectory in the Fledge data directory.
Definition: http_sender.cpp:42
Conflict exception.
Definition: http_sender.h:116
Definition: http_sender.h:20
virtual ~HttpSender()
Destructor.
Definition: http_sender.cpp:33