The Aws::SDKOptions
Aws::SDKOptions
focuses on general SDK configuration, whereas the ClientConfiguration struct focuses on
configuration of communicating with AWS services.
An instance of Aws::SDKOptions
The following samples demonstrate some of the available options.
-
Turn logging on using the default logger
Aws::SDKOptions options; options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info; Aws::InitAPI(options); { // make your SDK calls here. } Aws::ShutdownAPI(options);
-
Override the default HTTP client factory
Aws::SDKOptions options; options.httpOptions.httpClientFactory_create_fn = [](){ return Aws::MakeShared<MyCustomHttpClientFactory>( "ALLOC_TAG", arg1); }; Aws::InitAPI(options); { // make your SDK calls here. } Aws::ShutdownAPI(options);
Note
httpOptions
takes a closure (also called an anonymous function or lambda expression) rather than astd::shared_ptr
. Each of the SDK factory functions operates in this manner because at the time at which the factory memory allocation occurs, the memory manager has not yet been installed. By passing a closure to the method, the memory manager will be called to perform the memory allocation when it is safe to do so. A simple technique to accomplish this procedure is by using a Lambda expression. -
Use a global
SIGPIPE
handlerIf you build the SDK for C++ with curl and OpenSSL, you must specify a signal handler. If you don’t use your own custom signal handler, set
installSigPipeHandler
totrue
.Aws::SDKOptions options; options.httpOptions.installSigPipeHandler = true; Aws::InitAPI(options); { // make your SDK calls here. } Aws::ShutdownAPI(options);
When
installSigPipeHandler
istrue
, the SDK for C++ uses a handler that ignoresSIGPIPE
signals. For more information onSIGPIPE
, see Operation Error Signalson the GNU Operating System website. For more information on the curl handler, see CURLOPT_NOSIGNAL explained on the curl website. The underlying libraries of curl and OpenSSL can send a
SIGPIPE
signal to notify when the remote side closes a connection. These signals must be handled by the application. For more information this curl functionality, see libcurl thread safetyon the curl website. This behavior is not automatically built-in to the SDK because signal handlers are global for each application and the library is a dependency for the SDK.