AWS SDK for C++  0.14.3
AWS SDK for C++
Aws.h
Go to the documentation of this file.
1 /*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 #pragma once
16 
22 #include <aws/core/Core_EXPORTS.h>
23 
24 namespace Aws
25 {
26  static const char* DEFAULT_LOG_PREFIX = "aws_sdk_";
27 
32  {
33  LoggingOptions() : logLevel(Aws::Utils::Logging::LogLevel::Off), defaultLogPrefix(DEFAULT_LOG_PREFIX)
34  { }
35 
40 
44  const char* defaultLogPrefix;
45 
50  std::function<std::shared_ptr<Aws::Utils::Logging::LogSystemInterface>()> logger_create_fn;
51  };
52 
57  {
58  MemoryManagementOptions() : memoryManager(nullptr)
59  { }
60 
67  };
68 
72  struct HttpOptions
73  {
74  HttpOptions() : initAndCleanupCurl(true)
75  { }
76 
80  std::function<std::shared_ptr<Aws::Http::HttpClientFactory>()> httpClientFactory_create_fn;
86  };
87 
92  {
93  CryptoOptions() : initAndCleanupOpenSSL(true)
94  { }
95 
99  std::function<std::shared_ptr<Aws::Utils::Crypto::HashFactory>()> md5Factory_create_fn;
103  std::function<std::shared_ptr<Aws::Utils::Crypto::HashFactory>()> sha256Factory_create_fn;
107  std::function<std::shared_ptr<Aws::Utils::Crypto::HMACFactory>()> sha256HMACFactory_create_fn;
111  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_CBCFactory_create_fn;
115  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_CTRFactory_create_fn;
119  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_GCMFactory_create_fn;
123  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_KeyWrapFactory_create_fn;
127  std::function<std::shared_ptr<Aws::Utils::Crypto::SecureRandomFactory>()> secureRandomFactory_create_fn;
134  };
135 
176  struct SDKOptions
177  {
194  };
195 
196  /*
197  * Initialize SDK wide state for the SDK. This method must be called before doing anything else with this library.
198  *
199  * Common Recipes:
200  *
201  * Just use defaults:
202  *
203  * SDKOptions options;
204  * Aws::InitAPI(options);
205  * .....
206  * Aws::ShutdownAPI(options);
207  *
208  * Turn logging on using the default logger:
209  *
210  * SDKOptions options;
211  * options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
212  * Aws::InitAPI(options);
213  * .....
214  * Aws::ShutdownAPI(options);
215  *
216  * Install custom memory manager:
217  *
218  * MyMemoryManager memoryManager;
219  *
220  * SDKOptions options;
221  * options.memoryManagementOptions.memoryManager = &memoryManager;
222  * Aws::InitAPI(options);
223  * .....
224  * Aws::ShutdownAPI(options);
225  *
226  * Override default http client factory
227  *
228  * SDKOptions options;
229  * options.httpOptions.httpClientFactory_create_fn = [](){ return Aws::MakeShared<MyCustomHttpClientFactory>("ALLOC_TAG", arg1); };
230  * Aws::InitAPI(options);
231  * .....
232  * Aws::ShutdownAPI(options);
233  */
234  AWS_CORE_API void InitAPI(const SDKOptions& options);
235 
240  AWS_CORE_API void ShutdownAPI(const SDKOptions& options);
241 }
242 
const char * defaultLogPrefix
Definition: Aws.h:44
bool initAndCleanupCurl
Definition: Aws.h:85
std::function< std::shared_ptr< Aws::Utils::Logging::LogSystemInterface >)> logger_create_fn
Definition: Aws.h:50
MemoryManagementOptions memoryManagementOptions
Definition: Aws.h:185
bool initAndCleanupOpenSSL
Definition: Aws.h:133
static const char * DEFAULT_LOG_PREFIX
Definition: Aws.h:26
LoggingOptions loggingOptions
Definition: Aws.h:181
AWS_CORE_API void ShutdownAPI(const SDKOptions &options)
CryptoOptions cryptoOptions
Definition: Aws.h:193
Aws::Utils::Memory::MemorySystemInterface * memoryManager
Definition: Aws.h:66
Aws::Utils::Logging::LogLevel logLevel
Definition: Aws.h:39
HttpOptions httpOptions
Definition: Aws.h:189
AWS_CORE_API void InitAPI(const SDKOptions &options)
#define AWS_CORE_API
Definition: Core_EXPORTS.h:35
JSON (JavaScript Object Notation).
HttpOptions()
Definition: Aws.h:74