C++ Client-Side SDK
LaunchDarkly SDK
http_properties_builder.hpp
1 #pragma once
2 
3 #include <chrono>
4 #include <map>
5 #include <optional>
6 #include <string>
7 #include <vector>
8 
9 #include <launchdarkly/config/shared/built/http_properties.hpp>
10 
11 namespace launchdarkly::config::shared::builders {
12 
18 template <typename SDK>
19 class TlsBuilder {
20  public:
26  TlsBuilder();
27 
34  TlsBuilder(built::TlsOptions const& tls);
35 
41  TlsBuilder& SkipVerifyPeer(bool skip_verify_peer);
42 
56  TlsBuilder& CustomCAFile(std::string custom_ca_file);
57 
62  [[nodiscard]] built::TlsOptions Build() const;
63 
64  private:
65  enum built::TlsOptions::VerifyMode verify_mode_;
66  std::optional<std::string> custom_ca_file_;
67 };
73 template <typename SDK>
75  public:
82 
97 
105  std::chrono::milliseconds connect_timeout);
106 
114  HttpPropertiesBuilder& ReadTimeout(std::chrono::milliseconds read_timeout);
115 
124  std::chrono::milliseconds write_timeout);
125 
134  std::chrono::milliseconds response_timeout);
135 
143  HttpPropertiesBuilder& WrapperName(std::string wrapper_name);
144 
152  HttpPropertiesBuilder& WrapperVersion(std::string wrapper_version);
153 
162  std::map<std::string, std::string> base_headers);
163 
171  HttpPropertiesBuilder& Header(std::string key,
172  std::optional<std::string> value);
173 
180 
185  [[nodiscard]] built::HttpProperties Build() const;
186 
187  private:
188  std::chrono::milliseconds connect_timeout_;
189  std::chrono::milliseconds read_timeout_;
190  std::chrono::milliseconds write_timeout_;
191  std::chrono::milliseconds response_timeout_;
192  std::string wrapper_name_;
193  std::string wrapper_version_;
194  std::map<std::string, std::string> base_headers_;
195  TlsBuilder<SDK> tls_;
196 };
197 
198 } // namespace launchdarkly::config::shared::builders
Definition: http_properties_builder.hpp:74
HttpPropertiesBuilder & ConnectTimeout(std::chrono::milliseconds connect_timeout)
Definition: http_properties_builder.cpp:57
HttpPropertiesBuilder & Tls(TlsBuilder< SDK > builder)
Definition: http_properties_builder.cpp:118
HttpPropertiesBuilder & WrapperName(std::string wrapper_name)
Definition: http_properties_builder.cpp:85
HttpPropertiesBuilder & WrapperVersion(std::string wrapper_version)
Definition: http_properties_builder.cpp:92
HttpPropertiesBuilder & ReadTimeout(std::chrono::milliseconds read_timeout)
Definition: http_properties_builder.cpp:64
HttpPropertiesBuilder & Headers(std::map< std::string, std::string > base_headers)
Definition: http_properties_builder.cpp:99
HttpPropertiesBuilder & ResponseTimeout(std::chrono::milliseconds response_timeout)
Definition: http_properties_builder.cpp:78
built::HttpProperties Build() const
Definition: http_properties_builder.cpp:125
HttpPropertiesBuilder & Header(std::string key, std::optional< std::string > value)
Definition: http_properties_builder.cpp:106
HttpPropertiesBuilder()
Definition: http_properties_builder.cpp:42
HttpPropertiesBuilder & WriteTimeout(std::chrono::milliseconds write_timeout)
Definition: http_properties_builder.cpp:71
Definition: http_properties_builder.hpp:19
TlsBuilder & CustomCAFile(std::string custom_ca_file)
Definition: http_properties_builder.cpp:27
TlsBuilder & SkipVerifyPeer(bool skip_verify_peer)
Definition: http_properties_builder.cpp:19
TlsBuilder()
Definition: http_properties_builder.cpp:10
built::TlsOptions Build() const
Definition: http_properties_builder.cpp:37
Definition: http_properties.hpp:26
Definition: http_properties.hpp:11