Prometheus Client Library for Modern C++
curl_wrapper.h
1 #include <curl/curl.h>
2 
3 #include <mutex>
4 #include <string>
5 
6 #include "prometheus/detail/http_method.h"
7 
8 namespace prometheus {
9 namespace detail {
10 
11 class CurlWrapper {
12  public:
13  CurlWrapper(const std::string& username, const std::string& password);
14 
15  CurlWrapper(const CurlWrapper&) = delete;
16  CurlWrapper(CurlWrapper&&) = delete;
17  CurlWrapper& operator=(const CurlWrapper&) = delete;
18  CurlWrapper& operator=(CurlWrapper&&) = delete;
19 
20  ~CurlWrapper();
21 
22  int performHttpRequest(HttpMethod method, const std::string& uri,
23  const std::string& body);
24 
25  private:
26  CURL* curl_;
27  std::string auth_;
28  std::mutex mutex_;
29 };
30 
31 } // namespace detail
32 } // namespace prometheus