Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose proxy configuration in wrapper #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions aws/kinesis/core/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,34 @@ class Configuration : private boost::noncopyable {
return verify_certificate_;
}

/// If you have users going through a proxy, get the host here.
///
/// Default: ""
std::string proxy_host() const noexcept {
return proxy_host_;
}

/// If you have users going through a proxy, get the port here.
///
/// Default: 8080
size_t proxy_port() const noexcept {
return proxy_port_;
}

/// If you have users going through a proxy, get the user name here.
///
/// Default: ""
std::string proxy_user_name() const noexcept {
return proxy_user_name_;
}

/// If you have users going through a proxy, get the password here.
///
/// Default: ""
std::string proxy_password() const noexcept {
return proxy_password_;
}

/// Indicates whether the SDK clients should use a thread pool or not
/// \return true if the client should use a thread pool, false otherwise
bool use_thread_pool() const noexcept {
Expand Down Expand Up @@ -937,6 +965,38 @@ class Configuration : private boost::noncopyable {
return *this;
}

/// If you have users going through a proxy, set the host here.
///
/// Default: ""
Configuration& proxy_host(std::string val) {
proxy_host_ = val;
return *this;
}

/// If you have users going through a proxy, set the port here.
///
/// Default: 8080
Configuration& proxy_port(size_t val) {
proxy_port_ = val;
return *this;
}

/// If you have users going through a proxy, set the user name here.
///
/// Default: ""
Configuration& proxy_user_name(std::string val) {
proxy_user_name_ = val;
return *this;
}

/// If you have users going through a proxy, set the password here.
///
/// Default: ""
Configuration& proxy_password(std::string val) {
proxy_password_ = val;
return *this;
}

/// Enables or disable the use of a thread pool for the SDK Client.
/// Default: false
/// \param val whether or not to use a thread pool
Expand Down Expand Up @@ -1002,6 +1062,10 @@ class Configuration : private boost::noncopyable {
region(c.region());
request_timeout(c.request_timeout());
verify_certificate(c.verify_certificate());
proxy_host(c.proxy_host());
proxy_port(c.proxy_port());
proxy_user_name(c.proxy_user_name());
proxy_password(c.proxy_password());
if (c.thread_config() == ::aws::kinesis::protobuf::Configuration_ThreadConfig::Configuration_ThreadConfig_POOLED) {
use_thread_pool(true);
thread_pool_size(c.thread_pool_size());
Expand Down Expand Up @@ -1043,6 +1107,10 @@ class Configuration : private boost::noncopyable {
std::string region_ = "";
uint64_t request_timeout_ = 6000;
bool verify_certificate_ = true;
std::string proxy_host_ = "";
size_t proxy_port_ = 8080;
std::string proxy_user_name_ = "";
std::string proxy_password_ = "";

bool use_thread_pool_ = true;
uint32_t thread_pool_size_ = 64;
Expand Down
4 changes: 4 additions & 0 deletions aws/kinesis/core/kinesis_producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ make_sdk_client_cfg(const aws::kinesis::core::Configuration& kpl_cfg,
cfg.requestTimeoutMs = cast_size_t<long>(kpl_cfg.request_timeout());
cfg.connectTimeoutMs = cast_size_t<long>(kpl_cfg.connect_timeout());
cfg.retryStrategy = std::make_shared<Aws::Client::DefaultRetryStrategy>(0, 0);
cfg.proxyHost = kpl_cfg.proxy_host();
cfg.proxyPort = cast_size_t<unsigned>(kpl_cfg.proxy_port());
cfg.proxyUserName = kpl_cfg.proxy_user_name();
cfg.proxyPassword = kpl_cfg.proxy_password();
if (kpl_cfg.use_thread_pool()) {
if (sdk_client_executor == nullptr) {
uint32_t thread_pool_size = kpl_cfg.thread_pool_size();
Expand Down
Loading